using System;
using BP.En;
using BP.Port;
namespace BP.WF.Port
{
///
/// 操作员
///
public class WFEmpAttr
{
#region 基本属性
///
/// No
///
public const string No = "No";
///
/// 申请人
///
public const string Name = "Name";
public const string LoginData = "LoginData";
public const string Tel = "Tel";
//public const string Email = "Email";
public const string Stas = "Stas";
public const string Depts = "Depts";
public const string FK_Dept = "FK_Dept";
public const string Msg = "Msg";
public const string UseSta = "UseSta";
///
/// 可以发起的流程
///
public const string StartFlows = "StartFlows";
///
/// 图片签名密码
///
public const string SPass = "SPass";
///
/// token.
///
public const string Token = "Token";
public const string OrgNo = "OrgNo";
public const string UserID = "UserID";
public const string Author = "Author";
public const string AuthorDate = "AuthorDate";
#endregion
}
///
/// 操作员
///
public class WFEmp : EntityNoName
{
#region 基本属性
///
/// 编号
///
public new string No
{
get
{
return this.GetValStringByKey(EntityNoNameAttr.No);
}
set
{
this.SetValByKey(EmpAttr.No, value);
}
}
///
/// 用户ID:SAAS模式下UserID是可以重复的.
///
public string UserID
{
get
{
if (BP.Difference.SystemConfig.CCBPMRunModel == BP.Sys.CCBPMRunModel.SAAS)
return this.GetValStringByKey(WFEmpAttr.UserID);
return this.GetValStringByKey(WFEmpAttr.No);
}
set
{
this.SetValByKey(WFEmpAttr.UserID, value);
if (BP.Difference.SystemConfig.CCBPMRunModel == BP.Sys.CCBPMRunModel.SAAS)
this.SetValByKey(WFEmpAttr.No, BP.Web.WebUser.OrgNo + "_" + value);
else
this.SetValByKey(WFEmpAttr.No, value);
}
}
///
/// Token
///
public string Token
{
get
{
return this.GetValStringByKey(WFEmpAttr.Token);
}
set
{
this.SetValByKey(WFEmpAttr.Token, value);
}
}
///
/// 组织编号
///
public string OrgNo
{
get
{
return this.GetValStringByKey(WFEmpAttr.OrgNo);
}
set
{
this.SetValByKey(WFEmpAttr.OrgNo, value);
}
}
///
/// 用户状态
///
public int UseSta
{
get
{
return this.GetValIntByKey(WFEmpAttr.UseSta);
}
set
{
SetValByKey(WFEmpAttr.UseSta, value);
}
}
///
/// 部门编号
///
public string FK_Dept
{
get
{
return this.GetValStringByKey(WFEmpAttr.FK_Dept);
}
set
{
SetValByKey(WFEmpAttr.FK_Dept, value);
}
}
///
/// 电话
///
public string Tel
{
get
{
return this.GetValStringByKey(WFEmpAttr.Tel);
}
set
{
SetValByKey(WFEmpAttr.Tel, value);
}
}
/* public string Email
{
get
{
return this.GetValStringByKey(WFEmpAttr.Email);
}
set
{
SetValByKey(WFEmpAttr.Email, value);
}
}*/
///
/// 发起流程.
///
public string StartFlows
{
get
{
return this.GetValStrByKey(WFEmpAttr.StartFlows);
}
set
{
SetValByKey(WFEmpAttr.StartFlows, value);
}
}
///
/// 图片签名密码
///
public string SPass
{
get
{
return this.GetValStringByKey(WFEmpAttr.SPass);
}
set
{
SetValByKey(WFEmpAttr.SPass, value);
}
}
#endregion
#region 构造函数
///
/// 操作员
///
public WFEmp() { }
///
/// 操作员
///
///
public WFEmp(string userID)
{
if (userID == null || userID.Length == 0)
throw new Exception("@要查询的操作员编号为空。");
userID = userID.Trim();
if (BP.Difference.SystemConfig.CCBPMRunModel == BP.Sys.CCBPMRunModel.SAAS)
{
if (userID.Equals("admin") == true)
this.SetValByKey("No", userID);
else
this.SetValByKey("No", BP.Web.WebUser.OrgNo + "_" + userID);
}
else
{
this.SetValByKey("No", userID);
}
if (this.RetrieveFromDBSources() == 0)
{
BP.Port.Emp emp = new BP.Port.Emp(userID);
this.Row = emp.Row;
this.Insert();
}
}
///
/// 重写基类方法
///
public override Map EnMap
{
get
{
if (this._enMap != null)
return this._enMap;
Map map = new Map("WF_Emp", "操作员");
map.AddTBStringPK(WFEmpAttr.No, null, "No", true, true, 1, 50, 36);
map.AddTBString(WFEmpAttr.Name, null, "Name", true, false, 0, 50, 20);
map.AddTBInt(WFEmpAttr.UseSta, 1, "用户状态0禁用,1正常.", true, true);
map.AddTBString(WFEmpAttr.Tel, null, "Tel", true, true, 0, 50, 20);
map.AddTBString(WFEmpAttr.FK_Dept, null, "FK_Dept", true, true, 0, 100, 36);
//map.AddTBString(WFEmpAttr.Email, null, "Email", true, true, 0, 50, 20);
map.AddTBString(WFEmpAttr.Stas, null, "角色s", true, true, 0, 3000, 20);
map.AddTBString(WFEmpAttr.Depts, null, "部门s", true, true, 0, 100, 36);
map.AddTBString(WFEmpAttr.Msg, null, "消息", true, true, 0, 4000, 20);
//如果是集团模式或者是SAAS模式.
if (BP.Difference.SystemConfig.CCBPMRunModel != BP.Sys.CCBPMRunModel.Single)
map.AddTBString(WFEmpAttr.UserID, null, "用户ID", true, false, 0, 50, 30);
//隶属组织.
map.AddTBString(WFEmpAttr.OrgNo, null, "OrgNo", true, true, 0, 100, 20);
map.AddTBString(WFEmpAttr.SPass, null, "图片签名密码", true, true, 0, 200, 20);
map.AddTBString(WFEmpAttr.Author, null, "授权人", true, true, 0, 50, 20);
map.AddTBString(WFEmpAttr.AuthorDate, null, "授权日期", true, true, 0, 20, 20);
map.AddTBString(WFEmpAttr.Token, null, "Token", true, true, 0, 50, 20);
map.AddTBAtParas(3500); //增加字段.
this._enMap = map;
return this._enMap;
}
}
#endregion
#region 方法
protected override bool beforeUpdate()
{
string msg = "";
//if (this.Email.Length == 0)
//{
// if (this.HisAlertWay == AlertWay.SMSAndEmail || this.HisAlertWay == AlertWay.Email)
// msg += "错误:您设置了用e-mail接收信息,但是您没有设置e-mail。";
//}
//if (this.Tel.Length == 0)
//{
// if (this.HisAlertWay == AlertWay.SMSAndEmail || this.HisAlertWay == AlertWay.SMS)
// msg += "错误:您设置了用短信接收信息,但是您没有设置手机号。";
//}
//EmpStations ess = new EmpStations();
//ess.Retrieve(EmpStationAttr.FK_Emp, this.No);
//string sts = "";
//foreach (EmpStation es in ess)
//{
// sts += es.FK_StationT + " ";
//}
//this.Stas = sts;
if (msg != "")
throw new Exception(msg);
return base.beforeUpdate();
}
protected override bool beforeInsert()
{
this.UseSta = 1;
return base.beforeInsert();
}
#endregion
public void DoUp()
{
this.DoOrderUp("FK_Dept", this.FK_Dept, "Idx");
return;
}
public void DoDown()
{
this.DoOrderDown("FK_Dept", this.FK_Dept, "Idx");
return;
}
}
///
/// 操作员s
///
public class WFEmps : EntitiesNoName
{
#region 构造
///
/// 操作员s
///
public WFEmps()
{
}
///
/// 得到它的 Entity
///
public override Entity GetNewEntity
{
get
{
return new WFEmp();
}
}
public override int RetrieveAll()
{
return base.RetrieveAll("FK_Dept", "Idx");
}
#endregion
#region 为了适应自动翻译成java的需要,把实体转换成List.
///
/// 转化成 java list,C#不能调用.
///
/// List
public System.Collections.Generic.IList ToJavaList()
{
return (System.Collections.Generic.IList)this;
}
///
/// 转化成list
///
/// List
public System.Collections.Generic.List Tolist()
{
System.Collections.Generic.List list = new System.Collections.Generic.List();
for (int i = 0; i < this.Count; i++)
{
list.Add((WFEmp)this[i]);
}
return list;
}
#endregion 为了适应自动翻译成java的需要,把实体转换成List.
}
}