void btn_del_Click(object sender, EventArgs e) { MapAttrs attrs = new MapAttrs(); attrs.Retrieve(MapAttrAttr.GroupID, this.RefOID); foreach (MapAttr attr in attrs) { if (attr.HisEditType != EditType.Edit) { continue; } if (attr.KeyOfEn == "FID") { continue; } attr.Delete(); } MapDtls dtls = new MapDtls(); dtls.Retrieve(MapDtlAttr.GroupID, this.RefOID); foreach (MapDtl dtl in dtls) { dtl.Delete(); } GroupField gf = new GroupField(this.RefOID); gf.Delete(); this.WinClose();// ("删除成功。"); }
/// <summary> /// 删除之后. /// </summary> protected override void afterDelete() { GroupField gf = new GroupField(); gf.Delete(GroupFieldAttr.CtrlID, this.MyPK); base.afterDelete(); }
protected override bool beforeUpdate() { MapDtl dtl = new MapDtl(this.No); //启用审核 dtl.IsEnablePass = this.IsEnablePass; //超链接 dtl.IsEnableLink = this.IsEnableLink; dtl.LinkLabel = this.LinkLabel; dtl.LinkUrl = this.LinkUrl; dtl.LinkTarget = this.LinkTarget; dtl.Update(); //获得事件实体. var febd = BP.Sys.Glo.GetFormDtlEventBaseByEnName(this.No); if (febd == null) { this.FEBD = ""; } else { this.FEBD = febd.ToString(); } #region 检查填充的SQL是否符合要求. #endregion //更新分组标签. @fanleiwei. 代码有变化. BP.Sys.GroupField gf = new GroupField(); int i = gf.Retrieve(GroupFieldAttr.CtrlType, "Dtl", GroupFieldAttr.CtrlID, this.No); if (i == 0) { gf.CtrlID = this.No; gf.CtrlType = "Dtl"; gf.FrmID = this.FK_MapData; gf.Insert(); } if (i > 1) { gf.Delete(); i = gf.Retrieve(GroupFieldAttr.CtrlType, "Dtl", GroupFieldAttr.CtrlID, this.No); } if (i == 1 && gf.Lab.Equals(this.Name) == false) { gf.Lab = this.Name; gf.Update(); } return(base.beforeUpdate()); }
protected override void afterDelete() { //删除分组信息. GroupField gf = new GroupField(); gf.Delete(GroupFieldAttr.CtrlID, this.MyPK); //调用frmEditAction, 完成其他的操作. BP.Sys.CCFormAPI.AfterFrmEditAction(this.FK_MapData); base.afterDelete(); }
protected override bool beforeUpdateInsertAction() { if (this.FK_Node == 0) { //适应设计器新的规则 by dgq if (!DataType.IsNullOrEmpty(this.NoOfObj) && this.NoOfObj.Contains(this.FK_MapData)) { this.MyPK = this.NoOfObj; } else { this.MyPK = this.FK_MapData + "_" + this.NoOfObj; } } else { this.MyPK = this.FK_MapData + "_" + this.NoOfObj + "_" + this.FK_Node; } #region 处理分组. //更新相关的分组信息. if (this.IsVisable == true) { GroupField gf = new GroupField(); int i = gf.Retrieve(GroupFieldAttr.FrmID, this.FK_MapData, GroupFieldAttr.CtrlID, this.MyPK); if (i == 0) { gf.Lab = this.Name; gf.FrmID = this.FK_MapData; gf.CtrlType = "Ath"; //gf.CtrlID = this.MyPK; gf.Insert(); } else { gf.Lab = this.Name; gf.FrmID = this.FK_MapData; gf.CtrlType = "Ath"; //gf.CtrlID = this.MyPK; gf.Update(); } } if (this.IsVisable == false) { GroupField gf = new GroupField(); gf.Delete(GroupFieldAttr.FrmID, this.FK_MapData, GroupFieldAttr.CtrlID, this.MyPK); } #endregion 处理分组. return(base.beforeUpdateInsertAction()); }
/// <summary> /// 删除之后. /// </summary> protected override void afterDelete() { GroupField gf = new GroupField(); gf.Delete(GroupFieldAttr.CtrlID, this.MyPK); //把相关的字段也要删除. MapAttrString attr = new MapAttrString(); attr.MyPK = this.MyPK; attr.Delete(); //调用frmEditAction, 完成其他的操作. BP.Sys.CCFormAPI.AfterFrmEditAction(this.FK_MapData); base.afterDelete(); }
/// <summary> /// 执行旧版本的兼容性检查. /// </summary> public string DoCheckFixFrmForUpdateVer() { // 更新状态. DBAccess.RunSQL("UPDATE Sys_GroupField SET CtrlType='' WHERE CtrlType IS NULL"); DBAccess.RunSQL("UPDATE Sys_GroupField SET CtrlID='' WHERE CtrlID IS NULL"); DBAccess.RunSQL("UPDATE Sys_GroupField SET CtrlID='' WHERE CtrlID IS NULL"); //删除重影数据. DBAccess.RunSQL("DELETE FROM Sys_GroupField WHERE CtrlType='FWC' and CTRLID is null"); //一直遇到遇到自动变长的问题, 强制其修复过来. DBAccess.RunSQL("UPDATE Sys_Mapattr SET colspan=3 WHERE UIHeight<=38 AND colspan=4"); string str = ""; //处理失去分组的字段. string sql = "SELECT MyPK FROM Sys_MapAttr WHERE FK_MapData='" + this.No + "' AND GroupID NOT IN (SELECT OID FROM Sys_GroupField WHERE FrmID='" + this.No + "' AND ( CtrlType='' OR CtrlType IS NULL) ) OR GroupID IS NULL "; MapAttrs attrs = new MapAttrs(); attrs.RetrieveInSQL(sql); if (attrs.Count != 0) { GroupField gf = null; GroupFields gfs = new GroupFields(this.No); foreach (GroupField mygf in gfs) { if (mygf.CtrlID == "") { gf = mygf; } } if (gf == null) { gf = new GroupField(); gf.Lab = "基本信息"; gf.FrmID = this.No; gf.Insert(); } //设置GID. foreach (MapAttr attr in attrs) { attr.Update(MapAttrAttr.GroupID, gf.OID); } } //从表. MapDtls dtls = new MapDtls(this.No); foreach (MapDtl dtl in dtls) { GroupField gf = new GroupField(); int i = gf.Retrieve(GroupFieldAttr.CtrlID, dtl.No, GroupFieldAttr.FrmID, this.No); if (i == 1) { continue; } //GroupField gf = new GroupField(); //if (gf.IsExit(GroupFieldAttr.CtrlID, dtl.No) == true && !DataType.IsNullOrEmpty(gf.CtrlType)) // continue; gf.Lab = dtl.Name; gf.CtrlID = dtl.No; gf.CtrlType = "Dtl"; gf.FrmID = dtl.FK_MapData; gf.DirectSave(); str += "@为从表" + dtl.Name + " 增加了分组."; } // 框架. MapFrames frams = new MapFrames(this.No); foreach (MapFrame fram in frams) { GroupField gf = new GroupField(); int i = gf.Retrieve(GroupFieldAttr.CtrlID, fram.MyPK, GroupFieldAttr.FrmID, this.No); if (i == 1) { continue; } gf.Lab = fram.Name; gf.CtrlID = fram.MyPK; gf.CtrlType = "Frame"; gf.EnName = fram.FK_MapData; gf.Insert(); str += "@为框架 " + fram.Name + " 增加了分组."; } // 附件. FrmAttachments aths = new FrmAttachments(this.No); foreach (FrmAttachment ath in aths) { if (ath.IsVisable == false) { continue; } GroupField gf = new GroupField(); int i = gf.Retrieve(GroupFieldAttr.CtrlID, ath.MyPK, GroupFieldAttr.FrmID, this.No); if (i == 1) { continue; } gf.Lab = ath.Name; gf.CtrlID = ath.MyPK; gf.CtrlType = "Ath"; gf.FrmID = ath.FK_MapData; gf.Insert(); str += "@为附件 " + ath.Name + " 增加了分组."; } if (this.IsNodeFrm == true) { FrmNodeComponent conn = new FrmNodeComponent(this.NodeID); conn.Update(); } //删除重复的数据, 比如一个从表显示了多个分组里. 增加此部分. if (SystemConfig.AppCenterDBType == DBType.Oracle) { sql = "SELECT * FROM (SELECT FrmID,CtrlID,CtrlType, count(*) as Num FROM sys_groupfield WHERE CtrlID!='' GROUP BY FrmID,CtrlID,CtrlType ) WHERE Num > 1"; } else { sql = "SELECT * FROM (SELECT FrmID,CtrlID,CtrlType, count(*) as Num FROM sys_groupfield WHERE CtrlID!='' GROUP BY FrmID,CtrlID,CtrlType ) AS A WHERE A.Num > 1"; } DataTable dt = DBAccess.RunSQLReturnTable(sql); foreach (DataRow dr in dt.Rows) { string enName = dr[0].ToString(); string ctrlID = dr[1].ToString(); string ctrlType = dr[2].ToString(); GroupFields gfs = new GroupFields(); gfs.Retrieve(GroupFieldAttr.FrmID, enName, GroupFieldAttr.CtrlID, ctrlID, GroupFieldAttr.CtrlType, ctrlType); if (gfs.Count <= 1) { continue; } foreach (GroupField gf in gfs) { gf.Delete(); //删除其中的一个. break; } } if (str == "") { return("检查成功."); } return(str + ", @@@ 检查成功。"); }
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(); }
protected override bool beforeUpdate() { GroupField gf = new GroupField(); #region 审核组件. FrmWorkCheck fwc = new FrmWorkCheck(this.NodeID); fwc.Copy(this); if (fwc.HisFrmWorkCheckSta == FrmWorkCheckSta.Disable) { gf.Delete(GroupFieldAttr.FrmID, this.No, GroupFieldAttr.CtrlType, GroupCtrlType.FWC); } else { if (gf.IsExit(GroupFieldAttr.FrmID, this.No, GroupFieldAttr.CtrlType, GroupCtrlType.FWC) == false) { gf = new GroupField(); gf.FrmID = "ND" + this.NodeID; gf.CtrlType = GroupCtrlType.FWC; gf.Lab = "审核组件"; gf.Idx = 0; gf.Insert(); //插入. } } #endregion 审核组件. #region 父子流程组件. FrmSubFlow subflow = new FrmSubFlow(this.NodeID); subflow.Copy(this); if (subflow.HisFrmSubFlowSta == FrmSubFlowSta.Disable) { gf.Delete(GroupFieldAttr.CtrlID, "SubFlow" + this.No); } else { if (gf.IsExit(GroupFieldAttr.CtrlID, "SubFlow" + this.No) == false) { gf = new GroupField(); gf.FrmID = "ND" + this.NodeID; gf.CtrlID = "SubFlow" + this.No; gf.CtrlType = GroupCtrlType.SubFlow; gf.Lab = "父子流程组件"; gf.Idx = 0; gf.Insert(); //插入. } } #endregion 父子流程组件. #region 处理轨迹组件. FrmTrack track = new FrmTrack(this.NodeID); track.Copy(this); if (track.FrmTrackSta == FrmTrackSta.Disable) { gf.Delete(GroupFieldAttr.CtrlID, "FrmTrack" + this.No); } else { if (gf.IsExit(GroupFieldAttr.CtrlID, "FrmTrack" + this.No) == false) { gf = new GroupField(); gf.FrmID = "ND" + this.NodeID; gf.CtrlID = "FrmTrack" + this.No; gf.CtrlType = GroupCtrlType.Track; gf.Lab = "轨迹"; gf.Idx = 0; gf.Insert(); //插入. } } #endregion 处理轨迹组件. #region 子线程组件. FrmThread thread = new FrmThread(this.NodeID); thread.Copy(this); if (thread.FrmThreadSta == FrmThreadSta.Disable) { gf.Delete(GroupFieldAttr.CtrlID, "FrmThread" + this.No); } else { if (gf.IsExit(GroupFieldAttr.CtrlID, "FrmThread" + this.No) == false) { gf = new GroupField(); gf.EnName = "ND" + this.NodeID; gf.CtrlID = "FrmThread" + this.No; gf.CtrlType = GroupCtrlType.Thread; gf.Lab = "子线程"; gf.Idx = 0; gf.Insert(); //插入. } } #endregion 子线程组件. #region 流转自定义组件. FrmTransferCustom ftc = new FrmTransferCustom(this.NodeID); ftc.Copy(this); if (ftc.FTCSta == FTCSta.Disable) { gf.Delete(GroupFieldAttr.CtrlID, "FrmFTC" + this.No); } else { if (gf.IsExit(GroupFieldAttr.CtrlID, "FrmFTC" + this.No) == false) { gf = new GroupField(); gf.FrmID = "ND" + this.NodeID; gf.CtrlID = "FrmFTC" + this.No; gf.CtrlType = GroupCtrlType.FTC; gf.Lab = "流转自定义"; gf.Idx = 0; gf.Insert(); //插入. } } #endregion 流转自定义组件. return(base.beforeUpdate()); }