private void ClearAll() { ddlEmployee.SelectedIndex = -1; (Calender.FindControl("TextBox1") as TextBox).Text = ""; txtInHour.Text = ""; txtInMinute.Text = ""; txtOutHour.Text = ""; txtOutMinute.Text = ""; ddlAttStatus.SelectedIndex = -1; }
protected void btnSearch_Click(object sender, EventArgs e) { SqlDataAdapter sda = new SqlDataAdapter("Select * from tblAttendence where EmpCode='" + txtEmpCode.Text + "'", con); DataTable dt = new DataTable(); sda.Fill(dt); ddlEmployee.SelectedValue = dt.Rows[0]["EmpCode"].ToString(); (Calender.FindControl("TextBox1") as TextBox).Text = dt.Rows[0]["AttDate"].ToString(); txtInHour.Text = dt.Rows[0]["InHour"].ToString(); }
protected void btnSave_Click(object sender, EventArgs e) { var date = (Calender.FindControl("TextBox1") as TextBox).Text; con.Open(); SqlCommand cmd = new SqlCommand("Insert into tblAttendence(EmpCode,AttDate,InHour,InMinute,OutHour,OutMinute,AttStatus)values('" + ddlEmployee.SelectedValue + "','" + date + "','" + txtInHour.Text + "','" + txtInMinute.Text + "','" + txtOutHour.Text + "','" + txtOutMinute.Text + "','" + ddlAttStatus.SelectedValue + "')", con); cmd.ExecuteNonQuery(); ClearAll(); Literal1.Text = "Data save successfully."; LoadGrid(); con.Close(); }
protected void btnSave_Click(object sender, EventArgs e) { string BenefitAcciDate = (Calender.FindControl("TextBox1") as TextBox).Text; con.Open(); SqlCommand cmd = new SqlCommand("insert into tblBenefit (EmpCode,BenefitAmount,BenefitType,PreviousNetSalary,NewNetSalary,Basic,HouseRent,Medical,otherAllowance,BenifitActiveDate) values('" + txtEmpCode.Text + "','" + txtBenfitAmount.Text + "','" + ddlBenefitType.SelectedValue + "','" + lblPrevGrossSalary.Text + "','" + lblNewGroSalary.Text + "','" + lblBasic.Text + "','" + lblMedical.Text + "','" + lblHouseRent.Text + "','" + lblOtherAllowance.Text + "','" + BenefitAcciDate + "')", con); SqlCommand cmd1 = new SqlCommand("update tblEmployee set CurrentSalary='" + lblNewGroSalary.Text + "' where EmpCode='" + txtEmpCode.Text + "'", con); cmd.ExecuteNonQuery(); cmd1.ExecuteNonQuery(); Literal1.Text = "Data saved successfully!!!"; LoadGrid(); ClearAll(); con.Close(); }
private void ClearAll() { txtEmpCode.Text = ""; lblEmpName.Text = ""; lblEmpDept.Text = ""; lblDesi.Text = ""; lblempType.Text = ""; lblempDiv.Text = ""; txtBenfitAmount.Text = ""; ddlBenefitType.SelectedIndex = -1; lblPrevGrossSalary.Text = ""; lblNewGroSalary.Text = ""; lblBasic.Text = ""; lblMedical.Text = ""; lblHouseRent.Text = ""; lblOtherAllowance.Text = ""; (Calender.FindControl("TextBox1") as TextBox).Text = ""; txtEmpCode.Focus(); }
protected void btnUpdate_Click(object sender, EventArgs e) { con.Open(); SqlCommand cmd = new SqlCommand("update tblAttendence set EmpCode='" + ddlEmployee.SelectedValue + "',InHour='" + txtInHour.Text + "',InMinute='" + txtInMinute.Text + "',OutHour='" + txtOutHour.Text + "',OutMinute='" + txtOutMinute.Text + "',AttStatus='" + ddlAttStatus.SelectedValue + "',AttDate='" + (Calender.FindControl("TextBox1") as TextBox).Text + "' where EmpCode='" + txtEmpCode.Text + "'", con); cmd.ExecuteNonQuery(); ClearAll(); Literal1.Text = "Data Updated successfully."; LoadGrid(); con.Close(); }