private void SetDataControlsToObject(ref CustomList <Users> lstUser) { try { Users objUsers = lstUser[0]; objUsers.UserCode = txtUserCode.Text; objUsers.Name = txtName.Text; objUsers.EmpCode = ddlEmpCode.SelectedValue; objUsers.UserName = Enc.Encrypt(txtUserName.Text.Trim(), ASL.STATIC.StaticInfo.encString); objUsers.Password = Enc.Encrypt(txtPassword.Text.Trim(), ASL.STATIC.StaticInfo.encString); objUsers.IsAdmin = 1; if (chkActiveUser.Checked) { objUsers.IsActive = 1; } else { objUsers.IsActive = 0; } if (chkAdminUser.Checked) { objUsers.IsAdmin = 1; } else { objUsers.IsAdmin = 0; } } catch (Exception ex) { throw ex; } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack.IsFalse()) { InitializeSession(); txtApproveBy_nc.Text = Enc.Decrypt(CurrentUserSession.UserName, ASL.STATIC.StaticInfo.encString); } else { Page.ClientScript.GetPostBackEventReference(this, String.Empty); String eventTarget = Request["__EVENTTARGET"].IsNullOrEmpty() ? String.Empty : Request["__EVENTTARGET"]; if (eventTarget == "SearchSalaryRule") { SalaryRuleBackup searchSalaryRule = Session[ASL.STATIC.StaticInfo.SearchSessionVarName] as SalaryRuleBackup; if (searchSalaryRule.IsNotNull()) { txtSalaryRuleID.Text = searchSalaryRule.SalaryRuleCode; grdSalaryRuleList = manager.GetAllSalaryRuleBackup(searchSalaryRule.SalaryRuleCode); if (grdSalaryRuleList.Count != 0) { chkApproved.Checked = grdSalaryRuleList[0].IsApproved; txtApprovalDate.Text = grdSalaryRuleList[0].ApprovalDate == DateTime.MinValue ? string.Empty : grdSalaryRuleList[0].ApprovalDate.ToShortDateString(); txtApproveBy_nc.Text = grdSalaryRuleList[0].ApproveBy; } } } } }
private void SetDataInControls(Users u) { try { txtUserCode.Text = u.UserCode.ToString(); txtName.Text = u.Name.ToString(); ddlEmpCode.SelectedValue = u.EmpCode; txtUserName.Text = Enc.Decrypt(u.UserName, ASL.STATIC.StaticInfo.encString); txtPassword.Attributes.Add("value", Enc.Decrypt(u.Password, ASL.STATIC.StaticInfo.encString)); txtConfirmPassword.Attributes.Add("value", Enc.Decrypt(u.Password, ASL.STATIC.StaticInfo.encString)); if (u.IsActive == 1) { chkActiveUser.Checked = true; } else { chkActiveUser.Checked = false; } if (u.IsAdmin == 1) { chkAdminUser.Checked = true; } else { chkAdminUser.Checked = false; } } catch (Exception ex) { throw (ex); } }