Esempio n. 1
0
    /// <summary>
    /// 树的实体包含了No,Name,ParentNo,Idx 必须的属性(字段),它是树结构的描述.
    /// </summary>
    public void EnttiyTree()
    {
        //创建父节点, 父节点的编号必须为1 ,父节点的ParentNo 必须是 0.
        FlowSort en = new FlowSort("1");

        en.Name = "根目录";

        //创建子目录节点.
        FlowSort subEn = (FlowSort)en.DoCreateSubNode();

        subEn.Name = "行政类";
        subEn.Update();

        //创建子目录的评级节点.
        FlowSort sameLevelSubEn = (FlowSort)subEn.DoCreateSameLevelNode();

        sameLevelSubEn.Name = "业务类";
        sameLevelSubEn.Update();

        //创建子目录的下一级节点1.
        FlowSort sameLevelSubSubEn = (FlowSort)subEn.DoCreateSameLevelNode();

        sameLevelSubSubEn.Name = "日常办公";
        sameLevelSubSubEn.Update();

        //创建子目录的下一级节点1.
        FlowSort sameLevelSubSubEn2 = (FlowSort)subEn.DoCreateSameLevelNode();

        sameLevelSubSubEn2.Name = "人力资源";
        sameLevelSubSubEn2.Update();

        /**
         *   根目录
         *     行政类
         *        日常办公
         *        人力资源
         *     业务类
         *
         */
    }
