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.

331 lines
8.7 KiB
Plaintext

using System;
using System.Data;
using BP.DA;
using BP.En;
namespace BP.GPM.AD
{
/// <summary>
/// 操作员属性
/// </summary>
public class EmpAttr : BP.En.EntityNoNameAttr
{
#region 基本属性
/// <summary>
/// 部门
/// </summary>
public const string FK_Dept = "FK_Dept";
/// <summary>
/// 密码
/// </summary>
public const string Pass = "Pass";
/// <summary>
/// sid
/// </summary>
public const string SID = "Token";
/// <summary>
/// 电话
/// </summary>
public const string Tel = "Tel";
/// <summary>
/// 邮箱
/// </summary>
public const string Email = "Email";
/// <summary>
/// 序号
/// </summary>
public const string Idx = "Idx";
/// <summary>
/// 拼音
/// </summary>
public const string PinYin = "PinYin";
#endregion
/// <summary>
/// 签字类型
/// </summary>
public const string SignType = "SignType";
/// <summary>
/// 部门经理
/// </summary>
public const string Manager = "Manager";
}
/// <summary>
/// 操作员 的摘要说明。
/// </summary>
public class Emp : EntityNoName
{
#region 扩展属性
/// <summary>
/// 该人员是否被禁用.
/// </summary>
public bool IsEnable
{
get
{
if (this.No.Equals("admin")==true)
return true;
string sql = "SELECT COUNT(FK_Emp) FROM Port_DeptEmpStation WHERE FK_Emp='" + this.No + "'";
if (DBAccess.RunSQLReturnValInt(sql, 0) == 0)
return false;
sql = "SELECT COUNT(FK_Emp) FROM Port_DeptEmp WHERE FK_Emp='" + this.No + "'";
if (DBAccess.RunSQLReturnValInt(sql, 0) == 0)
return false;
return true;
}
}
/// <summary>
/// 拼音
/// </summary>
public string PinYin
{
get
{
return this.GetValStrByKey(EmpAttr.PinYin);
}
set
{
this.SetValByKey(EmpAttr.PinYin, value);
}
}
/// <summary>
/// 主要的部门。
/// </summary>
public Dept HisDept
{
get
{
try
{
return new Dept(this.FK_Dept);
}
catch (Exception ex)
{
throw new Exception("@获取操作员" + this.No + "部门[" + this.FK_Dept + "]出现错误,可能是系统管理员没有给他维护部门.@" + ex.Message);
}
}
}
/// <summary>
/// 部门
/// </summary>
public string FK_Dept
{
get
{
return this.GetValStrByKey(EmpAttr.FK_Dept);
}
set
{
this.SetValByKey(EmpAttr.FK_Dept, value);
}
}
public string FK_DeptText
{
get
{
return this.GetValRefTextByKey(EmpAttr.FK_Dept);
}
}
public string Tel
{
get
{
return this.GetValStrByKey(EmpAttr.Tel);
}
set
{
this.SetValByKey(EmpAttr.Tel, value);
}
}
public string Email
{
get
{
return this.GetValStrByKey(EmpAttr.Email);
}
set
{
this.SetValByKey(EmpAttr.Email, value);
}
}
/// <summary>
/// 密码
/// </summary>
public string Pass
{
get
{
return this.GetValStrByKey(EmpAttr.Pass);
}
set
{
this.SetValByKey(EmpAttr.Pass, value);
}
}
/// <summary>
/// 顺序号
/// </summary>
public int Idx
{
get
{
return this.GetValIntByKey(EmpAttr.Idx);
}
set
{
this.SetValByKey(EmpAttr.Idx, value);
}
}
/// <summary>
/// 签字类型
/// </summary>
public int SignType
{
get
{
return this.GetValIntByKey(EmpAttr.SignType);
}
set
{
this.SetValByKey(EmpAttr.SignType, value);
}
}
#endregion
#region 公共方法
/// <summary>
/// 检查密码(可以重写此方法)
/// </summary>
/// <param name="pass">密码</param>
/// <returns>是否匹配成功</returns>
public bool CheckPass(string pass)
{
if (this.Pass == pass)
return true;
return false;
}
#endregion 公共方法
#region 构造函数
/// <summary>
/// 操作员
/// </summary>
public Emp()
{
}
/// <summary>
/// 操作员
/// </summary>
/// <param name="no">编号</param>
public Emp(string no)
{
this.No = no.Trim();
this.Retrieve();
}
public override UAC HisUAC
{
get
{
UAC uac = new UAC();
uac.OpenForAppAdmin();
return uac;
}
}
/// <summary>
/// 重写基类方法
/// </summary>
public override Map EnMap
{
get
{
if (this._enMap != null)
return this._enMap;
Map map = new Map("Port_Emp", "用户");
#region 字段
/*关于字段属性的增加 */
map.AddTBStringPK(EmpAttr.No, null, "登陆账号", true, false, 1, 50, 90);
map.AddTBString(EmpAttr.Name, null, "名称", true, false, 0, 200, 130);
map.AddTBString(EmpAttr.Pass, "123", "密码", false, false, 0, 100, 10);
map.AddDDLEntities(EmpAttr.FK_Dept, null, "主要部门", new BP.Port.Depts(), true);
map.AddTBString(EmpAttr.SID, null, "安全校验码", false, false, 0, 36, 36);
map.AddTBString(EmpAttr.Tel, null, "电话", true, false, 0, 20, 130);
map.AddTBString(EmpAttr.Email, null, "邮箱", true, false, 0, 100, 132, true);
map.AddTBString(EmpAttr.PinYin, null, "拼音", true, false, 0, 500, 132, true);
map.AddTBString(EmpAttr.Manager, null, "Manager", true, false, 0, 500, 132, true);
map.AddTBString("mobile", null, "mobile", true, false, 0, 500, 132, true);
map.AddTBInt(EmpAttr.Idx, 0, "序号", true, false);
#endregion 字段
this._enMap = map;
return this._enMap;
}
}
#endregion 构造函数
}
/// <summary>
/// 操作员s
// </summary>
public class Emps : EntitiesNoName
{
#region 构造方法
/// <summary>
/// 得到它的 Entity
/// </summary>
public override Entity GetNewEntity
{
get
{
return new Emp();
}
}
/// <summary>
/// 操作员s
/// </summary>
public Emps()
{
}
public override int RetrieveAll()
{
return base.RetrieveAll("Name");
}
#endregion 构造方法
#region 为了适应自动翻译成java的需要,把实体转换成List.
/// <summary>
/// 转化成 java list,C#不能调用.
/// </summary>
/// <returns>List</returns>
public System.Collections.Generic.IList<Emp> ToJavaList()
{
return (System.Collections.Generic.IList<Emp>)this;
}
/// <summary>
/// 转化成list
/// </summary>
/// <returns>List</returns>
public System.Collections.Generic.List<Emp> Tolist()
{
System.Collections.Generic.List<Emp> list = new System.Collections.Generic.List<Emp>();
for (int i = 0; i < this.Count; i++)
{
list.Add((Emp)this[i]);
}
return list;
}
#endregion 为了适应自动翻译成java的需要,把实体转换成List.
}
}