public void Share() { this.Pub1.AddTable(); this.Pub1.AddCaptionLeftTX("在施工中.."); this.Pub1.AddTR(); this.Pub1.AddTDTitle("项目"); this.Pub1.AddTDTitle("采集"); this.Pub1.AddTDTitle("说明"); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("表单类别"); MapData md = new MapData(this.RefNo); TextBox tb = new TextBox(); tb.ID = "TB_Sort"; if (string.IsNullOrEmpty(md.FK_FrmSort.Trim())) { /*没有类别,就考虑是节点表单*/ } else { SysFormTree fs = new SysFormTree(); fs.No = md.No; fs.RetrieveFromDBSources(); tb.Text = md.No; } this.Pub1.AddTD(tb); this.Pub1.AddTD(); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("表单名称"); tb = new TextBox(); tb.ID = "TB_Name"; tb.Text = md.Name; this.Pub1.AddTD(tb); this.Pub1.AddTD(); this.Pub1.AddTREnd(); //this.Pub1.AddTR(); //this.Pub1.AddTD("设计者"); //tb = new TextBox(); //tb.ID = "TB_Designer"; //tb.Text = md.Designer; //this.Pub1.AddTD(tb); //this.Pub1.AddTD(); //this.Pub1.AddTREnd(); //this.Pub1.AddTR(); //this.Pub1.AddTD("设计单位"); //tb = new TextBox(); //tb.ID = "TB_DesignerContact"; //tb.Text = md.DesignerContact; //this.Pub1.AddTD(tb); //this.Pub1.AddTD(); //this.Pub1.AddTREnd(); //this.Pub1.AddTR(); //this.Pub1.AddTD("联系方式"); //tb = new TextBox(); //tb.ID = "TB_DesignerContact"; //tb.Text = md.DesignerContact; //tb.Columns = 50; //this.Pub1.AddTD(tb); //this.Pub1.AddTD(); //this.Pub1.AddTREnd(); this.Pub1.AddTableEnd(); this.Pub1.AddTR(); this.Pub1.AddTD(); Button btn = new Button(); btn.CssClass = "Btn"; btn.ID = "Btn_Save"; btn.Text = "Share It"; btn.Click += new EventHandler(btn_ShareIt_Click); this.Pub1.AddTD(btn); this.Pub1.AddTD(); this.Pub1.AddTREnd(); this.Pub1.AddTableEnd(); this.Pub1.AddFieldSet("共享说明"); this.Pub1.Add("如果您想批量的共享表单,请转到流程设计器-功能执行-导出流程与表单模板,发送邮件到[email protected]中。"); this.Pub1.AddFieldSetEnd(); }
/// <summary> /// 执行 /// </summary> /// <returns>返回执行结果</returns> public override object Do() { string path = "C:\\CCFlowTemplete" + DateTime.Now.ToString("yy年MM月dd日HH时mm分ss秒"); if (System.IO.Directory.Exists(path) == false) { System.IO.Directory.CreateDirectory(path); } #region 1.备份流程类别信息 DataSet dsFlows = new DataSet(); //WF_FlowSort DataTable dt = DBAccess.RunSQLReturnTable("SELECT * FROM WF_FlowSort"); dt.TableName = "WF_FlowSort"; dsFlows.Tables.Add(dt); dsFlows.WriteXml(path + "\\FlowTables.xml"); #endregion 备份流程类别信息. #region 2.备份组织结构. DataSet dsPort = new DataSet(); //emps dt = DBAccess.RunSQLReturnTable("SELECT * FROM Port_Emp"); dt.TableName = "Port_Emp"; dsPort.Tables.Add(dt); //Port_Dept dt = DBAccess.RunSQLReturnTable("SELECT * FROM Port_Dept"); dt.TableName = "Port_Dept"; dsPort.Tables.Add(dt); //Port_Station dt = DBAccess.RunSQLReturnTable("SELECT * FROM Port_Station"); dt.TableName = "Port_Station"; dsPort.Tables.Add(dt); //Port_EmpStation dt = DBAccess.RunSQLReturnTable("SELECT * FROM Port_DeptEmpStation"); dt.TableName = "Port_DeptEmpStation"; dsPort.Tables.Add(dt); dsPort.WriteXml(path + "\\PortTables.xml"); #endregion 备份表单相关数据. #region 3.备份系统数据 DataSet dsSysTables = new DataSet(); //Sys_EnumMain dt = DBAccess.RunSQLReturnTable("SELECT * FROM Sys_EnumMain"); dt.TableName = "Sys_EnumMain"; dsSysTables.Tables.Add(dt); //Sys_Enum dt = DBAccess.RunSQLReturnTable("SELECT * FROM Sys_Enum"); dt.TableName = "Sys_Enum"; dsSysTables.Tables.Add(dt); //Sys_FormTree dt = DBAccess.RunSQLReturnTable("SELECT * FROM Sys_FormTree"); dt.TableName = "Sys_FormTree"; dsSysTables.Tables.Add(dt); dsSysTables.WriteXml(path + "\\SysTables.xml"); #endregion 备份系统数据. #region 4.备份表单相关数据. string pathOfTables = path + "\\SFTables"; System.IO.Directory.CreateDirectory(pathOfTables); SFTables tabs = new SFTables(); tabs.RetrieveAll(); foreach (SFTable item in tabs) { if (item.No.Contains(".")) { continue; } if (item.SrcType != SrcType.CreateTable) { continue; } try { string sql = "SELECT * FROM " + item.No + " "; DataSet ds = new DataSet(); ds.Tables.Add(BP.DA.DBAccess.RunSQLReturnTable(sql)); ds.WriteXml(pathOfTables + "\\" + item.No + ".xml"); } catch { } } #endregion 备份表单相关数据. #region 5.备份流程. Flows fls = new Flows(); fls.RetrieveAllFromDBSource(); foreach (Flow fl in fls) { FlowSort fs = new FlowSort(); fs.No = fl.FK_FlowSort; fs.RetrieveFromDBSources(); string pathDir = path + "\\Flow\\" + fs.No + "." + fs.Name + "\\"; if (System.IO.Directory.Exists(pathDir) == false) { System.IO.Directory.CreateDirectory(pathDir); } fl.DoExpFlowXmlTemplete(pathDir); } #endregion 备份流程. #region 6.备份表单. MapDatas mds = new MapDatas(); mds.RetrieveAllFromDBSource(); foreach (MapData md in mds) { if (md.FK_FrmSort.Length < 2) { continue; } SysFormTree fs = new SysFormTree(); fs.No = md.FK_FormTree; fs.RetrieveFromDBSources(); string pathDir = path + "\\Form\\" + fs.No + "." + fs.Name; if (System.IO.Directory.Exists(pathDir) == false) { System.IO.Directory.CreateDirectory(pathDir); } DataSet ds = BP.Sys.CCFormAPI.GenerHisDataSet(md.No); ds.WriteXml(pathDir + "\\" + md.Name + ".xml"); } #endregion 备份表单. return("执行成功,存放路径:" + path); }