private void LoadDataToEdit(SYS_tblUserDTO item) { txtUsername.EditValue = (item == null) ? null : item.UserName; txtUsername.Enabled = (item == null) ? true : false; txtUsernameID.EditValue = (item == null) ? null : item.UserName; txtPassword.EditValue = (item == null) ? null : Encryption.Decrypt(item.Password); txtPassword.Enabled = (item == null) ? true : false; gluGroupUser.EditValue = (item == null) ? busGroupUser.GetDefaultGroup(User.UserInfo.Username, User.UserInfo.LanguageID) : item.GroupID; chkIsEmployee.Checked = (item != null && !string.IsNullOrEmpty(item.EmpID)) ? true : false; txtFullName.EditValue = (item == null) ? null : item.FullName; gluEmployee.EditValue = null; daeEffectiveDate.EditValue = (item == null) ? DateTime.Now : item.EffectiveDate; daeToDate.EditValue = (item == null) ? null : item.ToDate; chkLock.Checked = (item == null) ? false : item.Locked; daeLockDate.EditValue = (item == null) ? null : item.LockDate; daeUnlockDate.EditValue = (item == null) ? null : item.UnlockDate; chkCanNotChangePassword.Checked = (item == null) ? false : item.CanNotChangePassword; chkChangePassNextTime.Checked = (item == null) ? false : item.ChangePassNextTime; chkPasswordNeverExpired.Checked = (item == null) ? false : item.PassNeverExpired; txtEmail.EditValue = (item == null) ? null : item.Email; mmoNote.EditValue = (item == null) ? null : item.Note; if (item == null) { depError.ClearErrors(); this.ParentForm.Text = (User.UserInfo.LanguageID.Equals("VN")) ? "Thêm Mới Người Dùng" : "Insert New User"; } txtUsername.Focus(); }
private void LoadDataToEdit(SYS_tblUserDTO item) { txtUsername.EditValue = (item == null) ? null : item.Username; txtUsername.Properties.ReadOnly = (item == null || isDuplicate) ? false : true; txtPassword.EditValue = (item == null) ? null : iPOS.Core.Security.EncryptEngine.Decrypt(item.Password); //gluGroupUser.EditValue = "1";// (item == null) ? null : item.GroupID; chkIsEmployee.Checked = (item == null) ? false : (!string.IsNullOrEmpty(item.EmpID)) ? true : false; txtFullName.EditValue = (item == null) ? null : item.FullName; gluEmployee.EditValue = (item == null) ? null : item.EmpID; dteEffectiveDate.EditValue = (item == null) ? CommonEngine.SystemDateTime : item.EffectiveDate; dteToDate.EditValue = (item == null) ? CommonEngine.SystemDateTime : item.ToDate; chkLocked.Checked = (item == null) ? false : item.Locked; dteLockDate.EditValue = (item == null) ? CommonEngine.SystemDateTime : item.LockDate; dteUnlockDate.EditValue = (item == null) ? CommonEngine.SystemDateTime : item.UnlockDate; chkCanNotChangePassword.Checked = (item == null) ? false : item.CanNotChangePassword; chkChangePassNextTime.Checked = (item == null) ? false : item.ChangePassNextTime; chkPasswordNeverExpired.Checked = (item == null) ? true : item.PassNeverExpired; txtEmail.EditValue = item == null ? null : item.Email; mmoNote.EditValue = item == null ? null : item.Note; if (item == null) { depError.ClearErrors(); this.ParentForm.Text = LanguageEngine.GetOpenFormText(this.Name, ConfigEngine.Language, false); txtUsername.Focus(); } }
public uc_UserDetail(uc_User parent, SYS_tblUserDTO item) { InitializeComponent(); Initialize(); parentForm = parent; LoadDataToEdit(item); SetPermission(); }
public uc_UserDetail(uc_User parent, SYS_tblUserDTO item) { InitializeComponent(); Initialize(); parentForm = parent; LoadDataToEdit(item); SetPermission(); }
private void btnUpdate_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (curRow != null) { SYS_tblUserDTO item = busUser.GetDataByID(curRow["Username"] + "", User.UserInfo.Username, User.UserInfo.LanguageID); if (item != null) { Commons.OpenInputForm(new uc_UserDetail(this, item), "Cập Nhật Người Dùng", "Update User", new System.Drawing.Size(455, 460)); } } }
private async void Initialize(SYS_tblUserDTO item) { LanguageEngine.ChangeCaptionLayoutControlGroup(this.Name, ConfigEngine.Language, logDetail); LanguageEngine.ChangeCaptionLayoutControlItem(this.Name, ConfigEngine.Language, new DevExpress.XtraLayout.LayoutControlItem[] { lciUsername, lciPassword, lciGroupUser, lciFullName, lciEffectiveDate, lciToDate, lciLockDate, lciUnlockDate, lciEmail, lciNote }); LanguageEngine.ChangeCaptionSimpleButton(this.Name, ConfigEngine.Language, new SimpleButton[] { btnSaveClose, btnSaveInsert, btnCancel }); LanguageEngine.ChangeCaptionCheckEdit(this.Name, ConfigEngine.Language, new CheckEdit[] { chkIsEmployee, chkLocked, chkCanNotChangePassword, chkChangePassNextTime, chkPasswordNeverExpired }); LanguageEngine.ChangeCaptionGridLookUpEdit(this.Name, ConfigEngine.Language, gluGroupUser); await LoadGroupUser(item); dteEffectiveDate.EditValue = CommonEngine.SystemDateTime; }
public uc_UserDetail(uc_User _parent_form, SYS_tblUserDTO item = null, bool _isDuplicate = false) { CommonEngine.ShowWaitForm(this); InitializeComponent(); Initialize(item); parent_form = _parent_form; isDuplicate = _isDuplicate; if (item != null) { LoadDataToEdit(item); } CommonEngine.LoadUserPermission("10", txtUsername, btnSaveClose, btnSaveInsert, isDuplicate); }
public async static Task <SYS_tblUserDRO> InsertUpdateUser(SYS_tblUserDTO item, SYS_tblActionLogDTO actionLog) { SYS_tblUserDRO result = new SYS_tblUserDRO(); try { string url = string.Format(@"{0}/InsertUpdateUser", GetBaseUrl()); var postData = new SYS_tblUserDCO { Username = item.Username, Password = item.Password, GroupID = item.GroupID, GroupName = item.GroupName, EffectiveDate = item.EffectiveDate, ToDate = item.ToDate, DateChangePass = item.DateChangePass, Locked = item.Locked, LockDate = item.LockDate, UnlockDate = item.UnlockDate, PassNeverExpired = item.PassNeverExpired, ChangePassNextTime = item.ChangePassNextTime, EmpID = item.EmpID, FullName = item.FullName, Email = item.EmpID, Note = item.Note, CanNotChangePassword = item.CanNotChangePassword, Activity = item.Activity, UserID = item.UserID, LanguageID = item.LanguageID }; var json_data = "{\"user\":" + JsonConvert.SerializeObject(postData, new JsonSerializerSettings { DateFormatHandling = DateFormatHandling.MicrosoftDateFormat }) + "}"; result = await SYS_tblUserDAO.InsertUpdateUser(url, json_data); if (string.IsNullOrEmpty(result.ResponseItem.Message)) { result.ResponseItem = await SYS_tblActionLogBUS.InsertUpdateLog(actionLog); } } catch (Exception ex) { logger.Error(ex); result.ResponseItem.Message = ex.Message; } return(result); }
private bool SaveUser(bool isEdit) { string strError = ""; try { SYS_tblUserDTO item = new SYS_tblUserDTO { UserName = txtUsername.Text, Password = Encryption.Encrypt(txtPassword.Text), GroupID = gluGroupUser.EditValue + "", EmpID = (chkIsEmployee.Checked) ? gluEmployee.EditValue + "" : "", FullName = txtFullName.Text, EffectiveDate = daeEffectiveDate.DateTime, DateChangePass = null, ToDate = (daeToDate.EditValue == null) ? null : daeToDate.EditValue, Locked = chkLock.Checked, LockDate = (chkLock.Checked) ? daeLockDate.EditValue : null, UnlockDate = (daeUnlockDate.EditValue == null) ? null : daeUnlockDate.EditValue, CanNotChangePassword = chkCanNotChangePassword.Checked, ChangePassNextTime = chkChangePassNextTime.Checked, PassNeverExpired = chkPasswordNeverExpired.Checked, Email = txtEmail.Text, Note = mmoNote.Text, Activity = (isEdit) ? "Update" : "Insert", Username = User.UserInfo.Username, LanguageID = User.UserInfo.LanguageID }; strError = (isEdit) ? busUser.UpdateUser(item) : busUser.InsertUser(item); if (strError != "") { Commons.ShowMessage(strError, 0); txtUsername.Focus(); return(false); } else { parentForm.LoadAllData(); } } catch (Exception ex) { Commons.ShowExceptionMessage(ex); txtUsername.Focus(); return(false); } return(true); }
private bool CheckLogin() { if (txtUsername.Text.Equals("")) { Common.Common.ShowMessage(Lang.GetMessageByLanguage("000011", Common.Common.Culture, Common.Common.ResourceMessage), 0); txtUsername.Focus(); return(false); } if (txtPassword.Text.Equals("")) { Common.Common.ShowMessage(Lang.GetMessageByLanguage("000011", Common.Common.Culture, Common.Common.ResourceMessage), 0); txtPassword.Focus(); return(false); } try { SYS_tblUserDTO user = busUser.CheckLogin(txtUsername.Text, Encryption.Encrypt(txtPassword.Text)); if (user != null) { User.UserInfo = user; if (user.Locked) { Common.Common.ShowMessage(Lang.GetMessageByLanguage("000010", Common.Common.Culture, Common.Common.ResourceMessage).Replace("$UserName$", user.Username), 0); txtUsername.Focus(); return(false); } } else { Common.Common.ShowMessage(Lang.GetMessageByLanguage("000009", Common.Common.Culture, Common.Common.ResourceMessage), 0); txtUsername.Focus(); return(false); } } catch (Exception ex) { Common.Common.ShowExceptionMessage(ex); txtUsername.Focus(); return(false); } return(true); }
public SYS_tblUserDTO GetDataByID(string username_other, string username, string language_id) { SYS_tblUserDTO result = new SYS_tblUserDTO(); try { DataTable data = db.GetDataTable("SYS_spfrmUser", new string[] { "Activity", "Username", "LanguageID", "UsernameOther" }, new object[] { BaseConstant.COMMAND_GET_DATA_BY_ID_EN, username, language_id, username_other }); if (data != null && data.Rows.Count > 0) { result = ConvertEngine.ConvertDataTableToObjectList <SYS_tblUserDTO>(data)[0]; return(result); } } catch (Exception ex) { logger.Error(ex); } return(result); }
public string InsertUser(SYS_tblUserDTO item) { string strError = ""; strError = db.sExecuteSQL("SYS_spfrmUser", new string[] { "Activity", "Username", "LanguageID", "UsernameOther", "Password", "GroupID", "EffectiveDate", "ToDate", "DateChangePass", "Locked", "LockDate", "UnlockDate", "PassNeverExpired", "ChangePassNextTime", "EmpID", "FullName", "CanNotChangePassword", "Email", "Note" }, new object[] { item.Activity, item.Username, item.LanguageID, item.UserName, item.Password, item.GroupID, item.EffectiveDate, item.ToDate, item.DateChangePass, item.Locked, item.LockDate, item.UnlockDate, item.PassNeverExpired, item.ChangePassNextTime, item.EmpID, item.FullName, item.CanNotChangePassword, item.Email, item.Note }); if (strError.Equals("")) { SYS_tblActionLogDTO log = new SYS_tblActionLogDTO(); log.Activity = item.Activity; log.Username = item.Username; log.LanguageID = item.LanguageID; log.ActionVN = "Thêm Mới"; log.ActionEN = "Insert"; log.FunctionID = "10"; log.DescriptionVN = string.Format("Tài khoản '{0}' vừa thêm mới thành công người dùng có tên tài khoản '{1}'.", item.Username, item.UserName); log.DescriptionEN = string.Format("Account '{0}' has inserted new user successfully with username is '{1}'.", item.Username, item.UserName); strError = this.InsertActionLog(log); } return(strError); }
public string UpdateUser(SYS_tblUserDTO item) { string strError = ""; strError = db.sExecuteSQL("SYS_spfrmUser", new string[] { "Activity", "Username", "LanguageID", "UsernameOther", "GroupID", "EffectiveDate", "ToDate", "DateChangePass", "Locked", "LockDate", "UnlockDate", "PassNeverExpired", "ChangePassNextTime", "EmpID", "FullName", "CanNotChangePassword", "Email", "Note" }, new object[] { item.Activity, item.Username, item.LanguageID, item.UserName, item.GroupID, item.EffectiveDate, item.ToDate, item.DateChangePass, item.Locked, item.LockDate, item.UnlockDate, item.PassNeverExpired, item.ChangePassNextTime, item.EmpID, item.FullName, item.CanNotChangePassword, item.Email, item.Note }); if (strError.Equals("")) { strError = this.InsertActionLog(new SYS_tblActionLogDTO { Activity = "Insert", Username = item.Username, LanguageID = item.LanguageID, ActionVN = "Cập Nhật", ActionEN = "Update", FunctionID = "10", DescriptionVN = string.Format("Tài khoản '{0}' vừa cập nhật thành công người dùng có tên tài khoản '{1}'.", item.Username, item.UserName), DescriptionEN = string.Format("Account '{0}' has updated user successfully with username is '{1}'.", item.Username, item.UserName) }); } return(strError); }
private async Task LoadGroupUser(SYS_tblUserDTO item) { try { SYS_tblGroupUserDRO groupUsers = await iPOS.BUS.Systems.SYS_tblGroupUserBUS.GetAllGroupUsers(CommonEngine.userInfo.Username, ConfigEngine.Language, true, null); gluGroupUser.DataBindings.Clear(); if (!CommonEngine.CheckValidResponseItem(groupUsers.ResponseItem)) { return; } else { gluGroupUser.Properties.DataSource = groupUsers.GroupUserList; } gluGroupUser.Properties.DisplayMember = "Note"; gluGroupUser.Properties.ValueMember = "GroupID"; if (item == null && groupUsers.GroupUserList != null) { var groupDefault = (from groupUser in groupUsers.GroupUserList where groupUser.IsDefault.Equals(true) select groupUser).FirstOrDefault(); if (groupUsers.GroupUserList.Count > 0) { gluGroupUser.EditValue = groupDefault.GroupID; } } else { gluGroupUser.EditValue = item.GroupID; } } catch (Exception ex) { CommonEngine.ShowExceptionMessage(ex); } }
public string UpdateUser(SYS_tblUserDTO item) { string strError = ""; try { strError = db.sExecuteSQL("SYS_spfrmUser", new string[] { "Activity", "Username", "LanguageID", "UsernameOther", "Password", "GroupID", "EffectiveDate", "ToDate", "DateChangePass", "Locked", "LockDate", "UnlockDate", "PassNeverExpired", "ChangePassNextTime", "EmpID", "FullName", "CanNotChangePassword", "Email", "Note" }, new object[] { item.Activity, item.UserID, item.LanguageID, item.Username, item.Password, item.GroupID, item.EffectiveDate, item.ToDate, item.DateChangePass, item.Locked, item.LockDate, item.UnlockDate, item.PassNeverExpired, item.ChangePassNextTime, item.EmpID, item.FullName, item.CanNotChangePassword, item.Email, item.Note }); if (!string.IsNullOrEmpty(strError)) { logger.Error(strError); } return(strError); } catch (Exception ex) { logger.Error(ex); strError = ex.Message; } return(strError); }
public string UpdateUser(SYS_tblUserDTO item) { return daoUser.UpdateUser(item); }
public string UpdateUser(SYS_tblUserDTO item) { string strError = ""; strError = db.sExecuteSQL("SYS_spfrmUser", new string[] { "Activity", "Username", "LanguageID", "UsernameOther", "GroupID", "EffectiveDate", "ToDate", "DateChangePass", "Locked", "LockDate", "UnlockDate", "PassNeverExpired", "ChangePassNextTime", "EmpID", "FullName", "CanNotChangePassword", "Email", "Note" }, new object[] { item.Activity, item.Username, item.LanguageID, item.UserName, item.GroupID, item.EffectiveDate, item.ToDate, item.DateChangePass, item.Locked, item.LockDate, item.UnlockDate, item.PassNeverExpired, item.ChangePassNextTime, item.EmpID, item.FullName, item.CanNotChangePassword, item.Email, item.Note }); if (strError.Equals("")) { strError = this.InsertActionLog(new SYS_tblActionLogDTO { Activity = "Insert", Username = item.Username, LanguageID = item.LanguageID, ActionVN = "Cập Nhật", ActionEN = "Update", FunctionID = "10", DescriptionVN = string.Format("Tài khoản '{0}' vừa cập nhật thành công người dùng có tên tài khoản '{1}'.", item.Username, item.UserName), DescriptionEN = string.Format("Account '{0}' has updated user successfully with username is '{1}'.", item.Username, item.UserName) }); } return strError; }
public string InsertUser(SYS_tblUserDTO item) { return(daoUser.InsertUser(item)); }
public string UpdateUser(SYS_tblUserDTO item) { return(daoUser.UpdateUser(item)); }
private bool SaveUser(bool isEdit) { string strError = ""; try { SYS_tblUserDTO item = new SYS_tblUserDTO { UserName = txtUsername.Text, Password = Encryption.Encrypt(txtPassword.Text), GroupID = gluGroupUser.EditValue + "", EmpID = (chkIsEmployee.Checked) ? gluEmployee.EditValue + "" : "", FullName = txtFullName.Text, EffectiveDate = daeEffectiveDate.DateTime, DateChangePass = null, ToDate = (daeToDate.EditValue == null) ? null : daeToDate.EditValue, Locked = chkLock.Checked, LockDate = (chkLock.Checked) ? daeLockDate.EditValue : null, UnlockDate = (daeUnlockDate.EditValue == null) ? null : daeUnlockDate.EditValue, CanNotChangePassword = chkCanNotChangePassword.Checked, ChangePassNextTime = chkChangePassNextTime.Checked, PassNeverExpired = chkPasswordNeverExpired.Checked, Email = txtEmail.Text, Note = mmoNote.Text, Activity = (isEdit) ? "Update" : "Insert", Username = User.UserInfo.Username, LanguageID = User.UserInfo.LanguageID }; strError = (isEdit) ? busUser.UpdateUser(item) : busUser.InsertUser(item); if (strError != "") { Commons.ShowMessage(strError, 0); txtUsername.Focus(); return false; } else parentForm.LoadAllData(); } catch (Exception ex) { Commons.ShowExceptionMessage(ex); txtUsername.Focus(); return false; } return true; }
private void LoadDataToEdit(SYS_tblUserDTO item) { txtUsername.EditValue = (item == null) ? null : item.UserName; txtUsername.Enabled = (item == null) ? true : false; txtUsernameID.EditValue = (item == null) ? null : item.UserName; txtPassword.EditValue = (item == null) ? null : Encryption.Decrypt(item.Password); txtPassword.Enabled = (item == null) ? true : false; gluGroupUser.EditValue = (item == null) ? busGroupUser.GetDefaultGroup(User.UserInfo.Username, User.UserInfo.LanguageID) : item.GroupID; chkIsEmployee.Checked = (item != null && !string.IsNullOrEmpty(item.EmpID)) ? true : false; txtFullName.EditValue = (item == null) ? null : item.FullName; gluEmployee.EditValue = null; daeEffectiveDate.EditValue = (item == null) ? DateTime.Now : item.EffectiveDate; daeToDate.EditValue = (item == null) ? null : item.ToDate; chkLock.Checked = (item == null) ? false : item.Locked; daeLockDate.EditValue = (item == null) ? null : item.LockDate; daeUnlockDate.EditValue = (item == null) ? null : item.UnlockDate; chkCanNotChangePassword.Checked = (item == null) ? false : item.CanNotChangePassword; chkChangePassNextTime.Checked = (item == null) ? false : item.ChangePassNextTime; chkPasswordNeverExpired.Checked = (item == null) ? false : item.PassNeverExpired; txtEmail.EditValue = (item == null) ? null : item.Email; mmoNote.EditValue = (item == null) ? null : item.Note; if (item == null) { depError.ClearErrors(); this.ParentForm.Text = (User.UserInfo.LanguageID.Equals("VN")) ? "Thêm Mới Người Dùng" : "Insert New User"; } txtUsername.Focus(); }
public string InsertUser(SYS_tblUserDTO item) { string strError = ""; strError = db.sExecuteSQL("SYS_spfrmUser", new string[] { "Activity", "Username", "LanguageID", "UsernameOther", "Password", "GroupID", "EffectiveDate", "ToDate", "DateChangePass", "Locked", "LockDate", "UnlockDate", "PassNeverExpired", "ChangePassNextTime", "EmpID", "FullName", "CanNotChangePassword", "Email", "Note" }, new object[] { item.Activity, item.Username, item.LanguageID, item.UserName, item.Password, item.GroupID, item.EffectiveDate, item.ToDate, item.DateChangePass, item.Locked, item.LockDate, item.UnlockDate, item.PassNeverExpired, item.ChangePassNextTime, item.EmpID, item.FullName, item.CanNotChangePassword, item.Email, item.Note }); if (strError.Equals("")) { SYS_tblActionLogDTO log = new SYS_tblActionLogDTO(); log.Activity = item.Activity; log.Username = item.Username; log.LanguageID = item.LanguageID; log.ActionVN = "Thêm Mới"; log.ActionEN = "Insert"; log.FunctionID = "10"; log.DescriptionVN = string.Format("Tài khoản '{0}' vừa thêm mới thành công người dùng có tên tài khoản '{1}'.", item.Username, item.UserName); log.DescriptionEN = string.Format("Account '{0}' has inserted new user successfully with username is '{1}'.", item.Username, item.UserName); strError = this.InsertActionLog(log); } return strError; }
public string InsertUser(SYS_tblUserDTO item) { return daoUser.InsertUser(item); }