Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

using System;

using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class admin : System.Web.UI.Page


{

SqlCommand cmd = new SqlCommand();


SqlDataReader dr;
String a;
SqlConnection cn = new SqlConnection("Data
Source=.\\SQLEXPRESS;AttachDbFilename=|
DataDirectory|\\claimsystem.mdf;Integrated Security=True;User Instance=True");
protected void Page_Load(object sender, EventArgs e)
{
cn.Open();
a = "select empid from emp";
cmd = new SqlCommand(a, cn);
dr = cmd.ExecuteReader();
while (dr.Read())
{

lstemp.Items.Add(Convert.ToString(dr.GetInt32(0)));

}
cn.Close();
}

protected void search_Click(object sender, EventArgs e)


{
cn.Open();
SqlCommand cmd1 = new SqlCommand("delete from emp where empid=" +
lstemp.Text + "", cn);
cmd1.ExecuteNonQuery();
cn.Close();
Label2.Text = "Deleted Successfully";

}
protected void edit_Click1(object sender, EventArgs e)
{
Response.Redirect("editemp.aspx");
}
protected void remove_Click(object sender, EventArgs e)
{
Label1.Visible = true;
}
protected void pend_Click(object sender, EventArgs e)
{
Response.Redirect("pending.aspx");
}
}

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class claim : System.Web.UI.Page


{

SqlConnection cn = new SqlConnection("Data


Source=.\\SQLEXPRESS;AttachDbFilename=|
DataDirectory|\\claimsystem.mdf;Integrated Security=True;User Instance=True");
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
if (txtaddate.Text == "")
{

Label11.Text = "Details are not proper......Your claim will be


pending";

}
if( txtddate.Text == "")
{

Label11.Text = "Details are not proper......Your claim will be


pending";

}
else if(txttreatment.Text == "")
{
Label11.Text = "Details are not proper......Your claim
will be pending";

}
else if( txttype.Text == "" )
{

Label11.Text = "Details are not proper......Your claim will be


pending";

else
{

cn.Open();
SqlCommand cmd = new SqlCommand("insert into claim values(" +
txtclaim.Text + "," + txtempid.Text + "," + txtamt.Text + ",'" + txttype.Text
+ "','" + DropDownList1.SelectedItem.Text + "','" +
DateTime.Parse(txtaddate.Text) + "','" + DateTime.Parse(txtddate.Text) + "','"
+ txtsurgery.Text + "','" + txttreatment.Text + "','" +
DateTime.Parse(txtapply.Text) + "')", cn);
cmd.ExecuteNonQuery();

cn.Close();

Label11.Text = "Inserted Successfully";

cn.Open();
SqlCommand cmd2 = new SqlCommand("insert into
status(claimid,empid) values(" + txtclaim.Text + "," + txtempid.Text + ")",
cn);
cmd2.ExecuteNonQuery();
cn.Close();
}

protected void Button2_Click(object sender, EventArgs e)


{
cn.Open();
SqlCommand cmd5 = new SqlCommand("select * from emp where empid=" +
txtempid.Text + "", cn);
SqlDataReader dr = cmd5.ExecuteReader();
if (dr.Read())
{

txtdetails.Text=dr.GetString(1);

cn.Close();
}
else
{
txtdetails.Text = "Employee not exists";

}
cn.Close();

}
}

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class login : System.Web.UI.Page


{

SqlConnection cn = new SqlConnection("Data


Source=.\\SQLEXPRESS;AttachDbFilename=|
DataDirectory|\\claimsystem.mdf;Integrated Security=True;User Instance=True");
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text == "")
{
Label3.Text = "User Id must not be empty";
}
if(TextBox2.Text=="")
{
Label3.Text = "Password must not be empty";
}
if (TextBox1.Text == "admin" && TextBox2.Text == "admin")
{
Response.Redirect("admin.aspx");
}
cn.Open();
SqlCommand cmd = new SqlCommand("select * from login where
empid="+TextBox1.Text+" and password='"+TextBox2.Text+"'",cn );
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
Response.Redirect("claim.aspx");
}
else
{
Label3.Text = "YOU CAN'T LOGIN WITH IMPROPER PASSWORD AND EMPID";
}

}
}

You might also like