using System; using System.Collections; using BP.DA; using BP.En; using BP.WF.Port; using BP.WF; using BP.Sys; namespace BP.WF.Template { /// /// Frm属性 /// public class FrmFieldAttr : EntityNoNameAttr { /// /// 字段 /// public const string KeyOfEn = "KeyOfEn"; /// /// FK_Node /// public const string FK_Node = "FK_Node"; /// /// 流程编号 /// public const string FK_Flow = "FK_Flow"; /// /// FK_MapData /// public const string FrmID = "FK_MapData"; /// /// 是否必填 /// public const string IsNotNull = "IsNotNull"; /// /// 正则表达式 /// public const string RegularExp = "RegularExp"; /// /// 类型 /// public const string EleType = "EleType"; /// /// 是否写入流程表? /// public const string IsWriteToFlowTable = "IsWriteToFlowTable"; /// /// 是否写入流程注册表 /// public const string IsWriteToGenerWorkFlow = "IsWriteToGenerWorkFlow"; } /// /// 表单字段方案 /// public class FrmField : EntityMyPK { #region 基本属性 /// /// 元素类型. /// public string EleType { get { return this.GetValStringByKey(FrmFieldAttr.EleType); } set { this.SetValByKey(FrmFieldAttr.EleType, value); } } /// /// 正则表达式 /// public string RegularExp { get { return this.GetValStringByKey(FrmFieldAttr.RegularExp); } set { this.SetValByKey(FrmFieldAttr.RegularExp, value); } } public string Name { get { return this.GetValStringByKey(FrmFieldAttr.Name); } set { this.SetValByKey(FrmFieldAttr.Name, value); } } /// /// 是否为空 /// public bool ItIsNotNull { get { return this.GetValBooleanByKey(FrmFieldAttr.IsNotNull); } set { this.SetValByKey(FrmFieldAttr.IsNotNull, value); } } /// /// 是否写入流程数据表 /// public bool ItIsWriteToFlowTable { get { return this.GetValBooleanByKey(FrmFieldAttr.IsWriteToFlowTable); } set { this.SetValByKey(FrmFieldAttr.IsWriteToFlowTable, value); } } /// /// 表单ID /// public string FrmID { get { return this.GetValStringByKey(FrmFieldAttr.FrmID); } set { this.SetValByKey(FrmFieldAttr.FrmID, value); } } public void setFK_MapData(string val) { this.SetValByKey(FrmFieldAttr.FrmID, val); } /// /// 字段 /// public string KeyOfEn { get { return this.GetValStringByKey(FrmFieldAttr.KeyOfEn); } set { this.SetValByKey(FrmFieldAttr.KeyOfEn, value); } } public void setKeyOfEn(string val) { this.SetValByKey(FrmFieldAttr.KeyOfEn, val); } /// /// 流程编号 /// public string FlowNo { get { return this.GetValStringByKey(FrmFieldAttr.FK_Flow); } set { this.SetValByKey(FrmFieldAttr.FK_Flow, value); } } /// /// 解决方案 /// public int NodeID { get { return this.GetValIntByKey(FrmFieldAttr.FK_Node); } set { this.SetValByKey(FrmFieldAttr.FK_Node, value); } } /// /// 是否可见 /// public bool UIVisible { get { return this.GetValBooleanByKey(MapAttrAttr.UIVisible); } set { this.SetValByKey(MapAttrAttr.UIVisible, value); } } /// /// 是否可用 /// public bool UIIsEnable { get { return this.GetValBooleanByKey(MapAttrAttr.UIIsEnable); } set { this.SetValByKey(MapAttrAttr.UIIsEnable, value); } } public void setUIIsEnable(bool val) { this.SetValByKey(MapAttrAttr.UIIsEnable, val); } public void setUIVisible(bool val) { this.SetValByKey(MapAttrAttr.UIVisible, val); } public string DefVal { get { return this.GetValStringByKey(MapAttrAttr.DefVal); } set { this.SetValByKey(MapAttrAttr.DefVal, value); } } /// /// 是否是数字签名? /// public bool ItIsSigan { get { return this.GetValBooleanByKey(MapAttrAttr.IsSigan); } set { this.SetValByKey(MapAttrAttr.IsSigan, value); } } public override string InitMyPKVals() { this.setMyPK( this.FrmID + "_" + this.FlowNo + "_" + this.NodeID + "_" + this.KeyOfEn + "_" + this.EleType); return base.InitMyPKVals(); } #endregion #region 构造方法 /// /// 表单字段方案 /// public FrmField() { } /// /// 表单字段方案 /// /// public FrmField(string mypk) : base(mypk) { } /// /// 重写基类方法 /// public override Map EnMap { get { if (this._enMap != null) return this._enMap; Map map = new Map("Sys_FrmSln", "表单字段方案"); map.CodeStruct = "4"; map.AddMyPK(); //该表单对应的表单ID map.AddTBString(FrmFieldAttr.FK_Flow, null, "流程编号", true, false, 0, 4, 4); map.AddTBInt(FrmFieldAttr.FK_Node, 0, "节点", true, false); map.AddTBString(FrmFieldAttr.FrmID, null, "表单ID", true, false, 0, 100, 10); map.AddTBString(FrmFieldAttr.KeyOfEn, null, "字段", true, false, 0, 200, 20); map.AddTBString(FrmFieldAttr.Name, null, "字段名", true, false, 0, 500, 20); map.AddTBString(FrmFieldAttr.EleType, null, "类型", true, false, 0, 20, 20); //控制内容. map.AddBoolean(MapAttrAttr.UIIsEnable, true, "是否可用", true, true); map.AddBoolean(MapAttrAttr.UIVisible, true, "是否可见", true, true); map.AddBoolean(MapAttrAttr.IsSigan, false, "是否签名", true, true); // Add 2013-12-26. map.AddTBInt(FrmFieldAttr.IsNotNull, 0, "是否为空", true, false); map.AddTBString(FrmFieldAttr.RegularExp, null, "正则表达式", true, false, 0, 500, 20); // 是否写入流程表? 2014-01-26,如果是,则首先写入该节点的数据表,然后copy到流程数据表里 // 在节点发送时有ccflow自动写入,写入目的就是为了 map.AddTBInt(FrmFieldAttr.IsWriteToFlowTable, 0, "是否写入流程表", true, false); map.AddTBInt(FrmFieldAttr.IsWriteToGenerWorkFlow, 0, "是否写入流程注册表", true, false); //map.AddDDLSysEnum(FrmFieldAttr.IsWriteToFlowTable, 0, "写入规则", true, true, FrmFieldAttr.IsWriteToFlowTable, // "@0=不写入@1=写入流程数据表@2=写入流程注册表@3=写入全部"); map.AddBoolean(MapAttrAttr.IsSigan, false, "是否签名", true, true); map.AddTBString(MapAttrAttr.DefVal, null, "默认值", true, false, 0, 200, 20); this._enMap = map; return this._enMap; } } #endregion protected override bool beforeInsert() { if (DataType.IsNullOrEmpty(this.EleType)) this.EleType = "Field"; if(this.EleType.Equals("Field") ==true) this.setMyPK(this.FrmID + "_"+ this.NodeID + "_" + this.KeyOfEn); return base.beforeInsert(); } } /// /// 表单字段方案s /// public class FrmFields : EntitiesMyPK { public FrmFields() { } /// /// 查询 /// public FrmFields(string fk_mapdata, int nodeID) { this.Retrieve(FrmFieldAttr.FrmID, fk_mapdata, FrmFieldAttr.FK_Node, nodeID,FrmFieldAttr.EleType, "Field"); } /// /// 得到它的 Entity /// public override Entity GetNewEntity { get { return new FrmField(); } } #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((FrmField)this[i]); } return list; } #endregion 为了适应自动翻译成java的需要,把实体转换成List. } }