Esempio n. 1
0
        /// <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);
            }

            Flows fls = new Flows();

            fls.RetrieveAllFromDBSource();
            foreach (Flow fl in fls)
            {
                FlowSort fs      = new FlowSort(fl.FK_FlowSort);
                string   pathDir = path + "\\Flow\\" + fs.No + "." + fs.Name;
                if (System.IO.Directory.Exists(pathDir) == false)
                {
                    System.IO.Directory.CreateDirectory(pathDir);
                }

                //  fl.GenerFlowXmlTemplete(pathDir + "\\" + fl.Name + ".xml");
                fl.GenerFlowXmlTemplete(pathDir);
            }

            MapDatas mds = new MapDatas();

            mds.RetrieveAllFromDBSource();
            foreach (MapData md in mds)
            {
                if (md.FK_FrmSort.Length < 2)
                {
                    continue;
                }

                FrmSort fs      = new FrmSort(md.FK_FrmSort);
                string  pathDir = path + "\\Form\\" + fs.No + "." + fs.Name;
                if (System.IO.Directory.Exists(pathDir) == false)
                {
                    System.IO.Directory.CreateDirectory(pathDir);
                }
                DataSet ds = md.GenerHisDataSet();
                ds.WriteXml(pathDir + "\\" + md.Name + ".xml");
            }
            return("执行成功,存放路径:" + path);
        }
Esempio n. 2
0
        /// <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);
        }