protected void Page_Load(object sender, EventArgs e) { MapDtl dtl = new MapDtl(); dtl.No = this.FK_MapDtl; if (dtl.RetrieveFromDBSources() == 0) { dtl.FK_MapData = this.FK_MapData; dtl.Name = this.FK_MapData; dtl.Insert(); dtl.IntMapAttrs(); } this.Pub1.AddTable("width=100% height='100%' align=left "); this.Pub1.AddTR(" ID='0_0' "); this.Pub1.Add("<TD colspan=4 class=TRSum ><div style='text-align:left; float:left'><a href=\"javascript:EditDtl('" + this.FK_MapData + "','" + dtl.No + "')\" >" + dtl.Name + "</a></div><div style='text-align:right; float:right'><a href=\"javascript:document.getElementById('F" + dtl.No + "').contentWindow.AddF('" + dtl.No + "');\"><img src='/WF/Img/Btn/New.gif' border=0/>插入列</a><a href=\"javascript:document.getElementById('F" + dtl.No + "').contentWindow.AddFGroup('" + dtl.No + "');\"><img src='/WF/Img/Btn/New.gif' border=0/>插入列组</a><a href=\"javascript:document.getElementById('F" + dtl.No + "').contentWindow.CopyF('" + dtl.No + "');\"><img src='/WF/Img/Btn/Copy.gif' border=0/>复制列</a><a href=\"javascript:document.getElementById('F" + dtl.No + "').contentWindow.HidAttr('" + dtl.No + "');\"><img src='/WF/Img/Btn/Copy.gif' border=0/>隐藏列</a><a href=\"javascript:document.getElementById('F" + dtl.No + "').contentWindow.DtlMTR('" + dtl.No + "');\"><img src='/WF/Img/Btn/Copy.gif' border=0/>多表头</a> <a href='Action.aspx?FK_MapData=" + this.FK_MapDtl + "' >从表事件</a><a href=\"javascript:DtlDoUp('" + dtl.No + "')\" ><img src='/WF/Img/Btn/Up.gif' border=0/></a> <a href=\"javascript:DtlDoDown('" + dtl.No + "')\" ><img src='/WF/Img/Btn/Down.gif' border=0/></a></div></td>"); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.Add("<TD colspan=4 ID='TD" + dtl.No + "' height='50px' align=left>"); string src = "MapDtlDe.aspx?DoType=Edit&FK_MapData=" + this.FK_MapData + "&FK_MapDtl=" + dtl.No; this.Pub1.Add("<iframe ID='F" + dtl.No + "' frameborder=0 style='align:left;padding:0px;border:0px;' leftMargin='0' topMargin='0' src='" + src + "' width='100%' height='400' /></iframe>"); this.Pub1.AddTDEnd(); this.Pub1.AddTREnd(); this.Pub1.AddTableEnd(); }
void btn_Click(object sender, EventArgs e) { Button btn = sender as Button; try { switch (this.DoType) { case "New": default: MapDtl dtlN = new MapDtl(); dtlN = (MapDtl)this.Pub1.Copy(dtlN); if (this.DoType == "New") { if (dtlN.IsExits) { this.Alert("已存在编号:" + dtlN.No); return; } } dtlN.FK_MapData = this.FK_MapData; dtlN.GroupID = 0; dtlN.RowIdx = 0; GroupFields gfs1 = new GroupFields(this.FK_MapData); if (gfs1.Count == 1) { GroupField gf = (GroupField)gfs1[0]; dtlN.GroupID = gf.OID; } else { dtlN.GroupID = this.Pub1.GetDDLByID("DDL_GroupField").SelectedItemIntVal; } dtlN.Insert(); if (btn.ID.Contains("AndClose")) { this.WinClose(); return; } this.Response.Redirect("MapDtl.aspx?DoType=Edit&FK_MapDtl=" + dtlN.No + "&FK_MapData=" + this.FK_MapData, true); break; case "Edit": MapDtl dtl = new MapDtl(this.FK_MapDtl); dtl = (MapDtl)this.Pub1.Copy(dtl); if (this.DoType == "New") { if (dtl.IsExits) { this.Alert("已存在编号:" + dtl.No); return; } } dtl.FK_MapData = this.FK_MapData; GroupFields gfs = new GroupFields(dtl.FK_MapData); if (gfs.Count > 1) { dtl.GroupID = this.Pub1.GetDDLByID("DDL_GroupField").SelectedItemIntVal; } if (this.DoType == "New") { dtl.Insert(); } else { dtl.Update(); } if (btn.ID.Contains("AndC")) { this.WinClose(); return; } this.Response.Redirect("MapDtl.aspx?DoType=Edit&FK_MapDtl=" + dtl.No + "&FK_MapData=" + this.FK_MapData, true); break; } } catch (Exception ex) { this.Alert(ex.Message); } }
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(); }
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); }
void btn_Click(object sender, EventArgs e) { Button btn = sender as Button; try { switch (this.DoType) { case "New": default: MapDtl dtlN = new MapDtl(); dtlN = (MapDtl)this.Pub1.Copy(dtlN); try { dtlN.GroupField = this.Pub1.GetDDLByID("DDL_GroupField").SelectedItemStringVal; } catch { } if (this.DoType == "New") { if (dtlN.IsExits) { this.Alert("已存在编号:" + dtlN.No); return; } } dtlN.FK_MapData = this.FK_MapData; dtlN.GroupID = 0; dtlN.RowIdx = 0; // 参数属性. dtlN.DtlSaveModel = (DtlSaveModel)this.Pub1.GetDDLByID("DDL_" + MapDtlAttr.DtlSaveModel).SelectedItemIntVal; dtlN.DtlAddRecModel = (DtlAddRecModel)this.Pub1.GetDDLByID("DDL_" + MapDtlAttr.DtlAddRecModel).SelectedItemIntVal; GroupFields gfs1 = new GroupFields(this.FK_MapData); if (gfs1.Count == 1) { GroupField gf = (GroupField)gfs1[0]; dtlN.GroupID = gf.OID; } else { dtlN.GroupID = this.Pub1.GetDDLByID("DDL_GroupID").SelectedItemIntVal; } dtlN.Insert(); if (btn.ID.Contains("AndClose")) { this.WinClose(); return; } this.Response.Redirect("MapDtl.aspx?DoType=Edit&FK_MapDtl=" + dtlN.No + "&FK_MapData=" + this.FK_MapData, true); break; case "Edit": MapDtl dtl = new MapDtl(this.FK_MapDtl); dtl = (MapDtl)this.Pub1.Copy(dtl); //参数保存. dtl.IsEnableLink = this.Pub1.GetCBByID("CB_" + MapDtlAttr.IsEnableLink).Checked; //手动保存,added by liuxc,2016-4-7 dtl.DtlSaveModel = (DtlSaveModel)this.Pub1.GetDDLByID("DDL_" + MapDtlAttr.DtlSaveModel).SelectedItemIntVal; dtl.DtlAddRecModel = (DtlAddRecModel)this.Pub1.GetDDLByID("DDL_" + MapDtlAttr.DtlAddRecModel).SelectedItemIntVal; if (this.FK_Node != 0) { //是否是分流. add 2015-06-30. dtl.IsFLDtl = this.Pub1.GetCBByID("CB_" + MapDtlAttr.IsFLDtl).Checked; //子线程处理字段. if (this.Pub1.GetDDLByID("DDL_" + MapDtlAttr.SubThreadGroupMark).Items.Count > 0) { dtl.SubThreadGroupMark = this.Pub1.GetDDLByID("DDL_" + MapDtlAttr.SubThreadGroupMark).SelectedItemStringVal; } if (this.Pub1.GetDDLByID("DDL_" + MapDtlAttr.SubThreadWorker).Items.Count > 0) { dtl.SubThreadWorker = this.Pub1.GetDDLByID("DDL_" + MapDtlAttr.SubThreadWorker).SelectedItemStringVal; } } dtl.LinkLabel = this.Pub1.GetTBByID("TB_" + MapDtlAttr.LinkLabel).Text; dtl.LinkTarget = this.Pub1.GetTBByID("TB_" + MapDtlAttr.LinkTarget).Text; dtl.LinkUrl = this.Pub1.GetTBByID("TB_" + MapDtlAttr.LinkUrl).Text; //锁定. dtl.IsRowLock = this.Pub1.GetCBByID("CB_" + MapDtlAttr.IsRowLock).Checked; //分组字段。 try { dtl.GroupField = this.Pub1.GetDDLByID("DDL_GroupField").SelectedItemStringVal; } catch { } if (this.DoType == "New") { if (dtl.IsExits) { this.Alert("已存在编号:" + dtl.No); return; } } dtl.FK_MapData = this.FK_MapData; GroupFields gfs = new GroupFields(dtl.FK_MapData); if (gfs.Count > 1) { dtl.GroupID = this.Pub1.GetDDLByID("DDL_GroupID").SelectedItemIntVal; } if (dtl.IsEnableAthM) { /*如果启用了多附件.*/ FrmAttachment ath = new FrmAttachment(); ath.MyPK = dtl.No + "_AthMDtl"; ath.FK_MapData = dtl.No; ath.NoOfObj = "AthMDtl"; ath.Name = "从表行记录附件"; if (ath.RetrieveFromDBSources() == 0) { ath.Insert(); } } if (this.DoType == "New") { dtl.Insert(); } else { dtl.Update(); } if (btn.ID.Contains("AndC")) { this.WinClose(); return; } this.Response.Redirect("MapDtl.aspx?DoType=Edit&FK_MapDtl=" + dtl.No + "&FK_MapData=" + this.FK_MapData, true); break; } } catch (Exception ex) { this.Alert(ex.Message); } }
void btn_Click(object sender, EventArgs e) { Button btn = sender as Button; try { switch (this.DoType) { case "New": default: MapDtl dtlN = new MapDtl(); dtlN = (MapDtl)this.Pub1.Copy(dtlN); try { dtlN.GroupField = this.Pub1.GetDDLByID("DDL_GroupField").SelectedItemStringVal; } catch { } if (this.DoType == "New") { if (dtlN.IsExits) { this.Alert("已存在编号:" + dtlN.No); return; } } dtlN.FK_MapData = this.FK_MapData; dtlN.GroupID = 0; dtlN.RowIdx = 0; GroupFields gfs1 = new GroupFields(this.FK_MapData); if (gfs1.Count == 1) { GroupField gf = (GroupField)gfs1[0]; dtlN.GroupID = gf.OID; } else { dtlN.GroupID = this.Pub1.GetDDLByID("DDL_GroupID").SelectedItemIntVal; } dtlN.Insert(); if (btn.ID.Contains("AndClose")) { this.WinClose(); return; } this.Response.Redirect("MapDtl.aspx?DoType=Edit&FK_MapDtl=" + dtlN.No + "&FK_MapData=" + this.FK_MapData, true); break; case "Edit": MapDtl dtl = new MapDtl(this.FK_MapDtl); dtl = (MapDtl)this.Pub1.Copy(dtl); //参数保存. dtl.IsEnableLink = this.Pub1.GetCBByID("CB_" + MapDtlAttr.IsEnableLink).Checked; //是否是分流. add 2015-06-30. dtl.IsFLDtl = this.Pub1.GetCBByID("CB_" + MapDtlAttr.IsFLDtl).Checked; dtl.SubThreadGroupMark = this.Pub1.GetDDLByID("DDL_" + MapDtlAttr.SubThreadGroupMark).SelectedItemStringVal; dtl.SubThreadWorker = this.Pub1.GetDDLByID("DDL_" + MapDtlAttr.SubThreadWorker).SelectedItemStringVal; dtl.LinkLabel = this.Pub1.GetTBByID("TB_" + MapDtlAttr.LinkLabel).Text; dtl.LinkTarget = this.Pub1.GetTBByID("TB_" + MapDtlAttr.LinkTarget).Text; dtl.LinkUrl = this.Pub1.GetTBByID("TB_" + MapDtlAttr.LinkUrl).Text; //锁定. dtl.IsRowLock = this.Pub1.GetCBByID("CB_" + MapDtlAttr.IsRowLock).Checked; //分组字段。 try { dtl.GroupField = this.Pub1.GetDDLByID("DDL_GroupField").SelectedItemStringVal; } catch { } if (this.DoType == "New") { if (dtl.IsExits) { this.Alert("已存在编号:" + dtl.No); return; } } dtl.FK_MapData = this.FK_MapData; GroupFields gfs = new GroupFields(dtl.FK_MapData); if (gfs.Count > 1) { dtl.GroupID = this.Pub1.GetDDLByID("DDL_GroupID").SelectedItemIntVal; } if (this.DoType == "New") { dtl.Insert(); } else { dtl.Update(); } if (btn.ID.Contains("AndC")) { this.WinClose(); return; } this.Response.Redirect("MapDtl.aspx?DoType=Edit&FK_MapDtl=" + dtl.No + "&FK_MapData=" + this.FK_MapData, true); break; } } catch (Exception ex) { this.Alert(ex.Message); } }
public string DoType(string dotype, string v1, string v2, string v3, string v4, string v5) { string sql = ""; try { switch (dotype) { case "CreateCheckGroup": string gKey = v1; string gName = v2; string enName1 = v3; MapAttr attrN = new MapAttr(); int i = attrN.Retrieve(MapAttrAttr.FK_MapData, enName1, MapAttrAttr.KeyOfEn, gKey + "_Note"); i += attrN.Retrieve(MapAttrAttr.FK_MapData, enName1, MapAttrAttr.KeyOfEn, gKey + "_Checker"); i += attrN.Retrieve(MapAttrAttr.FK_MapData, enName1, MapAttrAttr.KeyOfEn, gKey + "_RDT"); if (i > 0) { return("前缀已经使用:" + gKey + " , 请确认您是否增加了这个审核分组或者,请您更换其他的前缀。"); } GroupField gf = new GroupField(); gf.Lab = gName; gf.EnName = enName1; gf.Insert(); attrN = new MapAttr(); attrN.FK_MapData = enName1; attrN.KeyOfEn = gKey + "_Note"; attrN.Name = "审核意见"; attrN.MyDataType = DataType.AppString; attrN.UIContralType = UIContralType.TB; attrN.UIIsEnable = true; attrN.UIIsLine = true; attrN.MaxLen = 4000; attrN.GroupID = gf.OID; attrN.UIHeight = 23 * 3; attrN.IDX = 1; attrN.Insert(); attrN = new MapAttr(); attrN.FK_MapData = enName1; attrN.KeyOfEn = gKey + "_Checker"; attrN.Name = "审核人";// "审核人"; attrN.MyDataType = DataType.AppString; attrN.UIContralType = UIContralType.TB; attrN.MaxLen = 50; attrN.MinLen = 0; attrN.UIIsEnable = true; attrN.UIIsLine = false; attrN.DefVal = "@WebUser.Name"; attrN.UIIsEnable = false; attrN.GroupID = gf.OID; attrN.IsSigan = true; attrN.IDX = 2; attrN.Insert(); attrN = new MapAttr(); attrN.FK_MapData = enName1; attrN.KeyOfEn = gKey + "_RDT"; attrN.Name = "审核日期"; // "审核日期"; attrN.MyDataType = DataType.AppDateTime; attrN.UIContralType = UIContralType.TB; attrN.UIIsEnable = true; attrN.UIIsLine = false; attrN.DefVal = "@RDT"; attrN.UIIsEnable = false; attrN.GroupID = gf.OID; attrN.IDX = 3; attrN.Insert(); return(null); case "NewDtl": MapDtl dtlN = new MapDtl(); dtlN.No = v1; if (dtlN.RetrieveFromDBSources() != 0) { return("从表已存在"); } dtlN.Name = v1; dtlN.FK_MapData = v2; dtlN.PTable = v1; dtlN.Insert(); dtlN.IntMapAttrs(); return(null); case "DelM2M": MapM2M m2mDel = new MapM2M(); m2mDel.MyPK = v1; m2mDel.Delete(); //M2M m2mData = new M2M(); //m2mData.Delete(M2MAttr.FK_MapData, v1); return(null); case "NewAthM": // 新建 NewAthM. string fk_mapdataAth = v1; string athName = v2; BP.Sys.FrmAttachment athM = new FrmAttachment(); athM.MyPK = athName; if (athM.IsExits) { return("多选名称:" + athName + ",已经存在。"); } athM.X = float.Parse(v3); athM.Y = float.Parse(v4); athM.Name = "多文件上传"; athM.FK_MapData = fk_mapdataAth; athM.Insert(); return(null); case "NewM2M": string fk_mapdataM2M = v1; string m2mName = v2; MapM2M m2m = new MapM2M(); m2m.FK_MapData = v1; m2m.NoOfObj = v2; if (v3 == "0") { m2m.HisM2MType = M2MType.M2M; m2m.Name = "新建一对多"; } else { m2m.HisM2MType = M2MType.M2MM; m2m.Name = "新建一对多多"; } m2m.X = float.Parse(v4); m2m.Y = float.Parse(v5); m2m.MyPK = m2m.FK_MapData + "_" + m2m.NoOfObj; if (m2m.IsExits) { return("多选名称:" + m2mName + ",已经存在。"); } m2m.Insert(); return(null); case "DelEnum": // 检查这个物理表是否被使用。 sql = "SELECT * FROM Sys_MapAttr WHERE UIBindKey='" + v1 + "'"; DataTable dtEnum = DBAccess.RunSQLReturnTable(sql); string msgDelEnum = ""; foreach (DataRow dr in dtEnum.Rows) { msgDelEnum += "\n 表单编号:" + dr["FK_MapData"] + " , 字段:" + dr["KeyOfEn"] + ", 名称:" + dr["Name"]; } if (msgDelEnum != "") { return("该枚举已经被如下字段所引用,您不能删除它。" + msgDelEnum); } sql = "DELETE FROM Sys_EnumMain WHERE No='" + v1 + "'"; sql += "@DELETE FROM Sys_Enum WHERE EnumKey='" + v1 + "' "; DBAccess.RunSQLs(sql); return(null); case "DelSFTable": /* 删除自定义的物理表. */ // 检查这个物理表是否被使用。 sql = "SELECT * FROM Sys_MapAttr WHERE UIBindKey='" + v1 + "'"; DataTable dt = DBAccess.RunSQLReturnTable(sql); string msgDel = ""; foreach (DataRow dr in dt.Rows) { msgDel += "\n 表单编号:" + dr["FK_MapData"] + " , 字段:" + dr["KeyOfEn"] + ", 名称:" + dr["Name"]; } if (msgDel != "") { return("该数据表已经被如下字段所引用,您不能删除它。" + msgDel); } SFTable sfDel = new SFTable(); sfDel.No = v1; sfDel.DirectDelete(); return(null); case "SaveSFTable": string enName = v2; string chName = v1; if (string.IsNullOrEmpty(v1) || string.IsNullOrEmpty(v2)) { return("视图中的中英文名称不能为空。"); } SFTable sf = new SFTable(); sf.No = enName; sf.Name = chName; sf.No = enName; sf.Name = chName; sf.FK_Val = enName; sf.Save(); if (DBAccess.IsExitsObject(enName) == true) { /*已经存在此对象,检查一下是否有No,Name列。*/ sql = "SELECT No,Name FROM " + enName; try { DBAccess.RunSQLReturnTable(sql); } catch (Exception ex) { return("您指定的表或视图(" + enName + "),不包含No,Name两列,不符合ccflow约定的规则。技术信息:" + ex.Message); } return(null); } else { /*创建这个表,并且插入基础数据。*/ try { // 如果没有该表或者视图,就要创建它。 sql = "CREATE TABLE " + enName + "(No varchar(30) NOT NULL,Name varchar(50) NULL)"; DBAccess.RunSQL(sql); DBAccess.RunSQL("INSERT INTO " + enName + " (No,Name) VALUES('001','Item1')"); DBAccess.RunSQL("INSERT INTO " + enName + " (No,Name) VALUES('002','Item2')"); DBAccess.RunSQL("INSERT INTO " + enName + " (No,Name) VALUES('003','Item3')"); } catch (Exception ex) { sf.DirectDelete(); return("创建物理表期间出现错误,可能是非法的物理表名.技术信息:" + ex.Message); } } return(null); /*创建成功后返回空值*/ case "FrmTempleteExp": //导出表单. MapData mdfrmtem = new MapData(); mdfrmtem.No = v1; if (mdfrmtem.RetrieveFromDBSources() == 0) { if (v1.Contains("ND")) { int nodeId = int.Parse(v1.Replace("ND", "")); Node nd = new Node(nodeId); mdfrmtem.Name = nd.Name; mdfrmtem.PTable = v1; mdfrmtem.EnPK = "OID"; mdfrmtem.Insert(); } } DataSet ds = mdfrmtem.GenerHisDataSet(); string file = System.Web.HttpContext.Current.Request.PhysicalApplicationPath + "\\Temp\\" + v1 + ".xml"; if (System.IO.File.Exists(file)) { System.IO.File.Delete(file); } ds.WriteXml(file); // BP.PubClass.DownloadFile(file, mdfrmtem.Name + ".xml"); //this.DownLoadFile(System.Web.HttpContext.Current, file, mdfrmtem.Name); return(null); case "FrmTempleteImp": //导入表单. DataSet dsImp = new DataSet(); string fileImp = System.Web.HttpContext.Current.Request.PhysicalApplicationPath + "\\Temp\\" + v1 + ".xml"; dsImp.ReadXml(fileImp); //读取文件. MapData.ImpMapData(v1, dsImp, true); return(null); case "NewHidF": string fk_mapdataHid = v1; string key = v2; string name = v3; int dataType = int.Parse(v4); MapAttr mdHid = new MapAttr(); mdHid.MyPK = fk_mapdataHid + "_" + key; mdHid.FK_MapData = fk_mapdataHid; mdHid.KeyOfEn = key; mdHid.Name = name; mdHid.MyDataType = dataType; mdHid.HisEditType = EditType.Edit; mdHid.MaxLen = 100; mdHid.MinLen = 0; mdHid.LGType = FieldTypeS.Normal; mdHid.UIVisible = false; mdHid.UIIsEnable = false; mdHid.Insert(); return(null); case "DelDtl": MapDtl dtl = new MapDtl(v1); dtl.Delete(); return(null); case "DeleteFrm": string delFK_Frm = v1; MapData mdDel = new MapData(delFK_Frm); mdDel.Delete(); sql = "@DELETE FROM Sys_MapData WHERE No='" + delFK_Frm + "'"; sql = "@DELETE FROM WF_FrmNode WHERE FK_Frm='" + delFK_Frm + "'"; DBAccess.RunSQLs(sql); return(null); case "FrmUp": case "FrmDown": FrmNode myfn = new FrmNode(); myfn.Retrieve(FrmNodeAttr.FK_Node, v1, FrmNodeAttr.FK_Frm, v2); if (dotype == "FrmUp") { myfn.DoUp(); } else { myfn.DoDown(); } return(null); case "SaveFlowFrm": // 转化参数意义. string vals = v1; string fk_Node = v2; string fk_flow = v3; bool isPrint = false; if (v5 == "1") { isPrint = true; } bool isReadonly = false; if (v4 == "1") { isReadonly = true; } string msg = this.SaveEn(vals); if (msg.Contains("Error")) { return(msg); } string fk_frm = msg; Frm fm = new Frm(); fm.No = fk_frm; fm.Retrieve(); FrmNode fn = new FrmNode(); if (fn.Retrieve(FrmNodeAttr.FK_Frm, fk_frm, FrmNodeAttr.FK_Node, fk_Node) == 1) { fn.IsEdit = !isReadonly; fn.IsPrint = isPrint; fn.FK_Flow = fk_flow; fn.Update(); BP.DA.DBAccess.RunSQL("UPDATE Sys_MapData SET FK_FrmSort='01',AppType=1 WHERE No='" + fk_frm + "'"); return(fk_frm); } fn.FK_Frm = fk_frm; fn.FK_Flow = fk_flow; fn.FK_Node = int.Parse(fk_Node); fn.IsEdit = !isReadonly; fn.IsPrint = isPrint; fn.Idx = 100; fn.FK_Flow = fk_flow; fn.Insert(); MapData md = new MapData(); md.No = fm.No; if (md.RetrieveFromDBSources() == 0) { md.Name = fm.Name; md.EnPK = "OID"; md.Insert(); } MapAttr attr = new MapAttr(); attr.FK_MapData = md.No; attr.KeyOfEn = "OID"; attr.Name = "WorkID"; 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(); attr = new MapAttr(); attr.FK_MapData = md.No; attr.KeyOfEn = "FID"; attr.Name = "FID"; 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(); attr = new MapAttr(); attr.FK_MapData = md.No; attr.KeyOfEn = "RDT"; attr.Name = "记录日期"; attr.MyDataType = BP.DA.DataType.AppDateTime; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = false; attr.UIIsEnable = false; attr.DefVal = "@RDT"; attr.HisEditType = BP.En.EditType.Readonly; attr.Insert(); return(fk_frm); default: return("Error:" + dotype + " , 未设置此标记."); } } catch (Exception ex) { return("Error:" + ex.Message); } }