コード例 #1
0
ファイル: SetFlowSort.aspx.cs プロジェクト: zhaoyingju/ccflow
 protected void Btn_Save_Click(object sender, EventArgs e)
 {
     try
     {
         FlowSort fs = new FlowSort();
         fs.Name = Tbx_FlowSortName.Text;
         fs.No   = fs.GenerNewNo;
         fs.Insert();
         LbMessage.Text = "添加成功!";
         this.WinClose();
     }
     catch
     {
         LbMessage.Text = "保存失败!";
     }
 }
コード例 #2
0
        private string GetFlowTreeTable()
        {
            string sql = @"SELECT 'F'+No NO,'F'+ParentNo PARENTNO,NAME, IDX, 1 ISPARENT,'FLOWTYPE' TTYPE,-1 DTYPE FROM WF_FlowSort
                           union 
                           SELECT NO, 'F'+FK_FlowSort as PARENTNO,NAME,IDX,0 ISPARENT,'FLOW' TTYPE,DTYPE FROM WF_Flow";

            if (BP.Sys.SystemConfig.AppCenterDBType == DBType.Oracle)
            {
                sql = @"SELECT 'F'||No NO,'F'||ParentNo PARENTNO,NAME, IDX, 1 ISPARENT,'FLOWTYPE' TTYPE,-1 DTYPE FROM WF_FlowSort
                        union 
                        SELECT NO, 'F'||FK_FlowSort as PARENTNO,NAME,IDX,0 ISPARENT,'FLOW' TTYPE,DTYPE FROM WF_Flow";
            }

            DataTable dt = DBAccess.RunSQLReturnTable(sql);

            //判断是否为空,如果为空,则创建一个流程根结点,added by liuxc,2016-01-24
            if (dt.Rows.Count == 0)
            {
                FlowSort fs = new FlowSort();
                fs.No       = "99";
                fs.ParentNo = "0";
                fs.Name     = "流程树";
                fs.Insert();

                dt.Rows.Add("F99", "F0", "流程树", 0, 1, "FLOWTYPE", -1);
            }
            else
            {
                DataRow[] drs = dt.Select("NAME='流程树'");
                if (drs.Length > 0 && !Equals(drs[0]["PARENTNO"], "F0"))
                {
                    drs[0]["PARENTNO"] = "F0";
                }
            }

            return(Newtonsoft.Json.JsonConvert.SerializeObject(dt));
        }
