Ejemplo n.º 1
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            SqlDataAdapter sda = new SqlDataAdapter("Select * from tblEmployee where EmpCode='" + txtEmpCode.Text + "'", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            txtName.Text    = dt.Rows[0]["EmpName"].ToString();
            txtAddress.Text = dt.Rows[0]["Address"].ToString();
            txtEmail.Text   = dt.Rows[0]["Email"].ToString();
            (CalenderDOB.FindControl("TextBox1") as TextBox).Text = dt.Rows[0]["DateOfBirth"].ToString();
            txtFatherName.Text    = dt.Rows[0]["FatherName"].ToString();
            txtMotherName.Text    = dt.Rows[0]["MotherName"].ToString();
            ddlGender.Text        = dt.Rows[0]["Gender"].ToString();
            ddlMaritalStatus.Text = dt.Rows[0]["MaritalStatus"].ToString();
            txtMobile.Text        = dt.Rows[0]["Contact"].ToString();
            txtNationality.Text   = dt.Rows[0]["Nationality"].ToString();
            txtReligion.Text      = dt.Rows[0]["Religion"].ToString();
            txtBloodGroup.Text    = dt.Rows[0]["BloodGroup"].ToString();
            txtNid.Text           = dt.Rows[0]["NationalIDNo"].ToString();
            (CalenderJoinDate.FindControl("TextBox1") as TextBox).Text = dt.Rows[0]["JoiningDate"].ToString();
            ddlDept.Text        = dt.Rows[0]["DeptCode"].ToString();
            ddlDesig.Text       = dt.Rows[0]["DesigCode"].ToString();
            ddlDivision.Text    = dt.Rows[0]["DivCode"].ToString();
            ddlSection.Text     = dt.Rows[0]["SceCode"].ToString();
            ddlEmpType.Text     = dt.Rows[0]["ETCode"].ToString();
            txtCrrntSalary.Text = dt.Rows[0]["CurrentSalary"].ToString();
        }
Ejemplo n.º 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string     dateDOB     = (CalenderDOB.FindControl("TextBox1") as TextBox).Text;
            string     dateJoining = (CalenderJoinDate.FindControl("TextBox1") as TextBox).Text;
            SqlCommand cmd         = new SqlCommand("Insert into tblEmployee (EmpCode,EmpName,Address,Email,DateOfBirth,Contact,Gender,JoiningDate,BloodGroup,MaritalStatus,FatherName,MotherName,DeptCode,DesigCode,SceCode,DivCode,ETCode,CurrentSalary) values('" + txtEmpCode.Text + "','" + txtName.Text + "','" + txtAddress.Text + "','" + txtEmail.Text + "','" + dateDOB + "','" + txtMobile.Text + "','" + ddlGender.SelectedValue + "','" + dateJoining + "','" + txtBloodGroup.Text + "','" + ddlMaritalStatus.SelectedValue + "','" + txtFatherName.Text + "','" + txtMotherName.Text + "','" + ddlDept.SelectedValue + "','" + ddlDesig.SelectedValue + "','" + ddlSection.SelectedValue + "','" + ddlDivision.SelectedValue + "','" + ddlEmpType.SelectedValue + "','" + txtCrrntSalary.Text + "')", con);

            con.Open();
            cmd.ExecuteNonQuery();
            Literal1.Text = "Data saved successfully!!!";
            LoadGrid();
            ClearAll();
            con.Close();
        }
Ejemplo n.º 3
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            string dateDOB     = (CalenderDOB.FindControl("TextBox1") as TextBox).Text;
            string dateJoining = (CalenderJoinDate.FindControl("TextBox1") as TextBox).Text;

            con.Open();
            SqlCommand cmd = new SqlCommand("update tblEmployee set EmpName='" + txtName.Text + "',Address='" + txtAddress.Text + "',Gender='" + ddlGender.SelectedValue + "',Email='" + txtEmail.Text + "',Contact='" + txtMobile.Text + "',DateOfBirth='" + dateDOB + "',Religion='" + txtReligion.Text + "',Nationality='" + txtNationality.Text + "',NationalIDNo='" + txtNid.Text + "',MaritalStatus='" + ddlMaritalStatus.SelectedValue + "',FatherName='" + txtFatherName.Text + "',MotherName='" + txtMotherName.Text + "',BloodGroup='" + txtBloodGroup.Text + "',JoiningDate='" + dateJoining + "',CurrentSalary='" + txtCrrntSalary.Text + "',DivCode='" + ddlDivision.SelectedValue + "',SceCode='" + ddlSection.SelectedValue + "',DeptCode='" + ddlDept.SelectedValue + "',DesigCode='" + ddlDesig.SelectedValue + "',ETCode='" + ddlEmpType.SelectedValue + "' where EmpCode='" + txtEmpCode.Text + "'", con);

            cmd.ExecuteNonQuery();
            Literal1.Text = "Data Updated successfully.";
            LoadGrid();
            ClearAll();
            con.Close();
        }
Ejemplo n.º 4
0
 public void ClearAll()
 {
     txtEmpCode.Text = "";
     txtName.Text    = "";
     txtAddress.Text = "";
     txtEmail.Text   = "";
     (CalenderDOB.FindControl("TextBox1") as TextBox).Text = "";
     txtFatherName.Text  = "";
     txtMotherName.Text  = "";
     ddlGender.Text      = "";
     txtMobile.Text      = "";
     txtNationality.Text = "";
     txtReligion.Text    = "";
     txtBloodGroup.Text  = "";
     txtNid.Text         = "";
     (CalenderJoinDate.FindControl("TextBox1") as TextBox).Text = "";
     ddlDept.SelectedIndex          = -1;
     ddlDesig.SelectedIndex         = -1;
     ddlDivision.SelectedIndex      = -1;
     ddlSection.SelectedIndex       = -1;
     ddlEmpType.SelectedIndex       = -1;
     ddlMaritalStatus.SelectedIndex = -1;
     txtCrrntSalary.Text            = "";
 }