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.

1165 lines
35 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using HcUtility.Core;
using Newtonsoft.Json;
using HcUtility.Comm;
//using DSWeb.Areas.CommMng.Helper;
namespace DSWeb.Areas.SysMng.Models.SysUser
{
[JsonObject]
public class SysUserMC : ModelObjectBillHead
{
#region private Fields
private string _GID = string.Empty;
private string _USERNAME = string.Empty;
private string _CODENAME = string.Empty;
private string _PASSWORD = string.Empty;
private string _SHOWNAME = string.Empty;
private string _ENROLLTIME = string.Empty;
private string _CREATEUSER = string.Empty;
private string _CREATETIME = string.Empty;
private string _MODIFIEDUSER = string.Empty;
private string _MODIFIEDTIME = string.Empty;
private string _ISDELETED ="0";
private string _ISDISABLE = string.Empty;
private string _DELETEUSER = string.Empty;
private string _DELETETIME = string.Empty;
private string _NOCODE = string.Empty;
private string _OPENID = string.Empty;
private string _WECHATACCOUNT = string.Empty;
private string _DINGTALKACCOUNT = string.Empty;
private string _COMPANYID = string.Empty;
private string _COMPANYNAME = string.Empty;
private string _DEPTNAME = string.Empty;
private string _OFFICEPHONE = string.Empty;
private string _HOMEPHONE = string.Empty;
private string _MOBILE = string.Empty;
private string _FAX = string.Empty;
private string _EMAIL1 = string.Empty;
private string _EMAIL2 = string.Empty;
private string _HOMEADDRESS = string.Empty;
private string _REMARK = string.Empty;
private string _EMERGUSER = string.Empty;
private string _EMERGPHONE = string.Empty;
private string _EMERGEMAIL = string.Empty;
private string _POSTCODE = string.Empty;
private string _QQ = string.Empty;
private string _MSN = string.Empty;
//private string _SIGNATURE = string.Empty;
private string _FINANCESOFTCODE = string.Empty;
private string _IMAGEURL = string.Empty;
private string _SIGNATUREURL = string.Empty;
private string _MAILSIGN = string.Empty;
private string _CWUSERNAME = string.Empty;
private string _CWPASSWORD = string.Empty;
#endregion
#region 读写属性
/// <summary>
/// 账户Guid
/// </summary>
[ModelDB(MDBType = ModelDBOprationType.All, IsPrimary = true)]
public string GID
{
get { return _GID; }
set { _GID = value; }
}
[ModelDB]
public string USERNAME
{
get { return _USERNAME; }
set { _USERNAME = value; }
}
[ModelDB]
public string CODENAME
{
get { return _CODENAME; }
set { _CODENAME = value; }
}
[ModelDB]
public string PASSWORD
{
get { return _PASSWORD; }
set { _PASSWORD = value; }
}
[ModelDB]
public string SHOWNAME
{
get { return _SHOWNAME; }
set { _SHOWNAME = value; }
}
[ModelDB]
public string ENROLLTIME
{
get { return _ENROLLTIME; }
set { _ENROLLTIME = value; }
}
[ModelDB]
public string CWUSERNAME
{
get { return _CWUSERNAME; }
set { _CWUSERNAME = value; }
}
[ModelDB]
public string CWPASSWORD
{
get { return _CWPASSWORD; }
set { _CWPASSWORD = value; }
}
//[user_baseinfo]
public string CREATEUSER
{
get { return _CREATEUSER; }
set { _CREATEUSER = value; }
}
//[user_baseinfo]
public string CREATETIME
{
get { return _CREATETIME; }
set { _CREATETIME = value; }
}
//[user_baseinfo]
public string MODIFIEDUSER
{
get { return _MODIFIEDUSER; }
set { _MODIFIEDUSER = value; }
}
//[user_baseinfo]
public string MODIFIEDTIME
{
get { return _MODIFIEDTIME; }
set { _MODIFIEDTIME = value; }
}
[ModelDB]
public string ISDELETED
{
get { return _ISDELETED; }
set { _ISDELETED = value; }
}
[ModelDB]
public string ISDISABLE
{
get { return _ISDISABLE; }
set { _ISDISABLE = value; }
}
[ModelDB]
public string DELETEUSER
{
get { return _DELETEUSER; }
set { _DELETEUSER = value; }
}
[ModelDB]
public string DELETETIME
{
get { return _DELETETIME; }
set { _DELETETIME = value; }
}
[ModelDB]
public string NOCODE
{
get { return _NOCODE; }
set { _NOCODE = value; }
}
[ModelDB]
public string OPENID
{
get { return _OPENID; }
set { _OPENID = value; }
}
[ModelDB]
public string WECHATACCOUNT
{
get { return _WECHATACCOUNT; }
set { _WECHATACCOUNT = value; }
}
[ModelDB]
public string DINGTALKACCOUNT
{
get { return _DINGTALKACCOUNT; }
set { _DINGTALKACCOUNT = value; }
}
[ModelDB(MDBType = ModelDBOprationType.Insert)]
public string MODIFYPASSTIME { get; set; }
public string COMPANYID
{
get { return _COMPANYID; }
set { _COMPANYID = value; }
}
public string COMPANYNAME
{
get { return _COMPANYNAME; }
set { _COMPANYNAME = value; }
}
//[user_baseinfo]
public string DEPTNAME
{
get { return _DEPTNAME; }
set { _DEPTNAME = value; }
}
//[user_baseinfo]
public string OFFICEPHONE
{
get { return _OFFICEPHONE; }
set { _OFFICEPHONE = value; }
}
//[user_baseinfo]
public string HOMEPHONE
{
get { return _HOMEPHONE; }
set { _HOMEPHONE = value; }
}
//[user_baseinfo]
public string MOBILE
{
get { return _MOBILE; }
set { _MOBILE = value; }
}
//[user_baseinfo]
public string FAX
{
get { return _FAX; }
set { _FAX = value; }
}
//[user_baseinfo]
public string EMAIL1
{
get { return _EMAIL1; }
set { _EMAIL1 = value; }
}
//[user_baseinfo]
public string EMAIL2
{
get { return _EMAIL2; }
set { _EMAIL2 = value; }
}
//[user_baseinfo]
public string HOMEADDRESS
{
get { return _HOMEADDRESS; }
set { _HOMEADDRESS = value; }
}
//[user_baseinfo]
public string REMARK
{
get { return _REMARK; }
set { _REMARK = value; }
}
//[user_baseinfo]
public string EMERGUSER
{
get { return _EMERGUSER; }
set { _EMERGUSER = value; }
}
//[user_baseinfo]
public string EMERGPHONE
{
get { return _EMERGPHONE; }
set { _EMERGPHONE = value; }
}
//[user_baseinfo]
public string EMERGEMAIL
{
get { return _EMERGEMAIL; }
set { _EMERGEMAIL = value; }
}
//[user_baseinfo]
public string POSTCODE
{
get { return _POSTCODE; }
set { _POSTCODE = value; }
}
//[user_baseinfo]
public string QQ
{
get { return _QQ; }
set { _QQ = value; }
}
//[user_baseinfo]
public string MSN
{
get { return _MSN; }
set { _MSN = value; }
}
//[user_baseinfo]
//public string SIGNATURE
//{
// get { return _SIGNATURE; }
// set { _SIGNATURE = value; }
//}
//[user_baseinfo]
public string FINANCESOFTCODE
{
get { return _FINANCESOFTCODE; }
set { _FINANCESOFTCODE = value; }
}
//[user_baseinfo]
public string IMAGEURL
{
get { return _IMAGEURL; }
set { _IMAGEURL = value; }
}
//[user_baseinfo]
public string SIGNATUREURL
{
get { return _SIGNATUREURL; }
set { _SIGNATUREURL = value; }
}
//[user_baseinfo]
public string MAILSIGN
{
get { return _MAILSIGN; }
set { _MAILSIGN = value; }
}
public bool isedit { get; set; }
#endregion
public string USERCOMPANYGID { get; set; }
public string USERBASEINFOGID { get; set; }
#region private Fields
private string _isUseSystem = string.Empty;
private string _isOperator = string.Empty;
private string _isSaleMan = string.Empty;
private string _isDriver = string.Empty;
private string _isCustomsDeclarer = string.Empty;
private string _isDocument = string.Empty;
private string _isFinancialStaff = string.Empty;
private string _isDisable = string.Empty;
private string _isCustomsService = string.Empty;
private string _isVehiclesDispatcher = string.Empty;
#endregion
#region R&W
public string isUseSystem
{
get { return _isUseSystem; }
set { _isUseSystem = value; }
}
public string isOperator
{
get { return _isOperator; }
set { _isOperator = value; }
}
public string isSaleMan
{
get { return _isSaleMan; }
set { _isSaleMan = value; }
}
public string isDriver
{
get { return _isDriver; }
set { _isDriver = value; }
}
public string isCustomsDeclarer
{
get { return _isCustomsDeclarer; }
set { _isCustomsDeclarer = value; }
}
public string isDocument
{
get { return _isDocument; }
set { _isDocument = value; }
}
public string isFinancialStaff
{
get { return _isFinancialStaff; }
set { _isFinancialStaff = value; }
}
public string isDisable
{
get { return _isDisable; }
set { _isDisable = value; }
}
public string isCustomsService
{
get { return _isCustomsService; }
set { _isCustomsService = value; }
}
public string isVehiclesDispatcher
{
get { return _isVehiclesDispatcher; }
set { _isVehiclesDispatcher = value; }
}
#endregion
public void setAttribute(List<user_userattributeMC> AttributeList)
{
if (AttributeList == null) { } else {
foreach (var item in AttributeList)
{
SetPropertyValue(item.ATTRIBUTENAME,item.VALUE);
}
}
}
override public string getSQL()
{
return @"SELECT U.[GID],U.[USERNAME],U.[CODENAME],U.[PASSWORD],U.[SHOWNAME],dbo.trimtime(U.[ENROLLTIME]) ENROLLTIME
,U.[ISDELETED],U.[ISDISABLE],U.[DELETEUSER],dbo.trimtime(U.[DELETETIME])DELETETIME,U.[NOCODE],U.[OPENID]
,U.[WeChatAccount],U.DingTalkAccount,U.CWUSERNAME,U.CWPASSWORD
,uc.[COMPANYID]
,B.[DEPTNAME],B.[CREATEUSER],dbo.trimtime(B.[CREATETIME])CREATETIME,B.[MODIFIEDUSER],dbo.trimtime(B.[MODIFIEDTIME])MODIFIEDTIME
,B.[OFFICEPHONE],B.[HOMEPHONE],B.[MOBILE],B.[FAX],B.[EMAIL1],B.[EMAIL2],B.[HOMEADDRESS],B.[REMARK],B.[EMERGUSER],B.[EMERGPHONE]
,B.[EMERGEMAIL],B.[POSTCODE],B.[QQ],B.[MSN],B.[FINANCESOFTCODE],B.[IMAGEURL],B.[SIGNATUREURL],B.[MAILSIGN]
,(select name from company where gid=uc.COMPANYID) COMPANYNAME,uc.gid USERCOMPANYGID,b.gid USERBASEINFOGID
,(select value from user_userattribute where attributeid=(select GID from user_attribute where NAME='isUseSystem')
and USERID=U.GID)isUseSystem
,(select value from user_userattribute where attributeid=(select GID from user_attribute where NAME='isDisable')
and USERID=U.GID)isDisable
FROM [user] U
left join [user_company] uc on uc.USERID=u.GID
left join [user_baseinfo] B on b.USERID=U.GID
WHERE 1=1 ";
}
public SysUserMC()
{
TableName = "[user]";
}
public override string GetBillNoFieldName()
{
return "GID"; //主表子表关联字段
}
public override string GetTimeMarkFieldName()
{
return "";
}
}
[JsonObject]
public class USER_BASEINFOMC : ModelObjectBillHead //ModelObjectBillBody
{
#region private Fields
private string _GID = string.Empty;
private string _USERID = string.Empty;
private string _DEPTNAME = string.Empty;
private string _CREATEUSER = string.Empty;
private string _CREATETIME = string.Empty;
private string _MODIFIEDUSER = string.Empty;
private string _MODIFIEDTIME = string.Empty;
private string _OFFICEPHONE = string.Empty;
private string _HOMEPHONE = string.Empty;
private string _MOBILE = string.Empty;
private string _FAX = string.Empty;
private string _EMAIL1 = string.Empty;
private string _EMAIL2 = string.Empty;
private string _HOMEADDRESS = string.Empty;
private string _REMARK = string.Empty;
private string _EMERGUSER = string.Empty;
private string _EMERGPHONE = string.Empty;
private string _EMERGEMAIL = string.Empty;
private string _POSTCODE = string.Empty;
private string _QQ = string.Empty;
private string _MSN = string.Empty;
//private string _SIGNATURE = string.Empty;
private string _FINANCESOFTCODE = string.Empty;
private string _IMAGEURL = string.Empty;
private string _SIGNATUREURL = string.Empty;
private string _MAILSIGN = string.Empty;
private string _COMPANYNAME = string.Empty;
#endregion
#region R&W
[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 DEPTNAME
{
get { return _DEPTNAME; }
set { _DEPTNAME = value; }
}
[ModelDB]
public string CREATEUSER
{
get { return _CREATEUSER; }
set { _CREATEUSER = value; }
}
[ModelDB]
public string CREATETIME
{
get { return _CREATETIME; }
set { _CREATETIME = value; }
}
[ModelDB]
public string MODIFIEDUSER
{
get { return _MODIFIEDUSER; }
set { _MODIFIEDUSER = value; }
}
[ModelDB]
public string MODIFIEDTIME
{
get { return _MODIFIEDTIME; }
set { _MODIFIEDTIME = value; }
}
[ModelDB]
public string OFFICEPHONE
{
get { return _OFFICEPHONE; }
set { _OFFICEPHONE = value; }
}
[ModelDB]
public string HOMEPHONE
{
get { return _HOMEPHONE; }
set { _HOMEPHONE = value; }
}
[ModelDB]
public string MOBILE
{
get { return _MOBILE; }
set { _MOBILE = value; }
}
[ModelDB]
public string FAX
{
get { return _FAX; }
set { _FAX = value; }
}
[ModelDB]
public string EMAIL1
{
get { return _EMAIL1; }
set { _EMAIL1 = value; }
}
[ModelDB]
public string EMAIL2
{
get { return _EMAIL2; }
set { _EMAIL2 = value; }
}
[ModelDB]
public string HOMEADDRESS
{
get { return _HOMEADDRESS; }
set { _HOMEADDRESS = value; }
}
[ModelDB]
public string REMARK
{
get { return _REMARK; }
set { _REMARK = value; }
}
[ModelDB]
public string EMERGUSER
{
get { return _EMERGUSER; }
set { _EMERGUSER = value; }
}
[ModelDB]
public string EMERGPHONE
{
get { return _EMERGPHONE; }
set { _EMERGPHONE = value; }
}
[ModelDB]
public string EMERGEMAIL
{
get { return _EMERGEMAIL; }
set { _EMERGEMAIL = value; }
}
[ModelDB]
public string POSTCODE
{
get { return _POSTCODE; }
set { _POSTCODE = value; }
}
[ModelDB]
public string QQ
{
get { return _QQ; }
set { _QQ = value; }
}
[ModelDB]
public string MSN
{
get { return _MSN; }
set { _MSN = value; }
}
//[ModelDB]
//public string SIGNATURE
//{
// get { return _SIGNATURE; }
// set { _SIGNATURE = value; }
//}
[ModelDB]
public string FINANCESOFTCODE
{
get { return _FINANCESOFTCODE; }
set { _FINANCESOFTCODE = value; }
}
[ModelDB]
public string IMAGEURL
{
get { return _IMAGEURL; }
set { _IMAGEURL = value; }
}
[ModelDB]
public string SIGNATUREURL
{
get { return _SIGNATUREURL; }
set { _SIGNATUREURL = value; }
}
[ModelDB]
public string MAILSIGN
{
get { return _MAILSIGN; }
set { _MAILSIGN = value; }
}
[ModelDB]
public string COMPANYNAME
{
get { return _COMPANYNAME; }
set { _COMPANYNAME = value; }
}
#endregion
public USER_BASEINFOMC() {
TableName = "user_baseinfo";
}
public USER_BASEINFOMC(SysUserMC user) {
TableName = "user_baseinfo";
this.DbOperationType = user.DbOperationType;
if (this.DbOperationType == DbOperationType.DbotIns)
GID = Guid.NewGuid().ToString();
else { GID = user.USERBASEINFOGID; }
//GID = user.GID;
USERID = user.GID;
DEPTNAME = user.DEPTNAME;
CREATEUSER = user.CREATEUSER;
CREATEUSER = user.CREATEUSER;
MODIFIEDUSER = user.MODIFIEDUSER;
MODIFIEDTIME = user.MODIFIEDTIME;
OFFICEPHONE = user.OFFICEPHONE;
HOMEPHONE = user.HOMEPHONE;
MOBILE = user.MOBILE;
FAX = user.FAX;
EMAIL1 = user.EMAIL1;
EMAIL2 = user.EMAIL2;
HOMEADDRESS = user.HOMEADDRESS;
REMARK = user.REMARK;
EMERGUSER = user.EMERGUSER;
EMERGPHONE = user.EMERGPHONE;
EMERGEMAIL = user.EMERGEMAIL;
POSTCODE = user.POSTCODE;
QQ = user.QQ;
MSN = user.MSN;
//SIGNATURE = user.SIGNATURE;
FINANCESOFTCODE = user.FINANCESOFTCODE;
IMAGEURL = user.IMAGEURL;
SIGNATUREURL = user.SIGNATUREURL;
MAILSIGN = user.MAILSIGN;
COMPANYNAME = user.COMPANYNAME;
}
override public string getSQL()
{
return "select * from USER_BASEINFO";
}
public override string GetBillNoFieldName()
{
return "GID";
}
public override string GetTimeMarkFieldName()
{
return ""; //如果需要的话写入时间标签
}
}
[JsonObject]
public class USER_COMPANYMC : ModelObjectBillHead
{
private string _GID = string.Empty;
private string _COMPANYID = string.Empty;
private string _USERID = string.Empty;
[ModelDB(MDBType = ModelDBOprationType.All, IsPrimary = true)]
public string GID
{
get { return _GID; }
set { _GID = value; }
}
[ModelDB]
public string COMPANYID
{
get { return _COMPANYID; }
set { _COMPANYID = value; }
}
[ModelDB]
public string USERID
{
get { return _USERID; }
set { _USERID = value; }
}
public USER_COMPANYMC()
{
TableName = "user_company";
}
public USER_COMPANYMC(SysUserMC user) {
TableName = "user_company";
this.DbOperationType = user.DbOperationType;
if (this.DbOperationType == DbOperationType.DbotIns)
GID = Guid.NewGuid().ToString();
else { GID = user.USERCOMPANYGID; }
//GID = user.GID;
USERID = user.GID;
COMPANYID = user.COMPANYID;
}
public override string GetBillNoFieldName()
{
return "GID";
}
public override string GetTimeMarkFieldName()
{
return "";
}
}
[JsonObject]
public class UserTreeRefModel : ModelObjectBase
{
#region private Fields
private string _id = string.Empty;
private string _GID = 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 string _ICON = String.Empty;
#endregion
#region Public Properties
[ModelDB]
public string id
{
get { return _id; }
set { _id = value; }
}
public string GID
{
get { return _GID; }
set { _GID = 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 Boolean leaf
{
get { return _leaf; }
set { _leaf = value; }
}
public Boolean expanded
{
get { return _expanded; }
set { _expanded = value; }
}
public string icon
{
get { return _ICON; }
set { _ICON = value; }
}
#endregion
public UserTreeRefModel()
{
TableName = "sys_module";
}
}
[JsonObject]
public class USEROPRangeMC : ModelObjectBillHead
{
#region 私有成员
private string _id = string.Empty;
private string _GID = string.Empty;
private string _NAME = string.Empty;
private string _DESCRIPTION = string.Empty;
private string _MODULEURL = string.Empty;
private string _icon = string.Empty;
private string _SORT = string.Empty;
private string _STATE = string.Empty;
private string _PARENTID = string.Empty;
private string _TYPE = string.Empty;
private Boolean _leaf = true;
private Boolean _expanded = true;
//private Boolean _checked = true;
#endregion
#region 读写属性
/// <summary>
/// 主键唯一值
/// </summary>
[ModelDB(MDBType = ModelDBOprationType.All, IsPrimary = true)]
public string id
{
get { return _id; }
set { _id = value; }
}
[ModelDB]
public string GID
{
get { return _GID; }
set { _GID = value; }
}
[ModelDB]
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 icon
{
get { return _icon; }
set { _icon = value; }
}
[ModelDB]
public string SORT
{
get { return _SORT; }
set { _SORT = value; }
}
[ModelDB]
public string STATE
{
get { return _STATE; }
set { _STATE = value; }
}
[ModelDB]
public string PARENTID
{
get { return _PARENTID; }
set { _PARENTID = value; }
}
[ModelDB]
public string TYPE
{
get { return _TYPE; }
set { _TYPE = value; }
}
[ModelDB]
public Boolean leaf
{
get { return _leaf; }
set { _leaf = value; }
}
[ModelDB]
public Boolean expanded
{
get { return _expanded; }
set { _expanded = value; }
}
override public string GetBillNoFieldName()
{
return "id";
}
#endregion
private string SQL = "";
override public string getSQL()
{
return SQL;
}
public USEROPRangeMC(string PARENTID)
{
TableName = "sys_module";
if (PARENTID == "0")
{
SQL = " exec p_usermodule 'and PARENTID=''0'' AND TYPE<>1' ";
//SQL = "SELECT GID id,NAME,DESCRIPTION,MODULEURL,MODULEICON icon,SORT,STATE,PARENTID,SHOWROOTSTATE,TYPE,case when exists (select 1 from sys_module s where s.PARENTID=sys_module.gid) then 0 else 1 end isleaf "
//+ "FROM sys_module WHERE STATE <> 1 and PARENTID='0' ORDER BY SORT,DESCRIPTION ASC ";
}
else
{
SQL = " exec p_usermodule 'and PARENTID=''" + PARENTID + "''' ";
//SQL = "SELECT GID id,NAME,DESCRIPTION,MODULEURL,MODULEICON icon,SORT,STATE,PARENTID,SHOWROOTSTATE,TYPE,case when exists (select 1 from sys_module s where s.PARENTID=sys_module.gid) then 0 else 1 end isleaf "
// + "FROM sys_module WHERE STATE <> 1 and PARENTID='" + PARENTID + "' ORDER BY SORT,DESCRIPTION ASC ";
}
}
public USEROPRangeMC(string USERID, string PARENTID)
{
TableName = "sys_module";
if (PARENTID == "0")
{
SQL = " exec P_usermodule_user '"+USERID+"', 'and PARENTID=''0'' '";
//SQL = "select GID id,*,case when exists (select 1 from sys_module s where s.PARENTID=sys_module.gid) then 0 else 1 end isleaf from sys_module where gid in(select moduleid from [action] where gid in("
//+ "select ACTIONID from [user_action] where userid ='" + USERID + "')"
//+ ") and STATE <> 1 AND PARENTID='0' ORDER BY SORT,DESCRIPTION ASC ";
}
else
{
SQL = " exec P_usermodule_user '" + USERID + "', 'and PARENTID=''" + PARENTID + "'' '";
//SQL = "select GID id,*,case when exists (select 1 from sys_module s where s.PARENTID=sys_module.gid) then 0 else 1 end isleaf from sys_module where gid in(select moduleid from [action] where gid in("
//+ "select ACTIONID from [user_action] where userid ='" + USERID + "')"
//+ ") and STATE <> 1 and PARENTID='" + PARENTID + "' ORDER BY SORT,DESCRIPTION ASC ";
}
}
}
[JsonObject]
public class user_userattributeMC : ModelObjectBillBody //ModelObjectBillBody
{
#region private Fields
private string _GID = string.Empty;
private string _USERID = string.Empty;
private string _ATTRIBUTEID = string.Empty;
private string _ATTRIBUTENAME = string.Empty;
private string _VALUE = string.Empty;
#endregion
#region R&W
[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 ATTRIBUTEID
{
get { return _ATTRIBUTEID; }
set { _ATTRIBUTEID = value; }
}
public string ATTRIBUTENAME
{
get { return _ATTRIBUTENAME; }
set { _ATTRIBUTENAME = value; }
}
[ModelDB]
public string VALUE
{
get { return _VALUE; }
set { _VALUE = value; }
}
#endregion
public void setAttribute(SysUserMC head)
{
if (ATTRIBUTENAME == "isUseSystem") VALUE = head.isUseSystem == "on" ? "true" : "false";
if (ATTRIBUTENAME == "isOperator") VALUE = head.isOperator == "on" ? "true" : "false";
if (ATTRIBUTENAME == "isSaleMan") VALUE = head.isSaleMan == "on" ? "true" : "false";
if (ATTRIBUTENAME == "isDriver") VALUE = head.isDriver == "on" ? "true" : "false";
if (ATTRIBUTENAME == "isCustomsDeclarer") VALUE = head.isCustomsDeclarer == "on" ? "true" : "false";
if (ATTRIBUTENAME == "isDocument") VALUE = head.isDocument == "on" ? "true" : "false";
if (ATTRIBUTENAME == "isFinancialStaff") VALUE = head.isFinancialStaff == "on" ? "true" : "false";
if (ATTRIBUTENAME == "isDisable") VALUE = head.isDisable == "on" ? "true" : "false";
if (ATTRIBUTENAME == "isCustomsService") VALUE = head.isCustomsService == "on" ? "true" : "false";
if (ATTRIBUTENAME == "isVehiclesDispatcher") VALUE = head.isVehiclesDispatcher == "on" ? "true" : "false";
}
public static void setAttribute(List<user_userattributeMC> AttributeList, SysUserMC head)
{
if (AttributeList.Count==0)
{
//新user 需要构筑新数据
user_userattributeMC item0 = new user_userattributeMC("2E5E6066-1C5D-4B04-BF8C-56637C20FC8C", head.isUseSystem=="on"?"true":"false");//isUseSystem
user_userattributeMC item1 = new user_userattributeMC("31AC11C1-D005-46EC-A0EE-05BC211AE1B7", head.isOperator == "on" ? "true" : "false");//isoperator
user_userattributeMC item2 = new user_userattributeMC("3C91140E-6FB6-4B5A-B5AB-30E59E3CBBED", head.isSaleMan == "on" ? "true" : "false");//isSaleMan
user_userattributeMC item3 = new user_userattributeMC("3CF26819-B519-4595-89E3-9F46A205218E", head.isDriver == "on" ? "true" : "false");//isDriver
user_userattributeMC item4 = new user_userattributeMC("4211AD22-FBF5-4A74-8A53-6AC05E598982", head.isCustomsDeclarer == "on" ? "true" : "false");//isCustomsDeclarer
user_userattributeMC item5 = new user_userattributeMC("A879800D-1CDC-4248-8120-7854431F2BE3", head.isDocument == "on" ? "true" : "false");//isDocument
user_userattributeMC item6 = new user_userattributeMC("D22315B2-3612-491A-B9E5-937E5E2CF310", head.isFinancialStaff == "on" ? "true" : "false");//isFinancialStaff
user_userattributeMC item7 = new user_userattributeMC("D4BF2204-F0AC-4F12-B02C-6520D57BF800", head.isDisable == "on" ? "true" : "false");//isDisable
user_userattributeMC item8 = new user_userattributeMC("D4BF2204-F0AC-4F12-B02C-6520D57BF806", head.isCustomsService == "on" ? "true" : "false");//isCustomsService
user_userattributeMC item9 = new user_userattributeMC("DFF42726-A0BA-4264-BFDF-2500A35E89C7", head.isVehiclesDispatcher == "on" ? "true" : "false");//isVehiclesDispatcher
AttributeList.Add(item0);
AttributeList.Add(item1);
AttributeList.Add(item2);
AttributeList.Add(item3);
AttributeList.Add(item4);
AttributeList.Add(item5);
AttributeList.Add(item6);
AttributeList.Add(item7);
AttributeList.Add(item8);
AttributeList.Add(item9);
} else {
foreach (user_userattributeMC attr in AttributeList) {
attr.setAttribute(head);
}
}
}
public user_userattributeMC()
{
TableName = "user_userattribute";
}
public user_userattributeMC(string ATTRIBUTEID,string VALUE)
{
TableName = "user_userattribute";
GID = Guid.NewGuid().ToString();
this.ATTRIBUTEID = ATTRIBUTEID;
this.VALUE = VALUE;
DbOperationType = DbOperationType.DbotIns;
}
public override string getSQL()
{
return "select [GID],[USERID],[ATTRIBUTEID],(select NAME from user_attribute where GID=ATTRIBUTEID)[ATTRIBUTENAME],[VALUE] from user_userattribute";
}
public override string GetBillNoFieldName()
{
return "USERID";
}
public override string GetTimeMarkFieldName()
{
return ""; //如果需要的话写入时间标签
}
}
}