コード例 #3
0
        public override object Do()
        {
            string msg = "";

            #region 检查数据文件是否完整.
            string path = "C:\\CCFlowTemplete";
            if (System.IO.Directory.Exists(path) == false)
            {
                msg += "@错误:约定的目录不存在服务器" + path + ",请把从ccflow备份的文件放入" + path;
            }

            //PortTables.
            string file = path + "\\PortTables.xml";
            if (System.IO.File.Exists(file) == false)
            {
                msg += "@错误:约定的文件不存在," + file;
            }

            //SysTables.
            file = path + "\\SysTables.xml";
            if (System.IO.File.Exists(file) == false)
            {
                msg += "@错误:约定的文件不存在," + file;
            }

            //FlowTables.
            file = path + "\\FlowTables.xml";
            if (System.IO.File.Exists(file) == false)
            {
                msg += "@错误:约定的文件不存在," + file;
            }
            #endregion 检查数据文件是否完整.

            #region 1 装载流程基础表数据.
            DataSet ds = new DataSet();
            ds.ReadXml(path + "\\FlowTables.xml");

            //流程类别.
            FlowSorts sorts = new FlowSorts();
            sorts.ClearTable();
            DataTable dt = ds.Tables["WF_FlowSort"];
            // sorts = QueryObject.InitEntitiesByDataTable(sorts, dt, null) as FlowSorts;
            foreach (FlowSort item in sorts)
            {
                item.DirectInsert(); //插入数据.
            }
            #endregion 1 装载流程基础表数据.

            #region 2 组织结构.
            ds = new DataSet();
            ds.ReadXml(path + "\\PortTables.xml");

            //Port_Emp.
            Emps emps = new Emps();
            emps.ClearTable();
            dt   = ds.Tables["Port_Emp"];
            emps = QueryObject.InitEntitiesByDataTable(emps, dt, null) as Emps;
            foreach (Emp item in emps)
            {
                item.DirectInsert(); //插入数据.
            }

            //Depts.
            Depts depts = new Depts();
            depts.ClearTable();
            dt    = ds.Tables["Port_Dept"];
            depts = QueryObject.InitEntitiesByDataTable(depts, dt, null) as Depts;
            foreach (Dept item in depts)
            {
                item.DirectInsert(); //插入数据.
            }

            //Stations.
            Stations stas = new Stations();
            stas.ClearTable();
            dt   = ds.Tables["Port_Station"];
            stas = QueryObject.InitEntitiesByDataTable(stas, dt, null) as Stations;
            foreach (Station item in stas)
            {
                item.DirectInsert(); //插入数据.
            }


            //EmpDepts.
            EmpDepts eds = new EmpDepts();
            eds.ClearTable();
            dt  = ds.Tables["Port_EmpDept"];
            eds = QueryObject.InitEntitiesByDataTable(eds, dt, null) as EmpDepts;
            foreach (EmpDept item in eds)
            {
                item.DirectInsert(); //插入数据.
            }

            //EmpStations.
            EmpStations ess = new EmpStations();
            ess.ClearTable();
            dt  = ds.Tables["Port_EmpStation"];
            ess = QueryObject.InitEntitiesByDataTable(ess, dt, null) as EmpStations;
            foreach (EmpStation item in ess)
            {
                item.DirectInsert(); //插入数据.
            }
            #endregion 2 组织结构.

            #region 3 恢复系统数据.
            ds = new DataSet();
            ds.ReadXml(path + "\\SysTables.xml");

            //枚举Main.
            SysEnumMains sems = new SysEnumMains();
            sems.ClearTable();
            dt   = ds.Tables["Sys_EnumMain"];
            sems = QueryObject.InitEntitiesByDataTable(sems, dt, null) as SysEnumMains;
            foreach (SysEnumMain item in sems)
            {
                item.DirectInsert(); //插入数据.
            }

            //枚举.
            SysEnums ses = new SysEnums();
            ses.ClearTable();
            dt  = ds.Tables["Sys_Enum"];
            ses = QueryObject.InitEntitiesByDataTable(ses, dt, null) as SysEnums;
            foreach (SysEnum item in ses)
            {
                item.DirectInsert(); //插入数据.
            }

            ////Sys_FormTree.
            //BP.Sys.SysFormTrees sfts = new SysFormTrees();
            //sfts.ClearTable();
            //dt = ds.Tables["Sys_FormTree"];
            //sfts = QueryObject.InitEntitiesByDataTable(sfts, dt, null) as SysFormTrees;
            //foreach (SysFormTree item in sfts)
            //{
            //    try
            //    {
            //       item.DirectInsert(); //插入数据.
            //    }
            //    catch
            //    {
            //    }
            //}
            #endregion 3 恢复系统数据.

            #region 4.备份表单相关数据.
            if (1 == 2)
            {
                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;
                    }

                    string sql = "SELECT * FROM " + item.No;
                    ds = new DataSet();
                    ds.Tables.Add(BP.DA.DBAccess.RunSQLReturnTable(sql));
                    ds.WriteXml(pathOfTables + "\\" + item.No + ".xml");
                }
            }
            #endregion 4 备份表单相关数据.

            #region 5.恢复表单数据.
            //删除所有的流程数据.
            MapDatas mds = new MapDatas();
            mds.RetrieveAll();
            foreach (MapData fl in mds)
            {
                //if (fl.FK_FormTree.Length > 1 || fl.FK_FrmSort.Length > 1)
                //    continue;
                fl.Delete(); //删除流程.
            }

            //清除数据.
            SysFormTrees fss = new SysFormTrees();
            fss.ClearTable();

            // 调度表单文件。
            string          frmPath = path + "\\Form";
            DirectoryInfo   dirInfo = new DirectoryInfo(frmPath);
            DirectoryInfo[] dirs    = dirInfo.GetDirectories();
            foreach (DirectoryInfo item in dirs)
            {
                if (item.FullName.Contains(".svn"))
                {
                    continue;
                }

                string[] fls = System.IO.Directory.GetFiles(item.FullName);
                if (fls.Length == 0)
                {
                    continue;
                }

                SysFormTree fs = new SysFormTree();
                fs.No       = item.Name.Substring(0, item.Name.IndexOf('.'));
                fs.Name     = item.Name.Substring(item.Name.IndexOf('.'));
                fs.ParentNo = "0";
                fs.Insert();

                foreach (string f in fls)
                {
                    try
                    {
                        msg += "@开始调度表单模板文件:" + f;
                        System.IO.FileInfo info = new System.IO.FileInfo(f);
                        if (info.Extension != ".xml")
                        {
                            continue;
                        }

                        ds = new DataSet();
                        ds.ReadXml(f);

                        MapData md = MapData.ImpMapData(ds, false);
                        md.FK_FrmSort = fs.No;
                        md.Update();
                    }
                    catch (Exception ex)
                    {
                        msg += "@调度失败,文件:" + f + ",异常信息:" + ex.Message;
                    }
                }
            }
            #endregion 5.恢复表单数据.

            #region 6.恢复流程数据.
            //删除所有的流程数据.
            Flows flsEns = new Flows();
            flsEns.RetrieveAll();
            foreach (Flow fl in flsEns)
            {
                fl.DoDelete(); //删除流程.
            }

            dirInfo = new DirectoryInfo(path + "\\Flow\\");
            dirs    = dirInfo.GetDirectories();

            //删除数据.
            FlowSorts fsRoots = new FlowSorts();
            fsRoots.ClearTable();

            //生成流程树.
            FlowSort fsRoot = new FlowSort();
            fsRoot.No       = "99";
            fsRoot.Name     = "流程树";
            fsRoot.ParentNo = "0";
            fsRoot.DirectInsert();

            foreach (DirectoryInfo dir in dirs)
            {
                if (dir.FullName.Contains(".svn"))
                {
                    continue;
                }

                string[] fls = System.IO.Directory.GetFiles(dir.FullName);
                if (fls.Length == 0)
                {
                    continue;
                }

                FlowSort fs = new FlowSort();
                fs.No       = dir.Name.Substring(0, dir.Name.IndexOf('.'));
                fs.Name     = dir.Name.Substring(3);
                fs.ParentNo = fsRoot.No;
                fs.Insert();

                foreach (string filePath in fls)
                {
                    msg += "@开始调度流程模板文件:" + filePath;
                    Flow myflow = BP.WF.Flow.DoLoadFlowTemplate(fs.No, filePath, ImpFlowTempleteModel.AsTempleteFlowNo);
                    msg += "@流程:" + myflow.Name + "装载成功。";

                    System.IO.FileInfo info = new System.IO.FileInfo(filePath);
                    myflow.Name = info.Name.Replace(".xml", "");
                    if (myflow.Name.Substring(2, 1) == ".")
                    {
                        myflow.Name = myflow.Name.Substring(3);
                    }

                    myflow.DirectUpdate();
                }
            }
            #endregion 6.恢复流程数据.

            BP.DA.Log.DefaultLogWriteLineInfo(msg);

            //删除多余的空格.
            BP.WF.DTS.DeleteBlankGroupField dts = new DeleteBlankGroupField();
            dts.Do();

            //执行生成签名.
            GenerSiganture gs = new GenerSiganture();
            gs.Do();

            return(msg);
        }
