private void btnSave_Click(object sender, EventArgs e) { try { if (ValidateChildren(ValidationConstraints.Enabled)) { int logged_in_user = LoggedUser.id; int rtn = -1; char gender; if (rbGender1.Checked == true) { gender = 'M'; } else { gender = 'F'; } if (txtID.Text.Trim() == "") //add data { rtn = objStaffs.addStaffs(txtFirstName.Text, txtLastName.Text, Convert.ToInt32(cmbDept.SelectedValue.ToString()), txtDesignation.Text, txtQualification.Text, Convert.ToInt32(cmbStaffType.SelectedValue.ToString()), gender, Convert.ToDateTime(dtpDob.Text), txtNationality.Text, txtPathaka.Text, Convert.ToDateTime(dtpPathakaExpiry.Text), txtAddress.Text, txtCity.Text, txtDistrict.Text, txtZip.Text, txtPhone.Text, txtEmail.Text, chkActive.Checked, Int32.Parse(cmbUserRole.SelectedValue.ToString())); if (rtn == 0) { ShowStatus(0, "Type name should be unique"); } else if (rtn == 1) { ShowStatus(1, "Record successfully added"); clearControls(); } else if (rtn == -1) { ShowStatus(0, "Some error occurred... Record cannot be added."); } } else //edit record { rtn = objStaffs.editStaffs(Int32.Parse(txtID.Text.Trim()), Int32.Parse(txtUSERID.Text.Trim()), txtFirstName.Text, txtLastName.Text, Convert.ToInt32(cmbDept.SelectedValue.ToString()), txtDesignation.Text, txtQualification.Text, Convert.ToInt32(cmbStaffType.SelectedValue.ToString()), gender, Convert.ToDateTime(dtpDob.Text), txtNationality.Text, txtPathaka.Text, Convert.ToDateTime(dtpPathakaExpiry.Text), txtAddress.Text, txtCity.Text, txtDistrict.Text, txtZip.Text, txtPhone.Text, txtEmail.Text, chkActive.Checked, Int32.Parse(cmbUserRole.SelectedValue.ToString())); //if (rtn == 0) // lblStatus.Text = "This name already exists. Please provide unique name."; //else if (rtn == 1) { ShowStatus(1, "Record successfully updated"); clearControls(); } else if (rtn == -1) { ShowStatus(0, "Some error occurred... Record cannot be added."); } } } } catch (Exception ex) { CommonLogger.Info("frmStaffs\r\n" + ex.ToString()); } }