Sic.Framework-Nanjing-Baishi/MECF.Framework.UI.Client/CenterViews/Configs/Roles/RoleItem.cs

231 lines
6.1 KiB
C#
Raw Normal View History

2023-04-13 11:51:03 +08:00
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; }
2023-04-13 11:51:03 +08:00
}
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> _MenuCollection = new ObservableCollection<MenuInfo>();
public ObservableCollection<MenuInfo> MenuCollection
{
get { return _MenuCollection; }
}
private ObservableCollection<RecipeInfo> _RecipeCollection = new ObservableCollection<RecipeInfo>();
public ObservableCollection<RecipeInfo> RecipeCollection
{
get { return _RecipeCollection; }
}
private ObservableCollection<StepInfo> _RecipeStepCollection = new ObservableCollection<StepInfo>();
public ObservableCollection<StepInfo> RecipeStepCollection
{
get { return _RecipeStepCollection; }
}
private ObservableCollection<ContentInfo> _ContentCollection = new ObservableCollection<ContentInfo>();
public ObservableCollection<ContentInfo> ContentCollection
{
get { return _ContentCollection; }
}
public void AddMenuInfo(MenuInfo pInfo)
{
if (null == pInfo)
return;
MenuCollection.Add(pInfo);
}
public void AddRecipeInfo(RecipeInfo pInfo)
{
if (null == pInfo)
return;
RecipeCollection.Add(pInfo);
}
public void AddStepInfo(StepInfo pInfo)
{
if (null == pInfo)
return;
RecipeStepCollection.Add(pInfo);
}
public void AddContentInfo(ContentInfo pInfo)
{
if (null == pInfo)
return;
ContentCollection.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 _MenuCollection)
{
if (item.DisplayIndexPermission != item.IndexPermission - 1)
return true;
}
foreach (RecipeInfo item in _RecipeCollection)
{
if (item.DisplayIndexPermission != item.IndexPermission - 1)
return true;
}
foreach (StepInfo item in _RecipeStepCollection)
{
if (item.DisplayIndexPermission != item.IndexPermission - 1)
return true;
}
foreach (ContentInfo item in ContentCollection)
{
if (item.DisplayIndexPermission != item.IndexPermission - 1)
return true;
}
return false;
}
}
}