コード例 #4
0
ファイル: WSDesigner.cs プロジェクト: zhaoyingju/ccflow
        public string Do(string doWhat, string para1, bool isLogin)
        {
            // 如果admin账户登陆时有错误发生,则返回错误信息
            var result = LetAdminLogin("CH", isLogin);

            if (string.IsNullOrEmpty(result) == false)
            {
                return(result);
            }

            switch (doWhat)
            {
            case "GenerFlowTemplete":
                Flow temp = new BP.WF.Flow(para1);
                return(null);

            case "NewFrmSort":
                BP.Sys.FrmSort frmSort = null;
                try
                {
                    frmSort      = new FrmSort();
                    frmSort.No   = "01";
                    frmSort.Name = para1;
                    frmSort.No   = frmSort.GenerNewNo;
                    frmSort.Insert();
                    return(null);
                }
                catch (Exception ex)
                {
                    return("Do Method NewFlowSort Branch has a error , para:\t" + para1 + ex.Message);
                }

            case "NewFlowSort":
                BP.WF.FlowSort fs = null;
                try
                {
                    fs      = new FlowSort();
                    fs.Name = para1;
                    fs.No   = fs.GenerNewNo;
                    fs.Insert();
                    return(fs.No);
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method NewFlowSort Branch has a error , para:\t" + para1 + ex.Message);
                    return(null);
                }

            case "EditFlowSort":
                try
                {
                    var para = para1.Split(',');
                    fs      = new FlowSort(para[0]);
                    fs.Name = para[1];
                    fs.Save();
                    return(fs.No);
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method EditFlowSort Branch has a error , para:\t" + para1 + ex.Message);
                    return(null);
                }

            case "NewFlow":
                Flow fl = new Flow();
                try
                {
                    string[] ps = para1.Split(',');
                    if (ps.Length != 5)
                    {
                        throw new Exception("@创建流程参数错误");
                    }

                    string         fk_floSort    = ps[0];
                    string         flowName      = ps[1];
                    DataStoreModel dataSaveModel = (DataStoreModel)int.Parse(ps[2]);
                    string         pTable        = ps[3];
                    string         flowCode      = ps[4];

                    fl.DoNewFlow(fk_floSort, flowName, dataSaveModel, pTable, flowCode);
                    return(fl.No + ";" + fl.Name);
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method NewFlow Branch has a error , para:\t" + para1 + ex.Message);
                    return(ex.Message);
                }

            case "DelFlow":
                BP.WF.Flow fl1 = new BP.WF.Flow(para1);
                try
                {
                    fl1.DoDelete();
                    return(null);
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method DelFlow Branch has a error , para:\t" + para1 + ex.Message);
                    return(ex.Message);
                }

            case "DelLable":
                BP.WF.LabNote ln = new BP.WF.LabNote(para1);
                try
                {
                    ln.Delete();
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method DelLable Branch has a error , para:\t" + para1 + ex.Message);
                }
                return(null);

            case "DelFlowSort":
                try
                {
                    FlowSort delfs = new FlowSort(para1);
                    delfs.Delete();
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method DelFlowSort Branch has a error , para:\t" + para1 + ex.Message);
                }

                return(null);

            case "NewNode":
                try
                {
                    BP.WF.Flow fl11 = new BP.WF.Flow(para1);
                    BP.WF.Node node = new BP.WF.Node();
                    node.FK_Flow = "";
                    node.X       = 0;
                    node.Y       = 0;
                    node.Insert();
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method NewNode Branch has a error , para:\t" + para1 + ex.Message);
                }

                return(null);

            case "DelNode":
                try
                {
                    if (!string.IsNullOrEmpty(para1))
                    {
                        BP.WF.Node delNode = new BP.WF.Node(int.Parse(para1));
                        delNode.Delete();
                    }
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method DelNode Branch has a error , para:\t" + para1 + ex.Message);
                }
                return(null);

            case "NewLab":
                BP.WF.LabNote lab = new BP.WF.LabNote();;
                try
                {
                    lab.FK_Flow = para1;
                    lab.MyPK    = BP.DA.DBAccess.GenerOID().ToString();
                    lab.Insert();
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method NewLab Branch has a error , para:\t" + para1 + ex.Message);
                }
                return(lab.MyPK);

            case "DelLab":
                try
                {
                    BP.WF.LabNote dellab = new BP.WF.LabNote();
                    dellab.MyPK = para1;
                    dellab.Delete();
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method DelLab Branch has a error , para:\t" + para1 + ex.Message);
                }

                return(null);

            case "GetSettings":
                return(SystemConfig.AppSettings[para1]);

            case "GetFlows":
                string sqls = "SELECT NO,NAME FROM WF_FlowSort";
                sqls += "@SELECT No,Name,FK_FlowSort FROM WF_Flow";
                return(RunSQLReturnTableS(sqls));

            case "SaveFlowFrm":
                Entity en = null;
                try
                {
                    AtPara ap     = new AtPara(para1);
                    string enName = ap.GetValStrByKey("EnName");
                    string pk     = ap.GetValStrByKey("PKVal");
                    en = ClassFactory.GetEn(enName);
                    en.ResetDefaultVal();

                    if (en == null)
                    {
                        throw new Exception("无效的类名:" + enName);
                    }

                    if (string.IsNullOrEmpty(pk) == false)
                    {
                        en.PKVal = pk;
                        en.RetrieveFromDBSources();
                    }

                    foreach (string key in ap.HisHT.Keys)
                    {
                        if (key == "PKVal")
                        {
                            continue;
                        }
                        en.SetValByKey(key, ap.HisHT[key].ToString().Replace('^', '@'));
                    }
                    en.Save();
                    return(en.PKVal as string);
                }
                catch (Exception ex)
                {
                    if (en != null)
                    {
                        en.CheckPhysicsTable();
                    }
                    return("Error:" + ex.Message);
                }

            case "ReleaseToFTP":
                // 暂时注释,下次更新ftp功能时会得新编译 。
                //var args = para1.Split(',');
                //var binaryData = Convert.FromBase64String(args[1]);
                //var imageFilePath = Server.MapPath(System.Web.HttpContext.Current.Request.ApplicationPath) + "/Temp/" + args[0] + ".jpg";
                //if (File.Exists(imageFilePath))
                //{
                //    File.Delete(imageFilePath);
                //}
                //System.IO.Directory.CreateDirectory(
                //    Server.MapPath(System.Web.HttpContext.Current.Request.ApplicationPath) + "/Temp");
                //var stream = new System.IO.FileStream(imageFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite);
                //stream.Write(binaryData, 0, binaryData.Length);
                //stream.Close();
                //var xmlFilePath = FlowTemplete_Gener(args[0], true);
                //string remoteDr = "/" + ConfigurationSettings.AppSettings["UserIdentifier"];;
                //var ftp = new FtpConnection();
                //try
                //{
                //    string ftpIP = ConfigurationSettings.AppSettings["FTPServerIP"];
                //    string email = ConfigurationSettings.AppSettings["FTPUserEmail"];

                //    Session session = new Session();
                //    session.Server = ftpIP;


                //    session.Connect("anonymous", "*****@*****.**");
                //    ftp.Connect(ftpIP, "anonymous", email);
                //    remoteDr = remoteDr;
                //    if(!ftp.DirectoryExist(remoteDr))
                //    {
                //        ftp.CreateDirectory(remoteDr);
                //    }
                //    ftp.SetCurrentDirectory(remoteDr);
                //    ftp.PutFile(imageFilePath, remoteDr);
                //    return string.Empty;//上传成功

                //}
                //catch (Exception err)
                //{
                //    return err.Message;//上传失败
                //}
                //finally
                //{
                //    ftp.Close();
                //}
                return(string.Empty);

            default:
                throw null;
            }
        }
