From 1655308028d67a4d23ac946cc894cde4527bf34b Mon Sep 17 00:00:00 2001 From: sj84 Date: Thu, 31 Aug 2023 11:46:04 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A9=94=EB=89=B4=20=ED=99=94=EB=A9=B4=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(=EC=A0=91=EA=B7=BC=EA=B6=8C=ED=95=9C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- INT69DC_7C/DialogForms/DialogFormLogOn.cs | 19 +- INT69DC_7C/Forms/FormDataStatistics.cs | 319 +++++++++++++++++----- INT69DC_7C/Forms/FormMain.cs | 8 +- INT69DC_7C/Forms/FormMainDisplay.cs | 40 +-- INT69DC_7C/Forms/FormMenu.Designer.cs | 10 +- INT69DC_7C/Forms/FormMenu.cs | 163 ++++++----- INT69DC_7C/Forms/FormUserEditor.cs | 136 +++++---- INT69DC_7C/Forms/FormUserGroupEditor.cs | 2 +- INT69DC_7C/Part11_UserManager/UserItem.cs | 10 + 9 files changed, 476 insertions(+), 231 deletions(-) diff --git a/INT69DC_7C/DialogForms/DialogFormLogOn.cs b/INT69DC_7C/DialogForms/DialogFormLogOn.cs index f2b5733..1e6a824 100644 --- a/INT69DC_7C/DialogForms/DialogFormLogOn.cs +++ b/INT69DC_7C/DialogForms/DialogFormLogOn.cs @@ -145,7 +145,7 @@ namespace INT69DC_7C.DialogForms UserManager.UserManager_UserLoginDirect(this.textBoxID.Text, this.textBoxPassword.Text, ref userInfo); - if (userInfo.status == 0) + if (userInfo.status == 0 && userInfo.fFirstPW == 0) { //MessageBox.Show("로그인 성공"); @@ -167,6 +167,11 @@ namespace INT69DC_7C.DialogForms this.ParentForm.SystemConfig.CurrentUser.ExpireId = userInfo.id_expire_period; this.ParentForm.SystemConfig.CurrentUser.ExpirePassword = userInfo.password_expire_period; + Console.WriteLine(userInfo.password_register_date.GetDateTime()); + Console.WriteLine(userInfo.id_login_date.GetDateTime()); + Console.WriteLine(userInfo.id_expire_date.GetDateTime()); + Console.WriteLine(userInfo.password_expire_date.GetDateTime()); + DateTime time = DateTime.ParseExact(userInfo.password_register_date.GetDateTime(), "yyyyMMddHHmmss", null); this.ParentForm.SystemConfig.CurrentUser.DatePasswordRegister = time; time = DateTime.ParseExact(userInfo.id_login_date.GetDateTime(), "yyyyMMddHHmmss", null); @@ -180,11 +185,19 @@ namespace INT69DC_7C.DialogForms this.ParentForm.SystemConfig.CurrentUser.IsLockPassword = userInfo.password_flock_status == 0 ? false : true; this.ParentForm.SystemConfig.CurrentUser.IsAdmin = userInfo.fadmin == 0 ? false : true; this.ParentForm.SystemConfig.CurrentUser.ActiveLevel = userInfo.active_level; + this.ParentForm.SystemConfig.CurrentUser.IsFirstPassword = userInfo.fFirstPW; #endregion this.DialogResult = DialogResult.OK; this.Close(); } + else if (userInfo.fFirstPW == 1) + { + // 최초 로그인 시 비밀번호 변경 + this.ParentForm.ChildFormMainDisplay.ChangeID = this.textBoxID.Text; + this.DialogResult = DialogResult.Abort; + this.Close(); + } else { DialogFormMessage myMsg = new DialogFormMessage(null, userInfo.status, this.ParentForm.SystemConfig.Language); @@ -287,6 +300,7 @@ namespace INT69DC_7C.DialogForms this.ParentForm.SystemConfig.CurrentUser.IsLockPassword = userInfo.password_flock_status == 0 ? false : true; this.ParentForm.SystemConfig.CurrentUser.IsAdmin = userInfo.fadmin == 0 ? false : true; this.ParentForm.SystemConfig.CurrentUser.ActiveLevel = userInfo.active_level; + this.ParentForm.SystemConfig.CurrentUser.IsFirstPassword = userInfo.fFirstPW; #endregion this.DialogResult = DialogResult.OK; @@ -301,6 +315,9 @@ namespace INT69DC_7C.DialogForms else { // 비밀번호 변경 실패 시 메시지?? + Console.WriteLine(ret.ToString()); + DialogFormMessage myMsg = new DialogFormMessage(null, ret, this.ParentForm.SystemConfig.Language); + myMsg.ShowDialog(); } } #endregion diff --git a/INT69DC_7C/Forms/FormDataStatistics.cs b/INT69DC_7C/Forms/FormDataStatistics.cs index 2ea04e0..0529d37 100644 --- a/INT69DC_7C/Forms/FormDataStatistics.cs +++ b/INT69DC_7C/Forms/FormDataStatistics.cs @@ -627,16 +627,15 @@ namespace INT69DC_7C.Forms for (int i = 0; i < this.CollectionLaneData.Count; i++) this.CollectionLaneData[i].ClearDatas(); } - private void FileBackup(DataCommonList commonList, Collection datas) + private void FileBackup1(string path, DateTime time, DataCommonList commonList, Collection datas) { bool fileCheck = false; string fullFilePath = ""; StreamWriter sw; - fullFilePath = string.Format("{0}{1:yyyyMMdd-HHmmss}_{2}_CheckList.csv", - this.ParentForm.PathDataStatisticsFolder, DateTime.Now, this.ParentForm.SystemConfig.UsbID); + fullFilePath = string.Format("{0}S{1:yyyyMMdd-HHmmss}.csv", path, time); this.ParentForm.smartFileIO.FilePathName = fullFilePath; - sw = new StreamWriter(fullFilePath, true, Encoding.Default); + sw = new StreamWriter(fullFilePath, true, Encoding.UTF8); FileInfo fileInfo = new FileInfo(fullFilePath); fileCheck = fileInfo.Exists; @@ -664,7 +663,7 @@ namespace INT69DC_7C.Forms sw.WriteLine(string.Format("Total Count[ea],{0}", commonList.TotalCount)); sw.WriteLine(string.Format("Total NG Count[ea],{0}", commonList.TotalNGCount)); - + sw.WriteLine(string.Format("Total Pass Count[ea],{0}", commonList.TotalPassCount)); sw.WriteLine(string.Format("Total Pass Percentage[%],{0}", commonList.TotalPassPercentage)); sw.WriteLine(string.Format("Total Pass Average[g],{0:0.000}", commonList.TotalPassAverageWeight)); @@ -677,7 +676,7 @@ namespace INT69DC_7C.Forms sw.WriteLine(string.Format("Total Over Count[ea],{0}", commonList.TotalOverCount)); sw.WriteLine(string.Format("Total Over Percentage[%],{0}", commonList.TotalOverPercentage)); sw.WriteLine(string.Format("Total Over Sum Weight[kg],{0:0.000}", commonList.TotalOverSumWeight / 1000)); - + sw.WriteLine(string.Format("Total ExNG count[ea],{0}", commonList.TotalExNgCount)); sw.WriteLine(string.Format("Total ExNG Percentage[%],{0}", commonList.TotalExNgPercentage)); @@ -737,7 +736,7 @@ namespace INT69DC_7C.Forms sw.Write(","); sw.Write(Helper.DoubleToString(datas[i].PassMaxWeight, 1)); } - sw.WriteLine(); + sw.WriteLine(); #endregion #region Over @@ -789,7 +788,7 @@ namespace INT69DC_7C.Forms sw.Write(","); sw.Write(datas[i].UnderPercentage); } - sw.WriteLine(); + sw.WriteLine(); #endregion #region Ex @@ -827,7 +826,168 @@ namespace INT69DC_7C.Forms } sw.WriteLine(); #endregion - + + sw.Close(); + } + private void FileBackup2(string path, DateTime time, DataCommonList commonList, Collection datas) + { + bool fileCheck = false; + string fullFilePath = ""; + StreamWriter sw; + + fullFilePath = string.Format("{0}S{1:yyyyMMdd-HHmmss}.csv", path, time); + this.ParentForm.smartFileIO.FilePathName = fullFilePath; + sw = new StreamWriter(fullFilePath, true, Encoding.UTF8); + + FileInfo fileInfo = new FileInfo(fullFilePath); + fileCheck = fileInfo.Exists; + + // 같은 파일이 있으면 초기화 + if (fileCheck == true) + { + this.ParentForm.smartFileIO.Open(this.ParentForm.BufferSmartUart); + + for (int i = 0; i < 40; i++) + { + this.ParentForm.smartFileIO.WriteString(""); + } + this.ParentForm.smartFileIO.Close(); + } + + for (int i = 0; i < this.ParentForm.SystemConfig.EquipmentColumns; i++) + { + // Lane Number + sw.Write("{0}", i + 1); + sw.Write(","); + + // ProductName + sw.Write(commonList.ProductName); + sw.Write(","); + // Lot + sw.Write(commonList.Lot); + sw.Write(","); + // StartTime + sw.Write(commonList.StartTime); + sw.Write(","); + // EndTime + sw.Write(commonList.EndTime); + sw.Write(","); + + // UnderRange + sw.Write(commonList.UnderRange); + sw.Write(","); + // PassRange + sw.Write(commonList.PassRange); + sw.Write(","); + // OverRange + sw.Write(commonList.OverRange); + sw.Write(","); + // TareRange + sw.Write(commonList.TareRange); + sw.Write(","); + + // TotalCount + sw.Write(commonList.TotalCount); + sw.Write(","); + // TotalNGCount + sw.Write(commonList.TotalNGCount); + sw.Write(","); + + // TotalPassCount + sw.Write(commonList.TotalPassCount); + sw.Write(","); + // TotalPassPercentage + sw.Write(commonList.TotalPassPercentage); + sw.Write(","); + // TotalPassAverage + sw.Write(string.Format("{0:0.000}", commonList.TotalPassAverageWeight)); + sw.Write(","); + // TotalPassSD + sw.Write(string.Format("{0:0.00}", commonList.TotalPassStandardDeviation)); + sw.Write(","); + + // TotalUnderCount + sw.Write(commonList.TotalUnderCount); + sw.Write(","); + // TotalUnderPercentage + sw.Write(commonList.TotalUnderPercentage); + sw.Write(","); + // TotalUnderSumWeight + sw.Write(string.Format("{0:0.0000}", commonList.TotalUnderSumWeight / 1000)); + sw.Write(","); + + // TotalOverCount + sw.Write(commonList.TotalOverCount); + sw.Write(","); + // TotalOverPercentage + sw.Write(commonList.TotalOverPercentage); + sw.Write(","); + // TotalOverSumWeight + sw.Write(string.Format("{0:0.0000}", commonList.TotalOverSumWeight / 1000)); + sw.Write(","); + + // TotalExNgCount + sw.Write(commonList.TotalExNgCount); + sw.Write(","); + // TotalExNgPercentage + sw.Write(commonList.TotalExNgPercentage); + sw.Write(","); + + // Lane PassCount + sw.Write(datas[i].PassTotalCount); + sw.Write(","); + // Lane PassAverage + sw.Write(string.Format("{0:0.000}", datas[i].PassAverage)); + sw.Write(","); + // Lane PassPercentage + sw.Write(datas[i].PassPercentage); + sw.Write(","); + // Lane PassSD + sw.Write(string.Format("{0:0.00}", datas[i].PassStandardDeviation)); + sw.Write(","); + // Lane PassMinWeight + sw.Write(Helper.DoubleToString(datas[i].PassMinWeight, 1)); + sw.Write(","); + // Lane PassMaxWeight + sw.Write(Helper.DoubleToString(datas[i].PassMaxWeight, 1)); + sw.Write(","); + + // Lane OverCount + sw.Write(datas[i].OverTotalCount); + sw.Write(","); + // Lane OverSumWeight + sw.Write(Helper.DoubleToString(datas[i].OverSumWeight / 1000, 3)); + sw.Write(","); + // Lane OverPercentage + sw.Write(datas[i].OverPercentage); + sw.Write(","); + + // Lane UnderCount + sw.Write(datas[i].UnderTotalCount); + sw.Write(","); + // Lane UnderSumWeight + sw.Write(Helper.DoubleToString(datas[i].UnderSumWeight / 1000, 3)); + sw.Write(","); + // Lane UnderPercentage + sw.Write(datas[i].UnderPercentage); + sw.Write(","); + + // Lane ExNgCount + sw.Write(datas[i].ExNgTotalCount); + sw.Write(","); + // Lane ExNgPercentage + sw.Write(datas[i].ExNgPercentage); + sw.Write(","); + + // Lane TotalCount + sw.Write(datas[i].TotalCount); + sw.Write(","); + // Lane TotalNgCount + sw.Write(datas[i].TotalNGCount); + + sw.WriteLine(); + } + sw.Close(); } private bool CheckUSBMemory() @@ -869,6 +1029,84 @@ namespace INT69DC_7C.Forms this.FileCopy(file, fileName); } } + private int Backup1() + { + int ret = 0; + string filePath = ""; + bool directoryCheck = false; + DateTime time = DateTime.Now; + + // 메모리 장착 체크 + if (this.CheckUSBMemory() == false) + { + DialogFormMessage msg = new DialogFormMessage(5, this.ParentForm.SystemConfig.Language); + msg.ShowDialog(); + + this.buttonSave.Enabled = true; + ret = -1; + return ret; + } + + #region 통계 데이터 생성 + // ScreenCapture + this.CreateScreenCapture(this.ParentForm.PathDataStatisticsFolder, time); + // csv File + this.FileBackup1(this.ParentForm.PathDataStatisticsFolder, time, this.CurrentDataCommonList, this.CollectionLaneData); + #endregion + + #region 메모리로 파일 복사 + try + { + filePath = "하드 디스크\\"; + DirectoryInfo dir = new DirectoryInfo(this.ParentForm.PathDataStatisticsFolder); + + directoryCheck = dir.Exists; + // 폴더 체크 + if (directoryCheck == false) + dir.Create(); + + FileInfo[] files = dir.GetFiles(); + + foreach (FileInfo file in files) + { + this.FileCopy(file, filePath + file.Name); + file.Delete(); + } + DialogFormMessage msg = new DialogFormMessage("2", this.ParentForm.SystemConfig.Language); + msg.ShowDialog(); + } + catch + { + DialogFormMessage msg = new DialogFormMessage(6, this.ParentForm.SystemConfig.Language); + msg.ShowDialog(); + ret = -1; + return ret; + } + #endregion + + return ret; + } + private int Backup2() + { + int ret = 0; + DateTime time = DateTime.Now; + + // csv File + this.FileBackup2(this.ParentForm.PathDataBackupFolder, time, this.CurrentDataCommonList, this.CollectionLaneData); + + return ret; + } + private void CreateScreenCapture(string path, DateTime time) + { + string filePath = ""; + Bitmap bitMap = new Bitmap(1024, 768); + + bitMap = IntechGraphics.CopyFromScreen(); + filePath = string.Format("{0}S{1:yyyyMMdd-HHmmss}.jpg", path, time); + + bitMap.Save(filePath, ImageFormat.Jpeg); + } + public void DisplayRefresh() { @@ -897,66 +1135,19 @@ namespace INT69DC_7C.Forms this.SelectFilePath = ""; DialogFormDataStatistics form = new DialogFormDataStatistics(this); - if (form.ShowDialog() == DialogResult.OK) - this.buttonSave.Enabled = true; - else - this.buttonSave.Enabled = false; + form.ShowDialog(); } private void buttonSave_Click(object sender, EventArgs e) { + if (this.SelectFilePath == "") + return; + this.buttonSave.Enabled = false; - string filePath = ""; - bool directoryCheck = false; - Bitmap bitMap = new Bitmap(1024, 768); - - // 메모리 장착 체크 - if (this.CheckUSBMemory() == false) - { - DialogFormMessage msg = new DialogFormMessage(5, this.ParentForm.SystemConfig.Language); - msg.ShowDialog(); - - this.buttonSave.Enabled = true; - return; - } - - #region 통계 데이터 생성 - bitMap = IntechGraphics.CopyFromScreen(); - filePath = string.Format("{0}{1:yyyyMMdd-HHmmss}_{2}_Capture.jpg", - this.ParentForm.PathDataStatisticsFolder, DateTime.Now, this.ParentForm.SystemConfig.UsbID); - bitMap.Save(filePath, ImageFormat.Jpeg); - - this.FileBackup(this.CurrentDataCommonList, this.CollectionLaneData); - #endregion - - #region 메모리로 파일 복사 - try - { - filePath = "하드 디스크\\"; - DirectoryInfo dir = new DirectoryInfo(this.ParentForm.PathDataStatisticsFolder); - - directoryCheck = dir.Exists; - // 폴더 체크 - if (directoryCheck == false) - dir.Create(); - - FileInfo[] files = dir.GetFiles(); - - foreach (FileInfo file in files) - { - this.FileCopy(file, filePath + file.Name); - file.Delete(); - } - DialogFormMessage msg = new DialogFormMessage("2", this.ParentForm.SystemConfig.Language); - msg.ShowDialog(); - } - catch - { - DialogFormMessage msg = new DialogFormMessage(6, this.ParentForm.SystemConfig.Language); - msg.ShowDialog(); - return; - } - #endregion + if (this.ParentForm.SystemConfig.IsPart11 == false) + this.Backup1(); + else + this.Backup2(); this.buttonSave.Enabled = true; } diff --git a/INT69DC_7C/Forms/FormMain.cs b/INT69DC_7C/Forms/FormMain.cs index 71cddb7..e0332b9 100644 --- a/INT69DC_7C/Forms/FormMain.cs +++ b/INT69DC_7C/Forms/FormMain.cs @@ -7384,10 +7384,10 @@ namespace INT69DC_7C.Forms structItem.IsMenuFactoryReset = true; structItem.IsMenuEquipmentSetting = true; structItem.IsMenuIOTest = true; - structItem.IsMenuDataStatistics = true; - structItem.IsMenuUserSetting = true; - structItem.IsMenuUserGroupSetting = true; - structItem.IsMenuDataViewer = true; + structItem.IsMenuDataStatistics = false; + structItem.IsMenuUserSetting = false; + structItem.IsMenuUserGroupSetting = false; + structItem.IsMenuDataViewer = false; structItem.Dummy1 = false; structItem.Dummy2 = false; diff --git a/INT69DC_7C/Forms/FormMainDisplay.cs b/INT69DC_7C/Forms/FormMainDisplay.cs index 56054c5..a773462 100644 --- a/INT69DC_7C/Forms/FormMainDisplay.cs +++ b/INT69DC_7C/Forms/FormMainDisplay.cs @@ -1227,29 +1227,37 @@ namespace INT69DC_7C.Forms { if (this.ParentForm.SystemConfig.IsPart11 == true) { - expireDate = user.GetPasswordExpiryDday(); - if (expireDate == 9999) + if (user.ExpirePassword != 0) { - // Administrator or Developer - colorExpirePW = this.ParentForm.ColorLogOn; - expirePW = "-"; - } - else - { - if (expireDate >= -10) + expireDate = user.GetPasswordExpiryDday(); + if (expireDate == 9999) { - colorExpirePW = this.ParentForm.ColorLogOff; - if (expireDate > 0) - expirePW = string.Format("D+{0}", expireDate); - else - expirePW = string.Format("D{0}", expireDate); + // Administrator or Developer + colorExpirePW = this.ParentForm.ColorLogOn; + expirePW = "-"; } else { - colorExpirePW = this.ParentForm.ColorLogOn; - expirePW = string.Format("D{0}", expireDate); + if (expireDate >= -10) + { + colorExpirePW = this.ParentForm.ColorLogOff; + if (expireDate > 0) + expirePW = string.Format("D+{0}", expireDate); + else + expirePW = string.Format("D{0}", expireDate); + } + else + { + colorExpirePW = this.ParentForm.ColorLogOn; + expirePW = string.Format("D{0}", expireDate); + } } } + else + { + colorExpirePW = this.ParentForm.ColorLogOn; + expirePW = "-"; + } } else { diff --git a/INT69DC_7C/Forms/FormMenu.Designer.cs b/INT69DC_7C/Forms/FormMenu.Designer.cs index f05c613..b45cf27 100644 --- a/INT69DC_7C/Forms/FormMenu.Designer.cs +++ b/INT69DC_7C/Forms/FormMenu.Designer.cs @@ -84,7 +84,7 @@ this.buttonTimeSetting.DownImage = ((System.Drawing.Image)(resources.GetObject("buttonTimeSetting.DownImage"))); this.buttonTimeSetting.GroupID = 0; this.buttonTimeSetting.InitVisible = true; - this.buttonTimeSetting.Location = new System.Drawing.Point(114, 435); + this.buttonTimeSetting.Location = new System.Drawing.Point(270, 435); this.buttonTimeSetting.Mode = SmartX.SmartButton.BUTTONMODE.NORMAL; this.buttonTimeSetting.Name = "buttonTimeSetting"; this.buttonTimeSetting.NestedClickEventPrevent = false; @@ -363,7 +363,7 @@ this.buttonEquipmentSetting.DownImage = ((System.Drawing.Image)(resources.GetObject("buttonEquipmentSetting.DownImage"))); this.buttonEquipmentSetting.GroupID = 0; this.buttonEquipmentSetting.InitVisible = true; - this.buttonEquipmentSetting.Location = new System.Drawing.Point(114, 603); + this.buttonEquipmentSetting.Location = new System.Drawing.Point(114, 435); this.buttonEquipmentSetting.Mode = SmartX.SmartButton.BUTTONMODE.NORMAL; this.buttonEquipmentSetting.Name = "buttonEquipmentSetting"; this.buttonEquipmentSetting.NestedClickEventPrevent = false; @@ -425,7 +425,7 @@ this.buttonEquipmentTest.DownImage = ((System.Drawing.Image)(resources.GetObject("buttonEquipmentTest.DownImage"))); this.buttonEquipmentTest.GroupID = 0; this.buttonEquipmentTest.InitVisible = true; - this.buttonEquipmentTest.Location = new System.Drawing.Point(270, 603); + this.buttonEquipmentTest.Location = new System.Drawing.Point(114, 603); this.buttonEquipmentTest.Mode = SmartX.SmartButton.BUTTONMODE.NORMAL; this.buttonEquipmentTest.Name = "buttonEquipmentTest"; this.buttonEquipmentTest.NestedClickEventPrevent = false; @@ -487,7 +487,7 @@ this.buttonUser.DownImage = ((System.Drawing.Image)(resources.GetObject("buttonUser.DownImage"))); this.buttonUser.GroupID = 0; this.buttonUser.InitVisible = true; - this.buttonUser.Location = new System.Drawing.Point(270, 435); + this.buttonUser.Location = new System.Drawing.Point(738, 435); this.buttonUser.Mode = SmartX.SmartButton.BUTTONMODE.NORMAL; this.buttonUser.Name = "buttonUser"; this.buttonUser.NestedClickEventPrevent = false; @@ -580,7 +580,7 @@ this.buttonOptionSetting.DownImage = ((System.Drawing.Image)(resources.GetObject("buttonOptionSetting.DownImage"))); this.buttonOptionSetting.GroupID = 0; this.buttonOptionSetting.InitVisible = true; - this.buttonOptionSetting.Location = new System.Drawing.Point(426, 603); + this.buttonOptionSetting.Location = new System.Drawing.Point(270, 603); this.buttonOptionSetting.Mode = SmartX.SmartButton.BUTTONMODE.NORMAL; this.buttonOptionSetting.Name = "buttonOptionSetting"; this.buttonOptionSetting.NestedClickEventPrevent = false; diff --git a/INT69DC_7C/Forms/FormMenu.cs b/INT69DC_7C/Forms/FormMenu.cs index 2c20a60..1dad0bb 100644 --- a/INT69DC_7C/Forms/FormMenu.cs +++ b/INT69DC_7C/Forms/FormMenu.cs @@ -290,7 +290,7 @@ namespace INT69DC_7C.Forms } } - public void UpdateDisplayUser(UserItem user) + public void UpdateDisplayMenuAccess(UserItem user) { string id = "", group = "", expirePW = ""; int expireDate = 0; @@ -301,12 +301,10 @@ namespace INT69DC_7C.Forms case DataStore.UserGroup.None: break; case DataStore.UserGroup.Level1: + #region Level1 id = user.ID; group = this.ParentForm.SystemConfig.User_Level1_Name; - if (this.ParentForm.SystemConfig.IsPart11 == true) - this.labelExpireOfPassword.Visible = true; - if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn) this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOn; @@ -330,13 +328,15 @@ namespace INT69DC_7C.Forms this.buttonEquipmentTest.Visible = false; this.buttonOptionSetting.Visible = false; - break; - case DataStore.UserGroup.Level2: - id = user.ID; - group = this.ParentForm.SystemConfig.User_Level2_Name; if (this.ParentForm.SystemConfig.IsPart11 == true) this.labelExpireOfPassword.Visible = true; + #endregion + break; + case DataStore.UserGroup.Level2: + #region Level2 + id = user.ID; + group = this.ParentForm.SystemConfig.User_Level2_Name; if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn) this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOn; @@ -361,14 +361,16 @@ namespace INT69DC_7C.Forms this.buttonEquipmentTest.Visible = false; this.buttonOptionSetting.Visible = false; + + if (this.ParentForm.SystemConfig.IsPart11 == true) + this.labelExpireOfPassword.Visible = true; + #endregion break; case DataStore.UserGroup.Level3: + #region Level3 id = user.ID; group = this.ParentForm.SystemConfig.User_Level3_Name; - if (this.ParentForm.SystemConfig.IsPart11 == true) - this.labelExpireOfPassword.Visible = true; - if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn) this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOn; @@ -392,21 +394,16 @@ namespace INT69DC_7C.Forms this.buttonEquipmentTest.Visible = false; this.buttonOptionSetting.Visible = false; + + if (this.ParentForm.SystemConfig.IsPart11 == true) + this.labelExpireOfPassword.Visible = true; + #endregion break; case DataStore.UserGroup.Admin: + #region Admin id = user.ID; - if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.German) - group = "Administrator"; - else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese) - group = "行政"; - else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Russian) - group = "Администратор"; - else - group = "Administrator"; - - if (this.ParentForm.SystemConfig.IsPart11 == true) - this.labelExpireOfPassword.Visible = true; - + group = "Administrator"; + if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn) this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOn; @@ -430,20 +427,20 @@ namespace INT69DC_7C.Forms this.buttonEquipmentTest.Visible = false; this.buttonOptionSetting.Visible = false; - break; - case DataStore.UserGroup.Developer: - id = user.ID; - if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.German) - group = "Entwickler"; - else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese) - group = "开发商"; - else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Russian) - group = "Разработчик"; - else - group = "Developer"; if (this.ParentForm.SystemConfig.IsPart11 == true) this.labelExpireOfPassword.Visible = true; + else + { + this.buttonDataViewer.Visible = false; + this.buttonUser.Location = new Point(this.buttonDataViewer.Location.X, this.buttonDataViewer.Location.Y); + } + #endregion + break; + case DataStore.UserGroup.Developer: + #region Developer + id = user.ID; + group = "Developer"; if (this.labelUserLevel.ForeColor != this.ParentForm.ColorLogOn) this.labelUserLevel.ForeColor = this.labelUserID.ForeColor = this.ParentForm.ColorLogOn; @@ -468,8 +465,13 @@ namespace INT69DC_7C.Forms this.buttonEquipmentTest.Visible = true; this.buttonOptionSetting.Visible = true; + + if (this.ParentForm.SystemConfig.IsPart11 == true) + this.labelExpireOfPassword.Visible = true; + #endregion break; case DataStore.UserGroup.NotLogin: + #region NotLogin this.buttonInformation.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsMenuInformation; this.buttonDataBackup.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsMenuDataBackup; this.buttonConfiguration.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsMenuConfiguration; @@ -482,7 +484,7 @@ namespace INT69DC_7C.Forms this.buttonFactoryInitialize.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsMenuInitialization; this.buttonIOTest.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsMenuIOTest; - this.buttonEquipmentSetting.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsMenuEquipment; + this.buttonEquipmentSetting.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsMenuEquipment; this.buttonTimeSetting.Enabled = this.ParentForm.CurrentUserGroup.NotLogin.IsMenuTime; this.buttonEquipmentTest.Visible = false; @@ -495,38 +497,73 @@ namespace INT69DC_7C.Forms this.buttonDataStatistics.Visible = true; else this.buttonDataStatistics.Visible = false; + #endregion break; case DataStore.UserGroup.LogOut: - if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.German) - group = "Ausloggen"; - else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese) - group = "登出"; - else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Russian) - group = "Выйти."; - else - group = "Log out"; - + group = "Log out"; this.labelExpireOfPassword.Visible = false; break; default: break; } - if (this.ParentForm.SystemConfig.IsLogin == true) + //if (this.ParentForm.SystemConfig.IsLogin == true) + //{ + // if (this.ParentForm.SystemConfig.IsPart11 == true) + // { + // if (user.ExpirePassword != 0) + // { + // expireDate = user.GetPasswordExpiryDday(); + // if (expireDate == 9999) + // { + // // Administrator or Developer + // colorExpirePW = this.ParentForm.ColorLogOn; + // expirePW = "-"; + + // } + // else + // { + // if (expireDate >= -10) + // { + // colorExpirePW = this.ParentForm.ColorLogOff; + // if (expireDate > 0) + // expirePW = string.Format("D+{0}", expireDate); + // else + // expirePW = string.Format("D{0}", expireDate); + // } + // else + // { + // colorExpirePW = this.ParentForm.ColorLogOn; + // expirePW = string.Format("D{0}", expireDate); + // } + // } + // } + // else + // { + // colorExpirePW = this.ParentForm.ColorLogOn; + // expirePW = "-"; + // } + // } + // else + // { + // // Part11 미사용 + // colorExpirePW = this.ParentForm.ColorLogOn; + // expirePW = "-"; + // } + //} + + + if (this.ParentForm.SystemConfig.IsPart11 == true) { - if (this.ParentForm.SystemConfig.IsPart11 == true) + if (user.ExpirePassword != 0) { expireDate = user.GetPasswordExpiryDday(); - if (expireDate == 9999) + colorExpirePW = this.ParentForm.ColorLogOn; + expirePW = "-"; + + if (expireDate < 9999) { - // Administrator or Developer - colorExpirePW = this.ParentForm.ColorLogOn; - expirePW = "-"; - - } - else - { - if (expireDate >= -10) + if (expireDate >= -10) { colorExpirePW = this.ParentForm.ColorLogOff; if (expireDate > 0) @@ -541,12 +578,6 @@ namespace INT69DC_7C.Forms } } } - else - { - // Part11 미사용 - colorExpirePW = this.ParentForm.ColorLogOn; - expirePW = "-"; - } } if (this.labelUserID.Text != id) @@ -564,7 +595,7 @@ namespace INT69DC_7C.Forms if(this.ParentForm.SystemConfig.IsLogin == false) this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.NotLogin; - this.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser); + this.UpdateDisplayMenuAccess(this.ParentForm.SystemConfig.CurrentUser); this.ParentForm.TransferData(CommunicationCommand.ModeNormal, CommunicationID.MainBoard); this.ParentForm.SystemConfig.CurrentForm = DataStore.FormStore.FormMenu; @@ -739,11 +770,11 @@ namespace INT69DC_7C.Forms if (this.ParentForm.SystemConfig.IsLogin == false) { this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Developer; - this.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser); + this.UpdateDisplayMenuAccess(this.ParentForm.SystemConfig.CurrentUser); } else { - if (this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Admin) + if (this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Developer) { if (this.buttonEquipmentSetting.Visible != true) this.buttonEquipmentSetting.Visible = true; @@ -756,8 +787,8 @@ namespace INT69DC_7C.Forms this.buttonEquipmentSetting.Enabled = true; if (this.buttonEquipmentTest.Enabled != true) this.buttonEquipmentTest.Enabled = true; - if (this.buttonOptionSetting.Enabled != false) - this.buttonOptionSetting.Enabled = false; + if (this.buttonOptionSetting.Enabled != true) + this.buttonOptionSetting.Enabled = true; } } } diff --git a/INT69DC_7C/Forms/FormUserEditor.cs b/INT69DC_7C/Forms/FormUserEditor.cs index 0353b2a..4cb5cef 100644 --- a/INT69DC_7C/Forms/FormUserEditor.cs +++ b/INT69DC_7C/Forms/FormUserEditor.cs @@ -105,7 +105,6 @@ namespace INT69DC_7C.Forms this.PasswordChar = false; this.BeforeID = ""; this.BeforePassword = ""; - this.DisplayOnlyPart11Item(this.ParentForm.SystemConfig.IsPart11); this.UpdateAccessRightComboBoxDisplay(); this.comboBoxAccessRight.SelectedIndexChanged -= new EventHandler(this.comboBoxAccessRight_SelectedIndexChanged); @@ -116,6 +115,30 @@ namespace INT69DC_7C.Forms this.Controls.Add(this.ChildControlUserSet); this.ChildControlUserSet.Location = new Point(0, 73); this.ChildControlUserSet.Visible = false; + + 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; + } } private void SetEnableID(bool value) @@ -443,29 +466,6 @@ namespace INT69DC_7C.Forms return false; } } - private void DisplayOnlyPart11Item(bool value) - { - // Expiry date(Account) - this.labelTitleExpiryDateOfAccount.Visible = value; - this.labelTitleDayAccount.Visible = value; - this.labelExpiryDateOfAccount.Visible = value; - this.labelExpiryDateOfAccount2.Visible = value; - this.labelStatusExpiryAccount.Visible = value; - // Expiry date(Password) - this.labelTitleExpiryDateOfPassword.Visible = value; - this.labelTitleDayPassword.Visible = value; - this.labelExpiryDateOfPassword.Visible = value; - this.labelExpiryDateOfPassword2.Visible = value; - this.labelStatusExpiryPassword.Visible = value; - // Auto logout time - this.labelTitleAutomaticLogoutTime.Visible = value; - this.labelAutomaticLogoutTime.Visible = value; - this.labelTitleMin.Visible = value; - this.labelAutoLogoutWarning.Visible = value; - - this.smartSeparatorLine1.Visible = value; - this.smartSeparatorLine2.Visible = value; - } private void UpdateAccessRightComboBoxDisplay() { this.comboBoxAccessRight.Items.Clear(); @@ -531,36 +531,26 @@ namespace INT69DC_7C.Forms else this.SelectedUserItem.Group = DataStore.UserGroup.None; - - if (this.SelectedUserItem.Group == DataStore.UserGroup.Admin - || this.SelectedUserItem.Group == DataStore.UserGroup.Developer) - { - 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()); + 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()); - this.SelectedUserItem.DatePasswordRegister = DateTime.Now; - this.SelectedUserItem.DateIdLogin = DateTime.Now; - this.SelectedUserItem.DateIdExpire = DateTime.Now; - this.SelectedUserItem.DatePasswordExpire = DateTime.Now; - } - else - { - 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; - } + 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.flock_status_password == 0 ? false : true; this.SelectedUserItem.IsAdmin = item.fadmin == 0 ? false : true; + + this.SelectedUserItem.IsFirstPassword = item.fFirstPW; } private void UpdateCurrentUserItem(UserManager.UserMgr_user_info_t item) { @@ -583,36 +573,26 @@ namespace INT69DC_7C.Forms else if (item.active_level == 10) this.SelectedUserItem.Group = DataStore.UserGroup.Developer; - if (this.SelectedUserItem.Group == DataStore.UserGroup.Admin - || this.SelectedUserItem.Group == DataStore.UserGroup.Developer) - { - 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()); + 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()); - - this.SelectedUserItem.DatePasswordRegister = DateTime.Now; - this.SelectedUserItem.DateIdLogin = DateTime.Now; - this.SelectedUserItem.DateIdExpire = DateTime.Now; - this.SelectedUserItem.DatePasswordExpire = DateTime.Now; - } - else - { - 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; - } + 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; } private void UpdateSelectUserDisplay(UserItem item) @@ -648,8 +628,16 @@ namespace INT69DC_7C.Forms { this.labelExpiryDateOfAccount.Text = item.ExpireId.ToString(); this.labelExpiryDateOfPassword.Text = item.ExpirePassword.ToString(); - this.labelExpiryDateOfAccount2.Text = string.Format("{0:yyyy/MM/dd} ~ {1:yyyy/MM/dd}", item.DateIdLogin, item.DateIdExpire); - this.labelExpiryDateOfPassword2.Text = string.Format("{0:yyyy/MM/dd} ~ {1:yyyy/MM/dd}", item.DatePasswordRegister, item.DatePasswordExpire); + + 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; diff --git a/INT69DC_7C/Forms/FormUserGroupEditor.cs b/INT69DC_7C/Forms/FormUserGroupEditor.cs index 8e9d565..9b12698 100644 --- a/INT69DC_7C/Forms/FormUserGroupEditor.cs +++ b/INT69DC_7C/Forms/FormUserGroupEditor.cs @@ -490,7 +490,7 @@ namespace INT69DC_7C.Forms this.ParentForm.CurrentUserGroup.NotLogin.IsMenuSystem = this.checkBoxNotLoginMenuSystem.Checked; this.ParentForm.CurrentUserGroup.NotLogin.IsMenuMotor = this.checkBoxNotLoginMenuMotor.Checked; this.ParentForm.CurrentUserGroup.NotLogin.IsMenuIOTest = this.checkBoxNotLoginMenuIOTest.Checked; - this.ParentForm.CurrentUserGroup.NotLogin.IsMenuEquipment = false; + this.ParentForm.CurrentUserGroup.NotLogin.IsMenuEquipment = this.checkBoxNotLoginMenuEquipment.Checked; this.ParentForm.CurrentUserGroup.NotLogin.IsMenuUpdate = this.checkBoxNotLoginMenuUpdate.Checked; this.ParentForm.CurrentUserGroup.NotLogin.IsMenuInitialization = this.checkBoxNotLoginMenuInitialization.Checked; this.ParentForm.CurrentUserGroup.NotLogin.IsMenuTime = this.checkBoxNotLoginMenuTime.Checked; diff --git a/INT69DC_7C/Part11_UserManager/UserItem.cs b/INT69DC_7C/Part11_UserManager/UserItem.cs index 7a57ae9..6aab2be 100644 --- a/INT69DC_7C/Part11_UserManager/UserItem.cs +++ b/INT69DC_7C/Part11_UserManager/UserItem.cs @@ -29,6 +29,8 @@ namespace INT69DC_7C.Part11_UserManager private bool m_IsAdmin; private int m_ActiveLevel; + + private int m_IsFirstPassword; #endregion #region Constructor @@ -110,6 +112,12 @@ namespace INT69DC_7C.Part11_UserManager get { return this.m_ActiveLevel; } set { this.m_ActiveLevel = value; } } + + public int IsFirstPassword + { + get { return this.m_IsFirstPassword; } + set { this.m_IsFirstPassword = value; } + } #endregion #region Method @@ -131,6 +139,8 @@ namespace INT69DC_7C.Part11_UserManager this.IsAdmin = false; this.ActiveLevel = 1; + + this.IsFirstPassword = 1; //[1] 최초 비밀번호(비밀번호 변경창 띄우기), [0] 비밀번호 변경완료됨 } public int GetPasswordExpiryDday()