Esempio n. 2
0
        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 "GetFlowSorts":        //获取所有流程类型
                DataTable dtSorts = null;

                try
                {
                    dtSorts = BP.DA.DBAccess.RunSQLReturnTable("SELECT no,name FROM WF_FlowSort");
                }
                catch (Exception ex)
                {
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

                return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = true, msg = string.Empty, data = dtSorts.Rows.Cast <DataRow>().Select(dr => new { Key = dr["no"].ToString(), Value = dr["name"].ToString() }) }));

            case "NewSameLevelFrmSort":     //创建同级别的 表单树 目录.
                SysFormTree frmSort = null;
                try
                {
                    var para = para1.Split(',');
                    frmSort = new SysFormTree(para[0]);
                    string sameNodeNo = frmSort.DoCreateSameLevelNode().No;
                    frmSort      = new SysFormTree(sameNodeNo);
                    frmSort.Name = para[1];
                    frmSort.Update();
                    return(null);
                }
                catch (Exception ex)
                {
                    return("Do Method NewFormSort Branch has a error , para:\t" + para1 + ex.Message);
                }

            case "NewSubLevelFrmSort":     //创建子级别的 表单树 目录.
                SysFormTree frmSortSub = null;
                try
                {
                    var para = para1.Split(',');
                    frmSortSub = new SysFormTree(para[0]);
                    string sameNodeNo = frmSortSub.DoCreateSubNode().No;
                    frmSortSub      = new SysFormTree(sameNodeNo);
                    frmSortSub.Name = para[1];
                    frmSortSub.Update();
                    return(null);
                }
                catch (Exception ex)
                {
                    return("Do Method NewSubLevelFrmSort Branch has a error , para:\t" + para1 + ex.Message);
                }

            case "NewSameLevelFlowSort":      //创建同级别的 流程树 目录.
                FlowSort fs = null;
                try
                {
                    var para = para1.Split(',');
                    fs = new FlowSort(para[0]);
                    string sameNodeNo = fs.DoCreateSameLevelNode().No;
                    fs      = new FlowSort(sameNodeNo);
                    fs.Name = para[1];
                    fs.Update();
                    return
                        (Newtonsoft.Json.JsonConvert.SerializeObject(
                             new { success = true, msg = string.Empty, data = fs.No }));
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method NewSameLevelFlowSort Branch has a error , para:\t" + para1 + ex.Message);
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "NewSubFlowSort":     //创建子级别的 表单树 目录.
                try
                {
                    var      para        = para1.Split(',');
                    FlowSort fsSub       = new FlowSort(para[0]);
                    string   subNodeNo   = fsSub.DoCreateSubNode().No;
                    FlowSort subFlowSort = new FlowSort(subNodeNo);
                    subFlowSort.Name = para[1];
                    subFlowSort.Update();
                    return
                        (Newtonsoft.Json.JsonConvert.SerializeObject(
                             new { success = true, msg = string.Empty, data = subFlowSort.No }));
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method NewSubFlowSort Branch has a error , para:\t" + ex.Message);
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "EditFlowSort":     //编辑表单树.
                try
                {
                    var para = para1.Split(',');
                    fs      = new FlowSort(para[0]);
                    fs.Name = para[1];
                    fs.Save();
                    return
                        (Newtonsoft.Json.JsonConvert.SerializeObject(
                             new { success = true, msg = string.Empty, data = fs.No }));
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method EditFlowSort Branch has a error , para:\t" + para1 + ex.Message);
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            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         FlowMark      = ps[4];                            // 流程标记.

                    fl.DoNewFlow(fk_floSort, flowName, dataSaveModel, pTable, FlowMark);
                    return
                        (Newtonsoft.Json.JsonConvert.SerializeObject(
                             new { success = true, msg = string.Empty, data = new { no = fl.No, name = fl.Name } }));
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method NewFlow Branch has a error , para:\t" + para1 + ex.Message);
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "DelFlow":     //删除流程.
                try
                {
                    return
                        (Newtonsoft.Json.JsonConvert.SerializeObject(
                             new { success = true, msg = WorkflowDefintionManager.DeleteFlowTemplete(para1) }));
                }
                catch (Exception ex)
                {
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "DelFlowSort":
                try
                {
                    FlowSort delfs = new FlowSort();
                    delfs.No = para1;
                    delfs.Delete();
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = true }));
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method DelFlowSort Branch has a error , para:\t" + para1 + ex.Message);
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "DelNode":
                try
                {
                    if (!string.IsNullOrEmpty(para1))
                    {
                        BP.WF.Node delNode = new BP.WF.Node(int.Parse(para1));
                        delNode.Delete();
                    }
                    else
                    {
                        throw new Exception("@参数错误:" + para1);
                    }
                }
                catch (Exception ex)
                {
                    return("err:" + ex.Message);
                }
                return(null);

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

            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 "ChangeNodeType":
                var p = para1.Split(',');

                try
                {
                    if (p.Length != 3)
                    {
                        throw new Exception("@修改节点类型参数错误");
                    }

                    //var sql = "UPDATE WF_Node SET Icon='{0}' WHERE FK_Flow='{1}' AND NodeID='{2}'";
                    var sql = "UPDATE WF_Node SET RunModel={0} WHERE FK_Flow='{1}' AND NodeID={2}";
                    DBAccess.RunSQL(string.Format(sql, p[0], p[1], p[2]));
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = true }));
                }
                catch (Exception ex)
                {
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "ChangeNodeIcon":
                p = para1.Split(',');

                try
                {
                    if (p.Length != 3)
                    {
                        throw new Exception("@修改节点图标参数错误");
                    }

                    var sql = "UPDATE WF_Node SET Icon='{0}' WHERE FK_Flow='{1}' AND NodeID={2}";
                    DBAccess.RunSQL(string.Format(sql, p[0], p[1], p[2]));
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = true }));
                }
                catch (Exception ex)
                {
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            default:
                throw new Exception("@没有约定的执行标记:" + doWhat);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 树节点管理
        /// </summary>
        public string Do()
        {
            string doWhat = getUTF8ToString("doWhat");
            string para1  = getUTF8ToString("para1");
            // 如果admin账户登陆时有错误发生,则返回错误信息
            var result = LetAdminLogin("CH", true);

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

            switch (doWhat)
            {
            case "GetFlowSorts":        //获取所有流程类型
                try
                {
                    FlowSorts flowSorts = new FlowSorts();
                    flowSorts.RetrieveAll(FlowSortAttr.Idx);
                    return(BP.Tools.Entitis2Json.ConvertEntitis2GenerTree(flowSorts, "0"));
                }
                catch (Exception ex)
                {
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "NewSameLevelFrmSort":     //创建同级别的 表单树 目录.
                SysFormTree frmSort = null;
                try
                {
                    var para = para1.Split(',');
                    frmSort = new SysFormTree(para[0]);
                    string sameNodeNo = frmSort.DoCreateSameLevelNode().No;
                    frmSort      = new SysFormTree(sameNodeNo);
                    frmSort.Name = para[1];
                    frmSort.Update();
                    return(null);
                }
                catch (Exception ex)
                {
                    return("Do Method NewFormSort Branch has a error , para:\t" + para1 + ex.Message);
                }

            case "NewSubLevelFrmSort":     //创建子级别的 表单树 目录.
                SysFormTree frmSortSub = null;
                try
                {
                    var para = para1.Split(',');
                    frmSortSub = new SysFormTree(para[0]);
                    string sameNodeNo = frmSortSub.DoCreateSubNode().No;
                    frmSortSub      = new SysFormTree(sameNodeNo);
                    frmSortSub.Name = para[1];
                    frmSortSub.Update();
                    return(null);
                }
                catch (Exception ex)
                {
                    return("Do Method NewSubLevelFrmSort Branch has a error , para:\t" + para1 + ex.Message);
                }

            case "NewSameLevelFlowSort":      //创建同级别的 流程树 目录.
                FlowSort fs = null;
                try
                {
                    var para = para1.Split(',');
                    fs = new FlowSort(para[0].Replace("F", ""));    //传入的编号多出F符号,需要替换掉
                    string sameNodeNo = fs.DoCreateSameLevelNode().No;
                    fs      = new FlowSort(sameNodeNo);
                    fs.Name = para[1];
                    fs.Update();
                    return
                        (Newtonsoft.Json.JsonConvert.SerializeObject(
                             new { success = true, msg = string.Empty, data = "F" + fs.No }));
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method NewSameLevelFlowSort Branch has a error , para:\t" + para1 + ex.Message);
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "NewSubFlowSort":     //创建子级别的 流程树 目录.
                try
                {
                    var      para        = para1.Split(',');
                    FlowSort fsSub       = new FlowSort(para[0].Replace("F", ""));//传入的编号多出F符号,需要替换掉
                    string   subNodeNo   = fsSub.DoCreateSubNode().No;
                    FlowSort subFlowSort = new FlowSort(subNodeNo);
                    subFlowSort.Name = para[1];
                    subFlowSort.Update();
                    return
                        (Newtonsoft.Json.JsonConvert.SerializeObject(
                             new { success = true, msg = string.Empty, data = "F" + subFlowSort.No }));
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method NewSubFlowSort Branch has a error , para:\t" + ex.Message);
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "EditFlowSort":     //编辑表单树.
                try
                {
                    var para = para1.Split(',');
                    fs      = new FlowSort(para[0].Replace("F", ""));//传入的编号多出F符号,需要替换掉
                    fs.Name = para[1];
                    fs.Save();
                    return
                        (Newtonsoft.Json.JsonConvert.SerializeObject(
                             new { success = true, msg = string.Empty, data = fs.No }));
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method EditFlowSort Branch has a error , para:\t" + para1 + ex.Message);
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

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

                    string fk_floSort = ps[0];                                       //类别编号.
                    fk_floSort = fk_floSort.Replace("F", "");                        //传入的编号多出F符号,需要替换掉

                    string         flowName      = ps[1];                            // 流程名称.
                    DataStoreModel dataSaveModel = (DataStoreModel)int.Parse(ps[2]); //数据保存方式。
                    string         pTable        = ps[3];                            // 物理表名。
                    string         flowMark      = ps[4];                            // 流程标记.
                    string         flowVer       = ps[5];                            // 流程版本

                    string FK_Flow = BP.BPMN.Glo.NewFlow(fk_floSort, flowName, dataSaveModel, pTable, flowMark, flowVer);
                    return
                        (Newtonsoft.Json.JsonConvert.SerializeObject(
                             new { success = true, msg = string.Empty, data = new { no = FK_Flow, name = flowName } }));
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method NewFlow Branch has a error , para:\t" + para1 + ex.Message);
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "DelFlow":     //删除流程.
                try
                {
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(
                               new { success = true, msg = WorkflowDefintionManager.DeleteFlowTemplete(para1) }));
                }
                catch (Exception ex)
                {
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "DelFlowSort":
                try
                {
                    string   FK_FlowSort = para1.Replace("F", "");
                    string   forceDel    = getUTF8ToString("force");
                    FlowSort delfs       = new FlowSort();
                    delfs.No = FK_FlowSort;
                    //强制删除,不需判断是否含有子项。
                    if (forceDel == "true")
                    {
                        delfs.DeleteFlowSortSubNode_Force();
                        delfs.Delete();
                        return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = true, reason = "" }));
                    }

                    //判断是否包含子类别
                    if (delfs.HisSubFlowSorts != null && delfs.HisSubFlowSorts.Count > 0)
                    {
                        return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, reason = "havesubsorts", msg = "此类别下包含子类别。" }));
                    }

                    //判断是否包含工作流程
                    if (delfs.HisFlows != null && delfs.HisFlows.Count > 0)
                    {
                        return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, reason = "haveflows", msg = "此类别下包含流程。" }));
                    }

                    //执行删除
                    delfs.Delete();
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = true, reason = "" }));
                }
                catch (Exception ex)
                {
                    BP.DA.Log.DefaultLogWriteLineError("Do Method DelFlowSort Branch has a error , para:\t" + para1 + ex.Message);
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "DelNode":
                try
                {
                    if (!string.IsNullOrEmpty(para1))
                    {
                        BP.WF.Node delNode = new BP.WF.Node(int.Parse(para1));
                        delNode.Delete();
                    }
                    else
                    {
                        throw new Exception("@参数错误:" + para1);
                    }
                }
                catch (Exception ex)
                {
                    return("err:" + ex.Message);
                }
                return(null);

            case "SetBUnit":
                try
                {
                    if (!string.IsNullOrEmpty(para1))
                    {
                        BP.WF.Node nd = new BP.WF.Node(int.Parse(para1));
                        nd.IsTask = !nd.IsBUnit;
                        nd.Update();
                    }
                    else
                    {
                        throw new Exception("@参数错误:" + para1);
                    }
                }
                catch (Exception ex)
                {
                    return("err:" + ex.Message);
                }
                return(null);

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

            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 "ChangeNodeType":
                var p = para1.Split(',');

                try
                {
                    if (p.Length != 3)
                    {
                        throw new Exception("@修改节点类型参数错误");
                    }

                    //var sql = "UPDATE WF_Node SET Icon='{0}' WHERE FK_Flow='{1}' AND NodeID='{2}'";
                    var sql = "UPDATE WF_Node SET RunModel={0} WHERE FK_Flow='{1}' AND NodeID={2}";
                    DBAccess.RunSQL(string.Format(sql, p[0], p[1], p[2]));
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = true }));
                }
                catch (Exception ex)
                {
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            case "ChangeNodeIcon":
                p = para1.Split(',');

                try
                {
                    if (p.Length != 3)
                    {
                        throw new Exception("@修改节点图标参数错误");
                    }

                    var sql = "UPDATE WF_Node SET Icon='{0}' WHERE FK_Flow='{1}' AND NodeID={2}";
                    DBAccess.RunSQL(string.Format(sql, p[0], p[1], p[2]));
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = true }));
                }
                catch (Exception ex)
                {
                    return(Newtonsoft.Json.JsonConvert.SerializeObject(new { success = false, msg = ex.Message }));
                }

            default:
                throw new Exception("@没有约定的执行标记:" + doWhat);
            }
        }
Esempio n. 4
0
        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);
        }