INT69DB_2A/INT69DB_2A/Forms/FormUserEditor.cs

1257 lines
56 KiB
C#
Raw Normal View History

2023-07-21 04:40:29 +00:00
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using INT69DB_2A_ImageDll;
using INT69DB_2A.Controls;
using INT69DB_2A.Part11_UserManager;
using INT69DB_2A.DialogForms;
namespace INT69DB_2A.Forms
{
public partial class FormUserEditor : Form
{
#region Field
private FormMain m_ParentForm;
private UserItem SelectedUserItem;
private ControlUserSetting ChildControlUserSet;
2023-08-14 00:32:08 +00:00
private bool IsNew;
private bool PasswordChar;
private string BeforeID;
private string BeforePassword;
2023-07-21 04:40:29 +00:00
#endregion
#region Constructor
public FormUserEditor(FormMain parent)
{
InitializeComponent();
this.ParentForm = parent;
this.InitializeDesign();
this.DefaultSetting();
}
#endregion
#region Property
public FormMain ParentForm
{
get { return this.m_ParentForm; }
set { this.m_ParentForm = value; }
}
#endregion
#region Method
private void InitializeDesign()
{
ImageDll images = new ImageDll();
2023-09-01 09:03:40 +00:00
if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Korean)
2023-07-21 04:40:29 +00:00
{
2023-09-01 09:03:40 +00:00
}
else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.English)
{
this.labelTitle.Text = "User settings";
2023-09-08 02:21:51 +00:00
this.labelStatusExpiryAccount.Text = "Expiry";
this.labelStatusExpiryPassword.Text = "Expiry";
2023-09-01 09:03:40 +00:00
}
else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese)
{
this.labelTitle.Text = "用户设置";
2023-09-08 02:21:51 +00:00
this.labelStatusExpiryAccount.Text = "过期";
this.labelStatusExpiryPassword.Text = "过期";
2023-09-01 09:03:40 +00:00
}
else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Czech)
{
this.labelTitle.Text = "uživatelské nastavení";
2023-09-08 02:21:51 +00:00
this.labelStatusExpiryAccount.Text = "Uplynutí";
this.labelStatusExpiryPassword.Text = "Uplynutí";
2023-09-01 09:03:40 +00:00
}
else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.German)
{
this.labelTitle.Text = "Benutzereinstellungen";
2023-09-08 02:21:51 +00:00
this.labelStatusExpiryAccount.Text = "Ablauf";
this.labelStatusExpiryPassword.Text = "Ablauf";
2023-09-01 09:03:40 +00:00
}
else
{
2023-07-21 04:40:29 +00:00
}
}
private void DefaultSetting()
{
2023-08-14 00:32:08 +00:00
this.IsNew = false;
this.PasswordChar = false;
this.BeforeID = "";
this.BeforePassword = "";
2023-09-01 09:03:40 +00:00
this.UpdateAccessRightComboBoxDisplay();
2023-08-14 00:32:08 +00:00
this.comboBoxAccessRight.SelectedIndexChanged -= new EventHandler(this.comboBoxAccessRight_SelectedIndexChanged);
this.comboBoxAccessRight.SelectedIndex = 0;
this.comboBoxAccessRight.SelectedIndexChanged += new EventHandler(this.comboBoxAccessRight_SelectedIndexChanged);
2023-07-21 04:40:29 +00:00
this.ChildControlUserSet = new ControlUserSetting(this);
this.Controls.Add(this.ChildControlUserSet);
2023-09-01 09:03:40 +00:00
this.ChildControlUserSet.Location = new Point(0, 73);
2023-07-21 04:40:29 +00:00
this.ChildControlUserSet.Visible = false;
2023-09-01 09:03:40 +00:00
if (this.ParentForm.SystemConfig.IsPart11 == false)
{
// Expiry date(Account)
this.labelTitleExpiryDateOfAccount.Visible = false;
this.labelTitleDayAccount.Visible = false;
this.labelExpiryDateOfAccount.Visible = false;
this.labelExpiryDateOfAccount2.Visible = false;
this.labelStatusExpiryAccount.Visible = false;
// Expiry date(Password)
this.labelTitleExpiryDateOfPassword.Visible = false;
this.labelTitleDayPassword.Visible = false;
this.labelExpiryDateOfPassword.Visible = false;
this.labelExpiryDateOfPassword2.Visible = false;
this.labelStatusExpiryPassword.Visible = false;
// Auto logout time
this.labelTitleAutomaticLogoutTime.Visible = false;
this.labelAutomaticLogoutTime.Visible = false;
this.labelTitleMin.Visible = false;
this.labelAutoLogoutWarning.Visible = false;
this.smartSeparatorLine1.Visible = false;
this.smartSeparatorLine2.Visible = false;
}
2023-07-21 04:40:29 +00:00
}
private void SetEnableID(bool value)
{
2023-08-28 04:07:51 +00:00
this.labelID.Enabled = value;
2023-07-21 04:40:29 +00:00
if (value == true)
this.labelID.BackColor = Color.White;
else
this.labelID.BackColor = Color.Silver;
}
private void SetEnablePassword(bool value)
{
//value = false;
2023-08-28 04:07:51 +00:00
this.labelPassword.Enabled = value;
2023-07-21 04:40:29 +00:00
if (value == true)
this.labelPassword.BackColor = Color.White;
else
this.labelPassword.BackColor = Color.Silver;
}
2023-09-01 09:03:40 +00:00
private void SetEnableExpireAccount(bool value)
2023-08-14 00:32:08 +00:00
{
this.labelExpiryDateOfAccount.Enabled = value;
if (value == true)
this.labelExpiryDateOfAccount.BackColor = Color.White;
else
this.labelExpiryDateOfAccount.BackColor = Color.Silver;
2023-09-01 09:03:40 +00:00
}
private void SetEnableExpirePassword(bool value)
{
this.labelExpiryDateOfPassword.Enabled = value;
if (value == true)
this.labelExpiryDateOfPassword.BackColor = Color.White;
else
2023-08-14 00:32:08 +00:00
this.labelExpiryDateOfPassword.BackColor = Color.Silver;
}
2023-07-21 04:40:29 +00:00
private void SaveUserDll()
{
2023-09-01 09:03:40 +00:00
string code = "", message1 = "", message2 = "", detail = "";
bool isNewReg = false;
2023-07-21 04:40:29 +00:00
if (this.listBoxUserList.SelectedIndex == -1)
2023-09-01 09:03:40 +00:00
isNewReg = true;
else
isNewReg = false;
if (isNewReg == true)
2023-07-21 04:40:29 +00:00
{
switch (this.ParentForm.SystemConfig.Language)
{
case DataStore.LanguageID.Korean:
code = "유저 설정";
message1 = "신규 사용자 추가 하시겠습니까?";
message2 = "";
break;
case DataStore.LanguageID.English:
code = "User Editor";
message1 = "Would you like to register as a user?";
message2 = "";
break;
case DataStore.LanguageID.Chinese:
code = "User Editor";
message1 = "Would you like to register as a user?";
message2 = "";
break;
case DataStore.LanguageID.Czech:
code = "User Editor";
message1 = "Would you like to register as a user?";
message2 = "";
break;
case DataStore.LanguageID.German:
code = "User Editor";
message1 = "Would you like to register as a user?";
message2 = "";
break;
default:
break;
}
}
else
{
switch (this.ParentForm.SystemConfig.Language)
{
case DataStore.LanguageID.Korean:
code = "유저 설정";
message1 = "선택된 사용자의 정보를 수정 하시겠습니까?";
message2 = "";
break;
case DataStore.LanguageID.English:
code = "User Editor";
message1 = "Are you sure you want to edit the";
message2 = "selected user's information?";
break;
case DataStore.LanguageID.Chinese:
code = "User Editor";
message1 = "Are you sure you want to edit the";
message2 = "selected user's information?";
break;
case DataStore.LanguageID.Czech:
code = "User Editor";
message1 = "Are you sure you want to edit the";
message2 = "selected user's information?";
break;
case DataStore.LanguageID.German:
code = "User Editor";
message1 = "Are you sure you want to edit the";
message2 = "selected user's information?";
break;
default:
break;
}
}
DialogFormYesNo dlg = new DialogFormYesNo(DataStore.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 검사
// Chck ID
2023-09-01 09:03:40 +00:00
if (isNewReg == true)
2023-07-21 04:40:29 +00:00
{
if (this.labelID.Text.Length < 6)
{
// ID : 6~20자 입력하세요
DialogFormMessage msg = new DialogFormMessage(null, 3, this.ParentForm.SystemConfig.Language);
msg.ShowDialog();
return;
}
}
// Check Password
2023-09-01 09:03:40 +00:00
if (this.labelPassword.Text.Length < 5)
2023-07-21 04:40:29 +00:00
{
// PASSWORD : 6~20자 입력하세요
DialogFormMessage msg = new DialogFormMessage(null, 9, this.ParentForm.SystemConfig.Language);
msg.ShowDialog();
return;
}
#endregion
item.ID = this.labelID.Text;
2023-09-01 09:03:40 +00:00
item.Password = this.labelPassword.Text;
item.ExpireId = int.Parse(this.labelExpiryDateOfAccount.Text);
2023-08-14 00:32:08 +00:00
item.ExpirePassword = int.Parse(this.labelExpiryDateOfPassword.Text);
2023-07-21 04:40:29 +00:00
//item.IsAdmin = this.cbAdministrator.Checked;
2023-08-14 00:32:08 +00:00
if (this.SelectedUserItem.Group == DataStore.UserGroup.Admin)
{
if (this.ParentForm.SystemConfig.IsPart11 == true)
item.ActiveLevel = 9;
}
else
{
item.ActiveLevel = this.comboBoxAccessRight.SelectedIndex + 1;
}
2023-07-21 04:40:29 +00:00
menuId.fMenu = new bool[UserManager.USER_MENU_ID_MAX];
for (int i = 0; i < UserManager.USER_MENU_ID_MAX; i++)
menuId.fMenu[i] = false;
2023-09-01 09:03:40 +00:00
if (isNewReg == true)
2023-07-21 04:40:29 +00:00
{
#region 신규 등록
2023-09-01 09:03:40 +00:00
UserManager.UserManager_UserNew(item.ID, item.Password, item.IsAdmin == false ? 0 : 1, item.ExpirePassword, item.ExpireId, item.ActiveLevel, menuId);
2023-07-21 04:40:29 +00:00
#endregion
}
else
{
#region 유저 수정
2023-09-01 09:03:40 +00:00
UserManager.UserManager_UserModify(item.ID, item.Password, item.IsAdmin == false ? 0 : 1, item.ExpirePassword, item.ExpireId, item.ActiveLevel, menuId);
2023-07-21 04:40:29 +00:00
#endregion
}
#region 자동 로그아웃 타임
//this.ParentForm.ParentForm.SystemConfig.AUTOMATIC_LOGOUT = int.Parse(this.labelAutomaticLogoutTime.Text);
//if (this.ParentForm.ParentForm.SystemConfig.AUTOMATIC_LOGOUT == 1)
// this.ParentForm.ParentForm.FlagAutomaticLogoutWarningTime = 30;
//else
// this.ParentForm.ParentForm.FlagAutomaticLogoutWarningTime = 60;
//UserManager.UserManager_AutoLogoutSetTimeout(this.ParentForm.ParentForm.SystemConfig.AUTOMATIC_LOGOUT, this.ParentForm.ParentForm.FlagAutomaticLogoutWarningTime);
#endregion
}
}
private void UserNew()
{
this.UpdateInitializeUserDisplay(this.ParentForm.SystemConfig);
}
2023-08-04 09:05:07 +00:00
private Color ReturnColor(bool bValue)
{
if (bValue == true)
2023-09-08 02:21:51 +00:00
return Color.Black;
2023-08-04 09:05:07 +00:00
else
2023-09-08 02:21:51 +00:00
return Color.DarkGray;
2023-08-04 09:05:07 +00:00
}
2023-08-14 00:32:08 +00:00
private void CheckBoxCheckedAsLevel(DataStore.UserGroup level)
2023-07-21 04:40:29 +00:00
{
switch (level)
{
2023-08-14 00:32:08 +00:00
case DataStore.UserGroup.Level1:
2023-08-04 09:05:07 +00:00
this.labelProductNo.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level1.IsMainDisplayProductNo);
this.labelClear.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level1.IsMainDisplayClear);
this.labelSubMenu.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level1.IsMainDisplaySubMenu);
this.labelWeightSetting.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level1.IsMainDisplayWeightSetting);
this.labelInformation.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level1.IsMenuInformation);
this.labelConfiguration.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level1.IsMenuConfiguration);
this.labelCommunication.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level1.IsMenuCommunication);
this.labelCalibration.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level1.IsMenuCalibration);
this.labelSystem.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level1.IsMenuSystem);
this.labelMotor.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level1.IsMenuMotor);
this.labelIOTest.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level1.IsMenuIOTest);
this.labelUpdate.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level1.IsMenuUpdate);
this.labelInitialization.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level1.IsMenuInitialization);
this.labelTime.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level1.IsMenuTime);
this.labelDataBackup.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level1.IsMenuDataBackup);
2023-09-08 02:21:51 +00:00
this.labelEquipment.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level1.IsMenuEquipment);
2023-08-04 09:05:07 +00:00
this.labelStatistics.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level1.IsMenuStatistics);
this.labelViewer.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level1.IsMenuViewer);
2023-07-21 04:40:29 +00:00
break;
2023-08-14 00:32:08 +00:00
case DataStore.UserGroup.Level2:
2023-08-04 09:05:07 +00:00
this.labelProductNo.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level2.IsMainDisplayProductNo);
this.labelClear.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level2.IsMainDisplayClear);
this.labelSubMenu.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level2.IsMainDisplaySubMenu);
this.labelWeightSetting.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level2.IsMainDisplayWeightSetting);
this.labelInformation.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level2.IsMenuInformation);
this.labelConfiguration.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level2.IsMenuConfiguration);
this.labelCommunication.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level2.IsMenuCommunication);
this.labelCalibration.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level2.IsMenuCalibration);
this.labelSystem.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level2.IsMenuSystem);
this.labelMotor.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level2.IsMenuMotor);
this.labelIOTest.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level2.IsMenuIOTest);
this.labelUpdate.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level2.IsMenuUpdate);
this.labelInitialization.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level2.IsMenuInitialization);
this.labelTime.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level2.IsMenuTime);
this.labelDataBackup.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level2.IsMenuDataBackup);
2023-09-08 02:21:51 +00:00
this.labelEquipment.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level2.IsMenuEquipment);
2023-08-04 09:05:07 +00:00
this.labelStatistics.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level2.IsMenuStatistics);
this.labelViewer.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level2.IsMenuViewer);
2023-07-21 04:40:29 +00:00
break;
2023-08-14 00:32:08 +00:00
case DataStore.UserGroup.Level3:
2023-08-04 09:05:07 +00:00
this.labelProductNo.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level3.IsMainDisplayProductNo);
this.labelClear.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level3.IsMainDisplayClear);
this.labelSubMenu.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level3.IsMainDisplaySubMenu);
this.labelWeightSetting.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level3.IsMainDisplayWeightSetting);
this.labelInformation.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level3.IsMenuInformation);
this.labelConfiguration.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level3.IsMenuConfiguration);
this.labelCommunication.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level3.IsMenuCommunication);
this.labelCalibration.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level3.IsMenuCalibration);
this.labelSystem.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level3.IsMenuSystem);
this.labelMotor.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level3.IsMenuMotor);
this.labelIOTest.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level3.IsMenuIOTest);
this.labelUpdate.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level3.IsMenuUpdate);
this.labelInitialization.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level3.IsMenuInitialization);
2023-09-08 02:21:51 +00:00
this.labelTime.ForeColor = this.ReturnColor(true);
2023-08-04 09:05:07 +00:00
this.labelDataBackup.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level3.IsMenuDataBackup);
2023-09-08 02:21:51 +00:00
this.labelEquipment.ForeColor = this.ReturnColor(true);
2023-08-04 09:05:07 +00:00
this.labelStatistics.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level3.IsMenuStatistics);
this.labelViewer.ForeColor = this.ReturnColor(this.ParentForm.CurrentUserGroup.Level3.IsMenuViewer);
2023-07-21 04:40:29 +00:00
break;
2023-08-14 00:32:08 +00:00
case DataStore.UserGroup.Developer:
case DataStore.UserGroup.Admin:
2023-08-04 09:05:07 +00:00
this.labelProductNo.ForeColor = Color.Black;
this.labelClear.ForeColor = Color.Black;
this.labelSubMenu.ForeColor = Color.Black;
this.labelWeightSetting.ForeColor = Color.Black;
this.labelInformation.ForeColor = Color.Black;
this.labelConfiguration.ForeColor = Color.Black;
this.labelCommunication.ForeColor = Color.Black;
this.labelCalibration.ForeColor = Color.Black;
this.labelSystem.ForeColor = Color.Black;
this.labelMotor.ForeColor = Color.Black;
this.labelIOTest.ForeColor = Color.Black;
this.labelUpdate.ForeColor = Color.Black;
this.labelInitialization.ForeColor = Color.Black;
this.labelTime.ForeColor = Color.Black;
this.labelDataBackup.ForeColor = Color.Black;
2023-09-08 02:21:51 +00:00
this.labelEquipment.ForeColor = Color.Black;
2023-08-04 09:05:07 +00:00
this.labelStatistics.ForeColor = Color.Black;
this.labelViewer.ForeColor = Color.Black;
2023-07-21 04:40:29 +00:00
break;
default:
break;
}
}
2023-09-01 09:03:40 +00:00
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;
}
}
private void UpdateAccessRightComboBoxDisplay()
{
this.comboBoxAccessRight.Items.Clear();
this.comboBoxAccessRight.Items.Add(this.ParentForm.SystemConfig.User_Level1_Name);
this.comboBoxAccessRight.Items.Add(this.ParentForm.SystemConfig.User_Level2_Name);
this.comboBoxAccessRight.Items.Add(this.ParentForm.SystemConfig.User_Level3_Name);
}
2023-07-21 04:40:29 +00:00
private void UpdateInitializeUserDisplay(SystemConfigurationItem system)
{
this.SelectedUserItem = new UserItem();
this.labelID.Text = "";
this.labelPassword.Text = this.SelectedUserItem.ResetPW;
2023-08-14 00:32:08 +00:00
this.labelExpiryDateOfAccount.Text = "180";
this.labelExpiryDateOfPassword.Text = "90";
this.labelExpiryDateOfAccount2.Text = "yyyy.mm.DD";
this.labelExpiryDateOfPassword2.Text = "yyyy.mm.DD";
this.comboBoxAccessRight.Visible = true;
this.comboBoxAccessRight.BringToFront();
2023-09-01 09:03:40 +00:00
this.UpdateAccessRightComboBoxDisplay();
2023-08-14 00:32:08 +00:00
this.comboBoxAccessRight.SelectedIndexChanged -= new EventHandler(this.comboBoxAccessRight_SelectedIndexChanged);
this.comboBoxAccessRight.SelectedIndex = 0;
this.comboBoxAccessRight.SelectedIndexChanged += new EventHandler(this.comboBoxAccessRight_SelectedIndexChanged);
2023-09-01 09:03:40 +00:00
this.UpdateAccessRightDisplay(this.comboBoxAccessRight.SelectedIndex + 1);
2023-08-14 00:32:08 +00:00
this.buttonDelete.Visible = false;
this.buttonSave.Visible = false;
2023-09-01 09:03:40 +00:00
this.labelStatusExpiryAccount.Visible = false;
this.labelStatusExpiryPassword.Visible = false;
this.SetEnablePassword(false);
2023-09-01 09:03:40 +00:00
this.SetEnableID(true);
this.SetEnableExpireAccount(true);
this.SetEnableExpirePassword(true);
2023-08-14 00:32:08 +00:00
2023-09-01 09:03:40 +00:00
this.labelAutomaticLogoutTime.Text = system.AutomaticLogout.ToString();
2023-08-14 00:32:08 +00:00
this.listBoxUserList.SelectedIndexChanged -= new EventHandler(this.listBoxUserList_SelectedIndexChanged);
this.listBoxUserList.SelectedIndex = -1;
2023-08-14 00:32:08 +00:00
this.listBoxUserList.SelectedIndexChanged += new EventHandler(this.listBoxUserList_SelectedIndexChanged);
2023-07-21 04:40:29 +00:00
}
private void UpdateCurrentUserItem(UserManager.UserMgr_user_list_t item)
{
// CurrentUserItem SET
this.SelectedUserItem.ID = item.user_id;
this.SelectedUserItem.Password = item.user_pw;
2023-09-01 09:03:40 +00:00
this.SelectedUserItem.ExpireId = item.id_expire_period;
this.SelectedUserItem.ExpirePassword = item.password_expire_period;
2023-07-21 04:40:29 +00:00
this.SelectedUserItem.ActiveLevel = item.active_level;
if (this.SelectedUserItem.ActiveLevel == 1)
2023-08-14 00:32:08 +00:00
this.SelectedUserItem.Group = DataStore.UserGroup.Level1;
2023-07-21 04:40:29 +00:00
else if (this.SelectedUserItem.ActiveLevel == 2)
2023-08-14 00:32:08 +00:00
this.SelectedUserItem.Group = DataStore.UserGroup.Level2;
2023-07-21 04:40:29 +00:00
else if (this.SelectedUserItem.ActiveLevel == 3)
2023-08-14 00:32:08 +00:00
this.SelectedUserItem.Group = DataStore.UserGroup.Level3;
2023-07-21 04:40:29 +00:00
else if (this.SelectedUserItem.ActiveLevel == 9)
2023-08-14 00:32:08 +00:00
this.SelectedUserItem.Group = DataStore.UserGroup.Admin;
2023-07-21 04:40:29 +00:00
else if (this.SelectedUserItem.ActiveLevel == 10)
2023-08-14 00:32:08 +00:00
this.SelectedUserItem.Group = DataStore.UserGroup.Developer;
2023-07-21 04:40:29 +00:00
else
2023-08-14 00:32:08 +00:00
this.SelectedUserItem.Group = DataStore.UserGroup.None;
2023-07-21 04:40:29 +00:00
//Console.WriteLine(item.password_register_date.GetDateTime());
//Console.WriteLine(item.id_login_date.GetDateTime());
//Console.WriteLine(item.id_expire_date.GetDateTime());
//Console.WriteLine(item.password_expire_date.GetDateTime());
2023-07-21 04:40:29 +00:00
2023-08-28 04:07:51 +00:00
DateTime time = DateTime.ParseExact(item.password_register_date.GetDateTime(), "yyyyMMddHHmmss", null);
2023-09-01 09:03:40 +00:00
this.SelectedUserItem.DatePasswordRegister = time;
2023-08-28 04:07:51 +00:00
time = DateTime.ParseExact(item.id_login_date.GetDateTime(), "yyyyMMddHHmmss", null);
2023-09-01 09:03:40 +00:00
this.SelectedUserItem.DateIdLogin = time;
time = DateTime.ParseExact(item.id_expire_date.GetDateTime(), "yyyyMMddHHmmss", null);
this.SelectedUserItem.DateIdExpire = time;
time = DateTime.ParseExact(item.password_expire_date.GetDateTime(), "yyyyMMddHHmmss", null);
this.SelectedUserItem.DatePasswordExpire = time;
2023-08-28 04:07:51 +00:00
2023-09-01 09:03:40 +00:00
this.SelectedUserItem.IsLockAccount = item.id_flock_status == 0 ? false : true;
2023-07-21 04:40:29 +00:00
this.SelectedUserItem.IsLockPassword = item.flock_status_password == 0 ? false : true;
this.SelectedUserItem.IsAdmin = item.fadmin == 0 ? false : true;
2023-09-01 09:03:40 +00:00
this.SelectedUserItem.IsFirstPassword = item.fFirstPW;
}
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.ExpireId = item.id_expire_period;
this.SelectedUserItem.ExpirePassword = item.password_expire_period;
this.SelectedUserItem.ActiveLevel = item.active_level;
2023-07-21 04:40:29 +00:00
if (item.active_level == 1)
2023-08-14 00:32:08 +00:00
this.SelectedUserItem.Group = DataStore.UserGroup.Level1;
2023-07-21 04:40:29 +00:00
else if (item.active_level == 2)
2023-08-14 00:32:08 +00:00
this.SelectedUserItem.Group = DataStore.UserGroup.Level2;
2023-07-21 04:40:29 +00:00
else if (item.active_level == 3)
2023-08-14 00:32:08 +00:00
this.SelectedUserItem.Group = DataStore.UserGroup.Level3;
2023-07-21 04:40:29 +00:00
else if (item.active_level == 9)
2023-08-14 00:32:08 +00:00
this.SelectedUserItem.Group = DataStore.UserGroup.Admin;
2023-07-21 04:40:29 +00:00
else if (item.active_level == 10)
2023-08-14 00:32:08 +00:00
this.SelectedUserItem.Group = DataStore.UserGroup.Developer;
2023-09-01 09:03:40 +00:00
//Console.WriteLine(item.password_register_date.GetDateTime());
//Console.WriteLine(item.id_login_date.GetDateTime());
//Console.WriteLine(item.id_expire_date.GetDateTime());
//Console.WriteLine(item.password_expire_date.GetDateTime());
2023-09-01 09:03:40 +00:00
DateTime time = DateTime.ParseExact(item.password_register_date.GetDateTime(), "yyyyMMddHHmmss", null);
this.SelectedUserItem.DatePasswordRegister = time;
time = DateTime.ParseExact(item.id_login_date.GetDateTime(), "yyyyMMddHHmmss", null);
this.SelectedUserItem.DateIdLogin = time;
time = DateTime.ParseExact(item.id_expire_date.GetDateTime(), "yyyyMMddHHmmss", null);
this.SelectedUserItem.DateIdExpire = time;
time = DateTime.ParseExact(item.password_expire_date.GetDateTime(), "yyyyMMddHHmmss", null);
this.SelectedUserItem.DatePasswordExpire = time;
this.SelectedUserItem.IsLockAccount = item.id_flock_status == 0 ? false : true;
this.SelectedUserItem.IsLockPassword = item.password_flock_status == 0 ? false : true;
this.SelectedUserItem.IsAdmin = item.fadmin == 0 ? false : true;
this.SelectedUserItem.IsFirstPassword = item.fFirstPW;
2023-07-21 04:40:29 +00:00
}
private void UpdateSelectUserDisplay(UserItem item)
{
2023-08-14 00:32:08 +00:00
this.SetEnableID(false);
2023-07-21 04:40:29 +00:00
this.labelID.Text = item.ID;
this.labelPassword.Text = item.Password;
2023-09-01 09:03:40 +00:00
this.UpdateAccessRightDisplay(item.ActiveLevel);
this.buttonSave.Visible = false;
2023-07-21 04:40:29 +00:00
2023-09-01 09:03:40 +00:00
if (item.Group == DataStore.UserGroup.Admin)
2023-08-14 00:32:08 +00:00
{
this.labelExpiryDateOfAccount.Text = "0";
this.labelExpiryDateOfPassword.Text = "0";
this.labelExpiryDateOfAccount2.Text = "-";
this.labelExpiryDateOfPassword2.Text = "-";
this.buttonDelete.Visible = false;
this.comboBoxAccessRight.Visible = false;
2023-09-01 09:03:40 +00:00
this.labelStatusExpiryAccount.Visible = false;
this.labelStatusExpiryPassword.Visible = false;
this.SetEnableExpireAccount(false);
this.SetEnableExpirePassword(false);
2023-08-14 00:32:08 +00:00
if (this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Admin
|| this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Developer)
this.SetEnablePassword(true);
else
this.SetEnablePassword(false);
}
else
{
2023-09-01 09:03:40 +00:00
this.labelExpiryDateOfAccount.Text = item.ExpireId.ToString();
2023-08-14 00:32:08 +00:00
this.labelExpiryDateOfPassword.Text = item.ExpirePassword.ToString();
2023-09-01 09:03:40 +00:00
if (item.ExpireId != 0)
this.labelExpiryDateOfAccount2.Text = string.Format("{0:yyyy/MM/dd} ~ {1:yyyy/MM/dd}", item.DateIdLogin, item.DateIdExpire);
else
this.labelExpiryDateOfAccount2.Text = "-";
if (item.ExpirePassword != 0)
this.labelExpiryDateOfPassword2.Text = string.Format("{0:yyyy/MM/dd} ~ {1:yyyy/MM/dd}", item.DatePasswordRegister, item.DatePasswordExpire);
else
this.labelExpiryDateOfPassword2.Text = "-";
this.labelStatusExpiryAccount.Visible = item.IsLockAccount;
this.labelStatusExpiryPassword.Visible = item.IsLockPassword;
2023-08-14 00:32:08 +00:00
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);
2023-09-01 09:03:40 +00:00
this.SetEnableExpireAccount(true);
this.SetEnableExpirePassword(true);
2023-08-14 00:32:08 +00:00
if (this.ParentForm.SystemConfig.CurrentUser.ActiveLevel < item.ActiveLevel)
{
2023-09-01 09:03:40 +00:00
this.buttonDelete.Visible = false;
2023-08-14 00:32:08 +00:00
this.SetEnablePassword(false);
2023-09-01 09:03:40 +00:00
this.comboBoxAccessRight.Enabled = false;
}
else if (this.ParentForm.SystemConfig.CurrentUser.ActiveLevel == item.ActiveLevel)
{
2023-08-14 00:32:08 +00:00
this.buttonDelete.Visible = false;
this.comboBoxAccessRight.Enabled = false;
}
else
{
2023-09-01 09:03:40 +00:00
this.buttonDelete.Visible = true;
2023-08-14 00:32:08 +00:00
this.comboBoxAccessRight.Enabled = true;
}
}
2023-07-21 04:40:29 +00:00
}
private void UpdateUserListBoxDisplay(List<string> items)
{
this.listBoxUserList.Items.Clear();
2023-07-21 04:40:29 +00:00
for (int i = 1; i < items.Count; i++)
this.listBoxUserList.Items.Add(items[i]);
2023-07-21 04:40:29 +00:00
}
2023-09-01 09:03:40 +00:00
private void UpdateAccessRightDisplay(int level)
2023-07-21 04:40:29 +00:00
{
2023-09-01 09:03:40 +00:00
UserGroupItem item;
switch (level)
{
case 1:
item = this.ParentForm.CurrentUserGroup.Level1;
break;
case 2:
item = this.ParentForm.CurrentUserGroup.Level2;
break;
case 3:
case 9:
item = this.ParentForm.CurrentUserGroup.Level3;
break;
default:
item = this.ParentForm.CurrentUserGroup.Level1;
break;
}
2023-08-04 09:05:07 +00:00
this.labelProductNo.ForeColor = this.ReturnColor(item.IsMainDisplayProductNo);
this.labelWeightSetting.ForeColor = this.ReturnColor(item.IsMainDisplayWeightSetting);
this.labelClear.ForeColor = this.ReturnColor(item.IsMainDisplayClear);
this.labelSubMenu.ForeColor = this.ReturnColor(item.IsMainDisplaySubMenu);
this.labelInformation.ForeColor = this.ReturnColor(item.IsMenuInformation);
this.labelConfiguration.ForeColor = this.ReturnColor(item.IsMenuConfiguration);
this.labelCommunication.ForeColor = this.ReturnColor(item.IsMenuCommunication);
this.labelCalibration.ForeColor = this.ReturnColor(item.IsMenuCalibration);
this.labelSystem.ForeColor = this.ReturnColor(item.IsMenuSystem);
this.labelMotor.ForeColor = this.ReturnColor(item.IsMenuMotor);
this.labelIOTest.ForeColor = this.ReturnColor(item.IsMenuIOTest);
this.labelUpdate.ForeColor = this.ReturnColor(item.IsMenuUpdate);
this.labelInitialization.ForeColor = this.ReturnColor(item.IsMenuInitialization);
this.labelTime.ForeColor = this.ReturnColor(item.IsMenuTime);
this.labelDataBackup.ForeColor = this.ReturnColor(item.IsMenuDataBackup);
2023-09-08 02:21:51 +00:00
this.labelEquipment.ForeColor = this.ReturnColor(item.IsMenuEquipment);
2023-08-04 09:05:07 +00:00
this.labelStatistics.ForeColor = this.ReturnColor(item.IsMenuStatistics);
this.labelViewer.ForeColor = this.ReturnColor(item.IsMenuViewer);
2023-07-21 04:40:29 +00:00
}
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 = "", detail = "";
switch (this.ParentForm.SystemConfig.Language)
{
case DataStore.LanguageID.Korean:
code = "유저설정";
message1 = "사용자 추가 완료!";
message2 = "";
break;
case DataStore.LanguageID.English:
code = "user settings";
message1 = "User addition complete!";
message2 = "";
break;
case DataStore.LanguageID.Chinese:
code = "用户设置";
message1 = "用户添加完成!";
message2 = "";
break;
case DataStore.LanguageID.Czech:
code = "uživatelské nastavení";
message1 = "Přidání uživatele dokončeno!";
message2 = "";
break;
case DataStore.LanguageID.German:
code = "Benutzereinstellungen";
message1 = "Benutzer hinzufügen abgeschlossen!";
message2 = "";
break;
default:
break;
}
if (user.status == (int)UserManager.E_user_mgr_status.USER_MGR_STATUS_OK)
{
this.UI_Invoke(delegate
{
// Part 11
detail = string.Format("Add : {0}", user.user_id);
this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.UserEditor, detail);
this.UpdateCurrentUserItem(user);
this.UpdateSelectUserDisplay(this.SelectedUserItem);
this.ParentForm.ListDllUserName.Add(user.user_id);
this.UpdateUserListBoxDisplay(this.ParentForm.ListDllUserName);
this.listBoxUserList.SelectedIndex = this.listBoxUserList.Items.Count - 1;
2023-07-21 04:40:29 +00:00
2023-09-01 09:03:40 +00:00
this.buttonDelete.Visible = true;
2023-08-28 04:07:51 +00:00
this.buttonSave.Visible = false;
2023-09-01 09:03:40 +00:00
this.SetEnableID(false);
2023-07-21 04:40:29 +00:00
DialogFormMessage dlg = new DialogFormMessage(DataStore.MessageBoxIcon.Asterisk, code, message1, message2, 0);
dlg.ShowDialog();
});
}
else
{
DialogFormMessage msg = new DialogFormMessage(null, user.status, this.ParentForm.SystemConfig.Language);
msg.ShowDialog();
}
}
public void CallBackUserModifyUserData(UserManager.UserMgr_user_modify_t user)
{
string code = "", message1 = "", message2 = "", detail = "";
switch (this.ParentForm.SystemConfig.Language)
{
case DataStore.LanguageID.Korean:
code = "유저설정";
message1 = "사용자 정보 수정 완료!";
message2 = "";
break;
case DataStore.LanguageID.English:
code = "user settings";
message1 = "User information modified!";
message2 = "";
break;
case DataStore.LanguageID.Chinese:
code = "用户设置";
message1 = "用户信息修改!";
message2 = "";
break;
case DataStore.LanguageID.Czech:
code = "uživatelské nastavení";
message1 = "Informace o uživateli upraveny!";
message2 = "";
break;
case DataStore.LanguageID.German:
code = "Benutzereinstellungen";
message1 = "Benutzerinformationen geändert!";
message2 = "";
break;
default:
break;
}
if (user.status == (int)UserManager.E_user_mgr_status.USER_MGR_STATUS_OK)
{
this.UI_Invoke(delegate
{
// Part 11
detail = string.Format("Modify : {0}", user.user_id);
this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.UserEditor, detail);
// 메시지 박스 교체
UserManager.UserManager_GetUserListID(this.listBoxUserList.SelectedItem.ToString());
2023-07-21 04:40:29 +00:00
DialogFormMessage dlg = new DialogFormMessage(DataStore.MessageBoxIcon.Asterisk, code, message1, message2, 0);
dlg.ShowDialog();
});
}
else
{
DialogFormMessage msg = new DialogFormMessage(null, user.status, this.ParentForm.SystemConfig.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.SelectedUserItem.ID);
2023-07-21 04:40:29 +00:00
}
}
public void CallBackUserListDeleteDataEvent(UserManager.UserMgr_user_del_t user)
{
string code = "", message1 = "", message2 = "", detail = "";
switch (this.ParentForm.SystemConfig.Language)
{
case DataStore.LanguageID.Korean:
code = "유저설정";
message1 = string.Format("{0} 사용자 삭제 완료!", user.user_id);
message2 = "";
break;
case DataStore.LanguageID.English:
code = "user settings";
message1 = string.Format("{0} User deletion complete!", user.user_id);
message2 = "";
break;
case DataStore.LanguageID.Chinese:
code = "用户设置";
message1 = string.Format("{0} 用户删除完成!", user.user_id);
message2 = "";
break;
case DataStore.LanguageID.Czech:
code = "uživatelské nastavení";
message1 = string.Format("{0} Smazání uživatele dokončeno!", user.user_id);
message2 = "";
break;
case DataStore.LanguageID.German:
code = "Benutzereinstellungen";
message1 = string.Format("{0} Benutzerlöschung abgeschlossen!", user.user_id);
message2 = "";
break;
default:
break;
}
if (user.status == 0)
{
for (int i = 0; i < this.ParentForm.ListDllUserName.Count; i++)
{
if (this.ParentForm.ListDllUserName[i] == user.user_id)
{
this.ParentForm.ListDllUserName.RemoveAt(i);
break;
}
}
this.UI_Invoke(delegate
{
this.UpdateUserListBoxDisplay(this.ParentForm.ListDllUserName);
this.UserNew();
DialogFormMessage dlg = new DialogFormMessage(DataStore.MessageBoxIcon.Asterisk, code, message1, message2, 0);
dlg.ShowDialog();
});
// Part 11
if (this.ParentForm.SystemConfig.IsPart11 == true)
{
detail = string.Format("Delete : {0}", user.user_id);
this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.UserEditor, detail);
}
}
else
{
DialogFormMessage msg = new DialogFormMessage(null, user.status, this.ParentForm.SystemConfig.Language);
msg.ShowDialog();
}
}
public void CallBackUserListModifyInfoDataEvent(UserManager.UserMgr_user_info_t user)
{
//if (this.ChildControlUserSet.Visible == true)
//{
this.ChildControlUserSet.CallBackUserListModifyInfoDataEvent(user);
//}
}
public void DisplayRefresh()
{
this.ParentForm.SystemConfig.CurrentForm = DataStore.FormStore.FormUserEditor;
2023-09-01 09:03:40 +00:00
if (this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Level3
|| this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Admin
|| this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Developer)
2023-07-21 04:40:29 +00:00
{
2023-09-08 02:21:51 +00:00
this.buttonNew.Visible = true;
2023-08-14 00:32:08 +00:00
this.buttonGroupEditor.Visible = true;
2023-07-21 04:40:29 +00:00
this.ChildControlUserSet.Visible = false;
2023-08-28 04:07:51 +00:00
this.UpdateInitializeUserDisplay(this.ParentForm.SystemConfig);
this.UpdateUserListBoxDisplay(this.ParentForm.ListDllUserName);
2023-07-21 04:40:29 +00:00
}
else
{
2023-09-08 02:21:51 +00:00
this.buttonNew.Visible = false;
this.buttonDelete.Visible = false;
this.buttonSave.Visible = false;
2023-08-14 00:32:08 +00:00
this.buttonGroupEditor.Visible = false;
2023-09-08 02:21:51 +00:00
2023-07-21 04:40:29 +00:00
this.ChildControlUserSet.Visible = true;
this.ChildControlUserSet.BringToFront();
this.ChildControlUserSet.DisplayRefresh();
}
}
#endregion
#region Event Handler
private void buttonBack_Click(object sender, EventArgs e)
{
this.ParentForm.ChildFormMenu.DisplayRefresh();
((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormMenu);
}
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)
{
// 메시지 추가
// 사용자를 삭제 하시겠습니까?
2023-08-28 04:07:51 +00:00
DialogFormYesNo dlg = new DialogFormYesNo(this.ParentForm.SystemConfig.Language, 14);
2023-07-21 04:40:29 +00:00
if (dlg.ShowDialog() == DialogResult.Yes)
{
if (this.listBoxUserList.Items.Count <= 1)
return;
if (this.listBoxUserList.SelectedIndex <= 0)
2023-07-21 04:40:29 +00:00
return;
string id = this.listBoxUserList.Items[this.listBoxUserList.SelectedIndex].ToString();
2023-07-21 04:40:29 +00:00
UserManager.UserManager_UserDel(id);
}
}
private void buttonResetPW_Click(object sender, EventArgs e)
{
int ret = 0;
string id = "", pw = "";
if (this.listBoxUserList.Items.Count <= 1)
return;
if (this.listBoxUserList.SelectedIndex <= 0)
return;
// 메시지
// 비밀번호를 초기화 하시겠습니까?
DialogFormYesNo dlg = new DialogFormYesNo(this.ParentForm.SystemConfig.Language, 17);
if (dlg.ShowDialog() == DialogResult.Yes)
{
id = this.SelectedUserItem.ID;
pw = this.SelectedUserItem.ResetPW;
ret = UserManager.UserManager_UserResetPWDirect(id, pw);
if (ret == 0)
this.labelPassword.Text = pw;
}
}
2023-07-21 04:40:29 +00:00
2023-08-14 00:32:08 +00:00
private void buttonGroupEditor_Click(object sender, EventArgs e)
2023-07-21 04:40:29 +00:00
{
this.ParentForm.ChildFormUserGroupEditor.DisplayRefresh();
((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormUserGroupEditor);
}
private void labelID_Click(object sender, EventArgs e)
{
string value = "";
2023-09-01 09:03:40 +00:00
DialogFormUserEditorKeyboard keyboard = new DialogFormUserEditorKeyboard(this.labelID.Text);
2023-07-21 04:40:29 +00:00
if (keyboard.ShowDialog() == DialogResult.OK)
{
value = keyboard.RetStringValue;
this.labelID.Text = value;
2023-08-14 00:32:08 +00:00
2023-09-08 02:21:51 +00:00
if (this.labelID.Text != "")
{
if (this.buttonSave.Visible == false)
this.buttonSave.Visible = true;
}
2023-07-21 04:40:29 +00:00
}
}
private void labelPassword_Click(object sender, EventArgs e)
{
string value = "";
2023-09-01 09:03:40 +00:00
DialogFormUserEditorKeyboard keyboard = new DialogFormUserEditorKeyboard(this.labelPassword.Text);
2023-07-21 04:40:29 +00:00
if (keyboard.ShowDialog() == DialogResult.OK)
{
value = keyboard.RetStringValue;
this.labelPassword.Text = value;
2023-08-14 00:32:08 +00:00
2023-09-08 02:21:51 +00:00
if (this.labelPassword.Text != "")
{
if (this.buttonSave.Visible == false)
this.buttonSave.Visible = true;
}
2023-07-21 04:40:29 +00:00
}
}
private void labelExpireAccount_Click(object sender, EventArgs e)
{
2023-08-14 00:32:08 +00:00
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelExpiryDateOfAccount.Text, 3, 0, false, this.ParentForm.SystemConfig.Language);
2023-07-21 04:40:29 +00:00
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
2023-09-01 09:03:40 +00:00
if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 180)
2023-07-21 04:40:29 +00:00
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.SystemConfig.Language);
myMsg.ShowDialog();
}
else
{
2023-08-14 00:32:08 +00:00
this.labelExpiryDateOfAccount.Text = myKeyPad.StringValue;
2023-09-01 09:03:40 +00:00
if (this.buttonSave.Visible != true)
2023-08-14 00:32:08 +00:00
this.buttonSave.Visible = true;
2023-07-21 04:40:29 +00:00
}
}
}
private void labelExpirePassword_Click(object sender, EventArgs e)
{
2023-08-14 00:32:08 +00:00
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelExpiryDateOfPassword.Text, 3, 0, false, this.ParentForm.SystemConfig.Language);
2023-07-21 04:40:29 +00:00
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
2023-09-01 09:03:40 +00:00
if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 90)
2023-07-21 04:40:29 +00:00
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.SystemConfig.Language);
myMsg.ShowDialog();
}
else
{
2023-08-14 00:32:08 +00:00
this.labelExpiryDateOfPassword.Text = myKeyPad.StringValue;
2023-09-01 09:03:40 +00:00
if (this.buttonSave.Visible != true)
2023-08-14 00:32:08 +00:00
this.buttonSave.Visible = true;
2023-07-21 04:40:29 +00:00
}
}
}
private void labelAutomaticLogout_Click(object sender, EventArgs e)
{
2023-09-01 09:03:40 +00:00
string before = "", after = "";
before = this.labelAutomaticLogoutTime.Text;
2023-08-14 00:32:08 +00:00
DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelAutomaticLogoutTime.Text, 2, 0, false, this.ParentForm.SystemConfig.Language);
2023-07-21 04:40:29 +00:00
if (myKeyPad.ShowDialog() == DialogResult.OK)
{
2023-09-01 09:03:40 +00:00
if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 90)
2023-07-21 04:40:29 +00:00
{
// 입력범위를 확인하세요
DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.SystemConfig.Language);
myMsg.ShowDialog();
}
else
{
2023-08-14 00:32:08 +00:00
this.labelAutomaticLogoutTime.Text = myKeyPad.StringValue;
2023-09-01 09:03:40 +00:00
this.ParentForm.SystemConfig.AutomaticLogout = myKeyPad.IntValue;
this.ParentForm.SaveSystemConfigurationFile(this.ParentForm.SystemConfig);
after = this.labelAutomaticLogoutTime.Text;
2023-07-21 04:40:29 +00:00
2023-09-01 09:03:40 +00:00
if (this.ParentForm.SystemConfig.AutomaticLogout == 1)
this.ParentForm.FlagAutomaticLogoutWarningTime = 30;
else
this.ParentForm.FlagAutomaticLogoutWarningTime = 60;
2023-08-14 00:32:08 +00:00
2023-09-01 09:03:40 +00:00
UserManager.UserManager_AutoLogoutSetTimeout(this.ParentForm.SystemConfig.AutomaticLogout, this.ParentForm.FlagAutomaticLogoutWarningTime);
2023-08-14 00:32:08 +00:00
2023-09-01 09:03:40 +00:00
// Part11
if (this.ParentForm.SystemConfig.IsPart11 == true)
this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.AutoLogout, "", before, after);
}
2023-07-21 04:40:29 +00:00
}
}
private void labelStatusExpireAccount_Click(object sender, EventArgs e)
{
string code = "", message1 = "", message2 = "";
switch (this.ParentForm.SystemConfig.Language)
{
case DataStore.LanguageID.Korean:
code = "유저설정";
message1 = "사용자 잠금 해제 하시겠습니까?";
message2 = "";
break;
case DataStore.LanguageID.English:
code = "유저설정";
message1 = "사용자 잠금 해제 하시겠습니까?";
message2 = "";
break;
case DataStore.LanguageID.Chinese:
code = "유저설정";
message1 = "사용자 잠금 해제 하시겠습니까?";
message2 = "";
break;
case DataStore.LanguageID.Czech:
code = "유저설정";
message1 = "사용자 잠금 해제 하시겠습니까?";
message2 = "";
break;
case DataStore.LanguageID.German:
code = "유저설정";
message1 = "사용자 잠금 해제 하시겠습니까?";
message2 = "";
break;
default:
break;
}
DialogFormYesNo dlg = new DialogFormYesNo(DataStore.MessageBoxIcon.Question, code, message1, message2);
if (dlg.ShowDialog() == DialogResult.Yes)
UserManager.UserManager_UserLockRelease(this.SelectedUserItem.ID, true, false);
}
private void labelStatusExpirePassword_Click(object sender, EventArgs e)
{
string code = "", message1 = "", message2 = "";
switch (this.ParentForm.SystemConfig.Language)
{
case DataStore.LanguageID.Korean:
code = "유저설정";
message1 = "비밀번호 잠금 해제 하시겠습니까?";
message2 = "";
break;
case DataStore.LanguageID.English:
code = "유저설정";
message1 = "비밀번호 잠금 해제 하시겠습니까?";
message2 = "";
break;
case DataStore.LanguageID.Chinese:
code = "유저설정";
message1 = "비밀번호 잠금 해제 하시겠습니까?";
message2 = "";
break;
case DataStore.LanguageID.Czech:
code = "유저설정";
message1 = "비밀번호 잠금 해제 하시겠습니까?";
message2 = "";
break;
case DataStore.LanguageID.German:
code = "유저설정";
message1 = "비밀번호 잠금 해제 하시겠습니까?";
message2 = "";
break;
default:
break;
}
DialogFormYesNo dlg = new DialogFormYesNo(DataStore.MessageBoxIcon.Question, code, message1, message2);
if (dlg.ShowDialog() == DialogResult.Yes)
UserManager.UserManager_UserLockRelease(this.SelectedUserItem.ID, false, true);
}
2023-08-14 00:32:08 +00:00
private void comboBoxAccessRight_SelectedIndexChanged(object sender, EventArgs e)
{
2023-09-01 09:03:40 +00:00
//switch (this.comboBoxAccessRight.SelectedIndex)
//{
// case 0:
// this.UpdateAccessRightDisplay(this.ParentForm.CurrentUserGroup.Level1);
// break;
// case 1:
// this.UpdateAccessRightDisplay(this.ParentForm.CurrentUserGroup.Level2);
// break;
// case 2:
// this.UpdateAccessRightDisplay(this.ParentForm.CurrentUserGroup.Level3);
// break;
// default:
// this.UpdateAccessRightDisplay(this.ParentForm.CurrentUserGroup.Level1);
// break;
//}
this.UpdateAccessRightDisplay(this.comboBoxAccessRight.SelectedIndex + 1);
2023-08-14 00:32:08 +00:00
if (this.buttonSave.Visible == false)
this.buttonSave.Visible = true;
}
2023-07-21 04:40:29 +00:00
private void listBoxUserList_SelectedIndexChanged(object sender, EventArgs e)
{
int index = this.listBoxUserList.SelectedIndex;
2023-07-21 04:40:29 +00:00
if (index == 0)
2023-07-21 04:40:29 +00:00
{
this.SetEnablePassword(true);
UserManager.UserManager_GetUserListID(this.listBoxUserList.SelectedItem.ToString());
}
else if (index > 0)
{
this.SetEnablePassword(false);
if (this.ParentForm.SystemConfig.CurrentUser.ID == this.listBoxUserList.Items[index].ToString())
2023-08-14 00:32:08 +00:00
this.buttonDelete.Visible = false;
2023-07-21 04:40:29 +00:00
else
2023-08-14 00:32:08 +00:00
this.buttonDelete.Visible = true;
2023-07-21 04:40:29 +00:00
UserManager.UserManager_GetUserListID(this.listBoxUserList.SelectedItem.ToString());
2023-07-21 04:40:29 +00:00
}
}
#endregion
}
}