436 lines
12 KiB
C#
436 lines
12 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace INT69DC_7C.Part11_UserManager
|
|
{
|
|
#region UserItem
|
|
public class UserItem
|
|
{
|
|
#region Field
|
|
private string m_ID;
|
|
private string m_Password;
|
|
private string m_PreviousPassword1;
|
|
private string m_PreviousPassword2;
|
|
private string m_PreviousPassword3;
|
|
|
|
private int m_ExpireAccount;
|
|
private int m_ExpirePassword;
|
|
|
|
private bool m_IsLockAccount;
|
|
private bool m_IsLockPassword;
|
|
|
|
private DateTime m_DateRegister;
|
|
private DateTime m_DateLogin;
|
|
private DateTime m_DateExpireRegister;
|
|
private DateTime m_DateExpireLogin;
|
|
|
|
private DataStore.UserGroup m_Group;
|
|
|
|
private bool m_IsAdmin;
|
|
|
|
private int m_ActiveLevel;
|
|
#endregion
|
|
|
|
#region Constructor
|
|
public UserItem()
|
|
{
|
|
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 string PreviousPassword1
|
|
{
|
|
get { return this.m_PreviousPassword1; }
|
|
set { this.m_PreviousPassword1 = value; }
|
|
}
|
|
public string PreviousPassword2
|
|
{
|
|
get { return this.m_PreviousPassword2; }
|
|
set { this.m_PreviousPassword2 = value; }
|
|
}
|
|
public string PreviousPassword3
|
|
{
|
|
get { return this.m_PreviousPassword3; }
|
|
set { this.m_PreviousPassword3 = value; }
|
|
}
|
|
|
|
public int ExpireAccount
|
|
{
|
|
get { return this.m_ExpireAccount; }
|
|
set { this.m_ExpireAccount = 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 DateRegister
|
|
{
|
|
get { return this.m_DateRegister; }
|
|
set { this.m_DateRegister = value; }
|
|
}
|
|
public DateTime DateLogin
|
|
{
|
|
get { return this.m_DateLogin; }
|
|
set { this.m_DateLogin = value; }
|
|
}
|
|
public DateTime DateExpireRegister
|
|
{
|
|
get { return this.m_DateExpireRegister; }
|
|
set { this.m_DateExpireRegister = value; }
|
|
}
|
|
public DateTime DateExpireLogin
|
|
{
|
|
get { return this.m_DateExpireLogin; }
|
|
set { this.m_DateExpireLogin = value; }
|
|
}
|
|
|
|
public DataStore.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; }
|
|
}
|
|
#endregion
|
|
|
|
#region Method
|
|
private void Initialize()
|
|
{
|
|
this.ID = "-";
|
|
this.Password = "-";
|
|
|
|
this.PreviousPassword1 = "-";
|
|
this.PreviousPassword2 = "-";
|
|
this.PreviousPassword3 = "-";
|
|
|
|
this.ExpireAccount = 0;
|
|
this.ExpirePassword = 0;
|
|
|
|
this.DateRegister = DateTime.Now;
|
|
this.DateLogin = DateTime.Now;
|
|
this.DateExpireRegister = DateTime.Now;
|
|
this.DateExpireLogin = DateTime.Now;
|
|
|
|
this.Group = DataStore.UserGroup.None;
|
|
|
|
this.IsAdmin = false;
|
|
|
|
this.ActiveLevel = 1;
|
|
}
|
|
|
|
public void SetPassword(string pass)
|
|
{
|
|
this.PreviousPassword3 = this.PreviousPassword2;
|
|
this.PreviousPassword2 = this.PreviousPassword1;
|
|
this.PreviousPassword1 = pass;
|
|
this.Password = pass;
|
|
}
|
|
#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;
|
|
#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; }
|
|
}
|
|
#endregion
|
|
|
|
#region Method
|
|
private void Initialize()
|
|
{
|
|
this.Level1 = new UserGroupItem();
|
|
this.Level2 = new UserGroupItem();
|
|
this.Level3 = new UserGroupItem();
|
|
this.NotLogin = new UserGroupItem();
|
|
}
|
|
#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_IsMenuInformation;
|
|
private bool m_IsMenuConfiguration;
|
|
private bool m_IsMenuCommunication;
|
|
private bool m_IsMenuCalibration;
|
|
private bool m_IsMenuSystem;
|
|
private bool m_IsMenuMotor;
|
|
private bool m_IsMenuIOTest;
|
|
private bool m_IsMenuEquipment;
|
|
private bool m_IsMenuUpdate;
|
|
private bool m_IsMenuInitialization;
|
|
private bool m_IsMenuTime;
|
|
private bool m_IsMenuDataBackup;
|
|
private bool m_IsMenuStatistics;
|
|
private bool m_IsMenuViewer;
|
|
private bool m_IsMenuUser;
|
|
private bool m_IsMenuUserGroupEditor;
|
|
#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 IsMenuTime
|
|
{
|
|
get { return this.m_IsMenuTime; }
|
|
set { this.m_IsMenuTime = value; }
|
|
}
|
|
public bool IsMenuInformation
|
|
{
|
|
get { return this.m_IsMenuInformation; }
|
|
set { this.m_IsMenuInformation = value; }
|
|
}
|
|
public bool IsMenuDataBackup
|
|
{
|
|
get { return this.m_IsMenuDataBackup; }
|
|
set { this.m_IsMenuDataBackup = value; }
|
|
}
|
|
public bool IsMenuCalibration
|
|
{
|
|
get { return this.m_IsMenuCalibration; }
|
|
set { this.m_IsMenuCalibration = value; }
|
|
}
|
|
public bool IsMenuCommunication
|
|
{
|
|
get { return this.m_IsMenuCommunication; }
|
|
set { this.m_IsMenuCommunication = value; }
|
|
}
|
|
public bool IsMenuConfiguration
|
|
{
|
|
get { return this.m_IsMenuConfiguration; }
|
|
set { this.m_IsMenuConfiguration = value; }
|
|
}
|
|
public bool IsMenuSystem
|
|
{
|
|
get { return this.m_IsMenuSystem; }
|
|
set { this.m_IsMenuSystem = value; }
|
|
}
|
|
public bool IsMenuMotor
|
|
{
|
|
get { return this.m_IsMenuMotor; }
|
|
set { this.m_IsMenuMotor = value; }
|
|
}
|
|
public bool IsMenuUpdate
|
|
{
|
|
get { return this.m_IsMenuUpdate; }
|
|
set { this.m_IsMenuUpdate = value; }
|
|
}
|
|
public bool IsMenuInitialization
|
|
{
|
|
get { return this.m_IsMenuInitialization; }
|
|
set { this.m_IsMenuInitialization = value; }
|
|
}
|
|
public bool IsMenuEquipment
|
|
{
|
|
get { return this.m_IsMenuEquipment; }
|
|
set { this.m_IsMenuEquipment = value; }
|
|
}
|
|
public bool IsMenuIOTest
|
|
{
|
|
get { return this.m_IsMenuIOTest; }
|
|
set { this.m_IsMenuIOTest = value; }
|
|
}
|
|
public bool IsMenuStatistics
|
|
{
|
|
get { return this.m_IsMenuStatistics; }
|
|
set { this.m_IsMenuStatistics = value; }
|
|
}
|
|
public bool IsMenuUser
|
|
{
|
|
get { return this.m_IsMenuUser; }
|
|
set { this.m_IsMenuUser = value; }
|
|
}
|
|
public bool IsMenuViewer
|
|
{
|
|
get { return this.m_IsMenuViewer; }
|
|
set { this.m_IsMenuViewer = value; }
|
|
}
|
|
public bool IsMenuUserGroupEditor
|
|
{
|
|
get { return this.m_IsMenuUserGroupEditor; }
|
|
set { this.m_IsMenuUserGroupEditor = value; }
|
|
}
|
|
#endregion
|
|
|
|
#region Method
|
|
private void Initialize()
|
|
{
|
|
this.IsMainDisplayProductNo = false;
|
|
this.IsMainDisplayWeightSetting = false;
|
|
this.IsMainDisplayClear = false;
|
|
this.IsMainDisplaySubMenu = false;
|
|
|
|
this.IsMenuTime = false;
|
|
this.IsMenuInformation = false;
|
|
this.IsMenuDataBackup = false;
|
|
this.IsMenuCalibration = false;
|
|
this.IsMenuCommunication = false;
|
|
this.IsMenuConfiguration = false;
|
|
this.IsMenuSystem = false;
|
|
this.IsMenuMotor = false;
|
|
this.IsMenuUpdate = false;
|
|
this.IsMenuInitialization = false;
|
|
this.IsMenuEquipment = false;
|
|
this.IsMenuIOTest = false;
|
|
this.IsMenuStatistics = false;
|
|
this.IsMenuUser = true;
|
|
this.IsMenuUserGroupEditor = false;
|
|
this.IsMenuViewer = false;
|
|
}
|
|
#endregion
|
|
}
|
|
#endregion
|
|
#region StructUserGroupItem
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
public struct StructUserGroupItem
|
|
{
|
|
public bool IsMainDisplayProductNo;
|
|
public bool IsMainDisplayWeightSetting;
|
|
public bool IsMainDisplayClear;
|
|
public bool IsMainDispalySubMenu;
|
|
|
|
public bool IsMenuTimeSetting;
|
|
public bool IsMenuInformation;
|
|
public bool IsMenuDataBackup;
|
|
public bool IsMenuCalibration;
|
|
public bool IsMenuCommunication;
|
|
public bool IsMenuConfiguration;
|
|
public bool IsMenuSystemSetting;
|
|
public bool IsMenuMotorSetting;
|
|
public bool IsMenuUpdate;
|
|
public bool IsMenuFactoryReset;
|
|
public bool IsMenuEquipmentSetting;
|
|
public bool IsMenuIOTest;
|
|
public bool IsMenuDataStatistics;
|
|
public bool IsMenuUserSetting;
|
|
public bool IsMenuUserGroupSetting;
|
|
public bool IsMenuDataViewer;
|
|
|
|
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;
|
|
public bool Dummy17;
|
|
public bool Dummy18;
|
|
public bool Dummy19;
|
|
public bool Dummy20;
|
|
}
|
|
#endregion
|
|
}
|