private string DoJumpUp(MapAttr attrTo) { string sql = "UPDATE Sys_MapAttr SET IDX=IDX+1 WHERE IDX <=" + attrTo.IDX + " AND FK_MapData='" + this.FK_MapData + "' AND GroupID=" + this.GroupID; DBAccess.RunSQL(sql); this.IDX = attrTo.IDX - 1; this.GroupID = attrTo.GroupID; this.Update(); return(null); }
private string DoJumpDown(MapAttr attrTo) { string sql = "UPDATE Sys_MapAttr SET Idx=Idx-1 WHERE Idx <=" + attrTo.Idx + " AND FK_MapData='" + this.FK_MapData + "' AND GroupID=" + this.GroupID; DBAccess.RunSQL(sql); this.Idx = attrTo.Idx + 1; this.GroupID = attrTo.GroupID; this.Update(); return(null); }
public void DoJump(MapAttr attrTo) { if (attrTo.Idx <= this.Idx) { this.DoJumpUp(attrTo); } else { this.DoJumpDown(attrTo); } }
/// <summary> /// 枚举类型新增保存后在Frm_RB中增加新的枚举值 /// </summary> protected override void afterInsert() { //获取引用枚举的表单 string sql = " select distinct(FK_MapData)from Sys_FrmRB where EnumKey='" + this.EnumKey + "'"; System.Data.DataTable dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count == 0) { base.afterInsert(); return; } foreach (System.Data.DataRow dr in dt.Rows) { if (DataType.IsNullOrEmpty(dr[0].ToString())) { continue; } string fk_mapdata = dr[0].ToString(); string mypk = fk_mapdata + "_" + this.EnumKey + "_" + this.IntKey; FrmRB frmrb = new FrmRB(); if (frmrb.IsExit("MyPK", mypk) == true) { frmrb.Lab = this.Lab; frmrb.Update(); continue; } //获取mapAttr MapAttr mapAttr = new MapAttr(fk_mapdata + "_" + this.EnumKey); int RBShowModel = mapAttr.GetParaInt("RBShowModel"); FrmRB frmrb1 = new FrmRB(fk_mapdata + "_" + this.EnumKey + "_0"); frmrb.FK_MapData = fk_mapdata; frmrb.KeyOfEn = this.EnumKey; frmrb.EnumKey = this.EnumKey; frmrb.Lab = this.Lab; frmrb.IntKey = this.IntKey; if (RBShowModel == 0) { frmrb.X = frmrb1.X; frmrb.Y = frmrb1.Y + 40; } if (RBShowModel == 3) { frmrb.X = frmrb1.X + 100; frmrb.Y = frmrb1.Y; } frmrb.Insert(); } base.afterInsert(); }
public void DoUp() { this.DoOrderUp(MapAttrAttr.GroupID, this.GroupID.ToString(), MapAttrAttr.UIVisible, "1", MapAttrAttr.Idx); MapAttr attr = new MapAttr(); attr.MyPK = this.FK_MapData + "_Title"; if (attr.RetrieveFromDBSources() == 1) { attr.Idx = -1; attr.Update(); } }
/// <summary> /// 检查enittyNoName类型的实体 /// </summary> public void CheckEnityTypeAttrsFor_EntityNoName() { //取出来全部的属性. MapAttrs attrs = new MapAttrs(this.No); #region 补充上流程字段到 NDxxxRpt. if (attrs.Contains(this.No + "_" + GERptAttr.OID) == false) { /* WorkID */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.KeyOfEn = "OID"; attr.Name = "主键ID"; attr.MyDataType = BP.DA.DataType.AppInt; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = false; attr.UIIsEnable = false; attr.DefVal = "0"; attr.HisEditType = BP.En.EditType.Readonly; attr.Insert(); } if (attrs.Contains(this.No + "_" + GERptAttr.BillNo) == false) { /* 单据编号 */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.HisEditType = EditType.UnDel; attr.KeyOfEn = GERptAttr.BillNo; attr.Name = "编号"; // 单据编号 attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = true; attr.UIIsEnable = false; attr.UIIsLine = false; attr.MinLen = 0; attr.MaxLen = 100; attr.Idx = -100; attr.Insert(); } if (attrs.Contains(this.No + "_" + GERptAttr.Title) == false) { /* 名称 */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.HisEditType = EditType.UnDel; attr.KeyOfEn = GERptAttr.Title; // "FlowEmps"; attr.Name = "名称"; // 单据模式, ccform的模式. attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = true; attr.UIIsEnable = true; attr.UIIsLine = true; attr.MinLen = 0; attr.MaxLen = 400; attr.Idx = -90; attr.Insert(); } if (attrs.Contains(this.No + "_BillState") == false) { /* 单据状态 */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.HisEditType = EditType.UnDel; attr.KeyOfEn = "BillState"; // "FlowEmps"; attr.Name = "单据状态"; // attr.MyDataType = DataType.AppInt; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = false; attr.UIIsEnable = false; attr.UIIsLine = true; attr.MinLen = 0; attr.MaxLen = 10; attr.Idx = -98; attr.Insert(); } if (attrs.Contains(this.No + "_Starter") == false) { /* 发起人 */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.HisEditType = EditType.UnDel; attr.KeyOfEn = "Starter"; attr.Name = "创建人"; // attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = false; attr.UIIsEnable = false; attr.MinLen = 0; attr.MaxLen = 32; attr.Idx = -1; attr.Insert(); } if (attrs.Contains(this.No + "_StarterName") == false) { /* 创建人名称 */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.HisEditType = EditType.UnDel; attr.KeyOfEn = "StarterName"; attr.Name = "创建人名称"; // attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = false; attr.UIIsEnable = false; attr.MinLen = 0; attr.MaxLen = 32; attr.Idx = -1; attr.Insert(); } if (attrs.Contains(this.No + "_" + GERptAttr.AtPara) == false) { /* 参数 */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.HisEditType = EditType.UnDel; attr.KeyOfEn = GERptAttr.AtPara; attr.Name = "参数"; // 单据编号 attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = false; attr.UIIsEnable = false; attr.UIIsLine = false; attr.MinLen = 0; attr.MaxLen = 4000; attr.Idx = -99; attr.Insert(); } if (attrs.Contains(this.No + "_RDT") == false) { /* MyNum */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.HisEditType = EditType.UnDel; attr.KeyOfEn = "RDT"; // "FlowStartRDT"; attr.Name = "创建时间"; attr.MyDataType = DataType.AppDateTime; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = false; attr.UIIsEnable = false; attr.UIIsLine = false; attr.Idx = -97; attr.Insert(); } #endregion 补充上流程字段。 #region 注册到外键表. SFTable sf = new SFTable(); sf.No = this.No; if (sf.RetrieveFromDBSources() == 0) { sf.Name = this.Name; sf.SrcType = SrcType.SQL; sf.SrcTable = this.PTable; sf.ColumnValue = "BillNo"; sf.ColumnText = "Title"; sf.SelectStatement = "SELECT BillNo AS No, Title as Name FROM " + this.PTable; sf.Insert(); } #endregion 注册到外键表 }
public static void SaveMapAttr(string fk_mapdata, string fieldID, string shape, JsonData control, JsonData properties, string pks) { MapAttr attr = new MapAttr(); attr.FK_MapData = fk_mapdata; attr.KeyOfEn = fieldID; attr.MyPK = fk_mapdata + "_" + fieldID; attr.RetrieveFromDBSources(); //if (attr.KeyOfEn == "BiaoTi") //{ // int i = 11; //} //执行一次查询,以防止其他的属性更新错误. //if (pks.Contains("@" + attr.KeyOfEn + "@") == true) // attr.RetrieveFromDBSources(); switch (shape) { case "TextBoxStr": //文本类型. case "TextBoxSFTable": attr.LGType = En.FieldTypeS.Normal; attr.UIContralType = En.UIContralType.TB; break; case "TextBoxInt": //数值 attr.LGType = En.FieldTypeS.Normal; attr.MyDataType = DataType.AppInt; attr.UIContralType = En.UIContralType.TB; break; case "TextBoxBoolean": attr.MyDataType = DataType.AppBoolean; attr.UIContralType = En.UIContralType.CheckBok; attr.LGType = En.FieldTypeS.Normal; break; case "TextBoxFloat": attr.LGType = En.FieldTypeS.Normal; attr.UIContralType = En.UIContralType.TB; break; case "TextBoxMoney": attr.MyDataType = DataType.AppMoney; attr.LGType = En.FieldTypeS.Normal; attr.UIContralType = En.UIContralType.TB; break; case "TextBoxDate": attr.MyDataType = DataType.AppDate; attr.LGType = En.FieldTypeS.Normal; attr.UIContralType = En.UIContralType.TB; break; case "TextBoxDateTime": attr.MyDataType = DataType.AppDateTime; attr.LGType = En.FieldTypeS.Normal; attr.UIContralType = En.UIContralType.TB; break; case "DropDownListEnum": //枚举类型. attr.MyDataType = BP.DA.DataType.AppInt; attr.LGType = En.FieldTypeS.Enum; attr.UIContralType = En.UIContralType.DDL; break; case "DropDownListTable": //外键类型. attr.MyDataType = BP.DA.DataType.AppString; if (pks.Contains("@" + attr.KeyOfEn + "@") == false) { attr.LGType = En.FieldTypeS.FK; } attr.UIContralType = En.UIContralType.DDL; attr.MaxLen = 100; attr.MinLen = 0; break; default: break; } //坐标 JsonData style = control["style"]; JsonData vector = style["gradientBounds"]; attr.X = float.Parse(vector[0].ToJson()); attr.Y = float.Parse(vector[1].ToJson()); for (int iProperty = 0; iProperty < properties.Count; iProperty++) { JsonData property = properties[iProperty]; //获得一个属性. if (property == null || !property.Keys.Contains("property") || property["property"] == null || property["property"].ToString() == "group") { continue; } string val = null; if (property["PropertyValue"] != null) { val = property["PropertyValue"].ToString(); } string propertyName = property["property"].ToString(); switch (propertyName) { case "Name": if (attr.Name == "") { attr.Name = val; } break; case "MinLen": case "MaxLen": case "DefVal": attr.SetValByKey(propertyName, val); break; case "UIIsEnable": case "UIVisible": attr.SetValByKey(propertyName, val); break; case "FieldText": if (attr.Name == "") { attr.Name = val; } break; case "UIIsInput": if (val == "true") { attr.UIIsInput = true; } else { attr.UIIsInput = false; } break; case "UIBindKey": attr.UIBindKey = val; break; default: break; } } //Textbox 高、宽. decimal minX = decimal.Parse(vector[0].ToJson()); decimal minY = decimal.Parse(vector[1].ToJson()); decimal maxX = decimal.Parse(vector[2].ToJson()); decimal maxY = decimal.Parse(vector[3].ToJson()); decimal imgWidth = maxX - minX; decimal imgHeight = maxY - minY; attr.UIWidth = float.Parse(imgWidth.ToString("0.00")); attr.UIHeight = float.Parse(imgHeight.ToString("0.00")); // attr.ColSpan if (pks.Contains("@" + attr.KeyOfEn + "@") == true) { attr.Update(); } else { attr.Insert(); } }
/// <summary> /// 检查检查实体类型 /// </summary> public void CheckEnityTypeAttrsFor_Bill() { //取出来全部的属性. MapAttrs attrs = new MapAttrs(this.No); #region 补充上流程字段到 NDxxxRpt. if (attrs.Contains(this.No + "_" + GERptAttr.Title) == false) { /* 标题 */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.HisEditType = EditType.UnDel; attr.KeyOfEn = GERptAttr.Title; // "FlowEmps"; attr.Name = "标题"; // 单据模式, ccform的模式. attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = true; attr.UIIsEnable = false; attr.UIIsLine = true; attr.MinLen = 0; attr.MaxLen = 400; attr.Idx = -100; attr.Insert(); } if (attrs.Contains(this.No + "_" + GERptAttr.OID) == false) { /* WorkID */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.KeyOfEn = "OID"; attr.Name = "主键ID"; attr.MyDataType = BP.DA.DataType.AppInt; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = false; attr.UIIsEnable = false; attr.DefVal = "0"; attr.HisEditType = BP.En.EditType.Readonly; attr.Insert(); } if (attrs.Contains(this.No + "_" + GERptAttr.BillNo) == false) { /* 单据编号 */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.HisEditType = EditType.UnDel; attr.KeyOfEn = GERptAttr.BillNo; attr.Name = "单据编号"; // 单据编号 attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = true; attr.UIIsEnable = false; attr.UIIsLine = false; attr.MinLen = 0; attr.MaxLen = 100; attr.Idx = -100; attr.Insert(); } if (attrs.Contains(this.No + "_" + GERptAttr.AtPara) == false) { /* 参数 */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.HisEditType = EditType.UnDel; attr.KeyOfEn = GERptAttr.AtPara; attr.Name = "参数"; // 单据编号 attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = false; attr.UIIsEnable = false; attr.UIIsLine = false; attr.MinLen = 0; attr.MaxLen = 4000; attr.Idx = -99; attr.Insert(); } if (attrs.Contains(this.No + "_BillState") == false) { /* 单据状态 */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.HisEditType = EditType.UnDel; attr.KeyOfEn = "BillState"; // "FlowEmps"; attr.Name = "单据状态"; // attr.MyDataType = DataType.AppInt; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = false; attr.UIIsEnable = false; attr.UIIsLine = true; attr.MinLen = 0; attr.MaxLen = 10; attr.Idx = -98; attr.Insert(); } if (attrs.Contains(this.No + "_Starter") == false) { /* 发起人 */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.HisEditType = EditType.UnDel; attr.KeyOfEn = "Starter"; attr.Name = "创建人"; // attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = false; attr.UIIsEnable = false; attr.MinLen = 0; attr.MaxLen = 32; attr.Idx = -1; attr.Insert(); } if (attrs.Contains(this.No + "_StarterName") == false) { /* 创建人名称 */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.HisEditType = EditType.UnDel; attr.KeyOfEn = "StarterName"; attr.Name = "创建人名称"; // attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = false; attr.UIIsEnable = false; attr.MinLen = 0; attr.MaxLen = 32; attr.Idx = -1; attr.Insert(); } if (attrs.Contains(this.No + "_RDT") == false) { /* MyNum */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.HisEditType = EditType.UnDel; attr.KeyOfEn = "RDT"; // "FlowStartRDT"; attr.Name = "创建时间"; attr.MyDataType = DataType.AppDateTime; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = false; attr.UIIsEnable = false; attr.UIIsLine = false; attr.Idx = -97; attr.Insert(); } #endregion 补充上流程字段。 }
void btn_Click(object sender, EventArgs e) { MapDtls dtl2s = new MapDtls(); dtl2s.Delete(MapDtlAttr.FK_MapData, this.MyPK); Nodes nds = new Nodes(BP.WF.Glo.GenerFlowNo(this.MyPK)); foreach (BP.WF.Node nd in nds) { if (nd.IsEndNode == false) { continue; } MapDtls dtls = new MapDtls("ND" + nd.NodeID); int i = 0; foreach (MapDtl dtl in dtls) { if (this.Pub1.GetCBByID("CB_" + dtl.No).Checked == false) { continue; } i++; // 生成从表让其可以在单个数据里显示他们。 MapDtl dtlNew = new MapDtl(); dtlNew.Copy(dtl); dtlNew.No = this.MyPK + i; dtlNew.FK_MapData = this.MyPK; dtlNew.GroupID = this.Pub1.GetDDLByID("DDL_" + dtl.No).SelectedItemIntVal; dtlNew.Insert(); // 删除原来的数据。 MapAttrs attrsDtl = new MapAttrs(); attrsDtl.Delete(MapAttrAttr.FK_MapData, dtlNew.No); // 复制到新的数据表里。 MapAttrs attrs = new MapAttrs(dtl.No); foreach (MapAttr attr in attrs) { MapAttr attrN = new MapAttr(); attrN.Copy(attr); attrN.FK_MapData = dtlNew.No; attrN.Insert(); } Cash.Map_Cash.Remove(dtlNew.No); #region 制成 主表.让其可以查询。 // 处理主表。 MapData md = new MapData(); md.Copy(dtlNew); md.No = "ND" + int.Parse(this.FK_Flow) + "RptDtl" + i.ToString(); md.Save(); // 删除原来的属性。 attrs.Delete(MapAttrAttr.FK_MapData, md.No); // 删除分组。 GroupField gfBase = new GroupField(); gfBase.Delete(GroupFieldAttr.EnName, md.No); // 增加基本信息分组。 gfBase.EnName = md.No; gfBase.Lab = md.Name; gfBase.Idx = 99; gfBase.Insert(); //生成基本信息属性。 foreach (MapAttr attr in attrs) { MapAttr attrN = new MapAttr(); attrN.Copy(attr); attrN.FK_MapData = md.No; attrN.GroupID = gfBase.OID; attrN.Insert(); } MapAttrs attrNs = new MapAttrs(md.No); // 对个别字段进行处理。 foreach (MapAttr attr in attrNs) { switch (attr.KeyOfEn) { case StartWorkAttr.FK_Dept: continue; //if (attr.UIContralType != UIContralType.DDL) //{ //attr.UIBindKey = "BP.Port.Depts"; //attr.UIContralType = UIContralType.DDL; //attr.LGType = FieldTypeS.FK; //attr.UIVisible = true; //// if (gfs.Contains(attr.GroupID) == false) //attr.GroupID = gfBase.OID;// gfs[0].GetValIntByKey("OID"); //attr.Update(); //// } break; case "FK_NY": //attr.Delete(); ////if (attr.UIContralType != UIContralType.DDL) ////{ //attr.UIBindKey = "BP.Pub.NYs"; //attr.UIContralType = UIContralType.DDL; //attr.LGType = FieldTypeS.FK; //attr.UIVisible = true; //// if (gfs.Contains(attr.GroupID) == false) //attr.GroupID = gfBase.OID; // gfs[0].GetValIntByKey("OID"); //attr.Update(); break; case "Rec": attr.UIBindKey = "BP.Port.Emps"; attr.UIContralType = UIContralType.DDL; attr.LGType = FieldTypeS.FK; attr.UIVisible = true; attr.Name = "最后处理人"; attr.GroupID = gfBase.OID; attr.Update(); break; default: break; } } // 生成流程基本信息属性。 GroupField gfFlow = new GroupField(); gfFlow.EnName = md.No; gfFlow.Idx = 0; gfFlow.Lab = "流程信息"; gfFlow.Insert(); MapAttr attrFlow = new BP.Sys.MapAttr(); attrFlow = new BP.Sys.MapAttr(); attrFlow.FK_MapData = md.No; attrFlow.HisEditType = EditType.UnDel; attrFlow.KeyOfEn = "Title"; attrFlow.Name = "标题"; attrFlow.MyDataType = BP.DA.DataType.AppString; attrFlow.UIContralType = UIContralType.TB; attrFlow.LGType = FieldTypeS.Normal; attrFlow.UIVisible = true; attrFlow.UIIsEnable = true; attrFlow.UIIsLine = true; attrFlow.MinLen = 0; attrFlow.MaxLen = 1000; attrFlow.IDX = -100; attrFlow.GroupID = gfFlow.OID; attrFlow.Insert(); attrFlow.FK_MapData = md.No; attrFlow.HisEditType = EditType.UnDel; attrFlow.KeyOfEn = "FlowStarter"; attrFlow.Name = "发起人"; //"发起人"; attrFlow.MyDataType = BP.DA.DataType.AppString; attrFlow.UIContralType = UIContralType.DDL; attrFlow.UIBindKey = "BP.Port.Emps"; attrFlow.LGType = FieldTypeS.FK; attrFlow.UIVisible = true; attrFlow.UIIsEnable = false; attrFlow.UIIsLine = false; attrFlow.MaxLen = 20; attrFlow.MinLen = 0; attrFlow.Insert(); attrFlow = new BP.Sys.MapAttr(); attrFlow.FK_MapData = md.No; attrFlow.HisEditType = EditType.UnDel; attrFlow.KeyOfEn = "FlowStarterDept"; attrFlow.Name = "发起人部门"; attrFlow.MyDataType = BP.DA.DataType.AppString; attrFlow.UIContralType = UIContralType.DDL; attrFlow.UIBindKey = "BP.Port.Depts"; attrFlow.LGType = FieldTypeS.FK; attrFlow.UIVisible = true; attrFlow.UIIsEnable = false; attrFlow.MaxLen = 20; attrFlow.MinLen = 0; attrFlow.Insert(); attrFlow = new BP.Sys.MapAttr(); attrFlow.FK_MapData = md.No; attrFlow.HisEditType = EditType.UnDel; attrFlow.KeyOfEn = "FlowEmps"; attrFlow.Name = "参与人"; // attrFlow.MyDataType = BP.DA.DataType.AppString; attrFlow.UIContralType = UIContralType.TB; attrFlow.LGType = FieldTypeS.Normal; attrFlow.UIVisible = true; attrFlow.UIIsEnable = true; attrFlow.UIIsLine = false; attrFlow.MinLen = 0; attrFlow.MaxLen = 1000; attrFlow.IDX = -100; attrFlow.GroupID = gfFlow.OID; attrFlow.Insert(); attrFlow = new BP.Sys.MapAttr(); attrFlow.FK_MapData = md.No; attrFlow.HisEditType = EditType.UnDel; attrFlow.KeyOfEn = "FlowStartRDT"; attrFlow.Name = "发起时间"; // attrFlow.MyDataType = BP.DA.DataType.AppDateTime; attrFlow.UIContralType = UIContralType.TB; attrFlow.LGType = FieldTypeS.Normal; attrFlow.UIVisible = true; attrFlow.UIIsEnable = true; attrFlow.UIIsLine = false; attrFlow.MinLen = 0; attrFlow.MaxLen = 1000; attrFlow.IDX = -100; attrFlow.GroupID = gfFlow.OID; attrFlow.Insert(); attrFlow = new BP.Sys.MapAttr(); attrFlow.FK_MapData = md.No; attrFlow.HisEditType = EditType.UnDel; attrFlow.KeyOfEn = "FlowNY"; attrFlow.Name = "隶属年月"; attrFlow.MyDataType = BP.DA.DataType.AppString; attrFlow.UIContralType = UIContralType.DDL; attrFlow.UIBindKey = "BP.Pub.NYs"; attrFlow.LGType = FieldTypeS.FK; attrFlow.UIVisible = true; attrFlow.UIIsEnable = false; attrFlow.MaxLen = 20; attrFlow.MinLen = 0; attrFlow.Insert(); attrFlow = new BP.Sys.MapAttr(); attrFlow.FK_MapData = md.No; attrFlow.HisEditType = EditType.UnDel; attrFlow.KeyOfEn = "MyNum"; attrFlow.Name = "条"; // attrFlow.MyDataType = BP.DA.DataType.AppInt; attrFlow.DefVal = "1"; attrFlow.UIContralType = UIContralType.TB; attrFlow.LGType = FieldTypeS.Normal; attrFlow.UIVisible = false; attrFlow.UIIsEnable = false; attrFlow.UIIsLine = false; attrFlow.IDX = -101; attrFlow.GroupID = gfFlow.OID; if (attrFlow.IsExits == false) { attrFlow.Insert(); } // 清除缓存的map. Cash.Map_Cash.Remove(md.No); //检查主表的正确性。 GEEntity ge = new GEEntity(md.No); ge.CheckPhysicsTable(); #endregion 制成 主表.让其可以查询。 } } this.WinClose(); }
/// <summary> /// 删除垃圾数据. /// </summary> public static void DeleteDB() { MapExts exts = new MapExts(); exts.RetrieveAll(); return; foreach (MapExt ext in exts) { if (ext.ExtType == MapExtXmlList.ActiveDDL) { if (ext.AttrOfOper.Trim().Length == 0) { ext.Delete(); continue; } MapAttr attr = new MapAttr(); attr.MyPK = ext.AttrOfOper; if (attr.IsExits == true) { ext.AttrOfOper = attr.KeyOfEn; ext.Delete(); ext.MyPK = ext.ExtType + "_" + ext.FK_MapData + "_" + ext.AttrOfOper + "_" + ext.AttrsOfActive; ext.Save(); } if (ext.MyPK == ext.ExtType + "_" + ext.FK_MapData + "_" + ext.FK_MapData + "_" + ext.AttrOfOper) { ext.Delete(); //直接删除. ext.MyPK = ext.ExtType + "_" + ext.FK_MapData + "_" + ext.AttrOfOper + "_" + ext.AttrsOfActive; ext.Save(); continue; } if (ext.MyPK == ext.ExtType + "_" + ext.FK_MapData + "_" + ext.FK_MapData + "_" + ext.AttrOfOper + "_" + ext.AttrsOfActive) { ext.Delete(); //直接删除. ext.MyPK = ext.ExtType + "_" + ext.FK_MapData + "_" + ext.AttrOfOper + "_" + ext.AttrsOfActive; ext.Save(); continue; } if (ext.MyPK == ext.ExtType + "_" + ext.FK_MapData + "_" + ext.FK_MapData + "_" + ext.AttrsOfActive + "_" + ext.AttrOfOper) { ext.Delete(); //直接删除. ext.MyPK = ext.ExtType + "_" + ext.FK_MapData + "_" + ext.AttrOfOper + "_" + ext.AttrsOfActive; ext.Save(); continue; } //三个主键的情况. if (ext.MyPK == ext.ExtType + "_" + ext.FK_MapData + "_" + ext.AttrOfOper) { ext.Delete(); ext.MyPK = ext.ExtType + "_" + ext.FK_MapData + "_" + ext.AttrOfOper + "_" + ext.AttrsOfActive; ext.Save(); continue; } //三个主键的情况. if (ext.MyPK == ext.ExtType + "_" + ext.FK_MapData + "_" + ext.AttrsOfActive) { ext.Delete(); ext.MyPK = ext.ExtType + "_" + ext.FK_MapData + "_" + ext.AttrOfOper + "_" + ext.AttrsOfActive; ext.Save(); continue; } } } }
void btn_Copy_Click(object sender, EventArgs e) { BP.WF.Node nd = new BP.WF.Node(this.FK_Node); Node sNd = new Node(this.NodeOfSelect); BP.En.Attrs attrs = sNd.HisWork.EnMap.Attrs; BP.En.Attrs attrsCopy = nd.HisWork.EnMap.Attrs; // 开始copy 分组的节点。 GroupFields gfs = new GroupFields(this.NodeOfSelect); MapDtls dtls = new MapDtls(this.NodeOfSelect); MapM2Ms m2ms = new MapM2Ms(this.NodeOfSelect); MapFrames frms = new MapFrames(this.NodeOfSelect); foreach (GroupField gf in gfs) { CheckBox cb = this.Pub2.GetCBByID("CB" + gf.OID); if (cb.Checked == false) { continue; } // 生成一个分组实体. GroupField mygf = new GroupField(); mygf.Lab = gf.Lab; mygf.EnName = this.FK_Node; mygf.Idx = gf.Idx; mygf.Insert(); foreach (MapM2M m2m in m2ms) { if (m2m.GroupID != gf.OID) { continue; } MapM2M mym2m = new MapM2M(); mym2m.MyPK = m2m.MyPK.Replace(this.NodeOfSelect, this.FK_Node); // mym2m.FK_MapData =this if (mym2m.IsExits) { continue; } mym2m.Copy(m2m); mym2m.FK_MapData = this.FK_Node; mym2m.GroupID = mygf.OID; mym2m.MyPK = m2m.MyPK.Replace(this.NodeOfSelect, this.FK_Node); mym2m.Insert(); } foreach (MapFrame frm in frms) { if (frm.GroupID != gf.OID) { continue; } MapFrame myen = new MapFrame(); myen.MyPK = frm.MyPK.Replace(this.NodeOfSelect, this.FK_Node); if (myen.IsExits) { continue; } myen.Copy(frm); myen.FK_MapData = this.FK_Node; myen.GroupID = mygf.OID; myen.MyPK = frm.MyPK.Replace(this.NodeOfSelect, this.FK_Node); myen.Insert(); } // 复制从表. foreach (MapDtl dtl in dtls) { cb = this.Pub2.GetCBByID("CB_" + dtl.No + gf.OID); MapDtl dtlNew = new MapDtl(); dtlNew.No = dtl.No.Replace(this.NodeOfSelect, this.FK_Node); if (dtlNew.IsExits) { continue; } dtlNew.Copy(dtl); dtlNew.FK_MapData = this.FK_Node; dtlNew.No = dtl.No.Replace(this.NodeOfSelect, this.FK_Node); // dtlNew.No = this.FK_Node + "Dtl"; // dtlNew.No = dtl.No.Replace(this.FK_Node, this.NodeOfSelect); dtlNew.IsInsert = false; dtlNew.IsUpdate = false; dtlNew.IsDelete = false; dtlNew.GroupID = mygf.OID; dtlNew.PTable = dtlNew.No; dtlNew.Insert(); // 复制从表里面的明细。 int idx = 0; MapAttrs mattrs = new MapAttrs(dtl.No); foreach (MapAttr attr in mattrs) { MapAttr attrNew = new MapAttr(); attrNew.Copy(attr); attrNew.FK_MapData = dtlNew.No; attrNew.UIIsEnable = false; if (attrNew.DefVal.Contains("@")) { attrNew.DefVal = ""; } dtlNew.RowIdx = idx; attrNew.HisEditType = EditType.Edit; attrNew.Insert(); } } // copy his fields. MapAttrs willCopyAttrs = new MapAttrs(); willCopyAttrs.Retrieve(MapAttrAttr.GroupID, gf.OID, MapAttrAttr.Idx); int idx1 = 0; foreach (MapAttr attr in willCopyAttrs) { MapAttr attrNew = new MapAttr(); if (attrNew.IsExit(MapAttrAttr.FK_MapData, this.FK_Node, MapAttrAttr.KeyOfEn, attr.KeyOfEn) == true) { continue; } if (attr.UIVisible == false) { continue; } idx1++; attrNew.Copy(attr); attrNew.GroupID = mygf.OID; attrNew.FK_MapData = this.FK_Node; attrNew.UIIsEnable = false; attrNew.Idx = idx1; if (attrNew.KeyOfEn == "Title") { attrNew.HisEditType = EditType.Edit; } attrNew.HisEditType = EditType.Edit; attrNew.DefVal = ""; attrNew.Insert(); } } int GroupField = this.Pub2.GetDDLByID("DDL_GroupField").SelectedItemIntVal; foreach (Attr attr in attrs) { if (this.Pub2.IsExit(attr.Key) == false) { continue; } CheckBox cb = this.Pub2.GetCBByID(attr.Key); if (cb.Checked == false) { continue; } BP.Sys.MapAttr ma = new BP.Sys.MapAttr(); int i = ma.Retrieve(BP.Sys.MapAttrAttr.KeyOfEn, attr.Key, BP.Sys.MapAttrAttr.FK_MapData, this.NodeOfSelect); BP.Sys.MapAttr ma1 = new BP.Sys.MapAttr(); bool ishavle = ma1.IsExit(BP.Sys.MapAttrAttr.KeyOfEn, attr.Key, BP.Sys.MapAttrAttr.FK_MapData, this.FK_Node); if (ishavle) { continue; } ma1.Copy(ma); ma1.FK_MapData = this.FK_Node; ma1.KeyOfEn = ma.KeyOfEn; ma1.Name = ma.Name; ma1.GroupID = GroupField; ma1.UIIsEnable = false; ma1.HisEditType = EditType.Edit; if (ma1.DefVal != null && ma1.DefVal.Contains("@")) { ma1.DefVal = ""; } ma1.Insert(); } if (this.Pub2.IsExit("CB_Table")) { if (this.Pub2.GetCBByID("CB_Table").Checked) { MapData md1 = new MapData(this.NodeOfSelect); MapData md2 = new MapData(this.FK_Node); //md2.CellsX = md1.CellsX; //md2.CellsY = md1.CellsY; md2.Update(); //MapAttrs ma1 = md1.GenerHisTableCells; // 删除历史数据。 //ma1.Delete(MapAttrAttr.FK_MapData, this.FK_Node + "T"); //foreach (MapAttr attr in ma1) //{ // MapAttr attr2 = new MapAttr(); // attr2.Copy(attr); // // attr2.OID = 0; // attr2.GroupID = 0; // attr2.Idx = 0; // attr2.FK_MapData = this.FK_Node + "T"; // attr2.UIIsEnable = false; // attr2.Insert(); //} } } this.WinClose(); //this.WinCloseWithMsg("复制成功"); //this.Response.Redirect("MapDef.aspx?PK=" + this.FK_Node + "&NodeOfSelect=" + this.NodeOfSelect); }