diff --git a/INT_PT002/Controls/User/ControlMenuUserGroupEditor.Designer.cs b/INT_PT002/Controls/User/ControlMenuUserGroupEditor.Designer.cs index aa97597..b500aab 100644 --- a/INT_PT002/Controls/User/ControlMenuUserGroupEditor.Designer.cs +++ b/INT_PT002/Controls/User/ControlMenuUserGroupEditor.Designer.cs @@ -278,7 +278,7 @@ this.groupBoxDefault.RoundRadius = 5; this.groupBoxDefault.Size = new System.Drawing.Size(120, 486); this.groupBoxDefault.TabIndex = 219; - this.groupBoxDefault.Text = "Default"; + this.groupBoxDefault.Text = "Admin"; this.groupBoxDefault.TextColor = System.Drawing.Color.White; this.groupBoxDefault.Visible = false; // diff --git a/INT_PT002/Controls/User/ControlMenuUserGroupEditor.cs b/INT_PT002/Controls/User/ControlMenuUserGroupEditor.cs index ef6a822..06d4226 100644 --- a/INT_PT002/Controls/User/ControlMenuUserGroupEditor.cs +++ b/INT_PT002/Controls/User/ControlMenuUserGroupEditor.cs @@ -120,19 +120,19 @@ namespace INT_PT002.Controls #endregion #region Default - this.checkBoxDefaultMainProductChange.Checked = group.Default.IsMainDisplayProductChange; - this.checkBoxDefaultMainClear.Checked = group.Default.IsMainDisplayClear; - this.checkBoxDefaultMainSubMenu.Checked = group.Default.IsMainDisplaySubMenu; + this.checkBoxDefaultMainProductChange.Checked = group.Admin.IsMainDisplayProductChange; + this.checkBoxDefaultMainClear.Checked = group.Admin.IsMainDisplayClear; + this.checkBoxDefaultMainSubMenu.Checked = group.Admin.IsMainDisplaySubMenu; - this.checkBoxDefaultMenuProduct.Checked = group.Default.IsMenuRecipe; - this.checkBoxDefaultMenuUserSetting.Checked = group.Default.IsMenuUserSetting; - this.checkBoxDefaultMenuUserGroupEditor.Checked = group.Default.IsMenuUserGroupEditor; - this.checkBoxDefaultMenuIOTest.Checked = group.Default.IsMenuIOTest; - this.checkBoxDefaultMenuEquipmentLog.Checked = group.Default.IsMenuHistoryLog; - this.checkBoxDefaultMenuCheckLog.Checked = group.Default.IsMenuInspectionLog; - this.checkBoxDefaultMenuAlarmList.Checked = group.Default.IsMenuAlarmLog; - this.checkBoxDefaultMenuInformation.Checked = group.Default.IsMenuInformation; - this.checkBoxDefaultMenuStatus.Checked = group.Default.IsMenuStatus; + this.checkBoxDefaultMenuProduct.Checked = group.Admin.IsMenuRecipe; + this.checkBoxDefaultMenuUserSetting.Checked = group.Admin.IsMenuUserSetting; + this.checkBoxDefaultMenuUserGroupEditor.Checked = group.Admin.IsMenuUserGroupEditor; + this.checkBoxDefaultMenuIOTest.Checked = group.Admin.IsMenuIOTest; + this.checkBoxDefaultMenuEquipmentLog.Checked = group.Admin.IsMenuHistoryLog; + this.checkBoxDefaultMenuCheckLog.Checked = group.Admin.IsMenuInspectionLog; + this.checkBoxDefaultMenuAlarmList.Checked = group.Admin.IsMenuAlarmLog; + this.checkBoxDefaultMenuInformation.Checked = group.Admin.IsMenuInformation; + this.checkBoxDefaultMenuStatus.Checked = group.Admin.IsMenuStatus; #endregion } @@ -341,20 +341,20 @@ namespace INT_PT002.Controls this.ParentForm.ParentForm.CurrentUserGroup.Level3.IsMenuStatus = this.checkBoxL3MenuStatus.Checked; #endregion - #region Default - this.ParentForm.ParentForm.CurrentUserGroup.Default.IsMainDisplayProductChange = this.checkBoxDefaultMainProductChange.Checked; - this.ParentForm.ParentForm.CurrentUserGroup.Default.IsMainDisplayClear = this.checkBoxDefaultMainClear.Checked; - this.ParentForm.ParentForm.CurrentUserGroup.Default.IsMainDisplaySubMenu = this.checkBoxDefaultMainSubMenu.Checked; + #region Admin + this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMainDisplayProductChange = this.checkBoxDefaultMainProductChange.Checked; + this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMainDisplayClear = this.checkBoxDefaultMainClear.Checked; + this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMainDisplaySubMenu = this.checkBoxDefaultMainSubMenu.Checked; - this.ParentForm.ParentForm.CurrentUserGroup.Default.IsMenuRecipe = this.checkBoxDefaultMenuProduct.Checked; - this.ParentForm.ParentForm.CurrentUserGroup.Default.IsMenuUserSetting = this.checkBoxDefaultMenuUserSetting.Checked; - this.ParentForm.ParentForm.CurrentUserGroup.Default.IsMenuUserGroupEditor = this.checkBoxDefaultMenuUserGroupEditor.Checked; - this.ParentForm.ParentForm.CurrentUserGroup.Default.IsMenuIOTest = this.checkBoxDefaultMenuIOTest.Checked; - this.ParentForm.ParentForm.CurrentUserGroup.Default.IsMenuHistoryLog = this.checkBoxDefaultMenuEquipmentLog.Checked; - this.ParentForm.ParentForm.CurrentUserGroup.Default.IsMenuInspectionLog = this.checkBoxDefaultMenuCheckLog.Checked; - this.ParentForm.ParentForm.CurrentUserGroup.Default.IsMenuAlarmLog = this.checkBoxDefaultMenuAlarmList.Checked; - this.ParentForm.ParentForm.CurrentUserGroup.Default.IsMenuInformation = this.checkBoxDefaultMenuInformation.Checked; - this.ParentForm.ParentForm.CurrentUserGroup.Default.IsMenuStatus = this.checkBoxDefaultMenuStatus.Checked; + this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMenuRecipe = this.checkBoxDefaultMenuProduct.Checked; + this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMenuUserSetting = this.checkBoxDefaultMenuUserSetting.Checked; + this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMenuUserGroupEditor = this.checkBoxDefaultMenuUserGroupEditor.Checked; + this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMenuIOTest = this.checkBoxDefaultMenuIOTest.Checked; + this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMenuHistoryLog = this.checkBoxDefaultMenuEquipmentLog.Checked; + this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMenuInspectionLog = this.checkBoxDefaultMenuCheckLog.Checked; + this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMenuAlarmLog = this.checkBoxDefaultMenuAlarmList.Checked; + this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMenuInformation = this.checkBoxDefaultMenuInformation.Checked; + this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMenuStatus = this.checkBoxDefaultMenuStatus.Checked; #endregion this.ParentForm.ParentForm.SaveUserGroupFile(this.ParentForm.ParentForm.CurrentUserGroup); diff --git a/INT_PT002/Controls/User/ControlMenuUserUserEditor.cs b/INT_PT002/Controls/User/ControlMenuUserUserEditor.cs index ef5ecb3..50f1d94 100644 --- a/INT_PT002/Controls/User/ControlMenuUserUserEditor.cs +++ b/INT_PT002/Controls/User/ControlMenuUserUserEditor.cs @@ -48,11 +48,36 @@ namespace INT_PT002.Controls } private void SetEnableID(bool value) - { + { + this.textBoxID.Enabled = value; + this.buttonIDEdit.Enabled = value; + + if (value == true) + { + this.textBoxID.BackColor = Color.White; + this.labelIDBackGround.BackGroundColor = Color.White; + } + else + { + this.textBoxID.BackColor = Color.Silver; + this.labelIDBackGround.BackGroundColor = Color.Silver; + } } private void SetEnablePassword(bool value) - { - + { + this.textBoxPassword.Enabled = value; + this.buttonPasswordEdit.Enabled = value; + + if (value == true) + { + this.textBoxPassword.BackColor = Color.White; + this.labelPasswordBackGround.BackGroundColor = Color.White; + } + else + { + this.textBoxPassword.BackColor = Color.Silver; + this.labelPasswordBackGround.BackGroundColor = Color.Silver; + } } private void KeyboardClose() { @@ -62,12 +87,8 @@ namespace INT_PT002.Controls this.buttonDelete.Enabled = true; this.groupBoxAccessRight.Enabled = true; this.listBoxUserList.Enabled = true; - this.textBoxPassword.Enabled = true; - this.labelPasswordBackGround.BackGroundColor = Color.White; - this.buttonPasswordEdit.Enabled = true; - this.textBoxID.Enabled = true; - this.labelIDBackGround.BackGroundColor = Color.White; - this.buttonIDEdit.Enabled = true; + this.SetEnableID(true); + this.SetEnablePassword(true); if(this.buttonSave.Visible == false) this.buttonSave.Visible = true; @@ -88,13 +109,10 @@ namespace INT_PT002.Controls this.buttonDelete.Enabled = false; this.buttonSave.Visible = false; - this.textBoxID.Enabled = true; - this.labelIDBackGround.BackGroundColor = Color.White; - this.textBoxPassword.Enabled = true; - this.labelPasswordBackGround.BackGroundColor = Color.White; this.labelExpiryDateOfAccount.Enabled = true; this.labelExpiryDateOfPassword.Enabled = true; - this.labelAutomaticLogoutTime.Enabled = true; + this.SetEnableID(true); + this.SetEnablePassword(true); } private void SaveUserDll() { @@ -209,36 +227,22 @@ namespace INT_PT002.Controls //item.IsAdmin = this.cbAdministrator.Checked; - menuId.fMenu = new bool[UserManager.USER_MENU_ID_MAX]; - menuId.fMenu[0] = this.checkBoxMainProductChange.Checked; - menuId.fMenu[1] = this.checkBoxMainClear.Checked; - menuId.fMenu[2] = this.checkBoxMainSubMenu.Checked; - - menuId.fMenu[3] = this.checkBoxMenuRecipe.Checked; - menuId.fMenu[4] = this.checkBoxMenuUserEditor.Checked; - menuId.fMenu[5] = this.checkBoxMenuUserGroupEditor.Checked; - menuId.fMenu[6] = this.checkBoxMenuIOTest.Checked; - menuId.fMenu[7] = this.checkBoxMenuHistoryLog.Checked; - menuId.fMenu[8] = this.checkBoxMenuCheckLog.Checked; - menuId.fMenu[9] = this.checkBoxMenuAlarmList.Checked; - menuId.fMenu[10] = this.checkBoxMenuInformation.Checked; - menuId.fMenu[11] = this.checkBoxMenuEquipment.Checked; - - for (int i = 12; i < UserManager.USER_MENU_ID_MAX - 11; i++) - menuId.fMenu[i] = false; - if (this.buttonLevel1.ButtonStatus == SmartX.SmartButton.BUTSTATUS.DOWN) - menuId.fMenu[25] = true; + item.ActiveLevel = 1; if (this.buttonLevel2.ButtonStatus == SmartX.SmartButton.BUTSTATUS.DOWN) - menuId.fMenu[26] = true; + item.ActiveLevel = 2; if (this.buttonLevel3.ButtonStatus == SmartX.SmartButton.BUTSTATUS.DOWN) - menuId.fMenu[27] = true; + item.ActiveLevel = 3; + + 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 (isNewReg == true) { #region 신규 등록 - UserManager.UserManager_UserNew(item.ID, item.Password, item.IsAdmin == false ? 0 : 1, item.ExpirePassword, item.ExpireAccount, menuId); + UserManager.UserManager_UserNew(item.ID, item.Password, item.IsAdmin == false ? 0 : 1, item.ExpirePassword, item.ExpireAccount, item.ActiveLevel, menuId); // Part 11 detail = string.Format("Add : {0}", item.ID); @@ -248,7 +252,7 @@ namespace INT_PT002.Controls else { #region 유저 수정 - UserManager.UserManager_UserModify(item.ID, item.Password, item.IsAdmin == false ? 0 : 1, item.ExpirePassword, item.ExpireAccount, menuId); + UserManager.UserManager_UserModify(item.ID, item.Password, item.IsAdmin == false ? 0 : 1, item.ExpirePassword, item.ExpireAccount, item.ActiveLevel, menuId); // Part 11 detail = string.Format("Modify : {0}", item.ID); @@ -280,6 +284,9 @@ namespace INT_PT002.Controls this.buttonLevel2.ButtonUp(); this.buttonLevel3.ButtonUp(); this.buttonLevel1.ButtonDown(); + this.buttonLevel1.Enabled = true; + this.buttonLevel2.Enabled = true; + this.buttonLevel3.Enabled = true; this.labelAccessRight.Text = this.ParentForm.ParentForm.SystemConfig.LEVEL1_NAME; @@ -301,6 +308,9 @@ namespace INT_PT002.Controls this.buttonLevel1.ButtonUp(); this.buttonLevel3.ButtonUp(); this.buttonLevel2.ButtonDown(); + this.buttonLevel1.Enabled = true; + this.buttonLevel2.Enabled = true; + this.buttonLevel3.Enabled = true; this.labelAccessRight.Text = this.ParentForm.ParentForm.SystemConfig.LEVEL2_NAME; @@ -322,6 +332,9 @@ namespace INT_PT002.Controls this.buttonLevel1.ButtonUp(); this.buttonLevel2.ButtonUp(); this.buttonLevel3.ButtonDown(); + this.buttonLevel1.Enabled = true; + this.buttonLevel2.Enabled = true; + this.buttonLevel3.Enabled = true; this.labelAccessRight.Text = this.ParentForm.ParentForm.SystemConfig.LEVEL3_NAME; @@ -339,7 +352,53 @@ namespace INT_PT002.Controls this.checkBoxMenuInformation.Checked = this.ParentForm.ParentForm.CurrentUserGroup.Level3.IsMenuInformation; this.checkBoxMenuEquipment.Checked = this.ParentForm.ParentForm.CurrentUserGroup.Level3.IsMenuStatus; break; + case Define.E_UserStatus.Admin: + this.buttonLevel1.ButtonUp(); + this.buttonLevel2.ButtonUp(); + this.buttonLevel3.ButtonUp(); + this.buttonLevel1.Enabled = false; + this.buttonLevel2.Enabled = false; + this.buttonLevel3.Enabled = false; + + this.labelAccessRight.Text = "Admin"; + + this.checkBoxMainProductChange.Checked = this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMainDisplayProductChange; + this.checkBoxMainClear.Checked = this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMainDisplayClear; + this.checkBoxMainSubMenu.Checked = this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMainDisplaySubMenu; + + this.checkBoxMenuRecipe.Checked = this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMenuRecipe; + this.checkBoxMenuUserEditor.Checked = this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMenuUserSetting; + this.checkBoxMenuUserGroupEditor.Checked = this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMenuUserGroupEditor; + this.checkBoxMenuIOTest.Checked = this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMenuIOTest; + this.checkBoxMenuHistoryLog.Checked = this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMenuHistoryLog; + this.checkBoxMenuCheckLog.Checked = this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMenuInspectionLog; + this.checkBoxMenuAlarmList.Checked = this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMenuAlarmLog; + this.checkBoxMenuInformation.Checked = this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMenuInformation; + this.checkBoxMenuEquipment.Checked = this.ParentForm.ParentForm.CurrentUserGroup.Admin.IsMenuStatus; + break; default: + this.buttonLevel1.ButtonUp(); + this.buttonLevel2.ButtonUp(); + this.buttonLevel3.ButtonUp(); + this.buttonLevel1.Enabled = true; + this.buttonLevel2.Enabled = true; + this.buttonLevel3.Enabled = true; + + this.labelAccessRight.Text = ""; + + this.checkBoxMainProductChange.Checked = false; + this.checkBoxMainClear.Checked = false; + this.checkBoxMainSubMenu.Checked = false; + + this.checkBoxMenuRecipe.Checked = false; + this.checkBoxMenuUserEditor.Checked = false; + this.checkBoxMenuUserGroupEditor.Checked = false; + this.checkBoxMenuIOTest.Checked = false; + this.checkBoxMenuHistoryLog.Checked = false; + this.checkBoxMenuCheckLog.Checked = false; + this.checkBoxMenuAlarmList.Checked = false; + this.checkBoxMenuInformation.Checked = false; + this.checkBoxMenuEquipment.Checked = false; break; } } @@ -409,26 +468,20 @@ namespace INT_PT002.Controls this.SelectedUserItem.IsLockPassword = item.flock_status_password == 0 ? false : true; this.SelectedUserItem.IsAdmin = item.fadmin == 0 ? false : true; - this.SelectedUserItem.IsMainRecipeChange = item.menuID.fMenu[0]; - this.SelectedUserItem.IsMainClear = item.menuID.fMenu[1]; - this.SelectedUserItem.IsMainSubMenu = item.menuID.fMenu[2]; + this.SelectedUserItem.ActiveLevel = item.active_level; - this.SelectedUserItem.IsMenuProduct = item.menuID.fMenu[3]; - this.SelectedUserItem.IsMenuUserSetting = item.menuID.fMenu[4]; - this.SelectedUserItem.IsMenuUserGroupEditor = item.menuID.fMenu[5]; - this.SelectedUserItem.IsMenuIOTest = item.menuID.fMenu[6]; - this.SelectedUserItem.IsMenuEquipmentLog = item.menuID.fMenu[7]; - this.SelectedUserItem.IsMenuCheckLog = item.menuID.fMenu[8]; - this.SelectedUserItem.IsMenuAlarmList = item.menuID.fMenu[9]; - this.SelectedUserItem.IsMenuInformation = item.menuID.fMenu[10]; - this.SelectedUserItem.IsMenuEquipmentTest = item.menuID.fMenu[11]; - - if (item.menuID.fMenu[25] == true) + if (this.SelectedUserItem.ActiveLevel == 1) this.SelectedUserItem.Status = Define.E_UserStatus.Level1; - else if(item.menuID.fMenu[26] == true) + else if (this.SelectedUserItem.ActiveLevel == 2) this.SelectedUserItem.Status = Define.E_UserStatus.Level2; - else if(item.menuID.fMenu[27] == true) + else if (this.SelectedUserItem.ActiveLevel == 3) this.SelectedUserItem.Status = Define.E_UserStatus.Level3; + else if (this.SelectedUserItem.ActiveLevel == 9) + this.SelectedUserItem.Status = Define.E_UserStatus.Admin; + else if (this.SelectedUserItem.ActiveLevel == 10) + this.SelectedUserItem.Status = Define.E_UserStatus.Developer; + else + this.SelectedUserItem.Status = Define.E_UserStatus.None; } private void UpdateCurrentUserItem(UserManager.UserMgr_user_info_t item) { @@ -452,34 +505,24 @@ namespace INT_PT002.Controls this.SelectedUserItem.IsLockPassword = item.flock_status_password == 0 ? false : true; this.SelectedUserItem.IsAdmin = item.fadmin == 0 ? false : true; - this.SelectedUserItem.IsMainRecipeChange = item.menuID.fMenu[0]; - this.SelectedUserItem.IsMainClear = item.menuID.fMenu[1]; - this.SelectedUserItem.IsMainSubMenu = item.menuID.fMenu[2]; - - this.SelectedUserItem.IsMenuProduct = item.menuID.fMenu[3]; - this.SelectedUserItem.IsMenuUserSetting = item.menuID.fMenu[4]; - this.SelectedUserItem.IsMenuUserGroupEditor = item.menuID.fMenu[5]; - this.SelectedUserItem.IsMenuIOTest = item.menuID.fMenu[6]; - this.SelectedUserItem.IsMenuEquipmentLog = item.menuID.fMenu[7]; - this.SelectedUserItem.IsMenuCheckLog = item.menuID.fMenu[8]; - this.SelectedUserItem.IsMenuAlarmList = item.menuID.fMenu[9]; - this.SelectedUserItem.IsMenuInformation = item.menuID.fMenu[10]; - this.SelectedUserItem.IsMenuEquipmentTest = item.menuID.fMenu[11]; - - if (item.menuID.fMenu[25] == true) + this.SelectedUserItem.ActiveLevel = item.active_level; + + if (item.active_level == 1) this.SelectedUserItem.Status = Define.E_UserStatus.Level1; - else if (item.menuID.fMenu[26] == true) + else if(item.active_level == 2) this.SelectedUserItem.Status = Define.E_UserStatus.Level2; - else if (item.menuID.fMenu[27] == true) + else if (item.active_level == 3) this.SelectedUserItem.Status = Define.E_UserStatus.Level3; + else if (item.active_level == 9) + this.SelectedUserItem.Status = Define.E_UserStatus.Admin; + else if (item.active_level == 10) + this.SelectedUserItem.Status = Define.E_UserStatus.Developer; } private void UpdateSelectUserDisplay(UserItem item) { // 화면 Enable 처리 추가할것 this.ChangeUserControlEnable(true); - this.textBoxID.Enabled = false; - this.textBoxID.BackColor = Color.Silver; - this.labelIDBackGround.BackGroundColor = Color.Silver; + this.SetEnableID(false); this.textBoxID.Text = item.ID; this.textBoxPassword.Text = item.Password; @@ -561,18 +604,12 @@ namespace INT_PT002.Controls this.UpdateUserListBoxDisplay(this.ParentForm.ParentForm.ListDllUserName); this.listBoxUserList.SelectItemIndex = this.listBoxUserList.ItemCount - 1; - this.textBoxID.Enabled = false; - this.textBoxID.BackColor = Color.Silver; - this.labelIDBackGround.BackGroundColor = Color.Silver; - this.textBoxPassword.Enabled = false; - this.textBoxPassword.BackColor = Color.Silver; - this.labelPasswordBackGround.BackGroundColor = Color.Silver; + this.SetEnableID(false); + this.SetEnablePassword(false); this.labelExpiryDateOfAccount.Enabled = false; this.labelExpiryDateOfAccount.BackColor = Color.Silver; this.labelExpiryDateOfPassword.Enabled = false; this.labelExpiryDateOfPassword.BackColor = Color.Silver; - this.labelAutomaticLogoutTime.Enabled = false; - this.labelAutomaticLogoutTime.BackColor = Color.Silver; this.buttonDelete.Enabled = true; DialogFormMessage dlg = new DialogFormMessage(Define.E_MessageBoxIcon.Asterisk, code, message1, message2, 0); @@ -764,12 +801,8 @@ namespace INT_PT002.Controls this.buttonDelete.Enabled = true; this.groupBoxAccessRight.Enabled = true; this.listBoxUserList.Enabled = true; - this.textBoxPassword.Enabled = true; - this.labelPasswordBackGround.BackGroundColor = Color.White; - this.buttonPasswordEdit.Enabled = true; - this.textBoxID.Enabled = true; - this.labelIDBackGround.BackGroundColor = Color.White; - this.buttonIDEdit.Enabled = true; + this.SetEnableID(true); + this.SetEnablePassword(true); if (this.buttonSave.Visible == false) this.buttonSave.Visible = true; @@ -798,12 +831,8 @@ namespace INT_PT002.Controls this.buttonDelete.Enabled = true; this.groupBoxAccessRight.Enabled = true; this.listBoxUserList.Enabled = true; - this.textBoxPassword.Enabled = true; - this.labelPasswordBackGround.BackGroundColor = Color.White; - this.buttonPasswordEdit.Enabled = true; - this.textBoxID.Enabled = true; - this.labelIDBackGround.BackGroundColor = Color.White; - this.buttonIDEdit.Enabled = true; + this.SetEnableID(true); + this.SetEnablePassword(true); if (this.buttonSave.Visible == false) this.buttonSave.Visible = true; @@ -876,10 +905,8 @@ namespace INT_PT002.Controls this.buttonDelete.Enabled = false; this.groupBoxAccessRight.Enabled = false; this.listBoxUserList.Enabled = false; - this.buttonPasswordEdit.Enabled = false; - this.textBoxPassword.Enabled = false; - this.labelPasswordBackGround.BackGroundColor = Color.Silver; this.buttonIDEdit.Enabled = false; + this.SetEnablePassword(false); } private void buttonPasswordEdit_Click(object sender, EventArgs e) { @@ -898,9 +925,7 @@ namespace INT_PT002.Controls this.groupBoxAccessRight.Enabled = false; this.listBoxUserList.Enabled = false; this.buttonPasswordEdit.Enabled = false; - this.textBoxID.Enabled = false; - this.labelIDBackGround.BackGroundColor = Color.Silver; - this.buttonIDEdit.Enabled = false; + this.SetEnableID(false); } private void labelExpiryDateOfAccount_Click(object sender, EventArgs e) { diff --git a/INT_PT002/DataStore/Define.cs b/INT_PT002/DataStore/Define.cs index 96545ea..65c456b 100644 --- a/INT_PT002/DataStore/Define.cs +++ b/INT_PT002/DataStore/Define.cs @@ -139,7 +139,7 @@ namespace INT_PT002.DataStore f0_Level1 = 0, f1_Level2, f2_Level3, - f3_Default, + f3_Admin, f4_Developer, } diff --git a/INT_PT002/DataStore/User.cs b/INT_PT002/DataStore/User.cs index b5c27df..a54c11c 100644 --- a/INT_PT002/DataStore/User.cs +++ b/INT_PT002/DataStore/User.cs @@ -7,246 +7,6 @@ using System.Text; namespace INT_PT002.DataStore { - #region User - public class CollectionUser - { - #region Field - private Collection m_Level1Users; - private Collection m_Level2Users; - private Collection m_Level3Users; - - private User m_DefaultUsers; - private User m_DeveloperUser; - #endregion - - #region Constructor - public CollectionUser() - { - this.Initialize(); - } - #endregion - - #region Property - public Collection Level1Users - { - get { return this.m_Level1Users; } - set { this.m_Level1Users = value; } - } - public Collection Level2Users - { - get { return this.m_Level2Users; } - set { this.m_Level2Users = value; } - } - public Collection Level3Users - { - get { return this.m_Level3Users; } - set { this.m_Level3Users = value; } - } - - public User DefaultUsers - { - get { return this.m_DefaultUsers; } - set { this.m_DefaultUsers = value; } - } - public User DeveloperUser - { - get { return this.m_DeveloperUser; } - private set { this.m_DeveloperUser = value; } - } - #endregion - - #region Method - private void Initialize() - { - this.Level1Users = new Collection(); - this.Level2Users = new Collection(); - this.Level3Users = new Collection(); - - this.Level1Users.Clear(); - this.Level2Users.Clear(); - this.Level3Users.Clear(); - - for (int i = 0; i < 5; i++) - { - this.Level1Users.Add(new User()); - this.Level2Users.Add(new User()); - this.Level3Users.Add(new User()); - } - - this.DefaultUsers = new User(); - - this.DeveloperUser = new User(); - this.DeveloperUser.ID = "Intech"; - this.DeveloperUser.Password = "20090810"; - this.DeveloperUser.Group = Define.E_UserStatus.Developer; - } - - public User FindUser(string id) - { - User user = null; - - // 개발자 유저 검색 - if (id == this.DeveloperUser.ID) - { - user = new User(); - user.ID = this.DeveloperUser.ID; - user.Password = this.DeveloperUser.Password; - user.Group = this.DeveloperUser.Group; - return user; - } - - // 일반 유저 검색 - for (int i = 0; i < this.Level1Users.Count; i++) - { - if (this.Level1Users[i].Group != Define.E_UserStatus.None) - { - if (this.Level1Users[i].ID.Trim() == id.Trim()) - { - user = new User(); - user.ID = this.Level1Users[i].ID.Trim(); - user.Password = this.Level1Users[i].Password; - user.Group = this.Level1Users[i].Group; - return user; - } - } - - if (this.Level2Users[i].Group != Define.E_UserStatus.None) - { - if (this.Level2Users[i].ID.Trim() == id.Trim()) - { - user = new User(); - user.ID = this.Level2Users[i].ID.Trim(); - user.Password = this.Level2Users[i].Password; - user.Group = this.Level2Users[i].Group; - return user; - } - } - - if (this.Level3Users[i].Group != Define.E_UserStatus.None) - { - if (this.Level3Users[i].ID.Trim() == id.Trim()) - { - user = new User(); - user.ID = this.Level3Users[i].ID.Trim(); - user.Password = this.Level3Users[i].Password; - user.Group = this.Level3Users[i].Group; - return user; - } - } - } - - return user; - } - public User FindDeveloperUser(string id) - { - User user = null; - - // 개발자 유저 검색 - if (id == this.DeveloperUser.ID) - { - user = new User(); - user.ID = this.DeveloperUser.ID; - user.Password = this.DeveloperUser.Password; - user.Group = this.DeveloperUser.Group; - return user; - } - - return user; - } - - public bool SearchID(string id) - { - bool ret = false; - - for (int i = 0; i < this.Level1Users.Count; i++) - { - if (this.Level1Users[i].ID.Trim() == id.Trim()) - return ret = true; - } - for (int i = 0; i < this.Level2Users.Count; i++) - { - if (this.Level2Users[i].ID.Trim() == id.Trim()) - return ret = true; - } - for (int i = 0; i < this.Level3Users.Count; i++) - { - if (this.Level3Users[i].ID.Trim() == id.Trim()) - return ret = true; - } - - return ret; - } - #endregion - } - #endregion - #region User - public class User - { - #region Field - private string m_ID; - private string m_Password; - private Define.E_UserStatus m_Group; - #endregion - - #region Constructor - public User() - { - this.Initialize(); - } - #endregion - - #region Property - public string ID - { - get { return this.m_ID; } - set { this.m_ID = value; } - } - public string Password - { - get { return this.m_Password; } - set { this.m_Password = value; } - } - public Define.E_UserStatus Group - { - get { return this.m_Group; } - set { this.m_Group = value; } - } - #endregion - - #region Method - private void Initialize() - { - this.ID = "-"; - this.Password = "-"; - this.Group = Define.E_UserStatus.None; - } - #endregion - } - #endregion - #region StructUserItem - [StructLayout(LayoutKind.Sequential)] - public struct StructUserItemPrevious - { - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] - public string ID; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] - public string Password; - - public Define.E_UserStatus Group; - - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] - public string Dummy1; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] - public string Dummy2; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] - public string Dummy3; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] - public string Dummy4; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] - public string Dummy5; - } - #endregion - #region UserGroup public class UserGroup { @@ -254,7 +14,7 @@ namespace INT_PT002.DataStore private UserGroupItem m_Level1; private UserGroupItem m_Level2; private UserGroupItem m_Level3; - private UserGroupItem m_Default; + private UserGroupItem m_Admin; #endregion #region Constructor @@ -280,10 +40,11 @@ namespace INT_PT002.DataStore get { return this.m_Level3; } set { this.m_Level3 = value; } } - public UserGroupItem Default + + public UserGroupItem Admin { - get { return this.m_Default; } - set { this.m_Default = value; } + get { return this.m_Admin; } + set { this.m_Admin = value; } } #endregion @@ -293,7 +54,7 @@ namespace INT_PT002.DataStore this.Level1 = new UserGroupItem(); this.Level2 = new UserGroupItem(); this.Level3 = new UserGroupItem(); - this.Default = new UserGroupItem(); + this.Admin = new UserGroupItem(); } public bool GetSet1AccessRight(Define.E_FormStore display) @@ -568,19 +329,7 @@ namespace INT_PT002.DataStore private bool m_IsAdmin; - private bool m_IsMainRecipeChange; - private bool m_IsMainClear; - private bool m_IsMainSubMenu; - - private bool m_IsMenuProduct; - private bool m_IsMenuUserSetting; - private bool m_IsMenuUserGroupEditor; - private bool m_IsMenuIOTest; - private bool m_IsMenuEquipmentLog; - private bool m_IsMenuCheckLog; - private bool m_IsMenuAlarmList; - private bool m_IsMenuInformation; - private bool m_IsMenuEquipmentTest; + private int m_ActiveLevel; #endregion #region Constructor @@ -678,66 +427,10 @@ namespace INT_PT002.DataStore set { this.m_IsAdmin = value; } } - public bool IsMainRecipeChange + public int ActiveLevel { - get { return this.m_IsMainRecipeChange; } - set { this.m_IsMainRecipeChange = value; } - } - public bool IsMainClear - { - get { return this.m_IsMainClear; } - set { this.m_IsMainClear = value; } - } - public bool IsMainSubMenu - { - get { return this.m_IsMainSubMenu; } - set { this.m_IsMainSubMenu = value; } - } - - public bool IsMenuProduct - { - get { return this.m_IsMenuProduct; } - set { this.m_IsMenuProduct = value; } - } - public bool IsMenuUserSetting - { - get { return this.m_IsMenuUserSetting; } - set { this.m_IsMenuUserSetting = value; } - } - public bool IsMenuUserGroupEditor - { - get { return this.m_IsMenuUserGroupEditor; } - set { this.m_IsMenuUserGroupEditor = value; } - } - public bool IsMenuIOTest - { - get { return this.m_IsMenuIOTest; } - set { this.m_IsMenuIOTest = value; } - } - public bool IsMenuEquipmentLog - { - get { return this.m_IsMenuEquipmentLog; } - set { this.m_IsMenuEquipmentLog = value; } - } - public bool IsMenuCheckLog - { - get { return this.m_IsMenuCheckLog; } - set { this.m_IsMenuCheckLog = value; } - } - public bool IsMenuAlarmList - { - get { return this.m_IsMenuAlarmList; } - set { this.m_IsMenuAlarmList = value; } - } - public bool IsMenuInformation - { - get { return this.m_IsMenuInformation; } - set { this.m_IsMenuInformation = value; } - } - public bool IsMenuEquipmentTest - { - get { return this.m_IsMenuEquipmentTest; } - set { this.m_IsMenuEquipmentTest = value; } + get { return this.m_ActiveLevel; } + set { this.m_ActiveLevel = value; } } #endregion @@ -746,12 +439,12 @@ namespace INT_PT002.DataStore { this.IsUpdate = false; - this.ID = "-"; - this.Password = "-"; + this.ID = ""; + this.Password = ""; - this.PreviousPassword1 = "-"; - this.PreviousPassword2 = "-"; - this.PreviousPassword3 = "-"; + this.PreviousPassword1 = ""; + this.PreviousPassword2 = ""; + this.PreviousPassword3 = ""; this.ExpireAccount = 0; this.ExpirePassword = 0; @@ -765,19 +458,7 @@ namespace INT_PT002.DataStore this.IsAdmin = false; - this.IsMainRecipeChange = false; - this.IsMainClear = false; - this.IsMainSubMenu = false; - - this.IsMenuProduct = false; - this.IsMenuUserSetting = false; - this.IsMenuUserGroupEditor = false; - this.IsMenuIOTest = false; - this.IsMenuEquipmentLog = false; - this.IsMenuCheckLog = false; - this.IsMenuAlarmList = false; - this.IsMenuInformation = false; - this.IsMenuEquipmentTest = false; + this.ActiveLevel = 1; } public void SetPassword(string pass) @@ -803,44 +484,4 @@ namespace INT_PT002.DataStore #endregion } #endregion - #region StructUserItem - [StructLayout(LayoutKind.Sequential)] - public struct StructUserItem - { - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] - public string ID; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] - public string Password; - - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] - public string PreviousPassword1; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] - public string PreviousPassword2; - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] - public string PreviousPassword3; - - public int ExpireAccount; - public int ExpirePassword; - - public DateTime DateRegister; - public DateTime DateLogin; - - public bool IsAdmin; - - public bool IsMainProductChange; - public bool IsMainWeightSetting; - public bool IsMainClear; - public bool IsMainSubMenu; - - public bool IsMenuProduct; - public bool IsMenuUserSetting; - public bool IsMenuUserGroupEditor; - public bool IsMenuIOTest; - public bool IsMenuEquipmentLog; - public bool IsMenuCheckLog; - public bool IsMenuAlarmList; - public bool IsMenuInformation; - public bool IsMenuStatus; - } - #endregion } diff --git a/INT_PT002/DialogForms/DialogFormLogOn.cs b/INT_PT002/DialogForms/DialogFormLogOn.cs index 4f2ab93..4295698 100644 --- a/INT_PT002/DialogForms/DialogFormLogOn.cs +++ b/INT_PT002/DialogForms/DialogFormLogOn.cs @@ -202,16 +202,16 @@ namespace INT_PT002.Forms //MessageBox.Show("로그인 성공"); #region 로그인 성공 - if (userInfo.user_id == "Intech") - this.ParentForm.CurrentSystemStatus.CurrentUser.Status = Define.E_UserStatus.Developer; - else if (userInfo.user_id == "Admin00") - this.ParentForm.CurrentSystemStatus.CurrentUser.Status = Define.E_UserStatus.Admin; - else if (userInfo.menuID.fMenu[25] == true) + if (userInfo.active_level == 1) this.ParentForm.CurrentSystemStatus.CurrentUser.Status = Define.E_UserStatus.Level1; - else if (userInfo.menuID.fMenu[26] == true) + else if (userInfo.active_level == 2) this.ParentForm.CurrentSystemStatus.CurrentUser.Status = Define.E_UserStatus.Level2; - else if (userInfo.menuID.fMenu[27] == true) + else if (userInfo.active_level == 3) this.ParentForm.CurrentSystemStatus.CurrentUser.Status = Define.E_UserStatus.Level3; + else if(userInfo.active_level == 9) + this.ParentForm.CurrentSystemStatus.CurrentUser.Status = Define.E_UserStatus.Admin; + else if (userInfo.active_level == 10) + this.ParentForm.CurrentSystemStatus.CurrentUser.Status = Define.E_UserStatus.Developer; this.ParentForm.CurrentSystemStatus.CurrentUser.ID = userInfo.user_id; this.ParentForm.CurrentSystemStatus.CurrentUser.Password = userInfo.user_pw; @@ -233,19 +233,7 @@ namespace INT_PT002.Forms this.ParentForm.CurrentSystemStatus.CurrentUser.IsAdmin = userInfo.fadmin == 0 ? false : true; - this.ParentForm.CurrentSystemStatus.CurrentUser.IsMainRecipeChange = userInfo.menuID.fMenu[0]; - this.ParentForm.CurrentSystemStatus.CurrentUser.IsMainClear = userInfo.menuID.fMenu[1]; - this.ParentForm.CurrentSystemStatus.CurrentUser.IsMainSubMenu = userInfo.menuID.fMenu[2]; - - this.ParentForm.CurrentSystemStatus.CurrentUser.IsMenuProduct = userInfo.menuID.fMenu[3]; - this.ParentForm.CurrentSystemStatus.CurrentUser.IsMenuUserSetting = userInfo.menuID.fMenu[4]; - this.ParentForm.CurrentSystemStatus.CurrentUser.IsMenuUserGroupEditor = userInfo.menuID.fMenu[5]; - this.ParentForm.CurrentSystemStatus.CurrentUser.IsMenuIOTest = userInfo.menuID.fMenu[6]; - this.ParentForm.CurrentSystemStatus.CurrentUser.IsMenuEquipmentLog = userInfo.menuID.fMenu[7]; - this.ParentForm.CurrentSystemStatus.CurrentUser.IsMenuCheckLog = userInfo.menuID.fMenu[8]; - this.ParentForm.CurrentSystemStatus.CurrentUser.IsMenuAlarmList = userInfo.menuID.fMenu[9]; - this.ParentForm.CurrentSystemStatus.CurrentUser.IsMenuInformation = userInfo.menuID.fMenu[10]; - this.ParentForm.CurrentSystemStatus.CurrentUser.IsMenuEquipmentTest = userInfo.menuID.fMenu[11]; + this.ParentForm.CurrentSystemStatus.CurrentUser.ActiveLevel = userInfo.active_level; #endregion this.DialogResult = DialogResult.OK; diff --git a/INT_PT002/DialogForms/DialogFormMessage.cs b/INT_PT002/DialogForms/DialogFormMessage.cs index 050fdf8..b696c50 100644 --- a/INT_PT002/DialogForms/DialogFormMessage.cs +++ b/INT_PT002/DialogForms/DialogFormMessage.cs @@ -724,7 +724,7 @@ namespace INT_PT002.DialogForms this.Location = new Point(x, y); - this.Size = new Size(450, 155); + this.Size = new Size(452, 157); } private void PictureBoxVisible(bool bValue) @@ -742,7 +742,6 @@ namespace INT_PT002.DialogForms base.OnLoad(e); this.InitializeControl(); - this.Size = new Size(450, 155); } #endregion diff --git a/INT_PT002/DialogForms/DialogFormProgressBar.cs b/INT_PT002/DialogForms/DialogFormProgressBar.cs index 1c4a4b2..a726795 100644 --- a/INT_PT002/DialogForms/DialogFormProgressBar.cs +++ b/INT_PT002/DialogForms/DialogFormProgressBar.cs @@ -688,6 +688,11 @@ namespace INT_PT002.DialogForms else this.UpdateMainBoardFail(this.Language); } + private void smartTimerReboot_Tick(object sender, EventArgs e) + { + this.smartTimerReboot.Stop(); + SmartX.SmartConfigs.ReBoot(); + } private void buttonOK_Click(object sender, EventArgs e) { @@ -696,11 +701,5 @@ namespace INT_PT002.DialogForms this.Close(); } #endregion - - private void smartTimerReboot_Tick(object sender, EventArgs e) - { - this.smartTimerReboot.Stop(); - SmartX.SmartConfigs.ReBoot(); - } } } \ No newline at end of file diff --git a/INT_PT002/DialogForms/DialogFormYesNo.cs b/INT_PT002/DialogForms/DialogFormYesNo.cs index c057eb5..564a00d 100644 --- a/INT_PT002/DialogForms/DialogFormYesNo.cs +++ b/INT_PT002/DialogForms/DialogFormYesNo.cs @@ -330,7 +330,7 @@ namespace INT_PT002.DialogForms y = Screen.PrimaryScreen.Bounds.Height / 2 - this.Size.Height / 2; this.Location = new Point(x, y); - this.Size = new Size(452, 162); + this.Size = new Size(452, 157); } #endregion diff --git a/INT_PT002/Forms/FormMain.cs b/INT_PT002/Forms/FormMain.cs index 1a205e1..c7188d2 100644 --- a/INT_PT002/Forms/FormMain.cs +++ b/INT_PT002/Forms/FormMain.cs @@ -2039,20 +2039,20 @@ namespace INT_PT002.Forms this.smartFileIO.StructType.Write(structItem, (int)Define.E_UserGroup.f2_Level3, SmartFile.WriteMode.Overwrite); #endregion - #region Default - structItem.IsMainDisplayRecipeChange = item.Default.IsMainDisplayProductChange; - structItem.IsMainDisplayClear = item.Default.IsMainDisplayClear; - structItem.IsMainDispalySubMenu = item.Default.IsMainDisplaySubMenu; + #region Admin + structItem.IsMainDisplayRecipeChange = item.Admin.IsMainDisplayProductChange; + structItem.IsMainDisplayClear = item.Admin.IsMainDisplayClear; + structItem.IsMainDispalySubMenu = item.Admin.IsMainDisplaySubMenu; - structItem.IsMenuRecipe = item.Default.IsMenuRecipe; - structItem.IsMenuUserSetting = item.Default.IsMenuUserSetting; - structItem.IsMenuUserGroupEditor = item.Default.IsMenuUserGroupEditor; - structItem.IsMenuIOTest = item.Default.IsMenuIOTest; - structItem.IsMenuEquipmentLog = item.Default.IsMenuHistoryLog; - structItem.IsMenuCheckLog = item.Default.IsMenuInspectionLog; - structItem.IsMenuAlarmList = item.Default.IsMenuAlarmLog; - structItem.IsMenuInformation = item.Default.IsMenuInformation; - structItem.IsMenuStatus = item.Default.IsMenuStatus; + structItem.IsMenuRecipe = item.Admin.IsMenuRecipe; + structItem.IsMenuUserSetting = item.Admin.IsMenuUserSetting; + structItem.IsMenuUserGroupEditor = item.Admin.IsMenuUserGroupEditor; + structItem.IsMenuIOTest = item.Admin.IsMenuIOTest; + structItem.IsMenuEquipmentLog = item.Admin.IsMenuHistoryLog; + structItem.IsMenuCheckLog = item.Admin.IsMenuInspectionLog; + structItem.IsMenuAlarmList = item.Admin.IsMenuAlarmLog; + structItem.IsMenuInformation = item.Admin.IsMenuInformation; + structItem.IsMenuStatus = item.Admin.IsMenuStatus; structItem.Dummy1 = false; structItem.Dummy2 = false; @@ -2073,7 +2073,7 @@ namespace INT_PT002.Forms structItem.Dummy17 = false; structItem.Dummy18 = false; - this.smartFileIO.StructType.Write(structItem, (int)Define.E_UserGroup.f3_Default, SmartFile.WriteMode.Overwrite); + this.smartFileIO.StructType.Write(structItem, (int)Define.E_UserGroup.f3_Admin, SmartFile.WriteMode.Overwrite); #endregion this.smartFileIO.Close(); @@ -2249,7 +2249,7 @@ namespace INT_PT002.Forms this.smartFileIO.Close(); } - public void SaveUserGroupFile_NotLogin(UserGroupItem item) + public void SaveUserGroupFile_Admin(UserGroupItem item) { string fullFilePath = ""; bool fileCheck = false; @@ -2301,7 +2301,7 @@ namespace INT_PT002.Forms structItem.Dummy17 = false; structItem.Dummy18 = false; - this.smartFileIO.StructType.Write(structItem, (int)Define.E_UserGroup.f3_Default, SmartFile.WriteMode.Overwrite); + this.smartFileIO.StructType.Write(structItem, (int)Define.E_UserGroup.f3_Admin, SmartFile.WriteMode.Overwrite); #endregion this.smartFileIO.Close(); @@ -2383,21 +2383,21 @@ namespace INT_PT002.Forms #endregion #region Default - structItem = (StructUserGroupItem)this.smartFileIO.StructType.ReadBuffer((int)Define.E_UserGroup.f3_Default); + structItem = (StructUserGroupItem)this.smartFileIO.StructType.ReadBuffer((int)Define.E_UserGroup.f3_Admin); - item.Default.IsMainDisplayProductChange = structItem.IsMainDisplayRecipeChange; - item.Default.IsMainDisplayClear = structItem.IsMainDisplayClear; - item.Default.IsMainDisplaySubMenu = structItem.IsMainDispalySubMenu; + item.Admin.IsMainDisplayProductChange = structItem.IsMainDisplayRecipeChange; + item.Admin.IsMainDisplayClear = structItem.IsMainDisplayClear; + item.Admin.IsMainDisplaySubMenu = structItem.IsMainDispalySubMenu; - item.Default.IsMenuRecipe = structItem.IsMenuRecipe; - item.Default.IsMenuUserSetting = structItem.IsMenuUserSetting; - item.Default.IsMenuUserGroupEditor = structItem.IsMenuUserGroupEditor; - item.Default.IsMenuIOTest = structItem.IsMenuIOTest; - item.Default.IsMenuHistoryLog = structItem.IsMenuEquipmentLog; - item.Default.IsMenuInspectionLog = structItem.IsMenuCheckLog; - item.Default.IsMenuAlarmLog = structItem.IsMenuAlarmList; - item.Default.IsMenuInformation = structItem.IsMenuInformation; - item.Default.IsMenuStatus = structItem.IsMenuStatus; + item.Admin.IsMenuRecipe = structItem.IsMenuRecipe; + item.Admin.IsMenuUserSetting = structItem.IsMenuUserSetting; + item.Admin.IsMenuUserGroupEditor = structItem.IsMenuUserGroupEditor; + item.Admin.IsMenuIOTest = structItem.IsMenuIOTest; + item.Admin.IsMenuHistoryLog = structItem.IsMenuEquipmentLog; + item.Admin.IsMenuInspectionLog = structItem.IsMenuCheckLog; + item.Admin.IsMenuAlarmLog = structItem.IsMenuAlarmList; + item.Admin.IsMenuInformation = structItem.IsMenuInformation; + item.Admin.IsMenuStatus = structItem.IsMenuStatus; #endregion } catch diff --git a/INT_PT002/Forms/FormMainDisplay2.cs b/INT_PT002/Forms/FormMainDisplay2.cs index 72b5709..023f63d 100644 --- a/INT_PT002/Forms/FormMainDisplay2.cs +++ b/INT_PT002/Forms/FormMainDisplay2.cs @@ -304,43 +304,99 @@ namespace INT_PT002.Forms { string id = "", group = ""; - if (user.Status == Define.E_UserStatus.NotLogin) + switch (user.Status) { - id = ""; - group = ""; + case Define.E_UserStatus.None: + break; + case Define.E_UserStatus.Level1: + id = user.ID; + group = user.Status.ToString(); - this.buttonRecipeNo.Enabled = true; - this.buttonClear.Enabled = true; - this.buttonInspection.Enabled = true; - this.buttonMenu.Enabled = true; - } - else if (user.Status == Define.E_UserStatus.LogOff) - { - id = "LogOff"; - group = ""; + if (this.labelUserLevel.TextColor != this.ParentForm.ColorLogOn) + this.labelUserLevel.TextColor = this.labelUserID.TextColor = this.ParentForm.ColorLogOn; - if (this.labelUserLevel.TextColor != this.ParentForm.ColorLogOff) - this.labelUserLevel.TextColor = this.labelUserID.TextColor = this.ParentForm.ColorLogOff; + this.buttonUser.ButtonDown(); + this.buttonRecipeNo.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMainDisplayProductChange; + this.buttonClear.Enabled = this.ParentForm.CurrentUserGroup.Level1.IsMainDisplayClear; + this.buttonInspection.Enabled = true; + this.buttonMenu.Enabled = true; + break; + case Define.E_UserStatus.Level2: + id = user.ID; + group = user.Status.ToString(); - this.buttonUser.ButtonUp(); - this.buttonRecipeNo.Enabled = false; - this.buttonClear.Enabled = false; - this.buttonInspection.Enabled = false; - this.buttonMenu.Enabled = false; - } - else - { - id = user.ID; - group = user.Status.ToString(); + if (this.labelUserLevel.TextColor != this.ParentForm.ColorLogOn) + this.labelUserLevel.TextColor = this.labelUserID.TextColor = this.ParentForm.ColorLogOn; - if (this.labelUserLevel.TextColor != this.ParentForm.ColorLogOn) - this.labelUserLevel.TextColor = this.labelUserID.TextColor = this.ParentForm.ColorLogOn; + this.buttonUser.ButtonDown(); + this.buttonRecipeNo.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMainDisplayProductChange; + this.buttonClear.Enabled = this.ParentForm.CurrentUserGroup.Level2.IsMainDisplayClear; + this.buttonInspection.Enabled = true; + this.buttonMenu.Enabled = true; + break; + case Define.E_UserStatus.Level3: + id = user.ID; + group = user.Status.ToString(); - this.buttonUser.ButtonDown(); - this.buttonRecipeNo.Enabled = user.IsMainRecipeChange; - this.buttonClear.Enabled = user.IsMainClear; - this.buttonInspection.Enabled = true; - this.buttonMenu.Enabled = true; + if (this.labelUserLevel.TextColor != this.ParentForm.ColorLogOn) + this.labelUserLevel.TextColor = this.labelUserID.TextColor = this.ParentForm.ColorLogOn; + + this.buttonUser.ButtonDown(); + this.buttonRecipeNo.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMainDisplayProductChange; + this.buttonClear.Enabled = this.ParentForm.CurrentUserGroup.Level3.IsMainDisplayClear; + this.buttonInspection.Enabled = true; + this.buttonMenu.Enabled = true; + break; + case Define.E_UserStatus.Admin: + id = user.ID; + group = user.Status.ToString(); + + if (this.labelUserLevel.TextColor != this.ParentForm.ColorLogOn) + this.labelUserLevel.TextColor = this.labelUserID.TextColor = this.ParentForm.ColorLogOn; + + this.buttonUser.ButtonDown(); + this.buttonRecipeNo.Enabled = true; + this.buttonClear.Enabled = true; + this.buttonInspection.Enabled = true; + this.buttonMenu.Enabled = true; + break; + case Define.E_UserStatus.Developer: + id = user.ID; + group = user.Status.ToString(); + + if (this.labelUserLevel.TextColor != this.ParentForm.ColorLogOn) + this.labelUserLevel.TextColor = this.labelUserID.TextColor = this.ParentForm.ColorLogOn; + + this.buttonUser.ButtonDown(); + this.buttonRecipeNo.Enabled = true; + this.buttonClear.Enabled = true; + this.buttonInspection.Enabled = true; + this.buttonMenu.Enabled = true; + break; + case Define.E_UserStatus.NotLogin: + id = ""; + group = ""; + + this.buttonRecipeNo.Enabled = true; + this.buttonClear.Enabled = true; + this.buttonInspection.Enabled = true; + this.buttonMenu.Enabled = true; + break; + case Define.E_UserStatus.LogOff: + id = "LogOff"; + group = ""; + + if (this.labelUserLevel.TextColor != this.ParentForm.ColorLogOff) + this.labelUserLevel.TextColor = this.labelUserID.TextColor = this.ParentForm.ColorLogOff; + + this.buttonUser.ButtonUp(); + this.buttonRecipeNo.Enabled = false; + this.buttonClear.Enabled = false; + this.buttonInspection.Enabled = false; + this.buttonMenu.Enabled = false; + break; + default: + break; } if (this.labelUserLevel.Text != group) diff --git a/INT_PT002/Part11_UserManager/UserManager.Define.cs b/INT_PT002/Part11_UserManager/UserManager.Define.cs index b36e553..54ccddd 100644 --- a/INT_PT002/Part11_UserManager/UserManager.Define.cs +++ b/INT_PT002/Part11_UserManager/UserManager.Define.cs @@ -101,10 +101,10 @@ namespace INT_PT002.Part11_UserManager private static extern void DLL_UserMgr_Deactivation(); [DllImport(PathDll, CallingConvention = CallingConvention.Winapi)] - private static extern int DLL_UserMgr_UserNew(IntPtr user_id, IntPtr user_pw, int fadmin, int expire_pw, int expire_account, IntPtr menuId); + private static extern int DLL_UserMgr_UserNew(IntPtr user_id, IntPtr user_pw, int fadmin, int expire_pw, int expire_account, int active_level, IntPtr menuId); [DllImport(PathDll, CallingConvention = CallingConvention.Winapi)] - private static extern int DLL_UserMgr_UserAdd(IntPtr user_id, IntPtr user_pw, int fadmin, int expire_pw, int expire_account, DateTime_t dateRegister, DateTime_t dateLogin); + private static extern int DLL_UserMgr_UserAdd(IntPtr user_id, IntPtr user_pw, int fadmin, int expire_pw, int expire_account, int active_level, DateTime_t dateRegister, DateTime_t dateLogin); [DllImport(PathDll, CallingConvention = CallingConvention.Winapi)] private static extern int DLL_UserMgr_UserAddHistoryPW(IntPtr user_id, IntPtr user_pw); @@ -113,7 +113,7 @@ namespace INT_PT002.Part11_UserManager private static extern int DLL_UserMgr_UserResetHistoryPW(IntPtr user_id); [DllImport(PathDll, CallingConvention = CallingConvention.Winapi)] - private static extern int DLL_UserMgr_UserModify(IntPtr user_id, IntPtr user_pw, int fadmin, int expire_pw, int expire_account, IntPtr menuId); + private static extern int DLL_UserMgr_UserModify(IntPtr user_id, IntPtr user_pw, int fadmin, int expire_pw, int expire_account, int active_level, IntPtr menuId); [DllImport(PathDll, CallingConvention = CallingConvention.Winapi)] private static extern int DLL_UserMgr_UserModifyPW(IntPtr user_id, IntPtr user_pw); @@ -122,7 +122,7 @@ namespace INT_PT002.Part11_UserManager private static extern int DLL_UserMgr_UserModifyID(IntPtr user_org_id, IntPtr user_new_id); [DllImport(PathDll, CallingConvention = CallingConvention.Winapi)] - private static extern int DLL_UserMgr_UserModifyOthers(IntPtr user_id, int fadmin, int expire_pw, int expire_account); + private static extern int DLL_UserMgr_UserModifyOthers(IntPtr user_id, int fadmin, int expire_pw, int expire_account, int active_level); [DllImport(PathDll, CallingConvention = CallingConvention.Winapi)] private static extern int DLL_UserMgr_UserDel(IntPtr user_id); diff --git a/INT_PT002/Part11_UserManager/UserManager.Structure.cs b/INT_PT002/Part11_UserManager/UserManager.Structure.cs index 7de15da..08fb8d3 100644 --- a/INT_PT002/Part11_UserManager/UserManager.Structure.cs +++ b/INT_PT002/Part11_UserManager/UserManager.Structure.cs @@ -58,6 +58,9 @@ namespace INT_PT002.Part11_UserManager public const int DEFAULT_LOGIN_AUTO_TIMEOUT_MIN = 30; // 30 min during login, auto logout timeout public const int USER_MENU_ID_MAX = 30; // MenuID_t buffer Size + + public const int MAX_ACTIVE_LEVEL = 10; // menu active level + public const int INVALID_ACTIVE_LEVEL = 0; #endregion #region Enum E_user_mgr_status @@ -94,25 +97,25 @@ namespace INT_PT002.Part11_UserManager #region Enum E_user_mgr_menu_id public enum E_user_mgr_menu_id { - USER_MENU_ID_PRODUCT_NO = 0x00, - USER_MENU_ID_WEIGHT_SETTING, - USER_MENU_ID_CLEAR, - USER_MENU_ID_TIME_SETTING, - USER_MENU_ID_INFORMATION, + USER_MENU_ID_RESERVE_0 = 0x00, + USER_MENU_ID_RESERVE_1, + USER_MENU_ID_RESERVE_2, + USER_MENU_ID_RESERVE_3, + USER_MENU_ID_RESERVE_4, - USER_MENU_ID_DATA_BACKUP, - USER_MENU_ID_CALIBRATION, - USER_MENU_ID_CONFIGURATION, - USER_MENU_ID_UPDATE, - USER_MENU_ID_SYSTEM_SETTING, + USER_MENU_ID_RESERVE_5, + USER_MENU_ID_RESERVE_6, + USER_MENU_ID_RESERVE_7, + USER_MENU_ID_RESERVE_8, + USER_MENU_ID_RESERVE_9, - USER_MENU_ID_FACTORY_RESET, - USER_MENU_ID_MOTOR_SETTING, - USER_MENU_ID_EQUIPMENT_SETTING, - USER_MENU_ID_IO_TEST, - USER_MENU_ID_USER_EDITOR, + USER_MENU_ID_RESERVE_10, + USER_MENU_ID_RESERVE_11, + USER_MENU_ID_RESERVE_12, + USER_MENU_ID_RESERVE_13, + USER_MENU_ID_RESERVE_14, - USER_MENU_ID_DATA_STATISTICS, + USER_MENU_ID_RESERVE_15, USER_MENU_ID_RESERVE_16, USER_MENU_ID_RESERVE_17, USER_MENU_ID_RESERVE_18, @@ -234,6 +237,9 @@ namespace INT_PT002.Part11_UserManager [MarshalAs(UnmanagedType.Struct)] public MenuID_t menuID; + + [MarshalAs(UnmanagedType.I4)] + public Int32 active_level; } #endregion @@ -341,6 +347,9 @@ namespace INT_PT002.Part11_UserManager [MarshalAs(UnmanagedType.Struct)] public DateTime_t expire_account_date; + [MarshalAs(UnmanagedType.I4)] + public Int32 active_level; + [MarshalAs(UnmanagedType.Struct)] public MenuID_t menuID; } diff --git a/INT_PT002/Part11_UserManager/UserManager.cs b/INT_PT002/Part11_UserManager/UserManager.cs index eff6b3f..dae888e 100644 --- a/INT_PT002/Part11_UserManager/UserManager.cs +++ b/INT_PT002/Part11_UserManager/UserManager.cs @@ -92,53 +92,53 @@ namespace INT_PT002.Part11_UserManager loginDateTime.SetDate(2021, 9, 1); loginDateTime.SetTime(10, 21, 12); - UserManager_UserAdd("Intech", "test12#$", 1, 90, 90, regDateTime, loginDateTime); - UserManager_UserAdd("Admin00", "test12#$", 1, 90, 90, regDateTime, loginDateTime); + UserManager_UserAdd("Intech", "test12#$", 1, 90, 90, 1, regDateTime, loginDateTime); + UserManager_UserAdd("Admin00", "test12#$", 1, 90, 90, 1, regDateTime, loginDateTime); regDateTime.SetDate(2021, 10, 2); - UserManager_UserAdd("Test101", "test12#$", 0, 90, 90, regDateTime, loginDateTime); + UserManager_UserAdd("Test101", "test12#$", 0, 90, 90, 1, regDateTime, loginDateTime); regDateTime.SetDate(2021, 10, 3); - UserManager_UserAdd("Test102", "test12#$", 0, 90, 90, regDateTime, loginDateTime); + UserManager_UserAdd("Test102", "test12#$", 0, 90, 90, 1, regDateTime, loginDateTime); regDateTime.SetDate(2021, 10, 4); - UserManager_UserAdd("Test103", "test12#$", 0, 90, 90, regDateTime, loginDateTime); + UserManager_UserAdd("Test103", "test12#$", 0, 90, 90, 1, regDateTime, loginDateTime); regDateTime.SetDate(2021, 10, 5); - UserManager_UserAdd("Test104", "test12#$", 0, 90, 90, regDateTime, loginDateTime); + UserManager_UserAdd("Test104", "test12#$", 0, 90, 90, 1, regDateTime, loginDateTime); regDateTime.SetDate(2021, 10, 6); - UserManager_UserAdd("Test105", "test12#$", 0, 90, 90, regDateTime, loginDateTime); + UserManager_UserAdd("Test105", "test12#$", 0, 90, 90, 1, regDateTime, loginDateTime); regDateTime.SetDate(2021, 10, 7); - UserManager_UserAdd("Test123", "test12#$", 0, 90, 90, regDateTime, loginDateTime); + UserManager_UserAdd("Test123", "test12#$", 0, 90, 90, 1, regDateTime, loginDateTime); regDateTime.SetDate(2021, 10, 7); - UserManager_UserAdd("Test321", "test12#$", 0, 90, 90, regDateTime, loginDateTime); + UserManager_UserAdd("Test321", "test12#$", 0, 90, 90, 1, regDateTime, loginDateTime); regDateTime.SetDate(2021, 10, 7); - UserManager_UserAdd("ABC001", "test12#$", 0, 90, 90, regDateTime, loginDateTime); + UserManager_UserAdd("ABC001", "test12#$", 0, 90, 90, 1, regDateTime, loginDateTime); regDateTime.SetDate(2021, 10, 7); - UserManager_UserAdd("CBA001", "test12#$", 0, 90, 90, regDateTime, loginDateTime); + UserManager_UserAdd("CBA001", "test12#$", 0, 90, 90, 1, regDateTime, loginDateTime); regDateTime.SetDate(2021, 10, 7); - UserManager_UserAdd("AAA001", "test12#$", 0, 90, 90, regDateTime, loginDateTime); + UserManager_UserAdd("AAA001", "test12#$", 0, 90, 90, 1, regDateTime, loginDateTime); regDateTime.SetDate(2021, 10, 7); - UserManager_UserAdd("Test000", "test12#$", 0, 90, 90, regDateTime, loginDateTime); + UserManager_UserAdd("Test000", "test12#$", 0, 90, 90, 1, regDateTime, loginDateTime); regDateTime.SetDate(2021, 10, 7); - UserManager_UserAdd("Test105", "test12#$", 0, 90, 90, regDateTime, loginDateTime); + UserManager_UserAdd("Test105", "test12#$", 0, 90, 90, 1, regDateTime, loginDateTime); regDateTime.SetDate(2021, 10, 7); - UserManager_UserAdd("Test106", "test12", 0, 90, 90, regDateTime, loginDateTime); + UserManager_UserAdd("Test106", "test12", 0, 90, 90, 1, regDateTime, loginDateTime); regDateTime.SetDate(2021, 10, 7); - UserManager_UserAdd("Test107", "test#$", 0, 90, 90, regDateTime, loginDateTime); + UserManager_UserAdd("Test107", "test#$", 0, 90, 90, 1, regDateTime, loginDateTime); regDateTime.SetDate(2021, 10, 7); - UserManager_UserAdd("Test108", "1223#$%", 0, 90, 90, regDateTime, loginDateTime); + UserManager_UserAdd("Test108", "1223#$%", 0, 90, 90, 1, regDateTime, loginDateTime); //UserManager_UserNew("Test200", "test12#$", 0, 20, 30); @@ -163,14 +163,14 @@ namespace INT_PT002.Part11_UserManager DLL_UserMgr_GetUserListID(pID); } } - public static void UserManager_UserAdd(String sID, String sPW, int fAdmin, int expire_period_pw, int expire_period_account, DateTime_t password_date, DateTime_t account_date) + public static void UserManager_UserAdd(String sID, String sPW, int fAdmin, int expire_period_pw, int expire_period_account, int active_level, DateTime_t password_date, DateTime_t account_date) { IntPtr pID = Marshal.StringToBSTR(sID.ToString()); IntPtr pPW = Marshal.StringToBSTR(sPW.ToString()); - DLL_UserMgr_UserAdd(pID, pPW, fAdmin, expire_period_pw, expire_period_account, password_date, account_date); + DLL_UserMgr_UserAdd(pID, pPW, fAdmin, expire_period_pw, expire_period_account, active_level, password_date, account_date); } - public static void UserManager_UserNew(String sID, String sPW, int fAdmin, int expire_period_pw, int expire_period_account, MenuID_t menuId) + public static void UserManager_UserNew(String sID, String sPW, int fAdmin, int expire_period_pw, int expire_period_account, int active_level, MenuID_t menuId) { IntPtr pID = Marshal.StringToBSTR(sID.ToString()); IntPtr pPW = Marshal.StringToBSTR(sPW.ToString()); @@ -178,7 +178,7 @@ namespace INT_PT002.Part11_UserManager IntPtr pMenuId = Marshal.AllocHGlobal(Marshal.SizeOf(menuId)); Marshal.StructureToPtr(menuId, pMenuId, false); - DLL_UserMgr_UserNew(pID, pPW, fAdmin, expire_period_pw, expire_period_account, pMenuId); + DLL_UserMgr_UserNew(pID, pPW, fAdmin, expire_period_pw, expire_period_account, active_level, pMenuId); } public static void UserManager_UserAddHistoryPW(String sID, String sHistoryPW) { @@ -193,7 +193,7 @@ namespace INT_PT002.Part11_UserManager DLL_UserMgr_UserResetHistoryPW(pID); } - public static void UserManager_UserModify(String sID, String sPW, int fAdmin, int expire_period_pw, int expire_period_account, MenuID_t menuId) + public static void UserManager_UserModify(String sID, String sPW, int fAdmin, int expire_period_pw, int expire_period_account, int active_level, MenuID_t menuId) { IntPtr pID = Marshal.StringToBSTR(sID.ToString()); IntPtr pPW = Marshal.StringToBSTR(sPW.ToString()); @@ -201,7 +201,7 @@ namespace INT_PT002.Part11_UserManager IntPtr pMenuId = Marshal.AllocHGlobal(Marshal.SizeOf(menuId)); Marshal.StructureToPtr(menuId, pMenuId, false); - DLL_UserMgr_UserModify(pID, pPW, fAdmin, expire_period_pw, expire_period_account, pMenuId); + DLL_UserMgr_UserModify(pID, pPW, fAdmin, expire_period_pw, expire_period_account, active_level, pMenuId); } public static void UserManager_UserModifyPW(String sID, String sNewPW) { @@ -217,11 +217,11 @@ namespace INT_PT002.Part11_UserManager DLL_UserMgr_UserModifyID(pID, pNewID); } - public static void UserManager_UserModifyOthers(String sID, int fadmin, int period_expire_pw, int period_expire_account) + public static void UserManager_UserModifyOthers(String sID, int fadmin, int period_expire_pw, int period_expire_account, int active_level) { IntPtr pID = Marshal.StringToBSTR(sID.ToString()); - DLL_UserMgr_UserModifyOthers(pID, fadmin, period_expire_pw, period_expire_account); + DLL_UserMgr_UserModifyOthers(pID, fadmin, period_expire_pw, period_expire_account, active_level); } public static void UserManager_UserDel(String sID) {