コード例 #5
0
ファイル: LoadTemplete.cs プロジェクト: gzcw/MyWebApplication
        public override object Do()
        {
            string msg = "";

            #region 处理表单.
            // 调度表单文件。
            SysFormTrees fss = new SysFormTrees();
            fss.ClearTable();

            //创建root.
            SysFormTree root = new SysFormTree();
            root.No       = "1";
            root.Name     = "表单库";
            root.ParentNo = "0";
            root.Insert();

            string          frmPath = SystemConfig.PathOfWebApp + "\\SDKFlowDemo\\FlowDemo\\Form\\";
            DirectoryInfo   dirInfo = new DirectoryInfo(frmPath);
            DirectoryInfo[] dirs    = dirInfo.GetDirectories();
            int             i       = 0;
            foreach (DirectoryInfo item in dirs)
            {
                if (item.FullName.Contains(".svn"))
                {
                    continue;
                }

                string[] fls = System.IO.Directory.GetFiles(item.FullName);
                if (fls.Length == 0)
                {
                    continue;
                }

                SysFormTree fs = new SysFormTree();
                fs.No       = item.Name.Substring(0, 2);
                fs.Name     = item.Name.Substring(3);
                fs.ParentNo = "1";
                fs.Idx      = i++;
                fs.Insert();

                foreach (string f in fls)
                {
                    System.IO.FileInfo info = new System.IO.FileInfo(f);
                    if (info.Extension != ".xml")
                    {
                        continue;
                    }

                    msg += "@开始调度表单模板文件:" + f;
                    BP.DA.Log.DefaultLogWriteLineInfo("@开始调度表单模板文件:" + f);

                    DataSet ds = new DataSet();
                    ds.ReadXml(f);

                    try
                    {
                        MapData md = MapData.ImpMapData(ds);
                        md.FK_FrmSort  = fs.No;
                        md.FK_FormTree = fs.No;
                        md.AppType     = "0";
                        md.Update();
                    }
                    catch (Exception ex)
                    {
                        BP.DA.Log.DefaultLogWriteLineInfo("@装载表单模版文件:" + f + "出现错误," + ex.Message + " <br> " + ex.StackTrace);

                        throw new Exception("@装载模版文件:" + f + "出现错误," + ex.Message + " <br> " + ex.StackTrace);
                    }
                }
            }
            #endregion 处理表单.

            #region 处理流程.
            FlowSorts sorts = new FlowSorts();
            sorts.ClearTable();
            dirInfo = new DirectoryInfo(SystemConfig.PathOfWebApp + "\\SDKFlowDemo\\FlowDemo\\Flow\\");
            dirs    = dirInfo.GetDirectories();

            FlowSort fsRoot = new FlowSort();
            fsRoot.No       = "99";
            fsRoot.Name     = "流程树";
            fsRoot.ParentNo = "0";
            fsRoot.DirectInsert();

            foreach (DirectoryInfo dir in dirs)
            {
                if (dir.FullName.Contains(".svn"))
                {
                    continue;
                }

                string[] fls = System.IO.Directory.GetFiles(dir.FullName);
                if (fls.Length == 0)
                {
                    continue;
                }

                FlowSort fs = new FlowSort();
                fs.No       = dir.Name.Substring(0, 3);
                fs.Name     = dir.Name.Substring(3);
                fs.ParentNo = fsRoot.No;
                fs.Insert();

                foreach (string filePath in fls)
                {
                    msg += "\t\n@开始调度流程模板文件:" + filePath;
                    BP.DA.Log.DefaultLogWriteLineInfo("@开始调度流程模板文件:" + filePath);

                    Flow myflow = BP.WF.Flow.DoLoadFlowTemplate(fs.No, filePath, ImpFlowTempleteModel.AsTempleteFlowNo);
                    msg += "\t\n@流程:[" + myflow.Name + "]装载成功。";

                    System.IO.FileInfo info = new System.IO.FileInfo(filePath);
                    myflow.Name = info.Name.Replace(".xml", "");
                    if (myflow.Name.Substring(2, 1) == ".")
                    {
                        myflow.Name = myflow.Name.Substring(3);
                    }
                    myflow.DirectUpdate();
                }


                //调度它的下一级目录.
                DirectoryInfo   dirSubInfo = new DirectoryInfo(SystemConfig.PathOfWebApp + "\\SDKFlowDemo\\FlowDemo\\Flow\\" + dir.Name);
                DirectoryInfo[] myDirs     = dirSubInfo.GetDirectories();
                foreach (DirectoryInfo mydir in myDirs)
                {
                    if (mydir.FullName.Contains(".svn"))
                    {
                        continue;
                    }

                    string[] myfls = System.IO.Directory.GetFiles(mydir.FullName);
                    if (myfls.Length == 0)
                    {
                        continue;
                    }

                    // 流程类别.
                    FlowSort subFlowSort = fs.DoCreateSubNode() as FlowSort;
                    subFlowSort.Name = mydir.Name.Substring(3);
                    subFlowSort.Update();

                    foreach (string filePath in myfls)
                    {
                        msg += "\t\n@开始调度流程模板文件:" + filePath;
                        BP.DA.Log.DefaultLogWriteLineInfo("@开始调度流程模板文件:" + filePath);

                        Flow myflow = BP.WF.Flow.DoLoadFlowTemplate(subFlowSort.No, filePath, ImpFlowTempleteModel.AsTempleteFlowNo);
                        msg += "\t\n@流程:" + myflow.Name + "装载成功。";

                        System.IO.FileInfo info = new System.IO.FileInfo(filePath);
                        myflow.Name = info.Name.Replace(".xml", "");
                        if (myflow.Name.Substring(2, 1) == ".")
                        {
                            myflow.Name = myflow.Name.Substring(3);
                        }
                        myflow.DirectUpdate();
                    }
                }
            }

            //执行流程检查.
            Flows flsEns = new Flows();
            flsEns.RetrieveAll();
            foreach (Flow fl in flsEns)
            {
                fl.DoCheck();
            }
            #endregion 处理流程.



            BP.DA.Log.DefaultLogWriteLineInfo(msg);

            //删除多余的空格.
            BP.WF.DTS.DeleteBlankGroupField dts = new DeleteBlankGroupField();
            dts.Do();

            return(msg);
        }
