using CommonLib; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Lskj.PubPower { /// /// 动态链接库对象 /// public class DynamicModel { /// /// 菜单ID /// /// The module identifier. public int ModuleId { get; protected set; } /// /// 窗口标题 /// /// The form text. public string FormText { get; protected set; } /// /// 权限(1.有操作权限.0.无权限.2.只读权限.3.右键配置权限全部开放) /// /// The privilege. public string Privilege { get; set; } /// /// 模块编号 /// /// The module code. public string ModuleCode { get; protected set; } /// /// 用户ID /// /// The user identifier. public string UserId { get { return ERPInfo.Instance.EmployeeId+""; } private set { ERPInfo.Instance.EmployeeId =int.Parse( value); } } /// /// 用户名称 /// /// The name of the user. public string UserName { get { return ERPInfo.Instance.EmployeeName; } private set { ERPInfo.Instance.EmployeeName = value; } } /// /// 是否是配置查询明细 /// /// The state of the save. public bool IsDetailSearch { get; set; } /// /// 说明:是否有操作权限 /// 创建人:龚宇超 /// 创建日期:2017-11-14 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// true if this instance has privilege; otherwise, false. public bool HasOperPrivilege() { return "1".Equals(this.Privilege) || "3".Equals(this.Privilege); } /// /// 说明:是否有只读权限 /// 创建人:龚宇超 /// 创建日期:2017-11-14 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// true if [has read privilege]; otherwise, false. public bool HasReadPrivilege() { return "2".Equals(this.Privilege); } /// /// 说明:是否有权限、包含只读和可操作权限 /// 创建人:龚宇超 /// 创建日期:2017-11-27 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// true if this instance has privilege; otherwise, false. public bool HasPrivilege() { return HasOperPrivilege() || HasReadPrivilege(); } /// /// 是否为基础档案 /// /// true if this instance is base module; otherwise, false. public virtual bool IsBaseModule { get { return false; } } /// /// 其他参数 /// /// The parameters. public string[] Params; /// /// 说明:传入特殊参数处理 /// 创建人:龚宇超 /// 创建日期:2017-11-22 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The model. /// System.String[]. public virtual string[] OtherParams() { return this.Params; } /// /// 初始化默认参数(1.标题、2、用户ID、3.用户名、4.权限、5.模块编号、6.菜单ID) /// /// The arguments. public DynamicModel(string[] args) { this.FormText = args[0]; this.UserId = args[1]; this.UserName = args[2]; this.Privilege = args[3]; this.ModuleCode = args[4]; this.ModuleId = 0; this.Params = new string[args.Length]; for (int i = 8; i < args.Length; i++) { Params[i - 8] = args[i]; } } } /// /// 权限设置入口对象 /// public class DynamicPowerModel : DynamicModel { public DynamicPowerModel(string[] args) : base(args) { // 右键菜单打开的模块没有moduleId,部分特殊模块没有moduleId比如添加界面. if (!string.IsNullOrEmpty(args[5])) { base.ModuleId = Convert.ToInt32(args[5]); } } } }