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(), STATIC.StaticInfo.encString); objUsers.Password = Enc.Encrypt(txtPassword.Text.Trim(), 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; } }
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, STATIC.StaticInfo.encString); txtPassword.Attributes.Add("value", Enc.Decrypt(u.Password, STATIC.StaticInfo.encString)); txtConfirmPassword.Attributes.Add("value", Enc.Decrypt(u.Password, 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); } }