635 lines
17 KiB
C#
635 lines
17 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
|
|
using ITC81DB_2H.Datastore;
|
|
|
|
namespace ITC81DB_0H.Part11_UserManager
|
|
{
|
|
#region UserItem
|
|
public class UserItem
|
|
{
|
|
#region Field
|
|
private bool m_IsUpdate;
|
|
|
|
private string m_ID;
|
|
private string m_Password;
|
|
|
|
private int m_ExpireId;
|
|
private int m_ExpirePassword;
|
|
|
|
private bool m_IsLockAccount;
|
|
private bool m_IsLockPassword;
|
|
|
|
private DateTime m_DatePasswordRegister;
|
|
private DateTime m_DateIdLogin;
|
|
private DateTime m_DatePasswordExpire;
|
|
private DateTime m_DateIdExpire;
|
|
|
|
private Define.E_UserGroup m_Group;
|
|
|
|
private bool m_IsAdmin;
|
|
|
|
private int m_ActiveLevel;
|
|
|
|
private int m_IsFirstPassword;
|
|
#endregion
|
|
|
|
#region Constructor
|
|
public UserItem()
|
|
{
|
|
this.Initialize();
|
|
}
|
|
#endregion
|
|
|
|
#region Property
|
|
public bool IsUpdate
|
|
{
|
|
get { return this.m_IsUpdate; }
|
|
set { this.m_IsUpdate = value; }
|
|
}
|
|
|
|
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 int ExpireId
|
|
{
|
|
get { return this.m_ExpireId; }
|
|
set { this.m_ExpireId = value; }
|
|
}
|
|
public int ExpirePassword
|
|
{
|
|
get { return this.m_ExpirePassword; }
|
|
set { this.m_ExpirePassword = value; }
|
|
}
|
|
|
|
public bool IsLockAccount
|
|
{
|
|
get { return this.m_IsLockAccount; }
|
|
set { this.m_IsLockAccount = value; }
|
|
}
|
|
public bool IsLockPassword
|
|
{
|
|
get { return this.m_IsLockPassword; }
|
|
set { this.m_IsLockPassword = value; }
|
|
}
|
|
|
|
public DateTime DatePasswordRegister
|
|
{
|
|
get { return this.m_DatePasswordRegister; }
|
|
set { this.m_DatePasswordRegister = value; }
|
|
}
|
|
public DateTime DateIdLogin
|
|
{
|
|
get { return this.m_DateIdLogin; }
|
|
set { this.m_DateIdLogin = value; }
|
|
}
|
|
public DateTime DatePasswordExpire
|
|
{
|
|
get { return this.m_DatePasswordExpire; }
|
|
set { this.m_DatePasswordExpire = value; }
|
|
}
|
|
public DateTime DateIdExpire
|
|
{
|
|
get { return this.m_DateIdExpire; }
|
|
set { this.m_DateIdExpire = value; }
|
|
}
|
|
|
|
public Define.E_UserGroup Group
|
|
{
|
|
get { return this.m_Group; }
|
|
set { this.m_Group = value; }
|
|
}
|
|
|
|
public bool IsAdmin
|
|
{
|
|
get { return this.m_IsAdmin; }
|
|
set { this.m_IsAdmin = value; }
|
|
}
|
|
|
|
public int ActiveLevel
|
|
{
|
|
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
|
|
private void Initialize()
|
|
{
|
|
this.IsUpdate = false;
|
|
|
|
this.ID = "";
|
|
this.Password = "";
|
|
|
|
this.ExpireId = 0;
|
|
this.ExpirePassword = 0;
|
|
|
|
this.DatePasswordRegister = DateTime.Now;
|
|
this.DateIdLogin = DateTime.Now;
|
|
this.DatePasswordExpire = DateTime.Now;
|
|
this.DateIdExpire = DateTime.Now;
|
|
|
|
this.Group = Define.E_UserGroup.None;
|
|
|
|
this.IsAdmin = false;
|
|
|
|
this.ActiveLevel = 1;
|
|
|
|
this.IsFirstPassword = 1; //[1] 최초 비밀번호(비밀번호 변경창 띄우기), [0] 비밀번호 변경완료됨
|
|
}
|
|
|
|
public int GetPasswordExpiryDday()
|
|
{
|
|
int ret = 0;
|
|
DateTime timeNow = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
|
|
TimeSpan dayDiff;
|
|
|
|
if (this.Group == Define.E_UserGroup.Admin || this.Group == Define.E_UserGroup.Developer)
|
|
ret = 9999;
|
|
else
|
|
{
|
|
dayDiff = timeNow.Date - this.DatePasswordExpire.Date;
|
|
ret = dayDiff.Days;
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
public bool CheckID(string id)
|
|
{
|
|
bool ret = false;
|
|
|
|
return ret;
|
|
}
|
|
public bool CheckPassword(string pass)
|
|
{
|
|
bool ret = false;
|
|
|
|
return ret;
|
|
}
|
|
#endregion
|
|
}
|
|
#endregion
|
|
|
|
#region UserGroup
|
|
public class UserGroup
|
|
{
|
|
#region Field
|
|
private UserGroupItem m_Level1;
|
|
private UserGroupItem m_Level2;
|
|
private UserGroupItem m_Level3;
|
|
private UserGroupItem m_NotLogin;
|
|
private UserGroupItem m_Admin;
|
|
#endregion
|
|
|
|
#region Constructor
|
|
public UserGroup()
|
|
{
|
|
this.Initialize();
|
|
}
|
|
#endregion
|
|
|
|
#region Property
|
|
public UserGroupItem Level1
|
|
{
|
|
get { return this.m_Level1; }
|
|
set { this.m_Level1 = value; }
|
|
}
|
|
public UserGroupItem Level2
|
|
{
|
|
get { return this.m_Level2; }
|
|
set { this.m_Level2 = value; }
|
|
}
|
|
public UserGroupItem Level3
|
|
{
|
|
get { return this.m_Level3; }
|
|
set { this.m_Level3 = value; }
|
|
}
|
|
public UserGroupItem NotLogin
|
|
{
|
|
get { return this.m_NotLogin; }
|
|
set { this.m_NotLogin = value; }
|
|
}
|
|
public UserGroupItem Admin
|
|
{
|
|
get { return this.m_Admin; }
|
|
set { this.m_Admin = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region Method
|
|
private void Initialize()
|
|
{
|
|
this.Level1 = new UserGroupItem();
|
|
this.Level2 = new UserGroupItem();
|
|
this.Level3 = new UserGroupItem();
|
|
this.NotLogin = new UserGroupItem();
|
|
this.Admin = new UserGroupItem();
|
|
}
|
|
|
|
public bool GetLevel1AccessRight(Define.E_DisplayStore display)
|
|
{
|
|
bool ret = false;
|
|
|
|
return ret;
|
|
}
|
|
public bool GetLevel2AccessRight(Define.E_DisplayStore display)
|
|
{
|
|
bool ret = false;
|
|
|
|
return ret;
|
|
}
|
|
public bool GetLevel3AccessRight(Define.E_DisplayStore display)
|
|
{
|
|
bool ret = false;
|
|
|
|
return ret;
|
|
}
|
|
#endregion
|
|
}
|
|
#endregion
|
|
#region UserGroupItem
|
|
public class UserGroupItem
|
|
{
|
|
#region Field
|
|
private bool m_IsMainDisplayProductNo;
|
|
private bool m_IsMainDisplayWeightSetting;
|
|
private bool m_IsMainDisplayClear;
|
|
private bool m_IsMainDisplaySubMenu;
|
|
|
|
private bool m_IsBasicTime;
|
|
private bool m_IsBasicProduct;
|
|
private bool m_IsBasicDataStatistics;
|
|
|
|
private bool m_IsConfiEthernet;
|
|
private bool m_IsConfiSerial;
|
|
private bool m_IsConfiOption;
|
|
|
|
private bool m_IsSystemCalibration;
|
|
private bool m_IsSystemJudgmentSetting;
|
|
private bool m_IsSystemSorterSetting;
|
|
private bool m_IsSystemAutoZero;
|
|
private bool m_IsSystemIOTest;
|
|
private bool m_IsSystemExternalOutput;
|
|
|
|
private bool m_IsEquipUpdate;
|
|
private bool m_IsEquipInitialize;
|
|
private bool m_IsEquipFunctionSetting;
|
|
private bool m_IsEquipUser; // 유저설정 권한(L3, Admin, Developer만 유저 추가수정삭제)
|
|
private bool m_IsEquipEngineerSetting;
|
|
|
|
private bool m_IsLogJudge;
|
|
private bool m_IsLogHistory;
|
|
private bool m_IsLogOthers;
|
|
|
|
private bool m_IsInforSystem;
|
|
private bool m_IsInforAS;
|
|
#endregion
|
|
|
|
#region Constructor
|
|
public UserGroupItem()
|
|
{
|
|
this.Initialize();
|
|
}
|
|
#endregion
|
|
|
|
#region Property
|
|
public bool IsMainDisplayProductNo
|
|
{
|
|
get { return this.m_IsMainDisplayProductNo; }
|
|
set { this.m_IsMainDisplayProductNo = value; }
|
|
}
|
|
public bool IsMainDisplayWeightSetting
|
|
{
|
|
get { return this.m_IsMainDisplayWeightSetting; }
|
|
set { this.m_IsMainDisplayWeightSetting = value; }
|
|
}
|
|
public bool IsMainDisplayClear
|
|
{
|
|
get { return this.m_IsMainDisplayClear; }
|
|
set { this.m_IsMainDisplayClear = value; }
|
|
}
|
|
public bool IsMainDisplaySubMenu
|
|
{
|
|
get { return this.m_IsMainDisplaySubMenu; }
|
|
set { this.m_IsMainDisplaySubMenu = value; }
|
|
}
|
|
public bool IsMainEnable
|
|
{
|
|
get
|
|
{
|
|
bool ret = false;
|
|
|
|
if (this.IsMainDisplayProductNo == true || this.IsMainDisplayWeightSetting == true
|
|
|| this.IsMainDisplayClear == true || this.IsMainDisplaySubMenu == true)
|
|
ret = true;
|
|
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
public bool IsBasicTime
|
|
{
|
|
get { return this.m_IsBasicTime; }
|
|
set { this.m_IsBasicTime = value; }
|
|
}
|
|
public bool IsBasicProduct
|
|
{
|
|
get { return this.m_IsBasicProduct; }
|
|
set { this.m_IsBasicProduct = value; }
|
|
}
|
|
public bool IsBasicDataStatistics
|
|
{
|
|
get { return this.m_IsBasicDataStatistics; }
|
|
set { this.m_IsBasicDataStatistics = value; }
|
|
}
|
|
public bool IsBasicEnable
|
|
{
|
|
get
|
|
{
|
|
bool ret = false;
|
|
|
|
if (this.IsBasicTime == true || this.IsBasicProduct == true || this.IsBasicDataStatistics == true)
|
|
ret = true;
|
|
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
public bool IsConfiEthernet
|
|
{
|
|
get { return this.m_IsConfiEthernet; }
|
|
set { this.m_IsConfiEthernet = value; }
|
|
}
|
|
public bool IsConfiSerial
|
|
{
|
|
get { return this.m_IsConfiSerial; }
|
|
set { this.m_IsConfiSerial = value; }
|
|
}
|
|
public bool IsConfiOption
|
|
{
|
|
get { return this.m_IsConfiOption; }
|
|
set { this.m_IsConfiOption = value; }
|
|
}
|
|
public bool IsConfiEnable
|
|
{
|
|
get
|
|
{
|
|
bool ret = false;
|
|
|
|
if (this.IsConfiSerial == true || this.IsConfiEthernet == true || this.IsConfiOption == true)
|
|
ret = true;
|
|
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
public bool IsSystemCalibration
|
|
{
|
|
get { return this.m_IsSystemCalibration; }
|
|
set { this.m_IsSystemCalibration = value; }
|
|
}
|
|
public bool IsSystemJudgmentSetting
|
|
{
|
|
get { return this.m_IsSystemJudgmentSetting; }
|
|
set { this.m_IsSystemJudgmentSetting = value; }
|
|
}
|
|
public bool IsSystemSorterSetting
|
|
{
|
|
get { return this.m_IsSystemSorterSetting; }
|
|
set { this.m_IsSystemSorterSetting = value; }
|
|
}
|
|
public bool IsSystemAutoZero
|
|
{
|
|
get { return this.m_IsSystemAutoZero; }
|
|
set { this.m_IsSystemAutoZero = value; }
|
|
}
|
|
public bool IsSystemIOTest
|
|
{
|
|
get { return this.m_IsSystemIOTest; }
|
|
set { this.m_IsSystemIOTest = value; }
|
|
}
|
|
public bool IsSystemExternalOutput
|
|
{
|
|
get { return this.m_IsSystemExternalOutput; }
|
|
set { this.m_IsSystemExternalOutput = value; }
|
|
}
|
|
public bool IsSystemEnable
|
|
{
|
|
get
|
|
{
|
|
bool ret = false;
|
|
|
|
if (this.IsSystemCalibration == true || this.IsSystemJudgmentSetting == true
|
|
|| this.IsSystemSorterSetting == true || this.IsSystemAutoZero == true
|
|
|| this.IsSystemIOTest == true || this.IsSystemExternalOutput == true)
|
|
ret = true;
|
|
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
public bool IsEquipUpdate
|
|
{
|
|
get { return this.m_IsEquipUpdate; }
|
|
set { this.m_IsEquipUpdate = value; }
|
|
}
|
|
public bool IsEquipInitialize
|
|
{
|
|
get { return this.m_IsEquipInitialize; }
|
|
set { this.m_IsEquipInitialize = value; }
|
|
}
|
|
public bool IsEquipFunctionSetting
|
|
{
|
|
get { return this.m_IsEquipFunctionSetting; }
|
|
set { this.m_IsEquipFunctionSetting = value; }
|
|
}
|
|
public bool IsEquipUserSetting
|
|
{
|
|
get { return this.m_IsEquipUser; }
|
|
set { this.m_IsEquipUser = value; }
|
|
}
|
|
public bool IsEquipEngineerSetting
|
|
{
|
|
get { return this.m_IsEquipEngineerSetting; }
|
|
set { this.m_IsEquipEngineerSetting = value; }
|
|
}
|
|
public bool IsEquipEnable
|
|
{
|
|
get
|
|
{
|
|
bool ret = false;
|
|
|
|
if (this.IsEquipUpdate == true || this.IsEquipInitialize == true
|
|
|| this.IsEquipFunctionSetting == true || this.IsEquipUserSetting == true || this.IsEquipEngineerSetting == true)
|
|
ret = true;
|
|
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
public bool IsLogJudge
|
|
{
|
|
get { return this.m_IsLogJudge; }
|
|
set { this.m_IsLogJudge = value; }
|
|
}
|
|
public bool IsLogHistory
|
|
{
|
|
get { return this.m_IsLogHistory; }
|
|
set { this.m_IsLogHistory = value; }
|
|
}
|
|
public bool IsLogOthers
|
|
{
|
|
get { return this.m_IsLogOthers; }
|
|
set { this.m_IsLogOthers = value; }
|
|
}
|
|
public bool IsLogEnable
|
|
{
|
|
get
|
|
{
|
|
bool ret = false;
|
|
|
|
if (this.IsLogJudge == true || this.IsLogHistory == true || this.IsLogOthers == true)
|
|
ret = true;
|
|
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
public bool IsInforSystem
|
|
{
|
|
get { return this.m_IsInforSystem; }
|
|
set { this.m_IsInforSystem = value; }
|
|
}
|
|
public bool IsInforAS
|
|
{
|
|
get { return this.m_IsInforAS; }
|
|
set { this.m_IsInforAS = value; }
|
|
}
|
|
public bool IsInforEnable
|
|
{
|
|
get
|
|
{
|
|
bool ret = false;
|
|
|
|
if (this.IsInforSystem == true || this.IsInforAS == true)
|
|
ret = true;
|
|
|
|
return ret;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Method
|
|
private void Initialize()
|
|
{
|
|
this.IsMainDisplayProductNo = false;
|
|
this.IsMainDisplayWeightSetting = false;
|
|
this.IsMainDisplayClear = false;
|
|
this.IsMainDisplaySubMenu = false;
|
|
|
|
this.IsBasicTime = false;
|
|
this.IsBasicProduct = false;
|
|
this.IsBasicDataStatistics = false;
|
|
|
|
this.IsConfiSerial = false;
|
|
this.IsConfiOption = false;
|
|
|
|
this.IsSystemCalibration = false;
|
|
this.IsSystemJudgmentSetting = false;
|
|
this.IsSystemSorterSetting = false;
|
|
this.IsSystemAutoZero = false;
|
|
this.IsSystemIOTest = false;
|
|
this.IsSystemExternalOutput = false;
|
|
|
|
this.IsEquipUpdate = false;
|
|
this.IsEquipInitialize = false;
|
|
this.IsEquipFunctionSetting = false;
|
|
this.IsEquipUserSetting = false;
|
|
|
|
this.IsInforSystem = false;
|
|
this.IsInforAS = false;
|
|
|
|
this.IsLogJudge = false;
|
|
this.IsLogHistory = false;
|
|
this.IsLogOthers = false;
|
|
}
|
|
#endregion
|
|
}
|
|
#endregion
|
|
#region StructUserGroupItem
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
public struct StructUserGroupItem
|
|
{
|
|
public bool IsMainDisplayProductNo;
|
|
public bool IsMainDisplayWeightSetting;
|
|
public bool IsMainDisplayClear;
|
|
public bool IsMainDisplaySubMenu;
|
|
public bool Dummy0;
|
|
|
|
public bool IsBasicTime;
|
|
public bool IsBasicProduct;
|
|
public bool IsConfiEthernet;
|
|
public bool IsBasicDataStatistics;
|
|
|
|
public bool IsConfiSerial;
|
|
public bool IsConfiOption;
|
|
|
|
public bool IsSystemCalibration;
|
|
public bool IsSystemJudgmentSetting;
|
|
public bool IsSystemSorterSetting;
|
|
public bool IsSystemAutoZero;
|
|
public bool IsSystemIOTest;
|
|
public bool IsSystemExternalOutput;
|
|
|
|
public bool IsEquipUpdate;
|
|
public bool IsEquipInitialize;
|
|
public bool IsEquipFunctionSetting;
|
|
public bool IsEquipUser;
|
|
|
|
public bool IsInforSystem;
|
|
public bool IsInforAS;
|
|
|
|
public bool IsLogJudge;
|
|
public bool IsLogHistory;
|
|
public bool IsLogOthers;
|
|
|
|
public bool IsEquipEngineerSetting;
|
|
public bool Dummy1;
|
|
public bool Dummy2;
|
|
public bool Dummy3;
|
|
public bool Dummy4;
|
|
public bool Dummy5;
|
|
public bool Dummy6;
|
|
public bool Dummy7;
|
|
public bool Dummy8;
|
|
public bool Dummy9;
|
|
public bool Dummy10;
|
|
public bool Dummy11;
|
|
public bool Dummy12;
|
|
public bool Dummy13;
|
|
public bool Dummy14;
|
|
public bool Dummy15;
|
|
public bool Dummy16;
|
|
}
|
|
#endregion
|
|
}
|