public partial class Staff_nHolidayL eave : System.Web.UI.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{
}
protected void btnUpdate_Click (object sender, EventArgs e)
{
SqlConnection MyConnection;
SqlCommand MyCommand;
MyConnection = new SqlConnection() ;
MyConnection.Co nnectionString =
ConfigurationMa nager.Connectio nStrings["ConnectionStri ng"].ConnectionStri ng;
MyConnection.Op en();
MyCommand = new SqlCommand("Sto redProcedure4", MyConnection);
MyCommand.Comma ndType = CommandType.Sto redProcedure;
MyCommand.Param eters.Add("@h_n ame", txtName.Text);
MyCommand.Param eters.Add("@h_f rom", txtFrom.Text);
MyCommand.Param eters.Add("@h_t ill", txtTill.Text);
MyCommand.Param eters.Add("@h_d ay", txtDay.Text);
MyCommand.Param eters.Add("@h_a dd", txtA1.Text + txtA2.Text);
MyCommand.Param eters.Add("@h_p ost", txtPost.Text);
MyCommand.Param eters.Add("@h_d ept", txtDept.Text);
MyCommand.Param eters.Add("@h_n o", txtStaff.Text);
MyCommand.Param eters.Add("@h_h pno", "+6" + txtH.Text + txtP.Text);
MyCommand.Param eters.Add("@h_e mail", txtEmail.Text);
MyCommand.Param eters.Add("@h_d ate_apply", DateTime.Today. ToString());
MyCommand.Execu teScalar();
MyConnection.Cl ose();
Response.Redire ct("dLeaveApply .aspx?staff_id= " + Request.QuerySt ring["staff_id"]);
}
protected void btnReset_Click( object sender, EventArgs e)
{
txtName.Text = "";
txtFrom.Text = "";
txtTill.Text = "";
txtDay.Text = "";
txtA1.Text = "";
txtA2.Text = "";
txtPost.Text = "";
txtDept.Text = "";
txtStaff.Text = "";
txtH.Text = "";
txtP.Text = "";
txtEmail.Text = "";
}
public static string Right(string param, int length)
{
//start at the index based on the lenght of the sting minus
//the specified lenght and assign it a variable
string result = param.Substring (param.Length - length, length);
//return the result of the operation
return result;
}
public static string Mid(string param, int startIndex, int length)
{
//start at the specified index in the string ang get N number of
//characters depending on the lenght and assign it to a variable
string result = param.Substring (startIndex, length);
//return the result of the operation
return result;
}
protected void Button1_Click(o bject sender, EventArgs e)
{
Response.Redire ct("Profile.asp x?staff_id=" + Request.QuerySt ring["staff_id"]);
}
protected void Button2_Click(o bject sender, EventArgs e)
{
Response.Redire ct("ProfileEdit .aspx?staff_id= " + Request.QuerySt ring["staff_id"]);
}
protected void Button3_Click(o bject sender, EventArgs e)
{
Response.Redire ct("PasswordCha nge.aspx?staff_ id=" + Request.QuerySt ring["staff_id"]);
}
protected void Button4_Click(o bject sender, EventArgs e)
{
Response.Redire ct("LeaveApply. aspx?staff_id=" + Request.QuerySt ring["staff_id"]);
}
protected void Button5_Click(o bject sender, EventArgs e)
{
Response.Redire ct("LeaveToday. aspx?staff_id=" + Request.QuerySt ring["staff_id"]);
}
protected void Button6_Click(o bject sender, EventArgs e)
{
Response.Redire ct("LeaveAuthor ized.aspx?staff _id=" + Request.QuerySt ring["staff_id"]);
}
protected void Button7_Click(o bject sender, EventArgs e)
{
Response.Redire ct("LeaveUnauth orized.aspx?sta ff_id=" + Request.QuerySt ring["staff_id"]);
}
protected void Button8_Click(o bject sender, EventArgs e)
{
Response.Redire ct("LeaveCancel .aspx?staff_id= " + Request.QuerySt ring["staff_id"]);
}
protected void Button9_Click(o bject sender, EventArgs e)
{
Response.Redire ct("LeaveNew.as px?staff_id=" + Request.QuerySt ring["staff_id"]);
}
protected void LinkButton1_Cli ck(object sender, EventArgs e)
{
Response.Redire ct("../Login.aspx");
}
protected void txtDay_Text(obj ect sender, EventArgs e)
{
SqlConnection MyConnection;
SqlCommand cmd;
SqlDataAdapter adt;
DataSet dts;
cmd = new SqlCommand("sel ect * from holiday where h_id='" + Request.QuerySt ring["h_id"] + "'", MyConnection);
adt = new SqlDataAdapter( cmd);
dts = new DataSet();
adt.Fill(dts);
int day = 0;
const int duration = 0;
if (dts.Tables[0].Rows.Count != 0)
{
foreach (DataRow t in dts.Tables[0].Rows)
{
int day = Convert.ToInt32 (t[3].ToString()) - Convert.ToInt32 (t[2].ToString());
day = day + duration;
}
}
}
}
{
protected void Page_Load(objec t sender, EventArgs e)
{
}
protected void btnUpdate_Click (object sender, EventArgs e)
{
SqlConnection MyConnection;
SqlCommand MyCommand;
MyConnection = new SqlConnection() ;
MyConnection.Co nnectionString =
ConfigurationMa nager.Connectio nStrings["ConnectionStri ng"].ConnectionStri ng;
MyConnection.Op en();
MyCommand = new SqlCommand("Sto redProcedure4", MyConnection);
MyCommand.Comma ndType = CommandType.Sto redProcedure;
MyCommand.Param eters.Add("@h_n ame", txtName.Text);
MyCommand.Param eters.Add("@h_f rom", txtFrom.Text);
MyCommand.Param eters.Add("@h_t ill", txtTill.Text);
MyCommand.Param eters.Add("@h_d ay", txtDay.Text);
MyCommand.Param eters.Add("@h_a dd", txtA1.Text + txtA2.Text);
MyCommand.Param eters.Add("@h_p ost", txtPost.Text);
MyCommand.Param eters.Add("@h_d ept", txtDept.Text);
MyCommand.Param eters.Add("@h_n o", txtStaff.Text);
MyCommand.Param eters.Add("@h_h pno", "+6" + txtH.Text + txtP.Text);
MyCommand.Param eters.Add("@h_e mail", txtEmail.Text);
MyCommand.Param eters.Add("@h_d ate_apply", DateTime.Today. ToString());
MyCommand.Execu teScalar();
MyConnection.Cl ose();
Response.Redire ct("dLeaveApply .aspx?staff_id= " + Request.QuerySt ring["staff_id"]);
}
protected void btnReset_Click( object sender, EventArgs e)
{
txtName.Text = "";
txtFrom.Text = "";
txtTill.Text = "";
txtDay.Text = "";
txtA1.Text = "";
txtA2.Text = "";
txtPost.Text = "";
txtDept.Text = "";
txtStaff.Text = "";
txtH.Text = "";
txtP.Text = "";
txtEmail.Text = "";
}
public static string Right(string param, int length)
{
//start at the index based on the lenght of the sting minus
//the specified lenght and assign it a variable
string result = param.Substring (param.Length - length, length);
//return the result of the operation
return result;
}
public static string Mid(string param, int startIndex, int length)
{
//start at the specified index in the string ang get N number of
//characters depending on the lenght and assign it to a variable
string result = param.Substring (startIndex, length);
//return the result of the operation
return result;
}
protected void Button1_Click(o bject sender, EventArgs e)
{
Response.Redire ct("Profile.asp x?staff_id=" + Request.QuerySt ring["staff_id"]);
}
protected void Button2_Click(o bject sender, EventArgs e)
{
Response.Redire ct("ProfileEdit .aspx?staff_id= " + Request.QuerySt ring["staff_id"]);
}
protected void Button3_Click(o bject sender, EventArgs e)
{
Response.Redire ct("PasswordCha nge.aspx?staff_ id=" + Request.QuerySt ring["staff_id"]);
}
protected void Button4_Click(o bject sender, EventArgs e)
{
Response.Redire ct("LeaveApply. aspx?staff_id=" + Request.QuerySt ring["staff_id"]);
}
protected void Button5_Click(o bject sender, EventArgs e)
{
Response.Redire ct("LeaveToday. aspx?staff_id=" + Request.QuerySt ring["staff_id"]);
}
protected void Button6_Click(o bject sender, EventArgs e)
{
Response.Redire ct("LeaveAuthor ized.aspx?staff _id=" + Request.QuerySt ring["staff_id"]);
}
protected void Button7_Click(o bject sender, EventArgs e)
{
Response.Redire ct("LeaveUnauth orized.aspx?sta ff_id=" + Request.QuerySt ring["staff_id"]);
}
protected void Button8_Click(o bject sender, EventArgs e)
{
Response.Redire ct("LeaveCancel .aspx?staff_id= " + Request.QuerySt ring["staff_id"]);
}
protected void Button9_Click(o bject sender, EventArgs e)
{
Response.Redire ct("LeaveNew.as px?staff_id=" + Request.QuerySt ring["staff_id"]);
}
protected void LinkButton1_Cli ck(object sender, EventArgs e)
{
Response.Redire ct("../Login.aspx");
}
protected void txtDay_Text(obj ect sender, EventArgs e)
{
SqlConnection MyConnection;
SqlCommand cmd;
SqlDataAdapter adt;
DataSet dts;
cmd = new SqlCommand("sel ect * from holiday where h_id='" + Request.QuerySt ring["h_id"] + "'", MyConnection);
adt = new SqlDataAdapter( cmd);
dts = new DataSet();
adt.Fill(dts);
int day = 0;
const int duration = 0;
if (dts.Tables[0].Rows.Count != 0)
{
foreach (DataRow t in dts.Tables[0].Rows)
{
int day = Convert.ToInt32 (t[3].ToString()) - Convert.ToInt32 (t[2].ToString());
day = day + duration;
}
}
}
}
Comment