public partial class Staff_nHolidayLeave : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnUpdate_Click(object sender, EventArgs e)
{
SqlConnection MyConnection;
SqlCommand MyCommand;
MyConnection = new SqlConnection();
MyConnection.ConnectionString =
ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
MyConnection.Open();
MyCommand = new SqlCommand("StoredProcedure4", MyConnection);
MyCommand.CommandType = CommandType.StoredProcedure;
MyCommand.Parameters.Add("@h_name", txtName.Text);
MyCommand.Parameters.Add("@h_from", txtFrom.Text);
MyCommand.Parameters.Add("@h_till", txtTill.Text);
MyCommand.Parameters.Add("@h_day", txtDay.Text);
MyCommand.Parameters.Add("@h_add", txtA1.Text + txtA2.Text);
MyCommand.Parameters.Add("@h_post", txtPost.Text);
MyCommand.Parameters.Add("@h_dept", txtDept.Text);
MyCommand.Parameters.Add("@h_no", txtStaff.Text);
MyCommand.Parameters.Add("@h_hpno", "+6" + txtH.Text + txtP.Text);
MyCommand.Parameters.Add("@h_email", txtEmail.Text);
MyCommand.Parameters.Add("@h_date_apply", DateTime.Today.ToString());
MyCommand.ExecuteScalar();
MyConnection.Close();
Response.Redirect("dLeaveApply.aspx?staff_id=" + Request.QueryString["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(object sender, EventArgs e)
{
Response.Redirect("Profile.aspx?staff_id=" + Request.QueryString["staff_id"]);
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("ProfileEdit.aspx?staff_id=" + Request.QueryString["staff_id"]);
}
protected void Button3_Click(object sender, EventArgs e)
{
Response.Redirect("PasswordChange.aspx?staff_id=" + Request.QueryString["staff_id"]);
}
protected void Button4_Click(object sender, EventArgs e)
{
Response.Redirect("LeaveApply.aspx?staff_id=" + Request.QueryString["staff_id"]);
}
protected void Button5_Click(object sender, EventArgs e)
{
Response.Redirect("LeaveToday.aspx?staff_id=" + Request.QueryString["staff_id"]);
}
protected void Button6_Click(object sender, EventArgs e)
{
Response.Redirect("LeaveAuthorized.aspx?staff_id=" + Request.QueryString["staff_id"]);
}
protected void Button7_Click(object sender, EventArgs e)
{
Response.Redirect("LeaveUnauthorized.aspx?staff_id =" + Request.QueryString["staff_id"]);
}
protected void Button8_Click(object sender, EventArgs e)
{
Response.Redirect("LeaveCancel.aspx?staff_id=" + Request.QueryString["staff_id"]);
}
protected void Button9_Click(object sender, EventArgs e)
{
Response.Redirect("LeaveNew.aspx?staff_id=" + Request.QueryString["staff_id"]);
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.Redirect("../Login.aspx");
}
protected void txtDay_Text(object sender, EventArgs e)
{
SqlConnection MyConnection;
SqlCommand cmd;
SqlDataAdapter adt;
DataSet dts;
cmd = new SqlCommand("select * from holiday where h_id='" + Request.QueryString["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;
}
}
}
}