private Int64 UpdateUsers(Int64 intEmpIdno) { Int32 empIdno = Convert.ToInt32((Session["UserIdno"] == null) ? "0" : Session["UserIdno"].ToString()); EmployeeMasterDAL objEmployeeMasterDAL = new EmployeeMasterDAL(); string strFileName = Convert.ToString(Path.GetFileName(fuPicture.FileName)); string strName = txtEmpName.Text.Trim(); string strFName = txtFatherName.Text.Trim(); DateTime? dtDOB = null; string Gndr = string.Empty; if (RdoBtnMale.Checked == true) { Gndr = "M"; } else if (RdoBtnFemale.Checked == true) { Gndr = "F"; } if (string.IsNullOrEmpty(txtDOB.Text.Trim()) == false) { dtDOB = Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDOB.Text.Trim())); } DateTime?dtDOJ = null; if (string.IsNullOrEmpty(txtDOJ.Text.Trim()) == false) { dtDOJ = Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDOJ.Text.Trim())); } DateTime?dtDOR = null; if (string.IsNullOrEmpty(txtDOR.Text.Trim()) == false) { dtDOR = Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDOR.Text.Trim())); } string strPhone = txtPhone.Text.Trim(); string strMobile = txtMobile.Text.Trim(); string strEmail = txtEmail.Text.Trim(); string strAddress = txtAddress.Text.Trim(); Int64 intCityIdno = string.IsNullOrEmpty(Convert.ToString(ddlCity.SelectedValue)) ? 0 : Convert.ToInt64(ddlCity.SelectedValue.Trim()); Int64 intStateIdno = string.IsNullOrEmpty(Convert.ToString(ddlState.SelectedValue)) ? 0 : Convert.ToInt64(ddlState.SelectedValue.Trim()); Int64 intDesigIdno = string.IsNullOrEmpty(Convert.ToString(ddlDesignation.SelectedValue)) ? 0 : Convert.ToInt64(ddlDesignation.SelectedValue.Trim()); string strPinCode = txtPinCode.Text.Trim(); string strLogoPath = ""; if (imgEmp.ImageUrl != "") { string filename = Path.GetFileName(fuPicture.FileName); strLogoPath = VirtualPathUtility.ToAbsolute(imgEmp.ImageUrl); } string strRemarks = txtRemarks.Text.Trim(); bool bStatus = Convert.ToBoolean((chkIsActive.Checked == true) ? 1 : 0); Int32 intCompIdno = 1; string strLoginname = txtUName.Text.Trim(); bool bComputer = Convert.ToBoolean((ddlcomputerstatus.SelectedIndex) == 0 ? 1 : 0); string strPassword = WebTransport.Classes.EncryptDecryptPass.encryptPassword(txtPassword.Text.Trim()); intEmpIdno = objEmployeeMasterDAL.Update(intEmpIdno, strName, strFName, dtDOB, dtDOJ, dtDOR, strPhone, strMobile, strEmail, strLoginname, strPassword, strAddress, intCityIdno, intStateIdno, intDesigIdno, strPinCode, strLogoPath, strRemarks, bStatus, intCompIdno, Gndr, bComputer, empIdno, (string.IsNullOrEmpty(Session["CompId"].ToString()) ? 0 : Convert.ToInt32(Session["CompId"]))); return(intEmpIdno); }
private void PopulateMultpleFromCity(int UserIdno) { EmployeeMasterDAL obj = new EmployeeMasterDAL(); DataSet Ds = obj.PopulateFromCityMultiple(UserIdno, ApplicationFunction.ConnectionString()); chklistFromcity.DataSource = null; chklistFromcity.DataSource = Ds.Tables[0]; chklistFromcity.DataTextField = "city_name"; chklistFromcity.DataValueField = "City_Idno"; chklistFromcity.DataBind(); }
private void BindMultpleFromCity() { EmployeeMasterDAL obj = new EmployeeMasterDAL(); var ToCity = obj.BindToCity(); obj = null; chklistFromcity.DataSource = ToCity; chklistFromcity.DataTextField = "city_name"; chklistFromcity.DataValueField = "City_Idno"; chklistFromcity.DataBind(); }
public void Countall() { EmployeeMasterDAL obj = new EmployeeMasterDAL(); Int64 count = obj.Countall(); if (count > 0) { lblTotalRecord.Text = "T. Record (s):" + count; } else { lblTotalRecord.Text = "T. Record (s): 0 "; } }
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 Page_Load(object sender, EventArgs e) { LoginDAL objLogin = new LoginDAL(); EmployeeMasterDAL objEmployeeMasterDAL = new EmployeeMasterDAL(); lblCompName.Text = objLogin.SelectCompanyName(); lblDatabaseName.Text = "DB: " + Convert.ToString(Session["DBName"]); var objEmpMaster = objEmployeeMasterDAL.SelectById(Convert.ToInt64(Session["UserIdno"])); imgEmp.ImageUrl = string.IsNullOrEmpty(Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Photo"))) ? "~/img/placeholder.png" : "~" + Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Photo")).Trim(); objEmpMaster = null; if (Session["LastLoginDate"] != "" && Session["LastLoginDate"] != null) { lblLastLoginDate.Visible = true; lblLastLoginDate.Text = "Last Login : "******"LastLoginDate"].ToString()).ToString(); } else { lblLastLoginDate.Visible = true; lblLastLoginDate.Text = "First time Login"; } if (string.IsNullOrEmpty(lblDatabaseName.Text)) { Response.Redirect("Login.aspx", false); } lblusername.Text = Convert.ToString(Session["UserName"]); if (string.IsNullOrEmpty(lblusername.Text)) { Response.Redirect("Login.aspx", false); } }
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(); }
private void Populate(Int64 intEmpIdno) { PopulateMultpleFromCity(Convert.ToInt32(intEmpIdno)); EmployeeMasterDAL objEmployeeMasterDAL = new EmployeeMasterDAL(); var objEmpMaster = objEmployeeMasterDAL.SelectById(intEmpIdno); var lst1 = objEmployeeMasterDAL.SelectFromCityMultiple(intEmpIdno); objEmployeeMasterDAL = null; if (objEmpMaster != null) { string gender = ""; gender = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Gender")); if (gender == "F") { RdoBtnFemale.Checked = true; } else { RdoBtnMale.Checked = true; } hidEmpIdno.Value = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "EmpIdno")); txtEmpName.Text = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "EmpName")); txtFatherName.Text = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "FName")); txtDOB.Text = string.IsNullOrEmpty(Convert.ToString(DataBinder.Eval(objEmpMaster[0], "DOB"))) ? "" : Convert.ToDateTime(DataBinder.Eval(objEmpMaster[0], "DOB")).ToString("dd-MM-yyyy"); txtDOJ.Text = string.IsNullOrEmpty(Convert.ToString(DataBinder.Eval(objEmpMaster[0], "DOJ"))) ? "" : Convert.ToDateTime(DataBinder.Eval(objEmpMaster[0], "DOJ")).ToString("dd-MM-yyyy"); txtDOR.Text = string.IsNullOrEmpty(Convert.ToString(DataBinder.Eval(objEmpMaster[0], "DOR"))) ? "" : Convert.ToDateTime(DataBinder.Eval(objEmpMaster[0], "DOR")).ToString("dd-MM-yyyy"); txtPhone.Text = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Phone")); txtMobile.Text = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Mobile")); txtEmail.Text = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "EMAIL")); txtAddress.Text = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Address")); ddlState.SelectedValue = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "State")); ddlState_SelectedIndexChanged(null, null); ddlCity.SelectedValue = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "City")); ddlDesignation.SelectedValue = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Desig")); txtPinCode.Text = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "PinCode")); txtRemarks.Text = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Remark")); bool bStatus = Convert.ToBoolean(DataBinder.Eval(objEmpMaster[0], "Status")); if (Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Computer_User")) == "False") { ddlcomputerstatus.SelectedValue = "1"; } else { ddlcomputerstatus.SelectedValue = "0"; } chkIsActive.Checked = bStatus; txtUName.Text = Convert.ToString(DataBinder.Eval(objEmpMaster[0], "UserName")); string pwd1 = WebTransport.Classes.EncryptDecryptPass.decryptPassword(Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Password"))); txtPassword.Attributes.Add("value", pwd1); imgEmp.ImageUrl = "~" + Convert.ToString(DataBinder.Eval(objEmpMaster[0], "Photo")).Trim(); if (lst1.Count > 0) { for (int i = 0; i < chklistFromcity.Items.Count; i++) { for (int j = 0; j < lst1.Count; j++) { if (Convert.ToInt64(chklistFromcity.Items[i].Value) == lst1[j].FrmCity_Idno) { chklistFromcity.Items[i].Selected = true; } } } } } }