Ejemplo n.º 1
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            string dateDOB     = (calenderDOB.FindControl("TextBox1") as TextBox).Text;
            string joiningDate = (CalenderJoiningDate.FindControl("TextBox1") as TextBox).Text;

            con.Open();
            SqlCommand cmd = new SqlCommand("update tblEmployee set EmpName='" + txtName.Text + "',Address='" + txtAddress.Text + "',Email='" + txtEmail.Text + "',DOB='" + dateDOB + "',ContactNo='" + txtMobile.Text + "',Gender='" + ddlGender.SelectedValue + "',JoiningDate='" + joiningDate + "',DeptCode='" + ddlDept.SelectedValue + "',DesigCode='" + ddlDesig.SelectedValue + "',SecCode='" + ddlSection.SelectedValue + "',DivCode='" + ddlDividion.SelectedValue + "',EmpTypeCode='" + ddlEmpType.SelectedValue + "',CurrentSalary='" + txtCrrntSalary.Text + "' where EmpCode='" + txtEmpCode.Text + "'", con);

            cmd.ExecuteNonQuery();
            ClearAll();
            con.Close();
            lblMsg.Text = "Data Updataed Successfully!!!";
            LoadGrid();
        }
Ejemplo n.º 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string dateDOB     = (calenderDOB.FindControl("TextBox1") as TextBox).Text;
            string joiningDate = (CalenderJoiningDate.FindControl("TextBox1") as TextBox).Text;

            con.Open();
            SqlCommand cmd = new SqlCommand("Insert into tblEmployee (EmpCode,EmpName,Address,Email,DOB,ContactNo,Gender, " +
                                            " JoiningDate,DeptCode,DesigCode,SecCode,DivCode,EmpTypeCode,CurrentSalary) " +
                                            " values('" + txtEmpCode.Text.Trim() + "','" + txtName.Text.Trim() + "','" + txtAddress.Text + "','" + txtEmail.Text.Trim() + "','" + dateDOB + "','" + txtMobile.Text + "','" + ddlGender.SelectedItem.Text + "','" + joiningDate + "','" + ddlDept.SelectedValue + "','" + ddlDesig.SelectedValue + "','" + ddlSection.SelectedValue + "','" + ddlDividion.SelectedValue + "','" + ddlEmpType.SelectedValue + "','" + txtCrrntSalary.Text + "')", con);

            cmd.ExecuteNonQuery();
            con.Close();
            lblMsg.Text = "Data Saved Successfully!!!";
            LoadGrid();
            ClearAll();
        }
Ejemplo n.º 3
0
 private void ClearAll()
 {
     txtName.Text    = "";
     txtAddress.Text = "";
     txtEmail.Text   = "";
     (calenderDOB.FindControl("TextBox1") as TextBox).Text = "";
     txtMobile.Text          = "";
     ddlGender.SelectedIndex = -1;
     (CalenderJoiningDate.FindControl("TextBox1") as TextBox).Text = "";
     ddlDept.SelectedIndex     = -1;
     ddlDesig.SelectedIndex    = -1;
     ddlSection.SelectedIndex  = -1;
     ddlDividion.SelectedIndex = -1;
     ddlEmpType.SelectedIndex  = -1;
     txtCrrntSalary.Text       = "";
     txtEmpCode.Text           = "";
     txtEmpCode.Focus();
 }
Ejemplo n.º 4
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string         dateDOB     = (calenderDOB.FindControl("TextBox1") as TextBox).Text;
            string         joiningDate = (CalenderJoiningDate.FindControl("TextBox1") as TextBox).Text;
            SqlDataAdapter sda         = new SqlDataAdapter("Select EmpCode,EmpName,Address,Email,DOB,ContactNo,Gender,JoiningDate,DeptCode,DesigCode,SecCode,DivCode,EmpTypeCode,CurrentSalary from tblEmployee where EmpCode='" + txtEmpCode.Text + "'", con);
            DataTable      dt          = new DataTable();

            sda.Fill(dt);
            GridView1.DataSource = 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]["DOB"].ToString();
            txtMobile.Text          = dt.Rows[0]["ContactNo"].ToString();
            ddlGender.SelectedValue = dt.Rows[0]["Gender"].ToString();
            (CalenderJoiningDate.FindControl("TextBox1") as TextBox).Text = dt.Rows[0]["JoiningDate"].ToString();
            ddlDept.SelectedValue     = dt.Rows[0]["DeptCode"].ToString();
            ddlDesig.SelectedValue    = dt.Rows[0]["DesigCode"].ToString();
            ddlSection.SelectedValue  = dt.Rows[0]["SecCode"].ToString();
            ddlDividion.SelectedValue = dt.Rows[0]["DivCode"].ToString();
            ddlEmpType.SelectedValue  = dt.Rows[0]["EmpTypeCode"].ToString();
            txtCrrntSalary.Text       = dt.Rows[0]["CurrentSalary"].ToString();
        }