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 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; }
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); }
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); } }
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 SYS_tblUserDRO GetUserByID(string Username, string LanguageID, string UsernameOther) { SYS_tblUserDRO result = new SYS_tblUserDRO(); try { using (var scope = Container.BeginLifetimeScope()) { SYS_tblUserDTO temp = new SYS_tblUserDTO(); var db = scope.Resolve<ISYS_tblUserDAO>(); temp = db.GetDataByID(UsernameOther, Username, LanguageID); if (temp != null) { result.UserItem = Mapper.Map<SYS_tblUserDCO>(temp); result.ResponseItem = new DCO.ResponseItem { Result = true, Status = DCO.ResponseStatus.Success, Message = "", RequestUser = Username, TotalItemCount = 1 }; } } } catch (Exception ex) { result.UserItem = Mapper.Map<SYS_tblUserDCO>(new SYS_tblUserDTO()); result.ResponseItem = new DCO.ResponseItem { Result = false, Status = DCO.ResponseStatus.Exception, Message = "Get data failed: " + ex.Message, RequestUser = Username, TotalItemCount = 0 }; logger.Error(ex); } return result; }