/// <summary> /// 执行 /// </summary> /// <returns>返回执行结果</returns> public override object Do() { string rpt = BP.PubClass.DBRpt(BP.DBLevel.High); // 手动升级. 2011-07-08 补充节点字段分组. string sql = "DELETE FROM Sys_EnCfg WHERE No='BP.WF.Ext.NodeSheet'"; BP.DA.DBAccess.RunSQL(sql); sql = "INSERT INTO Sys_EnCfg(No,GroupTitle) VALUES ('BP.WF.Ext.NodeSheet','NodeID=基本配置@WarningDays=考核属性@SendLab=功能按钮标签与状态')"; BP.DA.DBAccess.RunSQL(sql); // 修复因bug丢失的字段. MapDatas mds = new MapDatas(); mds.RetrieveAll(); foreach (MapData md in mds) { string nodeid = md.No.Replace("ND", ""); try { BP.WF.Node nd = new Node(int.Parse(nodeid)); nd.RepareMap(); continue; } catch (Exception ex) { } MapAttr attr = new MapAttr(); if (attr.IsExit(MapAttrAttr.KeyOfEn, "OID", MapAttrAttr.FK_MapData, md.No) == false) { attr.FK_MapData = md.No; attr.KeyOfEn = "OID"; attr.Name = "OID"; 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(); } } return("执行成功..."); }
protected void Page_Load(object sender, EventArgs e) { try { switch (this.DoType) { case "DownTempFrm": MapData md = new MapData(this.FK_MapData); DataSet ds = md.GenerHisDataSet(); string name = "ccflow表单模板." + md.Name + "." + md.No + ".xml"; string file = this.Request.PhysicalApplicationPath + "\\Temp\\" + this.FK_MapData + ".xml"; ds.WriteXml(file); this.Response.Redirect("../../Temp/" + this.FK_MapData + ".xml", true); this.WinClose(); break; case "CCForm": this.Application.Clear(); if (WebUser.NoOfRel != "admin") { BP.Port.Emp emp = new BP.Port.Emp("admin"); BP.Web.WebUser.SignInOfGener(emp); } MapAttr mattr = new MapAttr(); mattr.MyPK = this.Request.QueryString["MyPK"]; int i = mattr.RetrieveFromDBSources(); mattr.KeyOfEn = this.Request.QueryString["KeyOfEn"]; mattr.FK_MapData = this.Request.QueryString["FK_MapData"]; mattr.MyDataType = int.Parse(this.Request.QueryString["DataType"]); if (!string.IsNullOrEmpty(this.Request.QueryString["UIBindKey"] + "")) { mattr.UIBindKey = this.Request.QueryString["UIBindKey"]; } mattr.UIContralType = (UIContralType)int.Parse(this.Request.QueryString["UIContralType"]); mattr.LGType = (BP.En.FieldTypeS) int.Parse(this.Request.QueryString["LGType"]); if (i == 0) { mattr.Name = System.Web.HttpUtility.UrlDecode(this.Request.QueryString["KeyName"], System.Text.Encoding.GetEncoding("GB2312")); mattr.UIIsEnable = true; mattr.UIVisible = true; if (mattr.LGType == FieldTypeS.Enum) { mattr.DefVal = "0"; } mattr.Insert(); } else { mattr.Update(); } switch (mattr.LGType) { case BP.En.FieldTypeS.Enum: this.Response.Redirect("EditEnum.aspx?MyPK=" + mattr.FK_MapData + "&RefNo=" + mattr.MyPK, true); return; case BP.En.FieldTypeS.Normal: this.Response.Redirect("EditF.aspx?DoType=Edit&MyPK=" + mattr.FK_MapData + "&RefNo=" + mattr.MyPK + "&FType=" + mattr.MyDataType + "&GroupField=0", true); return; case BP.En.FieldTypeS.FK: this.Response.Redirect("EditTable.aspx?DoType=Edit&MyPK=" + mattr.FK_MapData + "&RefNo=" + mattr.MyPK + "&FType=" + mattr.MyDataType + "&GroupField=0", true); return; default: break; } break; case "DobackToF": MapAttr ma = new MapAttr(this.RefNo); switch (ma.LGType) { case FieldTypeS.Normal: this.Response.Redirect("EditF.aspx?RefNo=" + this.RefNo, true); return; case FieldTypeS.FK: this.Response.Redirect("EditTable.aspx?RefNo=" + this.RefNo, true); return; case FieldTypeS.Enum: this.Response.Redirect("EditEnum.aspx?RefNo=" + this.RefNo, true); return; default: return; } break; case "AddEnum": SysEnumMain sem1 = new SysEnumMain(this.Request.QueryString["EnumKey"]); MapAttr attrAdd = new MapAttr(); attrAdd.KeyOfEn = sem1.No; if (attrAdd.IsExit(MapAttrAttr.FK_MapData, this.MyPK, MapAttrAttr.KeyOfEn, sem1.No)) { BP.Sys.PubClass.Alert("字段已经存在 [" + sem1.No + "]。"); BP.Sys.PubClass.WinClose(); return; } attrAdd.FK_MapData = this.MyPK; attrAdd.Name = sem1.Name; attrAdd.UIContralType = UIContralType.DDL; attrAdd.UIBindKey = sem1.No; attrAdd.MyDataType = BP.DA.DataType.AppInt; attrAdd.LGType = FieldTypeS.Enum; attrAdd.DefVal = "0"; attrAdd.UIIsEnable = true; if (this.Idx == null || this.Idx == "") { MapAttrs attrs1 = new MapAttrs(this.MyPK); attrAdd.Idx = 0; } else { attrAdd.Idx = int.Parse(this.Idx); } attrAdd.Insert(); this.Response.Redirect("EditEnum.aspx?MyPK=" + this.MyPK + "&RefNo=" + attrAdd.MyPK, true); this.WinClose(); return; case "DelEnum": string eKey = this.Request.QueryString["EnumKey"]; SysEnumMain sem = new SysEnumMain(); sem.No = eKey; sem.Delete(); this.WinClose(); return; case "AddSysEnum": this.AddFEnum(); break; case "AddSFTable": this.AddSFTable(); break; case "AddSFTableAttr": SFTable sf = new SFTable(this.Request.QueryString["RefNo"]); this.Response.Redirect("EditTable.aspx?MyPK=" + this.MyPK + "&SFKey=" + sf.No, true); this.WinClose(); return; case "AddFG": /*执行一个插入列组的命令.*/ switch (this.RefNo) { case "IsPass": MapDtl dtl = new MapDtl(this.FK_MapData); dtl.IsEnablePass = true; /*更新是否启动审核分组字段.*/ MapAttr attr = new MapAttr(); attr.FK_MapData = this.FK_MapData; attr.KeyOfEn = "Check_Note"; attr.Name = "审核意见"; attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.DefVal = "同意"; attr.UIIsEnable = true; attr.UIIsLine = true; attr.MaxLen = 4000; attr.ColSpan = 4; // 默认为4列。 attr.Idx = 1; attr.Insert(); attr = new MapAttr(); attr.FK_MapData = this.FK_MapData; attr.KeyOfEn = "Checker"; attr.Name = "审核人";// "审核人"; attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.MaxLen = 50; attr.MinLen = 0; attr.UIIsEnable = true; attr.UIIsLine = false; attr.DefVal = "@WebUser.Name"; attr.UIIsEnable = false; attr.IsSigan = true; attr.Idx = 2; attr.Insert(); attr = new MapAttr(); attr.FK_MapData = this.FK_MapData; attr.KeyOfEn = "IsPass"; attr.Name = "通过否?";// "审核人"; attr.MyDataType = DataType.AppBoolean; attr.UIContralType = UIContralType.CheckBok; attr.UIIsEnable = true; attr.UIIsLine = false; attr.UIIsEnable = false; attr.IsSigan = true; attr.DefVal = "1"; attr.Idx = 2; attr.DefVal = "0"; attr.Insert(); attr = new MapAttr(); attr.FK_MapData = this.FK_MapData; attr.KeyOfEn = "Check_RDT"; attr.Name = "审核日期"; // "审核日期"; attr.MyDataType = DataType.AppDateTime; attr.UIContralType = UIContralType.TB; attr.UIIsEnable = true; attr.UIIsLine = false; attr.DefVal = "@RDT"; attr.UIIsEnable = false; attr.Idx = 3; attr.Insert(); /* 处理批次ID*/ attr = new MapAttr(); attr.FK_MapData = this.FK_MapData; attr.KeyOfEn = "BatchID"; attr.Name = "BatchID"; // this.ToE("IsPass", "是否通过");// "审核人"; attr.MyDataType = DataType.AppInt; attr.UIIsEnable = false; attr.UIIsLine = false; attr.UIIsEnable = false; attr.UIVisible = false; attr.Idx = 2; attr.DefVal = "0"; attr.Insert(); dtl.Update(); this.WinClose(); return; case "Eval": /* 质量评价 */ attr = new MapAttr(); attr.FK_MapData = this.FK_MapData; attr.KeyOfEn = "EvalEmpNo"; attr.Name = "被评价人员编号"; attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.MaxLen = 50; attr.MinLen = 0; attr.UIIsEnable = true; attr.UIIsLine = false; attr.UIIsEnable = false; attr.IsSigan = true; attr.Idx = 1; attr.Insert(); attr = new MapAttr(); attr.FK_MapData = this.FK_MapData; attr.KeyOfEn = "EvalEmpName"; attr.Name = "被评价人员名称"; attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.MaxLen = 50; attr.MinLen = 0; attr.UIIsEnable = true; attr.UIIsLine = false; attr.UIIsEnable = false; attr.IsSigan = true; attr.Idx = 2; attr.Insert(); attr = new MapAttr(); attr.FK_MapData = this.FK_MapData; attr.KeyOfEn = "EvalCent"; attr.Name = "工作得分"; attr.MyDataType = DataType.AppFloat; attr.UIContralType = UIContralType.TB; attr.MaxLen = 50; attr.MinLen = 0; attr.UIIsEnable = true; attr.UIIsLine = false; attr.UIIsEnable = true; attr.Idx = 3; attr.Insert(); attr = new MapAttr(); attr.FK_MapData = this.FK_MapData; attr.KeyOfEn = "EvalNote"; attr.Name = "评价信息"; attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.MaxLen = 50; attr.MinLen = 0; attr.UIIsEnable = true; attr.UIIsEnable = true; attr.Idx = 4; attr.Insert(); this.WinClose(); return; default: break; } break; case "AddFGroup": this.AddFGroup(); return; case "AddF": case "ChoseFType": this.AddF(); break; case "Up": MapAttr attrU = new MapAttr(this.RefNo); if (this.Request.QueryString["IsDtl"] != null) { attrU.DoDtlUp(); } else { attrU.DoUp(); } this.WinClose(); break; case "Down": //让一个字段下移动. MapAttr attrD = new MapAttr(this.RefNo); attrD.DoDown(); this.WinClose(); break; case "DownAttr": //让一个字段下移动. MapAttr attrAttr = new MapAttr(this.RefNo); attrAttr.DoDtlDown(); this.WinClose(); break; case "Jump": MapAttr attrFrom = new MapAttr(this.Request.QueryString["FromID"]); MapAttr attrTo = new MapAttr(this.Request.QueryString["ToID"]); attrFrom.DoJump(attrTo); this.WinClose(); break; case "MoveTo": string toID = this.Request.QueryString["ToID"]; int toGFID = int.Parse(this.Request.QueryString["ToGID"]); int fromGID = int.Parse(this.Request.QueryString["FromGID"]); string fromID = this.Request.QueryString["FromID"]; MapAttr fromAttr = new MapAttr(); fromAttr.MyPK = fromID; fromAttr.Retrieve(); if (toGFID == fromAttr.GroupID && fromAttr.MyPK == toID) { /* 如果没有移动. */ this.WinClose(); return; } if (toGFID != fromAttr.GroupID && fromAttr.MyPK == toID) { MapAttr toAttr = new MapAttr(toID); fromAttr.Update(MapAttrAttr.GroupID, toAttr.GroupID, MapAttrAttr.Idx, toAttr.Idx); this.WinClose(); return; } this.Response.Redirect(this.Request.RawUrl.Replace("MoveTo", "Jump"), true); return; case "Edit": Edit(); break; case "Del": MapAttr attrDel = new MapAttr(); attrDel.MyPK = this.RefNo; attrDel.Delete(); this.WinClose(); break; case "GFDoUp": GroupField gf = new GroupField(this.RefOID); gf.DoUp(); gf.Retrieve(); if (gf.Idx == 0) { this.WinClose(); return; } int oidIdx = gf.Idx; gf.Idx = gf.Idx - 1; GroupField gfUp = new GroupField(); if (gfUp.Retrieve(GroupFieldAttr.EnName, gf.EnName, GroupFieldAttr.Idx, gf.Idx) == 1) { gfUp.Idx = oidIdx; gfUp.Update(); } gf.Update(); this.WinClose(); break; case "GFDoDown": GroupField mygf = new GroupField(this.RefOID); mygf.DoDown(); mygf.Retrieve(); int oidIdx1 = mygf.Idx; mygf.Idx = mygf.Idx + 1; GroupField gfDown = new GroupField(); if (gfDown.Retrieve(GroupFieldAttr.EnName, mygf.EnName, GroupFieldAttr.Idx, mygf.Idx) == 1) { gfDown.Idx = oidIdx1; gfDown.Update(); } mygf.Update(); this.WinClose(); break; case "AthDoUp": FrmAttachment frmAth = new FrmAttachment(this.MyPK); if (frmAth.RowIdx > 0) { frmAth.RowIdx = frmAth.RowIdx - 1; frmAth.Update(); } this.WinClose(); break; case "AthDoDown": FrmAttachment frmAthD = new FrmAttachment(this.MyPK); if (frmAthD.RowIdx < 10) { frmAthD.RowIdx = frmAthD.RowIdx + 1; frmAthD.Update(); } this.WinClose(); break; case "DtlDoUp": MapDtl dtl1 = new MapDtl(this.MyPK); if (dtl1.RowIdx > 0) { dtl1.RowIdx = dtl1.RowIdx - 1; dtl1.Update(); } this.WinClose(); break; case "DtlDoDown": MapDtl dtl2 = new MapDtl(this.MyPK); if (dtl2.RowIdx < 10) { dtl2.RowIdx = dtl2.RowIdx + 1; dtl2.Update(); } this.WinClose(); break; case "M2MDoUp": MapM2M ddtl1 = new MapM2M(this.MyPK); if (ddtl1.RowIdx > 0) { ddtl1.RowIdx = ddtl1.RowIdx - 1; ddtl1.Update(); } this.WinClose(); break; case "M2MDoDown": MapM2M ddtl2 = new MapM2M(this.MyPK); if (ddtl2.RowIdx < 10) { ddtl2.RowIdx = ddtl2.RowIdx + 1; ddtl2.Update(); } this.WinClose(); break; case "FrameDoUp": MapFrame frame1 = new MapFrame(this.MyPK); if (frame1.RowIdx > 0) { frame1.RowIdx = frame1.RowIdx - 1; frame1.Update(); } this.WinClose(); break; case "FrameDoDown": MapFrame frame2 = new MapFrame(this.MyPK); if (frame2.RowIdx < 10) { frame2.RowIdx = frame2.RowIdx + 1; frame2.Update(); } this.WinClose(); break; default: break; } } catch (Exception ex) { this.Pub1.AddMsgOfWarning("错误:", ex.Message + " <br>" + this.Request.RawUrl); } }
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); }