You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

439 lines
10 KiB
C#

using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using HcUtility.Core;
using Newtonsoft.Json;
namespace DSWeb.MvcShipping.Models.MsUserAuthority
{
[JsonObject]
public class UserAuthority : ModelObjectBillBody
{
#region 私有成员
private string _GID ="";//业务编号
private string _USERID;//
private string _VISIBLERANGE;//
private string _OPERATERANGE;//
private string _VISIBLERANGEREF;//
private string _OPERATERANGEREF;//
private string _AUTHORITYID;//
private string _DESCRIPTION;//
private string _VSSQL;//
private string _NAME;//
#endregion
public UserAuthority()
{
TableName = "user_authority_range";
}
#region 读写属性
/// <summary>
/// 主键唯一值
/// </summary>
[ModelDB(MDBType = ModelDBOprationType.All, IsPrimary = true)]
public string GID
{
get { return _GID; }
set { _GID = value; }
}
[ModelDB]
public string USERID
{
get { return _USERID; }
set { _USERID = value; }
}
[ModelDB]
public string VISIBLERANGE
{
get { return _VISIBLERANGE; }
set { _VISIBLERANGE = value; }
}
public string OPERATERANGE
{
get { return _OPERATERANGE; }
set { _OPERATERANGE = value; }
}
public string VISIBLERANGEREF
{
get { return _VISIBLERANGEREF; }
set { _VISIBLERANGEREF = value; }
}
public string OPERATERANGEREF
{
get { return _OPERATERANGEREF; }
set { _OPERATERANGEREF = value; }
}
public string AUTHORITYID
{
get { return _AUTHORITYID; }
set { _AUTHORITYID = value; }
}
public string DESCRIPTION
{
get { return _DESCRIPTION; }
set { _DESCRIPTION = value; }
}
public string VSSQL
{
get { return _VSSQL; }
set { _VSSQL = value; }
}
public string NAME
{
get { return _NAME; }
set { _NAME = value; }
}
override public string GetBillNoFieldName()
{
return "GID";
}
#endregion
}
[JsonObject]
public class UserTreeRefModel : ModelObjectBase
{
#region private Fields
private string _id = string.Empty;
private string _name = String.Empty;
private string _description = String.Empty;
private string _moduleurl = String.Empty;
private string _parentid = String.Empty;
private string _parentname = String.Empty;
private string _deptname = String.Empty;
private decimal _sort = 0;
private string _type = "0";
private Boolean _leaf = true;
private Boolean _expanded = true;
private Boolean _checked = true;
private int _TASTCOUNT = 0;
#endregion
#region Public Properties
[ModelDB]
public string id
{
get { return _id; }
set { _id = value; }
}
[ModelDB(MDBType = ModelDBOprationType.All, IsPrimary = true)]
public string NAME
{
get { return _name; }
set { _name = value; }
}
[ModelDB]
public string DESCRIPTION
{
get { return _description; }
set { _description = value; }
}
[ModelDB]
public string MODULEURL
{
get { return _moduleurl; }
set { _moduleurl = value; }
}
[ModelDB]
public string PARENTID
{
get
{
return _parentid;
}
set
{
_parentid = value;
}
}
[ModelDB]
public string PARENTNAME
{
get
{
return _parentname;
}
set
{
_parentname = value;
}
}
public string DEPTNAME
{
get
{
return _deptname;
}
set
{
_deptname = value;
}
}
[ModelDB]
public decimal SORT
{
get { return _sort; }
set { _sort = value; }
}
public string TYPE
{
get { return _type; }
set { _type = value; }
}
public int TASTCOUNT
{
get { return _TASTCOUNT; }
set { _TASTCOUNT = value; }
}
public Boolean leaf
{
get { return _leaf; }
set { _leaf = value; }
}
public Boolean expanded
{
get { return _expanded; }
set { _expanded = value; }
}
#endregion
public UserTreeRefModel()
{
TableName = "sys_module";
}
}
[JsonObject]
public class UserAuthorityCompany : ModelObjectBillBody
{
#region 私有成员
private string _GID = "";//业务编号
private string _USERID;//
private Boolean _VISIBLERANGE;//
private Boolean _OPERATERANGE;//
private string _COMPANYID;//
private string _COMPANY;//
private string _AUTHORITYID;//
#endregion
public UserAuthorityCompany()
{
TableName = "user_authority_range_company";
}
#region 读写属性
/// <summary>
/// 主键唯一值
/// </summary>
[ModelDB(MDBType = ModelDBOprationType.All, IsPrimary = true)]
public string GID
{
get { return _GID; }
set { _GID = value; }
}
[ModelDB]
public string USERID
{
get { return _USERID; }
set { _USERID = value; }
}
[ModelDB]
public Boolean VISIBLERANGE
{
get { return _VISIBLERANGE; }
set { _VISIBLERANGE = value; }
}
public Boolean OPERATERANGE
{
get { return _OPERATERANGE; }
set { _OPERATERANGE = value; }
}
public string AUTHORITYID
{
get { return _AUTHORITYID; }
set { _AUTHORITYID = value; }
}
public string COMPANYID
{
get { return _COMPANYID; }
set { _COMPANYID = value; }
}
public string COMPANY
{
get { return _COMPANY; }
set { _COMPANY = value; }
}
override public string GetBillNoFieldName()
{
return "GID";
}
#endregion
}
[JsonObject]
public class UserAuthorityOp : ModelObjectBillBody
{
#region 私有成员
private string _GID = "";//业务编号
private string _USERID;//
private Boolean _VISIBLERANGE;//
private Boolean _OPERATERANGE;//
private string _OPID;//
private string _OPNAME;//
private string _DEPTNAME;//
private string _AUTHORITYID;//
#endregion
public UserAuthorityOp()
{
TableName = "user_authority_range_op";
}
#region 读写属性
/// <summary>
/// 主键唯一值
/// </summary>
[ModelDB(MDBType = ModelDBOprationType.All, IsPrimary = true)]
public string GID
{
get { return _GID; }
set { _GID = value; }
}
[ModelDB]
public string USERID
{
get { return _USERID; }
set { _USERID = value; }
}
[ModelDB]
public Boolean VISIBLERANGE
{
get { return _VISIBLERANGE; }
set { _VISIBLERANGE = value; }
}
public Boolean OPERATERANGE
{
get { return _OPERATERANGE; }
set { _OPERATERANGE = value; }
}
public string AUTHORITYID
{
get { return _AUTHORITYID; }
set { _AUTHORITYID = value; }
}
public string OPID
{
get { return _OPID; }
set { _OPID = value; }
}
public string OPNAME
{
get { return _OPNAME; }
set { _OPNAME = value; }
}
public string DEPTNAME
{
get { return _DEPTNAME; }
set { _DEPTNAME = value; }
}
override public string GetBillNoFieldName()
{
return "GID";
}
private string _PARENTID = "";
/// <summary>
/// 用于树形结构的节点值
/// </summary>
public string PARENTID {
get {
if (!string.IsNullOrWhiteSpace(USERID))
return DEPTNAME;
else return _PARENTID;
}
set { _PARENTID = value; }
}
public string id { get; set; }
public bool leaf { get; set; }
public bool @checked {get;set;}
#endregion
public static void SetOpVsValue(List<UserAuthorityOp> bodyList, string rtype) {
foreach (var item in bodyList) {
if (rtype == "VS") {
item.VISIBLERANGE = item.@checked;
}
if (rtype == "OP")
{
item.OPERATERANGE = item.@checked;
}
}
}
private string SQL = "";
override public string getSQL()
{
return SQL;
}
public UserAuthorityOp(string PARENTID)
{
TableName = "vw_user";
SQL = SQL = "select * from (select userid id, SHOWNAME, deptgid PARENTID, 1 isleaf from vw_user "
+" union all select distinct companyid id, companyname showname, '0' parentid, 0 isleaf from vw_user "
+" union all select distinct deptgid id, DEPTNAME showname, companyid parentid, 0 isleaf from vw_user)t where PARENTID = '"+ PARENTID + "' order by SHOWNAME";
}
}
}