protected void ddlDesignation_SelectedIndexChanged(object sender, EventArgs e) { string msg = ""; EmployeeMasterDAL userBLL = new EmployeeMasterDAL(); tblDesignation objDesigMast = new tblDesignation(); objDesigMast = userBLL.SelectDesigRghtsStatus(Convert.ToInt32(ddlDesignation.SelectedValue)); bool?bDesigRghtsStatus = false; if (objDesigMast != null) { bDesigRghtsStatus = objDesigMast.UserRights_Status; } if (bDesigRghtsStatus == false) { msg = "Rights for this designation has not assigned. Kindly Assign rights!"; ddlDesignation.Focus(); ScriptManager.RegisterStartupScript(this, this.GetType(), "alertstrMsg", "PassMessage('" + msg + "')", true); } RdoBtnMale.Focus(); }
protected void lnkbtnSave_OnClick(object sender, EventArgs e) { Int32 empIdno = Convert.ToInt32((Session["UserIdno"] == null) ? "0" : Session["UserIdno"].ToString()); EmployeeMasterDAL objEmployeeMaster = new EmployeeMasterDAL(); string strMsg = string.Empty; Int64 intEmpIdno = 0, intUserRghtsIdno = 0; //, intEmpWHStoreIdno = 0; tblDesignation objDesigMast = new tblDesignation(); objDesigMast = objEmployeeMaster.SelectDesigRghtsStatus(Convert.ToInt32(ddlDesignation.SelectedValue)); bool?bDesigRghtsStatus = false; bDesigRghtsStatus = objDesigMast.UserRights_Status; int rowcount = 0; if (bDesigRghtsStatus == false) { ShowMessageErr("Rights for this designation has not assigned. Kindly assign rights and then save!"); ddlDesignation.Focus(); return; } string strEmail = txtEmail.Text.Trim(); string strPassword = WebTransport.Classes.EncryptDecryptPass.encryptPassword(txtPassword.Text.Trim()); bool BSeXIST = false; bool EmailExist; if (string.IsNullOrEmpty(hidEmpIdno.Value) == true) { BSeXIST = objEmployeeMaster.SelectExistInMasterDB(strEmail, strPassword, 0); } else { BSeXIST = objEmployeeMaster.SelectExistInMasterDB(strEmail, strPassword, Convert.ToInt32(hidEmpIdno.Value.Trim())); } EmailExist = objEmployeeMaster.EmailExist(strEmail, 1, Convert.ToInt32(string.IsNullOrEmpty(hidEmpIdno.Value.Trim()) ? "0" : hidEmpIdno.Value.Trim())); if ((BSeXIST == true) || (EmailExist == true)) { ShowMessageErr("Email Id And Password Already Exist Please Enter Different Email And Password!"); txtEmail.Focus(); return; } for (int i = 0; i <= chklistFromcity.Items.Count - 1; i++) { if (chklistFromcity.Items[i].Selected == true) { rowcount++; } } if (chklistFromcity.Items.Count == 0) { ShowMessageErr("Please define Location in City Master!"); return; } if (rowcount == 0) { ShowMessageErr("Please select From City!"); chklistFromcity.Focus(); return; } using (TransactionScope tScope = new TransactionScope(TransactionScopeOption.Required)) { if (string.IsNullOrEmpty(hidEmpIdno.Value) == true) { intEmpIdno = InsertIntoUsers(); if (intEmpIdno > 0) { objEmployeeMaster.InsertMultpleFromCity(intEmpIdno, chklistFromcity); } } else { intEmpIdno = UpdateUsers(Convert.ToInt64(hidEmpIdno.Value.Trim())); if (intEmpIdno > 0) { objEmployeeMaster.UpdateMultpleFromCity(intEmpIdno, chklistFromcity); } } if (intEmpIdno > 0) { if (string.IsNullOrEmpty(hidEmpIdno.Value) == true) { intUserRghtsIdno = objEmployeeMaster.InsertIntoUserRights(intEmpIdno, Convert.ToInt32(ddlDesignation.SelectedValue), empIdno); if (intEmpIdno > 0 && intUserRghtsIdno > 0) { tScope.Complete(); ShowMessage("Record saved successfully."); this.ClearCntrl(); lnkbtnNew.Visible = false; } else { ShowMessageErr("Record not saved."); txtEmpName.Focus(); } } else { if (intEmpIdno > 0) { tScope.Complete(); ShowMessage("Record updated successfully."); this.ClearCntrl(); lnkbtnNew.Visible = false; } } } else if (intEmpIdno == -1) { ShowMessageErr("Record already exists."); txtEmpName.Focus(); } else { ShowMessageErr("Record not saved."); txtEmpName.Focus(); } } txtEmpName.Focus(); }