| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275 | using System.Collections.ObjectModel;using Caliburn.Micro.Core;using MECF.Framework.UI.Client.ClientBase;using OpenSEMI.ClientBase;namespace MECF.Framework.UI.Client.CenterViews.Configs.Roles{    public class RoleItem : PropertyChangedBase    {        public RoleItem(Common.Account.Extends.Role r)        {            this._Role = r;        }        public RoleItem(string roleid)        {            this._Role = new Common.Account.Extends.Role(roleid, string.Empty, false, 0, string.Empty, string.Empty);        }        private Common.Account.Extends.Role _Role;        public Common.Account.Extends.Role Role        {            get { return _Role; }            set { _Role = value; }        }        public string RoleID        {            get { return _Role.RoleID; }            set { _Role.RoleID = value; }        }        public string RoleName        {            get { return _Role.RoleName; }            set { _Role.RoleName = value; }        }        public int AutoLogoutTime        {            get { return _Role.LogoutTime; }            set { _Role.LogoutTime = value; }        }        public string Description        {            get { return _Role.Description; }            set { _Role.Description = value; }        }                public bool IsAutoLogout        {            get { return _Role.IsAutoLogout; }            set { _Role.IsAutoLogout = value; }        }        private string _DisplayRoleName;        public string DisplayRoleName        {            get { return _DisplayRoleName; }            set { _DisplayRoleName = value; NotifyOfPropertyChange("DisplayRoleName"); }        }        public int DisplayAutoLogoutTime        {            get;            set;        }        public bool DisplayIsAutoLogout        {            get;            set;        }        public string DisplayDescription        {            get;            set;        }        private bool _IsSelected = false;        public bool IsSelected        {            get { return _IsSelected; }            set { _IsSelected = value; NotifyOfPropertyChange("IsSelected"); }        }        private bool _RoleNameTextSaved = true;        public bool RoleNameTextSaved        {            get { return _RoleNameTextSaved; }            set            {                if (_RoleNameTextSaved != value)                {                    _RoleNameTextSaved = value;                    NotifyOfPropertyChange("RoleNameTextSaved");                }            }        }        private bool _TimeTextSaved = true;        public bool TimeTextSaved        {            get { return _TimeTextSaved; }            set            {                if (_TimeTextSaved != value)                {                    _TimeTextSaved = value;                    NotifyOfPropertyChange("TimeTextSaved");                }            }        }        private bool _DescriptionTextSaved = true;        public bool DescriptionTextSaved        {            get { return _DescriptionTextSaved; }            set            {                if (_DescriptionTextSaved != value)                {                    _DescriptionTextSaved = value;                    NotifyOfPropertyChange("DescriptionTextSaved");                }            }        }                private ObservableCollection<MenuInfo> _MenuColleciton = new ObservableCollection<MenuInfo>();        public ObservableCollection<MenuInfo> MenuCollection        {            get { return _MenuColleciton; }        }        public void AddMenuInfo(MenuInfo pInfo)        {            if (null == pInfo)                return;            MenuCollection.Add(pInfo);        }        public bool IsRoleChanged()        {            if (this.DisplayRoleName != this.Role.RoleName)                return true;            if (this.DisplayAutoLogoutTime != this.Role.LogoutTime)                return true;            if (this.DisplayIsAutoLogout != this.Role.IsAutoLogout)                return true;            if (this.DisplayDescription != this.Role.Description)                return true;            foreach (MenuInfo item in _MenuColleciton)            {                if (item.DisplayIndexPermission != item.IndexPermission - 1)                    return true;            }            return false;        }    }    public class MenuInfo : PropertyChangedBase    {        private string _strMenuID;        public string ID        {            get { return _strMenuID; }            set            {                if (value != _strMenuID)                    _strMenuID = value;            }        }        private MenuPermissionEnum _EnummenuPermission;        public MenuPermissionEnum EnumPermission        {            get { return _EnummenuPermission; }            set            {                if (value != _EnummenuPermission)                {                    _EnummenuPermission = value;                    _IndexMenuPermission = (int)_EnummenuPermission;                }            }        }        private string _StrMenuPermission;        public string StringPermission        {            get { return _StrMenuPermission; }            set            {                if (value != _StrMenuPermission)                    _StrMenuPermission = value;            }        }        private int _IndexMenuPermission;        public int IndexPermission        {            get { return _IndexMenuPermission; }            set            {                if (value != _IndexMenuPermission)                {                    _IndexMenuPermission = value;                    EnumPermission = (MenuPermissionEnum)_IndexMenuPermission;                }            }        }        private int _DisplayIndexPermission;        public int DisplayIndexPermission        {            get { return _DisplayIndexPermission; }            set            {                if (value != _DisplayIndexPermission)                {                    _DisplayIndexPermission = value;                }            }        }        private bool _ComboBoxSaved = false;        public bool ComboBoxSaved        {            get { return _ComboBoxSaved; }            set            {                if (_ComboBoxSaved != value)                {                    _ComboBoxSaved = value;                    NotifyOfPropertyChange("ComboBoxSaved");                }            }        }        private string _strMenuName;        public string Name        {            get { return _strMenuName; }            set            {                if (value != _strMenuName)                    _strMenuName = value;            }        }        public MenuInfo Clone()        {            MenuInfo menuInfo = new MenuInfo();            menuInfo.Name = this.Name;            menuInfo.StringPermission = this.StringPermission;            menuInfo.EnumPermission = this.EnumPermission;            menuInfo.ID = this.ID;            menuInfo.IndexPermission = this.IndexPermission;            menuInfo.DisplayIndexPermission = this.IndexPermission - 1;            return menuInfo;        }    }}
 |