using System; using System.Data; using BP.DA; using BP.En; namespace BP.GPM.AD { /// /// 操作员属性 /// public class EmpAttr : BP.En.EntityNoNameAttr { #region 基本属性 /// /// 部门 /// public const string FK_Dept = "FK_Dept"; /// /// 密码 /// public const string Pass = "Pass"; /// /// sid /// public const string SID = "Token"; /// /// 电话 /// public const string Tel = "Tel"; /// /// 邮箱 /// public const string Email = "Email"; /// /// 序号 /// public const string Idx = "Idx"; /// /// 拼音 /// public const string PinYin = "PinYin"; #endregion /// /// 签字类型 /// public const string SignType = "SignType"; /// /// 部门经理 /// public const string Manager = "Manager"; } /// /// 操作员 的摘要说明。 /// public class Emp : EntityNoName { #region 扩展属性 /// /// 该人员是否被禁用. /// 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; } } /// /// 拼音 /// public string PinYin { get { return this.GetValStrByKey(EmpAttr.PinYin); } set { this.SetValByKey(EmpAttr.PinYin, value); } } /// /// 主要的部门。 /// public Dept HisDept { get { try { return new Dept(this.FK_Dept); } catch (Exception ex) { throw new Exception("@获取操作员" + this.No + "部门[" + this.FK_Dept + "]出现错误,可能是系统管理员没有给他维护部门.@" + ex.Message); } } } /// /// 部门 /// 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); } } /// /// 密码 /// public string Pass { get { return this.GetValStrByKey(EmpAttr.Pass); } set { this.SetValByKey(EmpAttr.Pass, value); } } /// /// 顺序号 /// public int Idx { get { return this.GetValIntByKey(EmpAttr.Idx); } set { this.SetValByKey(EmpAttr.Idx, value); } } /// /// 签字类型 /// public int SignType { get { return this.GetValIntByKey(EmpAttr.SignType); } set { this.SetValByKey(EmpAttr.SignType, value); } } #endregion #region 公共方法 /// /// 检查密码(可以重写此方法) /// /// 密码 /// 是否匹配成功 public bool CheckPass(string pass) { if (this.Pass == pass) return true; return false; } #endregion 公共方法 #region 构造函数 /// /// 操作员 /// public Emp() { } /// /// 操作员 /// /// 编号 public Emp(string no) { this.No = no.Trim(); this.Retrieve(); } public override UAC HisUAC { get { UAC uac = new UAC(); uac.OpenForAppAdmin(); return uac; } } /// /// 重写基类方法 /// 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 构造函数 } /// /// 操作员s // public class Emps : EntitiesNoName { #region 构造方法 /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new Emp(); } } /// /// 操作员s /// public Emps() { } public override int RetrieveAll() { return base.RetrieveAll("Name"); } #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((Emp)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }