using BP.En; using BP.Sys; using BP.WF.Template; namespace BP.WF.Port { /// /// 部门属性(即将弃用) /// public class DeptAttr : EntityNoNameAttr { /// /// 父节点编号 /// public const string ParentNo = "ParentNo"; /// /// 隶属组织 /// public const string OrgNo = "OrgNo"; public const string Leader = "Leader"; public const string LeaderName = "LeaderName"; public const string Idx = "Idx"; } /// /// 部门(即将弃用) /// public class Dept:EntityNoName { #region 属性 public int Idx { get { return this.GetValIntByKey(DeptAttr.Idx); } set { this.SetValByKey(DeptAttr.Idx, value); } } /// /// 父节点编号 /// public string ParentNo { get { return this.GetValStrByKey(DeptAttr.ParentNo); } set { this.SetValByKey(DeptAttr.ParentNo, value); } } public string OrgNo { get { return this.GetValStrByKey(DeptAttr.OrgNo); } set { this.SetValByKey(DeptAttr.OrgNo, value); } } public string Leader { get { return this.GetValStrByKey(DeptAttr.Leader); } set { this.SetValByKey(DeptAttr.Leader, value); } } #endregion #region 构造函数 /// /// 部门 /// public Dept(){} /// /// 部门 /// /// 编号 public Dept(string no) : base(no){} #endregion #region 重写方法 /// /// UI界面上的访问控制 /// public override UAC HisUAC { get { UAC uac = new UAC(); uac.OpenForSysAdmin(); uac.IsInsert = false; return uac; } } /// /// Map /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; Map map = new Map("Port_Dept", "部门"); map.AddTBStringPK(DeptAttr.No, null, "编号", true, false, 1, 30, 40); map.AddTBString(DeptAttr.Name, null,"名称", true, false, 0, 60, 200); map.AddTBString(DeptAttr.ParentNo, null, "父节点编号", true, true, 0, 30, 40); map.AddTBString(DeptAttr.OrgNo, null, "隶属组织", true, true, 0, 50, 250); map.AddDDLEntities(DeptAttr.Leader, null, "部门领导", new BP.Port.Emps(), true); map.AddTBInt(DeptAttr.Idx, 0, "序号", true, false); //map.AddTBString(DeptAttr.FK_Unit, "1", "隶属单位", false, false, 0, 50, 10); //设置二级管理员 RefMethod rm = new RefMethod(); rm.Title = "设置二级管理员"; rm.ClassMethodName = this.ToString() + ".ToSetAdminer"; rm.RefMethodType = RefMethodType.RightFrameOpen; rm.IsCanBatch = false; //是否可以批处理? map.AddRefMethod(rm); this._enMap = map; return this._enMap; } } #endregion protected override bool beforeDelete() { //检查是否可以删除. BP.Port.Dept dept = new BP.Port.Dept(this.No); dept.CheckIsCanDelete(); return base.beforeDelete(); } /// /// 跳转到单机版二级管理员设置 /// /// public string ToSetAdminer() { return "../../../GPM/SetAdminer.htm?FK_Dept=" + this.No; } /// /// 设置单机版二级管理员 /// /// /// public string DoSetAdminer(string adminer, string userName) { GloVar gloVar = new GloVar(); gloVar.No = this.No + "_" + adminer + "_Adminer"; if (gloVar.RetrieveFromDBSources() == 1) return userName + "已经设置成部门[" + this.Name + "]的二级管理员"; gloVar.Name = userName; gloVar.Val = adminer; gloVar.Note = this.No; gloVar.GroupKey = "Adminer"; gloVar.Insert(); //设置流程目录、表单目录 #region 检查流程树. BP.WF.Template.FlowSort fs = new WF.Template.FlowSort(); fs.No = this.No; if (fs.RetrieveFromDBSources() == 0) { //获得根目录节点. BP.WF.Template.FlowSort root = new Template.FlowSort(); int i = root.Retrieve(BP.WF.Template.FlowSortAttr.ParentNo, "0"); //设置流程树权限. fs.No = this.No; fs.Name = "流程树"; fs.ParentNo = root.No; fs.Idx = 999; fs.DirectInsert(); //创建下一级目录. BP.WF.Template.FlowSort en = fs.DoCreateSubNode() as BP.WF.Template.FlowSort; en.Name = "日常办公类"; en.Domain = ""; en.DirectUpdate(); } #endregion 检查流程树. #region 检查表单树. //表单根目录. SysFormTree ftRoot = new SysFormTree(); int val = ftRoot.Retrieve(BP.WF.Template.FlowSortAttr.ParentNo, "0"); if (val == 0) { val = ftRoot.Retrieve(BP.WF.Template.FlowSortAttr.No, "100"); if (val == 0) { ftRoot.No = "100"; ftRoot.Name = "表单库"; ftRoot.ParentNo = "0"; ftRoot.Insert(); } else { ftRoot.ParentNo = "0"; ftRoot.Name = "表单库"; ftRoot.Update(); } } //设置表单树权限. SysFormTree ft = new SysFormTree(); ft.No = this.No; if (ft.RetrieveFromDBSources() == 0) { ft.Name = "表单树"; ft.ParentNo = ftRoot.No; ft.Idx = 999; ft.DirectInsert(); //创建两个目录. SysFormTree mySubFT = ft.DoCreateSubNode() as SysFormTree; mySubFT.Name = "日常办公类"; mySubFT.DirectUpdate(); } #endregion 检查表单树. return "设置成功"; } } /// ///部门集合(即将弃用) /// public class Depts : EntitiesNoName { /// /// 查询全部。 /// /// public override int RetrieveAll() { if (BP.Web.WebUser.No.Equals("admin")==true) return base.RetrieveAll(); if (BP.Difference.SystemConfig.CCBPMRunModel == CCBPMRunModel.Single) { QueryObject qo = new QueryObject(this); qo.AddWhere(DeptAttr.No, " = ", BP.Web.WebUser.FK_Dept); qo.addOr(); qo.AddWhere(DeptAttr.ParentNo, " = ", BP.Web.WebUser.FK_Dept); return qo.DoQuery(); } return this.Retrieve("OrgNo", BP.Web.WebUser.OrgNo); } /// /// 得到一个新实体 /// public override Entity GetNewEntity { get { return new Dept(); } } /// /// create ens /// public Depts() { } #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((Dept)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }