using BP.En; using BP.Port; using BP.WF.Template; namespace BP.WF.Port.Admin2Group { /// /// 组织管理员 /// public class OrgAdminerAttr : BP.En.EntityMyPKAttr { /// /// 管理员 /// public const string FK_Emp = "FK_Emp"; /// /// 组织 /// public const string OrgNo = "OrgNo"; public const string FlowSorts = "FlowSorts"; public const string FrmTrees = "FrmTrees"; public const string EmpName = "EmpName"; } /// /// 组织管理员 /// public class OrgAdminer : EntityMyPK { #region 属性 public string FrmTrees { get { return this.GetValStringByKey(OrgAdminerAttr.FrmTrees); } set { this.SetValByKey(OrgAdminerAttr.FrmTrees, value); } } public string FlowSorts { get { return this.GetValStringByKey(OrgAdminerAttr.FlowSorts); } set { this.SetValByKey(OrgAdminerAttr.FlowSorts, value); } } public string EmpName { get { return this.GetValStringByKey(OrgAdminerAttr.EmpName); } set { this.SetValByKey(OrgAdminerAttr.EmpName, value); } } public string FK_Emp { get { return this.GetValStringByKey(OrgAdminerAttr.FK_Emp); } set { this.SetValByKey(OrgAdminerAttr.FK_Emp, value); } } public string OrgNo { get { return this.GetValStringByKey(OrgAdminerAttr.OrgNo); } set { this.SetValByKey(OrgAdminerAttr.OrgNo, value); } } #endregion #region 构造方法 public override UAC HisUAC { get { UAC uac = new UAC(); uac.OpenForSysAdmin(); uac.IsInsert = false; //uac.IsDelete = false; // uac.IsInsert = false; return uac; } } /// /// 组织管理员 /// public OrgAdminer() { } /// /// 组织管理员 /// /// public OrgAdminer(string mypk) { this.MyPK = mypk; this.Retrieve(); } /// /// 组织管理员 /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; Map map = new Map("Port_OrgAdminer", "组织管理员"); //不能注释掉. map.AddMyPK(false); map.AddTBString(OrgAdminerAttr.OrgNo, null, "组织", true, true, 0, 100, 20); map.AddTBString(OrgAdminerAttr.FK_Emp, null, "管理员账号", true, true, 0, 100, 20); map.AddTBString(OrgAdminerAttr.EmpName, null, "管理员名称", true, true, 0, 50, 20); map.AddTBStringDoc(OrgAdminerAttr.FlowSorts, null, "管理的流程目录", true, true, true); map.AddTBStringDoc(OrgAdminerAttr.FrmTrees, null, "管理的表单目录", true, true, true); map.AttrsOfOneVSM.AddGroupPanelModel(new OAFlowSorts(), new BP.WF.Template.FlowSorts(), OAFlowSortAttr.RefOrgAdminer, OAFlowSortAttr.FlowSortNo, "流程目录权限"); map.AttrsOfOneVSM.AddGroupPanelModel(new OAFrmTrees(), new SysFormTrees(), OAFrmTreeAttr.RefOrgAdminer, OAFrmTreeAttr.FrmTreeNo, "表单目录权限"); if (BP.Web.WebUser.No != null) map.AddHidden("OrgNo", " = ", "@WebUser.OrgNo"); this._enMap = map; return this._enMap; } } #endregion protected override bool beforeUpdateInsertAction() { string str = ""; BP.WF.Template.FlowSorts ens = new Template.FlowSorts(); ens.RetrieveInSQL("SELECT FlowSortNo FROM Port_OrgAdminerFlowSort WHERE FK_Emp='" + this.FK_Emp + "' AND OrgNo='" + this.OrgNo + "'"); foreach (BP.WF.Template.FlowSort item in ens) str += "(" + item.No + ")" + item.Name + ";"; this.FlowSorts = str; str = ""; SysFormTrees enTrees = new SysFormTrees(); enTrees.RetrieveInSQL("SELECT FrmTreeNo FROM Port_OrgAdminerFrmTree WHERE FK_Emp='" + this.FK_Emp + "' AND OrgNo='" + this.OrgNo + "'"); foreach (SysFormTree item in enTrees) str += "(" + item.No + ")" + item.Name + ";"; this.FrmTrees = str; if (this.EmpName=="" || this.EmpName ==null) { Emp emp = new Emp(this.FK_Emp); this.EmpName = emp.Name; this.MyPK = this.OrgNo + "_" + this.FK_Emp; } return base.beforeUpdateInsertAction(); } } /// /// 组织管理员s /// public class OrgAdminers : EntitiesMyPK { public override int RetrieveAll() { if (BP.Web.WebUser.No != null && BP.Web.WebUser.No.Equals("admin") == false) return this.Retrieve(OrgAdminerAttr.OrgNo, BP.Web.WebUser.OrgNo); return base.RetrieveAll(); } #region 构造 /// /// 组织s /// public OrgAdminers() { } /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new OrgAdminer(); } } #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((OrgAdminer)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }