using System; using System.Linq; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Windows.Forms; using System.Threading; using ITC81DB_0H.Controls; using ITC81DB_0H.DialogForms; using ITC81DB_2H_ImageDll; using ITC81DB_2H.Datastore; using ITC81DB_0H.Part11_UserManager; using ITC81DB_0H.Forms; namespace ITC81DB_0H.Controls { public partial class ControlCenterEquipUser : UserControl { #region Field private FormMenu m_ParentForm; private bool IsNew; private object LockObject = new object(); private bool PasswordChar; private UserItem m_SelectedUserItem; private string BeforeID; private string BeforePassword; #endregion #region Constructor public ControlCenterEquipUser(FormMenu parent) { InitializeComponent(); this.ParentForm = parent; this.InitializeDesign(); this.DefaultSetting(); } #endregion #region Property public FormMenu ParentForm { get { return this.m_ParentForm; } private set { this.m_ParentForm = value; } } public UserItem SelectedUserItem { get { return this.m_SelectedUserItem; } private set { this.m_SelectedUserItem = value; } } #endregion #region Method public void InitializeDesign() { Class1 images = new Class1(); if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.English || this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Spanish) { this.labelTitleID.Text = "ID"; this.labelTitlePassword.Text = "Password"; this.labelTitleExpiryDateOfAccount.Text = "Expiry date(ID)"; this.labelTitleExpiryDateOfPassword.Text = "Expiry date(PW)"; this.labelTitleAutomaticLogoutTime.Text = "Auto Logout"; this.labelAutoLogoutWarning.Text = "* Applies to all ID"; this.labelTitleAccessRight.Text = "Access right"; } else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Chinese) { this.labelTitleID.Text = "用户名"; this.labelTitlePassword.Text = "密码"; this.labelTitleExpiryDateOfAccount.Text = "到期日(用户名)"; this.labelTitleExpiryDateOfPassword.Text = "到期日(密码)"; this.labelTitleAutomaticLogoutTime.Text = "自动注销"; this.labelAutoLogoutWarning.Text = "* 适用于所有身份证"; this.labelTitleAccessRight.Text = "访问权"; } else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Czech) { } else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.Russian) { this.labelTitleID.Text = "ID"; this.labelTitlePassword.Text = "Пароль"; this.labelTitleExpiryDateOfAccount.Text = "Истечения(ID)"; this.labelTitleExpiryDateOfPassword.Text = "Истечения(Пароль)"; this.labelTitleAutomaticLogoutTime.Text = "Автоматический выход"; this.labelAutoLogoutWarning.Text = "* Все идентификаторы"; this.labelTitleAccessRight.Text = "Право доступа"; } else if (this.ParentForm.ParentForm.SystemConfig1.Language == Define.E_LanguageID.German) { this.labelTitleID.Text = "ID"; this.labelTitlePassword.Text = "Passwort"; this.labelTitleExpiryDateOfAccount.Text = "Verfallsdatum(ID)"; this.labelTitleExpiryDateOfPassword.Text = "Verfallsdatum(PW)"; this.labelTitleAutomaticLogoutTime.Text = "Automatische Abmeldung"; this.labelAutoLogoutWarning.Text = "* Gilt für alle ID"; this.labelTitleAccessRight.Text = "Zugangsberechtigung"; } else { this.labelTitleID.Text = "ID"; this.labelTitlePassword.Text = "비밀번호"; this.labelTitleExpiryDateOfAccount.Text = "만료일(ID)"; this.labelTitleExpiryDateOfPassword.Text = "만료일(PW)"; this.labelTitleAutomaticLogoutTime.Text = "자동 로그아웃"; this.labelAutoLogoutWarning.Text = "* 모든 ID에 적용됨"; this.labelTitleAccessRight.Text = "접근 권한"; } } private void DefaultSetting() { this.IsNew = false; this.PasswordChar = false; this.BeforeID = ""; this.BeforePassword = ""; this.DisplayOnlyPart11Item(this.ParentForm.ParentForm.SystemConfig3.IsPart11); this.UpdateAccessRightComboBox(); this.comboBoxAccessRight.SelectedIndexChanged -= new EventHandler(this.comboBoxAccessRight_SelectedIndexChanged); this.comboBoxAccessRight.SelectedIndex = 0; this.comboBoxAccessRight.SelectedIndexChanged += new EventHandler(this.comboBoxAccessRight_SelectedIndexChanged); this.smartKeyboard.KeyboardType = SmartX.SmartKeyboard.KEYBOARDTYPES.NORMAL; this.smartKeyboard.Show(); } private bool UI_Invoke(ThreadStart invoker) { try { if (this.InvokeRequired) { if (this.IsDisposed) return true; this.Invoke(invoker); } else { invoker(); } return true; } catch (Exception e) { return false; } } public void DisplayOnlyPart11Item(bool bValue) { if (bValue == true) { this.labelTitleExpiryDateOfAccount.Visible = true; this.labelExpiryDateOfAccount.Visible = true; this.labelExpiryDateOfAccount2.Visible = true; this.labelTitleExpiryDateOfPassword.Visible = true; this.labelExpiryDateOfPassword.Visible = true; this.labelExpiryDateOfPassword2.Visible = true; this.labelTitleAutomaticLogoutTime.Visible = true; this.labelAutomaticLogoutTime.Visible = true; this.smartLabel3.Visible = true; this.smartLabel8.Visible = true; this.smartLabel11.Visible = true; this.labelAutoLogoutWarning.Visible = true; this.smartSeparatorLine1.Visible = true; this.smartSeparatorLine2.Visible = true; } else { this.labelTitleExpiryDateOfAccount.Visible = false; this.labelExpiryDateOfAccount.Visible = false; this.labelExpiryDateOfAccount2.Visible = false; this.labelTitleExpiryDateOfPassword.Visible = false; this.labelExpiryDateOfPassword.Visible = false; this.labelExpiryDateOfPassword2.Visible = false; this.labelTitleAutomaticLogoutTime.Visible = false; this.labelAutomaticLogoutTime.Visible = false; this.smartLabel3.Visible = false; this.smartLabel8.Visible = false; this.smartLabel11.Visible = false; this.labelAutoLogoutWarning.Visible = false; this.smartSeparatorLine1.Visible = false; this.smartSeparatorLine2.Visible = false; } } public void UpdateAccessRightComboBox() { this.comboBoxAccessRight.Items.Clear(); this.comboBoxAccessRight.Items.Add(this.ParentForm.ParentForm.SystemConfig2.UserGroupLevel1Name); this.comboBoxAccessRight.Items.Add(this.ParentForm.ParentForm.SystemConfig2.UserGroupLevel2Name); this.comboBoxAccessRight.Items.Add(this.ParentForm.ParentForm.SystemConfig2.UserGroupLevel3Name); } private void SetTextBoxPasswordChar(bool bValue) { if (bValue == false) this.textBoxPassword.PasswordChar = '*'; else this.textBoxPassword.PasswordChar = default(char); } public void DisplayHiddenMenu(bool bValue) { this.PasswordChar = bValue; this.SetTextBoxPasswordChar(this.PasswordChar); } private void SetEnableID(bool value) { this.textBoxID.Enabled = value; this.buttonIDEdit.Enabled = value; if (value == true) this.textBoxID.BackColor = Color.White; else this.textBoxID.BackColor = Color.Silver; } private void SetEnablePassword(bool value) { this.textBoxPassword.Enabled = value; this.buttonPasswordEdit.Enabled = value; if (value == true) this.textBoxPassword.BackColor = Color.White; else this.textBoxPassword.BackColor = Color.Silver; } private void SetEnableOnlyPart11Value(bool value) { this.labelExpiryDateOfAccount.Enabled = value; this.labelExpiryDateOfPassword.Enabled = value; if (value == true) { this.labelExpiryDateOfAccount.BackColor = Color.White; this.labelExpiryDateOfPassword.BackColor = Color.White; } else { this.labelExpiryDateOfAccount.BackColor = Color.Silver; this.labelExpiryDateOfPassword.BackColor = Color.Silver; } } private void SetEnableControl(bool value) { this.listBoxUserList.Enabled = value; this.buttonNew.Enabled = value; this.buttonDelete.Enabled = value; this.buttonSave.Enabled = value; this.buttonGroupEditor.Enabled = value; this.SetEnableOnlyPart11Value(value); } private void KeyboardClose() { this.smartKeyboard.Hide(); this.SetEnableControl(true); this.SetEnablePassword(true); } private void UserNew() { this.UpdateInitializeUserDisplay(this.ParentForm.ParentForm.SystemConfig2); } private void SaveUserDll() { string detail = ""; string code = "", message1 = "", message2 = ""; #region listbox 미선택 시 신규 유저 등록, 선택 시 기존 유저 정보 수정 if (this.IsNew == true) { switch (this.ParentForm.ParentForm.SystemConfig1.Language) { case Define.E_LanguageID.Korean: code = "유저 설정"; message1 = "신규 사용자 추가 하시겠습니까?"; message2 = ""; break; case Define.E_LanguageID.English: code = "User Editor"; message1 = "Would you like to register as a user?"; message2 = ""; break; case Define.E_LanguageID.Chinese: code = "用户设置"; message1 = "您想注册为用户吗?"; message2 = ""; break; case Define.E_LanguageID.Russian: code = "Пользовательские настройки"; message1 = "Хотите зарегистрироваться как пользователь?"; message2 = ""; break; case Define.E_LanguageID.German: code = "Benutzereinstellungen"; message1 = "Sie möchten sich als Benutzer registrieren?"; message2 = ""; break; case Define.E_LanguageID.Spanish: code = "Ajustes de usuario"; message1 = "¿Quieres registrarte como usuario?"; message2 = ""; break; default: break; } } else { switch (this.ParentForm.ParentForm.SystemConfig1.Language) { case Define.E_LanguageID.Korean: code = "유저 설정"; message1 = "선택된 사용자의 정보를 수정 하시겠습니까?"; message2 = ""; break; case Define.E_LanguageID.English: code = "User Editor"; message1 = "Are you sure you want to edit the"; message2 = "selected user's information?"; break; case Define.E_LanguageID.Chinese: code = "用户设置"; message1 = "您确定要编辑所选用户的信息吗?"; message2 = ""; break; case Define.E_LanguageID.Russian: code = "Пользовательские настройки"; message1 = "Вы уверены, что хотите изменить"; message2 = "информацию о выбранном пользователе?"; break; case Define.E_LanguageID.German: code = "Benutzereinstellungen"; message1 = "Möchten Sie die Informationen des"; message2 = "ausgewählten Benutzers wirklich bearbeiten?"; break; case Define.E_LanguageID.Spanish: code = "Ajustes de usuario"; message1 = "¿Está seguro de que desea editar"; message2 = "la información del usuario seleccionado?"; break; default: break; } } #endregion DialogFormYesNo dlg = new DialogFormYesNo(Define.E_MessageBoxIcon.Question, code, message1, message2); if (dlg.ShowDialog() == DialogResult.Yes) { UserItem item = new UserItem(); DateTime time = DateTime.Now; UserManager.MenuID_t menuId = new UserManager.MenuID_t(); #region ID, Password 검사 // Check ID if (this.IsNew == true) { if (this.textBoxID.Text.Length < 6) { // ID : 6~20자 입력하세요 DialogFormMessage msg = new DialogFormMessage(null, 3, this.ParentForm.ParentForm.SystemConfig1.Language); msg.ShowDialog(); return; } } // Check Password if (this.textBoxPassword.Text.Length < 6) { // PASSWORD : 6~20자 입력하세요 DialogFormMessage msg = new DialogFormMessage(null, 9, this.ParentForm.ParentForm.SystemConfig1.Language); msg.ShowDialog(); return; } #endregion item.ID = this.textBoxID.Text; item.SetPassword(this.textBoxPassword.Text); item.ExpireAccount = int.Parse(this.labelExpiryDateOfAccount.Text); item.ExpirePassword = int.Parse(this.labelExpiryDateOfPassword.Text); if (this.SelectedUserItem.Group == Define.E_UserGroup.Admin) { if (this.ParentForm.ParentForm.SystemConfig3.IsPart11 == true) item.ActiveLevel = 9; } else { item.ActiveLevel = this.comboBoxAccessRight.SelectedIndex + 1; } menuId.fMenu = new bool[UserManager.USER_MENU_ID_MAX]; for (int i = 0; i < UserManager.USER_MENU_ID_MAX; i++) menuId.fMenu[i] = false; if (this.IsNew == true) { #region 신규 등록 if (this.ParentForm.ParentForm.SystemConfig3.IsPart11 == true) { if (item.ActiveLevel == 1 || item.ActiveLevel == 2 || item.ActiveLevel == 3) UserManager.UserManager_UserNew(item.ID, item.Password, 0, item.ExpirePassword, item.ExpireAccount, item.ActiveLevel, menuId); else UserManager.UserManager_UserNew(item.ID, item.Password, 1, item.ExpirePassword, item.ExpireAccount, item.ActiveLevel, menuId); } else // Part11 미사용, Login 사용 시, 항상 관리자로 지정 UserManager.UserManager_UserNew(item.ID, item.Password, 1, item.ExpirePassword, item.ExpireAccount, item.ActiveLevel, menuId); // Part 11 detail = string.Format("Add : {0}", item.ID); this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingOperation.UserEditor, detail); #endregion } else { #region 유저 수정 if (this.ParentForm.ParentForm.SystemConfig3.IsPart11 == true) { if (item.ActiveLevel == 1 || item.ActiveLevel == 2 || item.ActiveLevel == 3) UserManager.UserManager_UserModify(item.ID, item.Password, 0, item.ExpirePassword, item.ExpireAccount, item.ActiveLevel, menuId); else UserManager.UserManager_UserModify(item.ID, item.Password, 1, item.ExpirePassword, item.ExpireAccount, item.ActiveLevel, menuId); } else // Part11 미사용, Login 사용 시, 항상 관리자로 지정 UserManager.UserManager_UserModify(item.ID, item.Password, 1, item.ExpirePassword, item.ExpireAccount, item.ActiveLevel, menuId); // Part 11 detail = string.Format("Modify : {0}", item.ID); this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingOperation.UserEditor, detail); #endregion } this.buttonSave.Visible = false; } } private void UpdateInitializeUserDisplay(SystemConfigurationItem2 system) { this.SelectedUserItem = new UserItem(); this.IsNew = true; this.textBoxID.Text = ""; this.textBoxPassword.Text = ""; this.labelExpiryDateOfAccount.Text = "180"; this.labelExpiryDateOfPassword.Text = "90"; this.labelExpiryDateOfAccount2.Text = "-"; this.labelExpiryDateOfPassword2.Text = "-"; this.labelExpiryDateOfAccount2.ForeColor = Color.White; this.labelExpiryDateOfPassword2.ForeColor = Color.White; this.comboBoxAccessRight.SelectedIndexChanged -= new EventHandler(this.comboBoxAccessRight_SelectedIndexChanged); this.comboBoxAccessRight.SelectedIndex = 0; this.comboBoxAccessRight.SelectedIndexChanged += new EventHandler(this.comboBoxAccessRight_SelectedIndexChanged); this.KeyboardClose(); this.SetEnableID(true); this.SetTextBoxPasswordChar(this.PasswordChar); this.buttonDelete.Visible = false; this.buttonSave.Visible = false; this.listBoxUserList.SelectedIndexChanged -= new EventHandler(this.listBoxUserList_SelectedIndexChanged); this.listBoxUserList.SelectItemIndex = -1; this.listBoxUserList.SelectedIndexChanged += new EventHandler(this.listBoxUserList_SelectedIndexChanged); } private void UpdateCurrentUserItem(UserManager.UserMgr_user_list_t item) { try { // CurrentUserItem SET this.SelectedUserItem.ID = item.user_id; this.SelectedUserItem.Password = item.user_pw; this.SelectedUserItem.ExpireAccount = item.expire_period_account; this.SelectedUserItem.ExpirePassword = item.expire_period_pw; if (this.ParentForm.ParentForm.SystemConfig3.IsPart11 == true) this.SelectedUserItem.IsAdmin = item.fadmin == 0 ? false : true; else this.SelectedUserItem.IsAdmin = true; this.SelectedUserItem.ActiveLevel = item.active_level; if (this.SelectedUserItem.ActiveLevel == 1) this.SelectedUserItem.Group = Define.E_UserGroup.Level1; else if (this.SelectedUserItem.ActiveLevel == 2) this.SelectedUserItem.Group = Define.E_UserGroup.Level2; else if (this.SelectedUserItem.ActiveLevel == 3) this.SelectedUserItem.Group = Define.E_UserGroup.Level3; else if (this.SelectedUserItem.ActiveLevel == 9) this.SelectedUserItem.Group = Define.E_UserGroup.Admin; else if (this.SelectedUserItem.ActiveLevel == 10) this.SelectedUserItem.Group = Define.E_UserGroup.Developer; else this.SelectedUserItem.Group = Define.E_UserGroup.None; if (this.SelectedUserItem.Group == Define.E_UserGroup.Admin || this.SelectedUserItem.Group == Define.E_UserGroup.Developer) { this.SelectedUserItem.DateRegister = DateTime.Now; this.SelectedUserItem.DateLogin = DateTime.Now; this.SelectedUserItem.DateExpireRegister = DateTime.Now; this.SelectedUserItem.DateExpireLogin = DateTime.Now; } else { DateTime time = DateTime.ParseExact(item.register_date.GetDateTime(), "yyyyMMddHHmmss", null); this.SelectedUserItem.DateRegister = time; time = DateTime.ParseExact(item.login_date.GetDateTime(), "yyyyMMddHHmmss", null); this.SelectedUserItem.DateLogin = time; time = DateTime.ParseExact(item.expire_account_date.GetDateTime(), "yyyyMMddHHmmss", null); this.SelectedUserItem.DateExpireLogin = time; time = DateTime.ParseExact(item.expire_register_date.GetDateTime(), "yyyyMMddHHmmss", null); this.SelectedUserItem.DateExpireRegister = time; } this.SelectedUserItem.IsLockAccount = item.flock_status_account == 0 ? false : true; this.SelectedUserItem.IsLockPassword = item.flock_status_password == 0 ? false : true; } catch (Exception ex) { FormMain.Exception(ex); } } private void UpdateCurrentUserItem(UserManager.UserMgr_user_info_t item) { // CurrentUserItem SET this.SelectedUserItem.ID = item.user_id; this.SelectedUserItem.Password = item.user_pw; this.SelectedUserItem.ExpireAccount = item.expire_period_account; this.SelectedUserItem.ExpirePassword = item.expire_period_pw; DateTime time = DateTime.ParseExact(item.register_date.GetDateTime(), "yyyyMMddHHmmss", null); this.SelectedUserItem.DateRegister = time; time = DateTime.ParseExact(item.login_date.GetDateTime(), "yyyyMMddHHmmss", null); this.SelectedUserItem.DateLogin = time; time = DateTime.ParseExact(item.expire_account_date.GetDateTime(), "yyyyMMddHHmmss", null); this.SelectedUserItem.DateExpireLogin = time; time = DateTime.ParseExact(item.expire_register_date.GetDateTime(), "yyyyMMddHHmmss", null); this.SelectedUserItem.DateExpireRegister = time; this.SelectedUserItem.IsLockAccount = item.flock_status_account == 0 ? false : true; this.SelectedUserItem.IsLockPassword = item.flock_status_password == 0 ? false : true; if (this.ParentForm.ParentForm.SystemConfig3.IsPart11 == true) this.SelectedUserItem.IsAdmin = item.fadmin == 0 ? false : true; else this.SelectedUserItem.IsAdmin = true; this.SelectedUserItem.ActiveLevel = item.active_level; if (item.active_level == 1) this.SelectedUserItem.Group = Define.E_UserGroup.Level1; else if (item.active_level == 2) this.SelectedUserItem.Group = Define.E_UserGroup.Level2; else if (item.active_level == 3) this.SelectedUserItem.Group = Define.E_UserGroup.Level3; else if (item.active_level == 9) this.SelectedUserItem.Group = Define.E_UserGroup.Admin; else if (item.active_level == 10) this.SelectedUserItem.Group = Define.E_UserGroup.Developer; } private void UpdateSelectUserDisplay(UserItem item) { this.SetEnableID(false); this.SetEnablePassword(true); this.SetEnableControl(true); this.textBoxID.Text = item.ID; this.textBoxPassword.Text = item.Password; if (this.listBoxUserList.SelectItemIndex == 0) { this.labelExpiryDateOfAccount.Text = "0"; this.labelExpiryDateOfPassword.Text = "0"; this.labelExpiryDateOfAccount2.Text = "-"; this.labelExpiryDateOfPassword2.Text = "-"; this.labelExpiryDateOfAccount2.ForeColor = Color.White; this.labelExpiryDateOfPassword2.ForeColor = Color.White; this.buttonDelete.Visible = false; this.comboBoxAccessRight.Visible = false; this.SetEnableOnlyPart11Value(false); if (this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUser.Group == Define.E_UserGroup.Admin || this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUser.Group == Define.E_UserGroup.Developer) this.SetEnablePassword(true); else this.SetEnablePassword(false); } else { #region 만료일 this.labelExpiryDateOfAccount.Text = item.ExpireAccount.ToString(); this.labelExpiryDateOfPassword.Text = item.ExpirePassword.ToString(); if (item.IsLockAccount == true) { this.labelExpiryDateOfAccount2.ForeColor = Color.Red; switch (this.ParentForm.ParentForm.SystemConfig1.Language) { case Define.E_LanguageID.Korean: this.labelExpiryDateOfAccount2.Text = "계정 만료"; break; case Define.E_LanguageID.English: this.labelExpiryDateOfAccount2.Text = "Account expiration"; break; case Define.E_LanguageID.Chinese: this.labelExpiryDateOfAccount2.Text = "账户过期"; break; case Define.E_LanguageID.Russian: this.labelExpiryDateOfAccount2.Text = "Срок действия учетной записи"; break; case Define.E_LanguageID.German: this.labelExpiryDateOfAccount2.Text = "Kontoablauf"; break; case Define.E_LanguageID.Spanish: this.labelExpiryDateOfAccount2.Text = "Caducidad de la cuenta"; break; default: break; } } else { this.labelExpiryDateOfAccount2.ForeColor = Color.White; this.labelExpiryDateOfAccount2.Text = string.Format("{0:yy/MM/dd} ~ {1:yy/MM/dd}", item.DateLogin, item.DateExpireLogin); } if (item.IsLockPassword == true) { this.labelExpiryDateOfPassword2.ForeColor = Color.Red; switch (this.ParentForm.ParentForm.SystemConfig1.Language) { case Define.E_LanguageID.Korean: this.labelExpiryDateOfPassword2.Text = "비밀번호 만료"; break; case Define.E_LanguageID.English: this.labelExpiryDateOfPassword2.Text = "Password expiration"; break; case Define.E_LanguageID.Chinese: this.labelExpiryDateOfPassword2.Text = "密码过期"; break; case Define.E_LanguageID.Russian: this.labelExpiryDateOfPassword2.Text = "Срок действия пароля"; break; case Define.E_LanguageID.German: this.labelExpiryDateOfPassword2.Text = "Kennwortablauf"; break; case Define.E_LanguageID.Spanish: this.labelExpiryDateOfPassword2.Text = "Caducidad de la contraseña"; break; default: break; } } else { this.labelExpiryDateOfPassword2.ForeColor = Color.White; this.labelExpiryDateOfPassword2.Text = string.Format("{0:yy/MM/dd} ~ {1:yy/MM/dd}", item.DateRegister, item.DateExpireRegister); } #endregion this.comboBoxAccessRight.Visible = true; this.comboBoxAccessRight.BringToFront(); this.comboBoxAccessRight.SelectedIndexChanged -= new EventHandler(this.comboBoxAccessRight_SelectedIndexChanged); this.comboBoxAccessRight.SelectedIndex = item.ActiveLevel - 1; this.comboBoxAccessRight.SelectedIndexChanged += new EventHandler(this.comboBoxAccessRight_SelectedIndexChanged); if (this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUser.ActiveLevel < item.ActiveLevel) { this.buttonDelete.Visible = false; this.comboBoxAccessRight.Enabled = false; this.SetEnableOnlyPart11Value(false); this.SetEnablePassword(false); } else { this.SetEnableOnlyPart11Value(true); this.comboBoxAccessRight.Enabled = true; } } //this.cbAdministrator.Visible = true; //this.cbAdministrator.Checked = item.IsAdmin; } private void UpdateUserListBoxDisplay(List items) { this.listBoxUserList.ClearAll(); for (int i = 1; i < items.Count; i++) this.listBoxUserList.AddItem(items[i]); } public void CallBackGetUserData(UserManager.UserMgr_user_list_t user) { this.UpdateCurrentUserItem(user); this.UI_Invoke(delegate { this.UpdateSelectUserDisplay(this.SelectedUserItem); }); } public void CallBackUserListNewData(UserManager.UserMgr_user_info_t user) { string code = "", message1 = "", message2 = ""; switch (this.ParentForm.ParentForm.SystemConfig1.Language) { case Define.E_LanguageID.Korean: code = "유저설정"; message1 = "사용자 추가 완료!"; message2 = ""; break; case Define.E_LanguageID.English: code = "User settings"; message1 = "User addition complete!"; message2 = ""; break; case Define.E_LanguageID.Chinese: code = "用户设置"; message1 = "用户添加完成!"; message2 = ""; break; case Define.E_LanguageID.Russian: code = "Пользовательские настройки"; message1 = "Добавление пользователя завершено!"; message2 = ""; break; case Define.E_LanguageID.German: code = "Benutzereinstellungen"; message1 = "Benutzerhinzufügung abgeschlossen!"; message2 = ""; break; case Define.E_LanguageID.Spanish: code = "Ajustes de usuario"; message1 = "Adición de usuario completa!"; message2 = ""; break; default: break; } if (user.status == (int)UserManager.E_user_mgr_status.USER_MGR_STATUS_OK) { this.UI_Invoke(delegate { this.UpdateCurrentUserItem(user); this.UpdateSelectUserDisplay(this.SelectedUserItem); this.ParentForm.ParentForm.ListDllUserName.Add(user.user_id); this.UpdateUserListBoxDisplay(this.ParentForm.ParentForm.ListDllUserName); this.listBoxUserList.SelectItemIndex = this.listBoxUserList.ItemCount - 1; this.SetEnableID(false); this.SetEnablePassword(false); this.SetEnableOnlyPart11Value(false); this.labelAutomaticLogoutTime.Enabled = false; DialogFormMessage dlg = new DialogFormMessage(Define.E_MessageBoxIcon.Asterisk, code, message1, message2, 0); dlg.ShowDialog(); }); } else { DialogFormMessage msg = new DialogFormMessage(null, user.status, this.ParentForm.ParentForm.SystemConfig1.Language); msg.ShowDialog(); } } public void CallBackUserModifyUserData(UserManager.UserMgr_user_modify_t user) { string code = "", message1 = "", message2 = ""; switch (this.ParentForm.ParentForm.SystemConfig1.Language) { case Define.E_LanguageID.Korean: code = "유저설정"; message1 = "사용자 정보 수정 완료!"; message2 = ""; break; case Define.E_LanguageID.English: code = "User settings"; message1 = "User information modified!"; message2 = ""; break; case Define.E_LanguageID.Chinese: code = "用户设置"; message1 = "用户信息修改!"; message2 = ""; break; case Define.E_LanguageID.Russian: code = "Пользовательские настройки"; message1 = "Информация о пользователе изменена!"; message2 = ""; break; case Define.E_LanguageID.German: code = "Benutzereinstellungen"; message1 = "Benutzerinformationen geändert!"; message2 = ""; break; case Define.E_LanguageID.Spanish: code = "Ajustes de usuario"; message1 = "¡Información de usuario modificada!"; message2 = ""; break; default: break; } if (user.status == (int)UserManager.E_user_mgr_status.USER_MGR_STATUS_OK) { this.UI_Invoke(delegate { // 메시지 박스 교체 UserManager.UserManager_GetUserListID(this.listBoxUserList.Items[this.listBoxUserList.SelectItemIndex]); DialogFormMessage dlg = new DialogFormMessage(Define.E_MessageBoxIcon.Asterisk, code, message1, message2, 0); dlg.ShowDialog(); }); } else { DialogFormMessage msg = new DialogFormMessage(null, user.status, this.ParentForm.ParentForm.SystemConfig1.Language); msg.ShowDialog(); } } public void CallBackUserListLockDataEvent(UserManager.UserMgr_user_lock_t user) { if (user.user_id == this.SelectedUserItem.ID) { this.SelectedUserItem.IsLockAccount = user.flock_status_account == 0 ? false : true; this.SelectedUserItem.IsLockPassword = user.flock_status_password == 0 ? false : true; UserManager.UserManager_GetUserListID(this.listBoxUserList.Items[this.listBoxUserList.SelectItemIndex]); } } public void CallBackUserListDeleteDataEvent(UserManager.UserMgr_user_del_t user) { string code = "", message1 = "", message2 = "", detail = ""; switch (this.ParentForm.ParentForm.SystemConfig1.Language) { case Define.E_LanguageID.Korean: code = "유저설정"; message1 = string.Format("{0} 사용자 삭제 완료!", user.user_id); message2 = ""; break; case Define.E_LanguageID.English: code = "User settings"; message1 = string.Format("{0} User deletion complete!", user.user_id); message2 = ""; break; case Define.E_LanguageID.Chinese: code = "用户设置"; message1 = string.Format("{0} 用户添加完成!", user.user_id); message2 = ""; break; case Define.E_LanguageID.Russian: code = "Пользовательские настройки"; message1 = string.Format("{0} Добавление пользователя завершено!", user.user_id); message2 = ""; break; case Define.E_LanguageID.German: code = "Benutzereinstellungen"; message1 = string.Format("{0} Benutzerhinzufügung abgeschlossen!", user.user_id); message2 = ""; break; case Define.E_LanguageID.Spanish: code = "Ajustes de usuario"; message1 = string.Format("{0} Adición de usuario completa!", user.user_id); message2 = ""; break; default: break; } if (user.status == 0) { for (int i = 0; i < this.ParentForm.ParentForm.ListDllUserName.Count; i++) { if (this.ParentForm.ParentForm.ListDllUserName[i] == user.user_id) { this.ParentForm.ParentForm.ListDllUserName.RemoveAt(i); break; } } this.UI_Invoke(delegate { this.UpdateUserListBoxDisplay(this.ParentForm.ParentForm.ListDllUserName); this.UserNew(); DialogFormMessage dlg = new DialogFormMessage(Define.E_MessageBoxIcon.Asterisk, code, message1, message2, 0); dlg.ShowDialog(); }); //// Part 11 //if (this.ParentForm.ParentForm.SystemConfig.IsPart11 == true) //{ detail = string.Format("Delete : {0}", user.user_id); this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingOperation.UserEditor, detail); //} } else { DialogFormMessage msg = new DialogFormMessage(null, user.status, this.ParentForm.ParentForm.SystemConfig1.Language); msg.ShowDialog(); } } public void CallBackUserListModifyInfoDataEvent(UserManager.UserMgr_user_info_t user) { try { if (user.status == 0) { string detail = "", code = "", message1 = "", message2 = ""; // Part 11 detail = string.Format("Modify Password : {0}", user.user_id); this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingOperation.UserEditor, detail); switch (this.ParentForm.ParentForm.SystemConfig1.Language) { case Define.E_LanguageID.Korean: code = "비밀번호 변경"; message1 = "비밀번호가 변경되었습니다."; message2 = ""; break; case Define.E_LanguageID.English: code = "Change Password"; message1 = "Password has been changed."; message2 = ""; break; case Define.E_LanguageID.Chinese: code = "更改密码"; message1 = "您的密码已被更改。"; message2 = ""; break; case Define.E_LanguageID.Russian: code = "Изменить пароль"; message1 = "Ваш пароль был изменен."; message2 = ""; break; case Define.E_LanguageID.German: code = "Kennwort ändern"; message1 = "Ihr Passwort wurde geändert."; message2 = ""; break; case Define.E_LanguageID.Spanish: code = "Cambiar la contraseña"; message1 = "Tu contraseña ha sido cambiada."; message2 = ""; break; default: break; } // 비밀번호가 변경되었습니다. DialogFormMessage dlg = new DialogFormMessage(Define.E_MessageBoxIcon.Asterisk, code, message1, message2, 0); dlg.ShowDialog(); } else { DialogFormMessage myMsg = new DialogFormMessage(null, user.status, this.ParentForm.ParentForm.SystemConfig1.Language); myMsg.ShowDialog(); } } catch (Exception ex) { FormMain.Exception(ex); } } public void DisplayRefresh(SystemStatus status) { this.ParentForm.ParentForm.CurrentSystemStatus.CurrentDisplay = Define.E_DisplayStore.EquipUser; this.ParentForm.ParentForm.SetDisplayMode(Define.E_DisplayMode.Menu); this.ParentForm.DisplayTitleRoot(this.ParentForm.ParentForm.CurrentSystemStatus); this.PasswordChar = false; this.labelAutomaticLogoutTime.Text = this.ParentForm.ParentForm.SystemConfig2.UserAutomaticLogout.ToString(); this.labelAutomaticLogoutTime.Enabled = true; this.UpdateUserListBoxDisplay(this.ParentForm.ParentForm.ListDllUserName); this.UpdateInitializeUserDisplay(this.ParentForm.ParentForm.SystemConfig2); } #endregion #region Event Handler private void listBoxUserList_SelectedIndexChanged(object sender, EventArgs e) { int index = this.listBoxUserList.SelectItemIndex; this.IsNew = false; this.SetEnablePassword(true); this.SetTextBoxPasswordChar(this.PasswordChar); this.labelAutomaticLogoutTime.Enabled = true; if (index == 0) { UserManager.UserManager_GetUserListID(this.listBoxUserList.Items[index]); } else if (index < 0) { this.UpdateInitializeUserDisplay(this.ParentForm.ParentForm.SystemConfig2); } else if (index > 0) { if (this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUser.ID == this.listBoxUserList.Items[index]) this.buttonDelete.Visible = false; else this.buttonDelete.Visible = true; this.SetEnableID(false); this.SetEnableControl(true); this.SetEnablePassword(true); UserManager.UserManager_GetUserListID(this.listBoxUserList.Items[index]); } } private void textBoxID_GotFocus(object sender, EventArgs e) { this.smartKeyboard.TargetInputObject = this.textBoxID; this.textBoxID.Select(this.textBoxID.Text.Length, 0); } private void textBoxPassword_GotFocus(object sender, EventArgs e) { this.smartKeyboard.TargetInputObject = this.textBoxPassword; this.textBoxPassword.Select(this.textBoxPassword.Text.Length, 0); } private void textBoxID_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == '\r') { e.Handled = true; this.KeyboardClose(); if (this.buttonSave.Visible == false) this.buttonSave.Visible = true; } else if (e.KeyChar == 27) { e.Handled = true; this.textBoxID.Text = this.BeforeID; this.KeyboardClose(); } else if (e.KeyChar == '<' || e.KeyChar == '>' || e.KeyChar == '|' || e.KeyChar == '"' || e.KeyChar == '?' || e.KeyChar == '*' || e.KeyChar == ':' || e.KeyChar == '/' || e.KeyChar == '\\') { e.Handled = true; } } private void textBoxPassword_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == '\r') { e.Handled = true; if(this.PasswordChar == false) this.SetTextBoxPasswordChar(this.PasswordChar); this.KeyboardClose(); if (this.IsNew == true) this.SetEnableID(true); if (this.buttonSave.Visible == false) this.buttonSave.Visible = true; } else if (e.KeyChar == 27) { e.Handled = true; if (this.PasswordChar == false) this.SetTextBoxPasswordChar(this.PasswordChar); if (this.IsNew == true) this.SetEnableID(true); this.textBoxPassword.Text = this.BeforePassword; this.KeyboardClose(); } else if (e.KeyChar == '<' || e.KeyChar == '>' || e.KeyChar == '|' || e.KeyChar == '"' || e.KeyChar == '?' || e.KeyChar == '*' || e.KeyChar == ':' || e.KeyChar == '/' || e.KeyChar == '\\') { e.Handled = true; } } private void smartKeyboard_OnXKeyClick(object sender, EventArgs e) { if (this.smartKeyboard.TargetInputObject == this.textBoxPassword) { this.textBoxPassword.Text = this.BeforePassword; if (this.PasswordChar == false) this.SetTextBoxPasswordChar(this.PasswordChar); this.textBoxPassword.Select(this.textBoxPassword.Text.Length, 0); } else if (this.smartKeyboard.TargetInputObject == this.textBoxID) { this.textBoxID.Text = this.BeforeID; this.textBoxID.Select(this.textBoxID.Text.Length, 0); } this.KeyboardClose(); if (this.IsNew == true) this.SetEnableID(true); } private void comboBoxAccessRight_SelectedIndexChanged(object sender, EventArgs e) { if (this.buttonSave.Visible == false) this.buttonSave.Visible = true; } private void buttonNew_Click(object sender, EventArgs e) { this.UserNew(); } private void buttonSave_Click(object sender, EventArgs e) { this.SaveUserDll(); } private void buttonDelete_Click(object sender, EventArgs e) { if (this.listBoxUserList.SelectItemIndex == -1) return; // 사용자를 삭제 하시겠습니까? DialogFormYesNo dlg = new DialogFormYesNo(this.ParentForm.ParentForm.SystemConfig1.Language, 14); if (dlg.ShowDialog() == DialogResult.Yes) { if (this.listBoxUserList.Items.Count <= 1) return; if (this.listBoxUserList.SelectItemIndex <= 0) return; string id = this.listBoxUserList.Items[this.listBoxUserList.SelectItemIndex]; UserManager.UserManager_UserDel(id); this.buttonDelete.Visible = false; } } private void buttonIDEdit_Click(object sender, EventArgs e) { this.smartKeyboard.KeyboardType = SmartX.SmartKeyboard.KEYBOARDTYPES.NORMAL; this.smartKeyboard.Location = new Point(3, 43); this.smartKeyboard.Size = new Size(704, 276); this.smartKeyboard.Hide(); this.BeforeID = this.textBoxID.Text; this.smartKeyboard.TargetInputObject = this.textBoxID; this.smartKeyboard.Show(); this.textBoxID.Select(this.textBoxID.Text.Length, 0); this.listBoxUserList.Enabled = false; this.SetEnableControl(false); this.SetEnablePassword(false); } private void buttonPasswordEdit_Click(object sender, EventArgs e) { this.smartKeyboard.KeyboardType = SmartX.SmartKeyboard.KEYBOARDTYPES.NORMAL; this.smartKeyboard.Location = new Point(3, 74); this.smartKeyboard.Size = new Size(704, 276); this.smartKeyboard.Hide(); this.BeforePassword = this.textBoxPassword.Text; this.smartKeyboard.TargetInputObject = this.textBoxPassword; this.smartKeyboard.Show(); this.SetTextBoxPasswordChar(true); this.textBoxPassword.Select(this.textBoxPassword.Text.Length, 0); this.SetEnableControl(false); this.SetEnableID(false); } private void labelExpiryDateOfAccount_Click(object sender, EventArgs e) { DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelExpiryDateOfAccount.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language); if (myKeyPad.ShowDialog() == DialogResult.OK) { if (myKeyPad.IntValue <= 0) { // 입력범위를 확인하세요 DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language); myMsg.ShowDialog(); } else if (myKeyPad.IntValue > 180) { this.labelExpiryDateOfAccount.Text = "180"; if (this.buttonSave.Visible == false) this.buttonSave.Visible = true; } else { this.labelExpiryDateOfAccount.Text = myKeyPad.StringValue; if (this.buttonSave.Visible == false) this.buttonSave.Visible = true; } } } private void labelExpiryDateOfPassword_Click(object sender, EventArgs e) { DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelExpiryDateOfPassword.Text, 3, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language); if (myKeyPad.ShowDialog() == DialogResult.OK) { if (myKeyPad.IntValue <= 0) { // 입력범위를 확인하세요 DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language); myMsg.ShowDialog(); } else if (myKeyPad.IntValue > 90) { this.labelExpiryDateOfPassword.Text = "90"; if (this.buttonSave.Visible == false) this.buttonSave.Visible = true; } else { this.labelExpiryDateOfPassword.Text = myKeyPad.StringValue; if (this.buttonSave.Visible == false) this.buttonSave.Visible = true; } } } private void labelAutomaticLogoutTime_Click(object sender, EventArgs e) { DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelAutomaticLogoutTime.Text, 2, 0, false, this.ParentForm.ParentForm.SystemConfig1.Language); if (myKeyPad.ShowDialog() == DialogResult.OK) { if (myKeyPad.IntValue < 0) { // 입력범위를 확인하세요 DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.ParentForm.SystemConfig1.Language); myMsg.ShowDialog(); } else if (myKeyPad.IntValue > 90) { this.labelAutomaticLogoutTime.Text = "90"; } else { this.labelAutomaticLogoutTime.Text = myKeyPad.StringValue; } this.ParentForm.ParentForm.SystemConfig2.UserAutomaticLogout = myKeyPad.IntValue; if (this.ParentForm.ParentForm.SystemConfig2.UserAutomaticLogout == 1) this.ParentForm.ParentForm.FlagAutomaticLogoutWarningTime = 30; else this.ParentForm.ParentForm.FlagAutomaticLogoutWarningTime = 60; this.ParentForm.ParentForm.SaveSystemConfigurationFile2(this.ParentForm.ParentForm.SystemConfig2); UserManager.UserManager_AutoLogoutSetTimeout(this.ParentForm.ParentForm.SystemConfig2.UserAutomaticLogout, this.ParentForm.ParentForm.FlagAutomaticLogoutWarningTime); } } private void labelExpiryDateOfAccount2_Click(object sender, EventArgs e) { string code = "", message1 = "", message2 = ""; string detail = ""; if (this.labelExpiryDateOfAccount2.ForeColor == Color.White) { if (this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUser.ActiveLevel < (int)Define.E_UserGroup.Level3) return; UserManager.UserManager_UserLockRelease(this.SelectedUserItem.ID, true, false); // Part 11 detail = string.Format("Extend EXP date(ID) : {0}", this.SelectedUserItem.ID); this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingOperation.UserEditor, detail); } else { switch (this.ParentForm.ParentForm.SystemConfig1.Language) { case Define.E_LanguageID.Korean: code = "유저설정"; message1 = "사용자 잠금 해제 하시겠습니까?"; message2 = ""; break; case Define.E_LanguageID.English: code = "User settings"; message1 = "Do you want to unlock user?"; message2 = ""; break; case Define.E_LanguageID.Chinese: code = "用户设置"; message1 = "你想解锁用户吗?"; message2 = ""; break; case Define.E_LanguageID.Russian: code = "Пользовательские настройки"; message1 = "Вы хотите разблокировать пользователя?"; message2 = ""; break; case Define.E_LanguageID.German: code = "Benutzereinstellungen"; message1 = "Möchten Sie Benutzer entsperren?"; message2 = ""; break; case Define.E_LanguageID.Spanish: code = "Ajustes de usuario"; message1 = "¿Quieres desbloquear usuario?"; message2 = ""; break; default: break; } DialogFormYesNo dlg = new DialogFormYesNo(Define.E_MessageBoxIcon.Question, code, message1, message2); if (dlg.ShowDialog() == DialogResult.Yes) { UserManager.UserManager_UserLockRelease(this.SelectedUserItem.ID, true, false); // Part 11 detail = string.Format("Release ID : {0}", this.SelectedUserItem.ID); this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingOperation.UserEditor, detail); } } } private void labelExpiryDateOfPassword2_Click(object sender, EventArgs e) { string code = "", message1 = "", message2 = ""; string detail = ""; if (this.labelExpiryDateOfPassword2.ForeColor == Color.White) { if (this.ParentForm.ParentForm.CurrentSystemStatus.CurrentUser.ActiveLevel < (int)Define.E_UserGroup.Level3) return; UserManager.UserManager_UserLockRelease(this.SelectedUserItem.ID, false, true); // Part 11 detail = string.Format("Extend EXP date(PW) : {0}", this.SelectedUserItem.ID); this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingOperation.UserEditor, detail); } else { switch (this.ParentForm.ParentForm.SystemConfig1.Language) { case Define.E_LanguageID.Korean: code = "유저설정"; message1 = "비밀번호 잠금 해제 하시겠습니까?"; message2 = ""; break; case Define.E_LanguageID.English: code = "User settings"; message1 = "Do you want to unlock password?"; message2 = ""; break; case Define.E_LanguageID.Chinese: code = "用户设置"; message1 = "你想解锁密码吗?"; message2 = ""; break; case Define.E_LanguageID.Russian: code = "Пользовательские настройки"; message1 = "Хотите разблокировать пароль?"; message2 = ""; break; case Define.E_LanguageID.German: code = "Benutzereinstellungen"; message1 = "Möchten Sie das Passwort entsperren?"; message2 = ""; break; case Define.E_LanguageID.Spanish: code = "Ajustes de usuario"; message1 = "¿Quieres desbloquear la contraseña?"; message2 = ""; break; default: break; } DialogFormYesNo dlg = new DialogFormYesNo(Define.E_MessageBoxIcon.Question, code, message1, message2); if (dlg.ShowDialog() == DialogResult.Yes) { UserManager.UserManager_UserLockRelease(this.SelectedUserItem.ID, false, true); // Part 11 detail = string.Format("Release PW: {0}", this.SelectedUserItem.ID); this.ParentForm.ParentForm.SetTrackingHistoryData(Define.E_TrackingOperation.UserEditor, detail); } } } private void buttonGroupEditor_Click(object sender, EventArgs e) { this.ParentForm.CenterEquipUserGroupEditor.Visible = true; this.ParentForm.CenterEquipUserGroupEditor.BringToFront(); this.ParentForm.CenterEquipUserGroupEditor.DisplayRefresh(this.ParentForm.ParentForm.CurrentSystemStatus); } #endregion } }