コード例 #6
0
ファイル: LoadTemplete.cs プロジェクト: zhaoyingju/ccflow
        public override object Do()
        {
            string    msg   = "";
            FlowSorts sorts = new FlowSorts();

            sorts.ClearTable();

            DirectoryInfo dirInfo = new DirectoryInfo(SystemConfig.PathOfData + "\\FlowDemo\\Flow\\");

            DirectoryInfo[] dirs = dirInfo.GetDirectories();
            foreach (DirectoryInfo dir in dirs)
            {
                if (dir.FullName.Contains(".svn"))
                {
                    continue;
                }

                string[] fls = System.IO.Directory.GetFiles(dir.FullName);
                if (fls.Length == 0)
                {
                    continue;
                }

                FlowSort fs = new FlowSort();
                fs.No   = dir.Name.Substring(0, 2);
                fs.Name = dir.Name.Substring(3);
                fs.Insert();
                foreach (string filePath in fls)
                {
                    msg += "@开始调度流程模板文件:" + filePath;
                    Flow myflow = BP.WF.Flow.DoLoadFlowTemplate(fs.No, filePath, ImpFlowTempleteModel.AsTempleteFlowNo);
                    msg += "@流程:" + myflow.Name + "装载成功。";

                    System.IO.FileInfo info = new System.IO.FileInfo(filePath);
                    myflow.Name = info.Name.Replace(".xml", "");
                    if (myflow.Name.Substring(2, 1) == ".")
                    {
                        myflow.Name = myflow.Name.Substring(3);
                    }
                    myflow.DirectUpdate();
                }
            }

            // 调度表单文件。
            FrmSorts fss = new FrmSorts();

            fss.ClearTable();

            string frmPath = SystemConfig.PathOfData + "\\FlowDemo\\Form\\";

            dirInfo = new DirectoryInfo(frmPath);
            dirs    = dirInfo.GetDirectories();
            foreach (DirectoryInfo item in dirs)
            {
                if (item.FullName.Contains(".svn"))
                {
                    continue;
                }

                string[] fls = System.IO.Directory.GetFiles(item.FullName);
                if (fls.Length == 0)
                {
                    continue;
                }
                FrmSort fs = new FrmSort();
                fs.No   = item.Name.Substring(0, 2);
                fs.Name = item.Name.Substring(3);
                fs.Insert();

                foreach (string f in fls)
                {
                    try
                    {
                        msg += "@开始调度表单模板文件:" + f;
                        System.IO.FileInfo info = new System.IO.FileInfo(f);
                        if (info.Extension != ".xml")
                        {
                            continue;
                        }

                        DataSet ds = new DataSet();
                        ds.ReadXml(f);

                        MapData md = MapData.ImpMapData(ds, false);
                        md.FK_FrmSort = fs.No;
                        md.Update();
                    }
                    catch (Exception ex)
                    {
                        msg += "@调度失败" + ex.Message;
                    }
                }
            }

            BP.DA.Log.DefaultLogWriteLineInfo(msg);
            return(msg);
        }