コード例 #1
2
        public override WFState Run()
        {
            WFState retval = new WFState(WFState.WFStateFail);

            Ionic.Zip.ZipFile zf = new Ionic.Zip.ZipFile(this.FileToProcess);
            string filedir = System.IO.Directory.GetParent(this.FileToProcess).FullName + "\\" + SFWorkflow.WFUtilities.GetNextDirectoryNumber(System.IO.Directory.GetParent(this.FileToProcess).FullName).ToString(); // "\\expanded";
            foreach (Ionic.Zip.ZipEntry ze in zf.EntriesSorted.Where(x => !x.IsDirectory))
            {
                string zedir = ze.FileName.Replace("/", "\\");
                int idx = zedir.LastIndexOf('\\');
                string path = filedir;
                if (idx != -1)
                {
                    path = filedir + "\\" + zedir.Substring(0, idx);
                    zedir = zedir.Substring(idx + 1);
                }
                if (!System.IO.Directory.Exists(path))
                    System.IO.Directory.CreateDirectory(path);
                if (System.IO.Directory.Exists(path))
                {
                    using (System.IO.FileStream fss = new System.IO.FileStream(path + "\\" + zedir, System.IO.FileMode.Create, System.IO.FileAccess.Write))
                    {
                        ze.Extract(fss);
                        this.OutputFiles.Add(path + "\\" + zedir);
                    }
                }
            }
            retval.Value = WFState.WFStateSuccess;

            return retval;
        }
コード例 #2
0
        public override WFState Run()
        {
            WFState retval = new WFState(WFState.WFStateFail);

            Ionic.Zip.ZipFile zf      = new Ionic.Zip.ZipFile(this.FileToProcess);
            string            filedir = System.IO.Directory.GetParent(this.FileToProcess).FullName + "\\" + SFWorkflow.WFUtilities.GetNextDirectoryNumber(System.IO.Directory.GetParent(this.FileToProcess).FullName).ToString();  // "\\expanded";

            foreach (Ionic.Zip.ZipEntry ze in zf.EntriesSorted.Where(x => !x.IsDirectory))
            {
                string zedir = ze.FileName.Replace("/", "\\");
                int    idx   = zedir.LastIndexOf('\\');
                string path  = filedir;
                if (idx != -1)
                {
                    path  = filedir + "\\" + zedir.Substring(0, idx);
                    zedir = zedir.Substring(idx + 1);
                }
                if (!System.IO.Directory.Exists(path))
                {
                    System.IO.Directory.CreateDirectory(path);
                }
                if (System.IO.Directory.Exists(path))
                {
                    using (System.IO.FileStream fss = new System.IO.FileStream(path + "\\" + zedir, System.IO.FileMode.Create, System.IO.FileAccess.Write))
                    {
                        ze.Extract(fss);
                        this.OutputFiles.Add(path + "\\" + zedir);
                    }
                }
            }
            retval.Value = WFState.WFStateSuccess;

            return(retval);
        }
コード例 #3
0
        public override WFState Run()
        {
            WFState retval = new WFState(WFState.WFStateFail);

            System.Collections.Generic.List <string> outputfiles = new System.Collections.Generic.List <string>();
            ParseFile(this.FileToProcess, this.Depth, ref outputfiles);
            foreach (string outputfile in outputfiles)
            {
                string filenm = outputfile;
                SFWorkflow.WFFileType.FileType type = SFWorkflow.WFFileType.GetFileType(outputfile);
                if (type != SFWorkflow.WFFileType.FileType.Unknown)
                {
                    string newfilenm = filenm;
                    string extension = SFWorkflow.WFFileType.GetFileTypeExtension(type);
                    if (System.IO.Path.GetExtension(filenm) != extension)
                    {
                        newfilenm = String.Format("{0}{1}", filenm, extension);
                    }
                    if (newfilenm != filenm)
                    {
                        if (System.IO.File.Exists(newfilenm))
                        {
                            System.IO.File.Delete(newfilenm);
                        }
                        System.IO.File.Move(filenm, newfilenm);
                        filenm = newfilenm;
                    }
                }
                this.OutputFiles.Add(filenm, "Process");
            }
            retval.Value = WFState.WFStateSuccess;

            return(retval);
        }
コード例 #4
0
        public override WFState Run()
        {
            WFState retval = new WFState() { Value = "Success" };

            OpenMcdf.CompoundFile cf = null;
            try
            {
                cf = new CompoundFile(this.FileToProcess);
                bool attachfound = false;
                int attachinc = 0;
                do
                {
                    CFStorage cfstorage = this.GetStorage(cf.RootStorage, MakeAttachStorageName(attachinc));
                    if (cfstorage != null)
                    {
                        // check if attachment is embedded message - if so do not process
                        if (this.GetStorage(cfstorage, nameOfEmbeddedMessageStream) == null)
                        {
                            string filename = string.Format("attachment{0}", attachinc);

                            // first get filename
                            CFStream cfstream = this.GetStream(cfstorage, MakeSubStorageStreamName(0x3001, 0x001F));
                            if (cfstream != null)
                                filename = System.Text.UnicodeEncoding.Unicode.GetString(cfstream.GetData());
                            // second get filename
                            cfstream = this.GetStream(cfstorage, MakeSubStorageStreamName(0x3701, 0x0102));
                            if (cfstream != null)
                            {
                                string filedir = string.Format("{0}\\{1}", this.ExportDirectory, WFUtilities.GetNextDirectoryNumber(this.ExportDirectory));
                                if (!Directory.Exists(filedir))
                                    Directory.CreateDirectory(filedir);
                                if (Directory.Exists(filedir))
                                {
                                    using (var bw = new BinaryWriter(File.OpenWrite(string.Format("{0}\\{1}", filedir, filename))))
                                    {
                                        bw.Write(cfstream.GetData());
                                        this.OutputFiles.Add(string.Format("{0}\\{1}", filedir, filename), "Success");
                                    }
                                }
                            }
                        }
                        attachfound = true;
                    }
                    else
                        attachfound = false;
                    attachinc++;
                } while(attachfound);
            }
            catch (Exception)
            {
                retval.Value = "Fail";
            }
            finally
            {
                if(cf != null)
                    cf.Close();
            }

            return retval;
        }
コード例 #5
0
        public override WFState Run()
        {
            WFState retval = new WFState(WFState.WFStateFail);

            System.Collections.Generic.List<string> outputfiles = new System.Collections.Generic.List<string>();
            ParseFile(this.FileToProcess, this.Depth, ref outputfiles);
            foreach (string outputfile in outputfiles)
            {
                string filenm = outputfile;
                SFWorkflow.WFFileType.FileType type = SFWorkflow.WFFileType.GetFileType(outputfile);
                if (type != SFWorkflow.WFFileType.FileType.Unknown)
                {
                    string newfilenm = filenm;
                    string extension = SFWorkflow.WFFileType.GetFileTypeExtension(type);
                    if (System.IO.Path.GetExtension(filenm) != extension)
                        newfilenm = String.Format("{0}{1}", filenm, extension);
                    if (newfilenm != filenm)
                    {
                        if (System.IO.File.Exists(newfilenm))
                            System.IO.File.Delete(newfilenm);
                        System.IO.File.Move(filenm, newfilenm);
                        filenm = newfilenm;
                    }
                }
                this.OutputFiles.Add(filenm, "Process");
            }
            retval.Value = WFState.WFStateSuccess;

            return retval;
        }
コード例 #6
0
        public override WFState Run()
        {
            WFState retval = new WFState();

            try
            {
                retval.Value = WFState.WFStateFail;
                if (Directory.Exists(this.FileToProcess))
                {
                    if (!Directory.Exists(this.ExportDirectory))
                    {
                        Directory.CreateDirectory(this.ExportDirectory);
                    }
                    if (Directory.Exists(this.ExportDirectory))
                    {
                        new Microsoft.VisualBasic.Devices.Computer().FileSystem.CopyDirectory(this.FileToProcess, this.ExportDirectory);
                        retval.Value = WFState.WFStateSuccess;
                    }
                }
            }
            catch (Exception)
            {
            }

            return(retval);
        }
コード例 #7
0
 public WFStatePOCO(WFState wfState)
 {
     this.Id = wfState.Id;
     this.WFSecurityPresetGroupId = wfState.WFSecurityPresetGroupId;
     this.WFGrantedGroupId        = wfState.WFGrantedGroupId;
     this.WFDeniedGroupId         = wfState.WFDeniedGroupId;
     this.Code        = wfState.Code;
     this.Name        = wfState.Name;
     this.Description = wfState.Description;
 }
コード例 #8
0
        public override WFState Run()
        {
            WFState retval = new WFState(WFState.WFStateFail);

            retval.Value = SFWorkflow.WFFileType.GetFileType(this.FileToProcess).ToString();
            if (retval.Value.StartsWith("Ole"))
                retval.Value = "Ole";

            this.OutputFiles.Add(this.FileToProcess);

            return retval;
        }
コード例 #9
0
        public override WFState Run()
        {
            WFState retval = new WFState(WFState.WFStateFail);

            retval.Value = SFWorkflow.WFFileType.GetFileType(this.FileToProcess).ToString();
            if (retval.Value.StartsWith("Ole"))
            {
                retval.Value = "Ole";
            }

            this.OutputFiles.Add(this.FileToProcess);

            return(retval);
        }
コード例 #10
0
        public override void Process(ExeDllParserData data)
        {
            WFState retval = new WFState();

            try
            {
                retval.Value = WFState.WFStateFail;

                StringLoader sl = new StringLoader(data.DocumentToProcess);
//				string output = sl.Load(strId);
                sl.Dispose();
//				Assembly assembly = Assembly.LoadFile(this.FileToProcess);
//				string[] resources = assembly.GetManifestResourceNames();
            }
            catch (Exception)
            {
            }
        }
コード例 #11
0
        public override WFState Run()
        {
            WFState retval = new WFState();
            try
            {
                retval.Value = WFState.WFStateFail;
                pstsdk.definition.pst.IPst rdopststore = new pstsdk.layer.pst.Pst(this.FileToProcess);
                foreach (pstsdk.definition.pst.message.IMessage msg in rdopststore.Messages)
                    this.OutputFiles.Add(msg.Node.Value.ToString(CultureInfo.InvariantCulture));
                rdopststore.Dispose();
                retval.Value = WFState.WFStateSuccess;
            }
            catch (Exception ex)
            {
                WFLogger.NLogger.ErrorException(String.Format("Message extraction for PST file: {0} failed.", this.FileToProcess), ex);
            }

            return retval;
        }
コード例 #12
0
        public override WFState Run()
        {
            WFState retval = new WFState();
            try
            {
                retval.Value = WFState.WFStateFail;

                StringLoader sl = new StringLoader(this.FileToProcess);
            //				string output = sl.Load(strId);
                sl.Dispose();
            //				Assembly assembly = Assembly.LoadFile(this.FileToProcess);
            //				string[] resources = assembly.GetManifestResourceNames();
            }
            catch (Exception)
            {
            }

            return retval;
        }
コード例 #13
0
        public override WFState Run()
        {
            WFState retval = new WFState();

            try
            {
                retval.Value = WFState.WFStateFail;

                Options dtOptions = new Options
                {
                    FieldFlags  = FieldFlags.dtsoFfOfficeSkipHiddenContent,
                    BinaryFiles = BinaryFilesSettings.dtsoIndexSkipBinary
                };
                dtOptions.Save();

                FileConverter fileConverter = new FileConverter
                {
                    InputFile    = this.FileToProcess,
                    OutputFile   = this.FileToProcess + ".dts",
                    OutputFormat = OutputFormats.it_ContentAsXml,
                    Flags        = ConvertFlags.dtsConvertInlineContainer
                };
                fileConverter.Execute();
                this.OutputFiles.Add(this.FileToProcess + ".dts");
                retval.Value = WFState.WFStateSuccess;

                JobErrorInfo errorInfo = fileConverter.Errors;
                if (errorInfo != null && errorInfo.Count > 0)
                {
                    for (int i = 0; i < errorInfo.Count; i++)
                    {
                        SFWorkflow.WFLogger.NLogger.Error(string.Format("DTSearch Error: ErrorCode={0}  ErrorMessage={1}", errorInfo.Message(i), errorInfo.Code(i)));
                    }
                }
            }
            catch (Exception ex)
            {
                SFWorkflow.WFLogger.NLogger.ErrorException("ERROR: TextExtractor.Run", ex);
            }

            return(retval);
        }
コード例 #14
0
        public override WFState Run()
        {
            WFState retval = new WFState();

            try
            {
                retval.Value = WFState.WFStateFail;

                StringLoader sl = new StringLoader(this.FileToProcess);
//				string output = sl.Load(strId);
                sl.Dispose();
//				Assembly assembly = Assembly.LoadFile(this.FileToProcess);
//				string[] resources = assembly.GetManifestResourceNames();
            }
            catch (Exception)
            {
            }

            return(retval);
        }
コード例 #15
0
        public override WFState Run()
        {
            WFState retval = new WFState();

            try
            {
                retval.Value = WFState.WFStateFail;
                pstsdk.definition.pst.IPst rdopststore = new pstsdk.layer.pst.Pst(this.FileToProcess);
                foreach (pstsdk.definition.pst.message.IMessage msg in rdopststore.Messages)
                {
                    this.OutputFiles.Add(msg.Node.Value.ToString(CultureInfo.InvariantCulture));
                }
                rdopststore.Dispose();
                retval.Value = WFState.WFStateSuccess;
            }
            catch (Exception ex)
            {
                WFLogger.NLogger.ErrorException(String.Format("Message extraction for PST file: {0} failed.", this.FileToProcess), ex);
            }

            return(retval);
        }
コード例 #16
0
ファイル: WF_WorkOpt_OneWork.cs プロジェクト: splanton/CCFlow
        /// <summary>
        /// 获取流程的JSON数据,以供显示工作轨迹/流程设计
        /// </summary>
        /// <param name="fk_flow">流程编号</param>
        /// <param name="workid">工作编号</param>
        /// <param name="fid">父流程编号</param>
        /// <returns></returns>
        public string Chart_Init()
        {
            string fk_flow = this.FK_Flow;
            Int64  workid  = this.WorkID;
            Int64  fid     = this.FID;

            DataSet   ds   = new DataSet();
            DataTable dt   = null;
            string    json = string.Empty;

            try
            {
                //获取流程信息
                var sql = "SELECT No \"No\", Name \"Name\", Paras \"Paras\", ChartType \"ChartType\" FROM WF_Flow WHERE No='" + fk_flow + "'";
                dt           = DBAccess.RunSQLReturnTable(sql);
                dt.TableName = "WF_Flow";
                ds.Tables.Add(dt);

                //获取流程中的节点信息
                sql = "SELECT NodeID \"ID\", Name \"Name\", ICON \"Icon\", X \"X\", Y \"Y\", NodePosType \"NodePosType\",RunModel \"RunModel\",HisToNDs \"HisToNDs\",TodolistModel \"TodolistModel\" FROM WF_Node WHERE FK_Flow='" +
                      fk_flow + "' ORDER BY Step";
                dt           = DBAccess.RunSQLReturnTable(sql);
                dt.TableName = "WF_Node";
                ds.Tables.Add(dt);

                //获取流程中的标签信息
                sql          = "SELECT MyPK \"MyPK\", Name \"Name\", X \"X\", Y \"Y\" FROM WF_LabNote WHERE FK_Flow='" + fk_flow + "'";
                dt           = DBAccess.RunSQLReturnTable(sql);
                dt.TableName = "WF_LabNote";
                ds.Tables.Add(dt);

                //获取流程中的线段方向信息
                sql          = "SELECT Node \"Node\", ToNode \"ToNode\", 0 as  \"DirType\", 0 as \"IsCanBack\",Dots \"Dots\" FROM WF_Direction WHERE FK_Flow='" + fk_flow + "'";
                dt           = DBAccess.RunSQLReturnTable(sql);
                dt.TableName = "WF_Direction";
                ds.Tables.Add(dt);

                if (workid != 0)
                {
                    //获取流程信息,added by liuxc,2016-10-26
                    //sql =
                    //    "SELECT wgwf.Starter,wgwf.StarterName,wgwf.RDT,wgwf.WFSta,wgwf.WFState FROM WF_GenerWorkFlow wgwf WHERE wgwf.WorkID = " +
                    //    workid;
                    sql = "SELECT wgwf.Starter as \"Starter\","
                          + "        wgwf.StarterName as \"StarterName\","
                          + "        wgwf.RDT as \"RDT\","
                          + "        wgwf.WFSta as \"WFSta\","
                          + "        se.Lab  as   \"WFStaText\","
                          + "        wgwf.WFState as \"WFState\","
                          + "        wgwf.FID as \"FID\","
                          + "        wgwf.PWorkID as \"PWorkID\","
                          + "        wgwf.PFlowNo as \"PFlowNo\","
                          + "        wgwf.PNodeID as \"PNodeID\","
                          + "        wgwf.FK_Flow as \"FK_Flow\","
                          + "        wgwf.FK_Node as \"FK_Node\","
                          + "        wgwf.Title as \"Title\","
                          + "        wgwf.WorkID as \"WorkID\","
                          + "        wgwf.NodeName as \"NodeName\","
                          + "        wf.Name  as   \"FlowName\""
                          + " FROM   WF_GenerWorkFlow wgwf"
                          + "        INNER JOIN WF_Flow wf"
                          + "             ON  wf.No = wgwf.FK_Flow"
                          + "        INNER JOIN Sys_Enum se"
                          + "             ON  se.IntKey = wgwf.WFSta"
                          + "             AND se.EnumKey = 'WFSta'"
                          + " WHERE  wgwf.WorkID = {0}"
                          + "        OR  wgwf.FID = {0}"
                          + "        OR  wgwf.PWorkID = {0}"
                          + " ORDER BY"
                          + "        wgwf.RDT DESC";

                    dt           = DBAccess.RunSQLReturnTable(string.Format(sql, workid));
                    dt.TableName = "FlowInfo";
                    ds.Tables.Add(dt);

                    //获得流程状态.
                    WFState wfState = (WFState)int.Parse(dt.Rows[0]["WFState"].ToString());

                    String fk_Node = dt.Rows[0]["FK_Node"].ToString();
                    //把节点审核配置信息.
                    FrmWorkCheck fwc = new FrmWorkCheck(fk_Node);
                    ds.Tables.Add(fwc.ToDataTableField("FrmWorkCheck"));


                    //获取工作轨迹信息
                    var trackTable = "ND" + int.Parse(fk_flow) + "Track";
                    sql = "SELECT FID \"FID\",NDFrom \"NDFrom\",NDFromT \"NDFromT\",NDTo  \"NDTo\", NDToT \"NDToT\", ActionType \"ActionType\",ActionTypeText \"ActionTypeText\",Msg \"Msg\",RDT \"RDT\",EmpFrom \"EmpFrom\",EmpFromT \"EmpFromT\", EmpToT \"EmpToT\",EmpTo \"EmpTo\" FROM " + trackTable +
                          " WHERE WorkID=" +
                          workid + (fid == 0 ? (" OR FID=" + workid) : (" OR WorkID=" + fid + " OR FID=" + fid)) + " ORDER BY RDT ASC";

                    dt = DBAccess.RunSQLReturnTable(sql);

                    //判断轨迹数据中,最后一步是否是撤销或退回状态的,如果是,则删除最后2条数据
                    if (dt.Rows.Count > 0)
                    {
                        if (Equals(dt.Rows[0]["ACTIONTYPE"], (int)ActionType.Return) || Equals(dt.Rows[0]["ACTIONTYPE"], (int)ActionType.UnSend))
                        {
                            if (dt.Rows.Count > 1)
                            {
                                dt.Rows.RemoveAt(0);
                                dt.Rows.RemoveAt(0);
                            }
                            else
                            {
                                dt.Rows.RemoveAt(0);
                            }
                        }
                    }

                    dt.TableName = "Track";
                    ds.Tables.Add(dt);

                    //获取预先计算的节点处理人,以及处理时间,added by liuxc,2016-4-15
                    sql = "SELECT wsa.FK_Node as \"FK_Node\",wsa.FK_Emp as \"FK_Emp\",wsa.EmpName as \"EmpName\",wsa.TimeLimit as \"TimeLimit\",wsa.TSpanHour as \"TSpanHour\",wsa.ADT as \"ADT\",wsa.SDT as \"SDT\" FROM WF_SelectAccper wsa WHERE wsa.WorkID = " + workid;
                    dt  = DBAccess.RunSQLReturnTable(sql);
                    // dt.TableName = "POSSIBLE";
                    dt.TableName = "Possible";
                    ds.Tables.Add(dt);

                    //获取节点处理人数据,及处理/查看信息
                    sql = "SELECT wgw.FK_Emp as \"FK_Emp\",wgw.FK_Node as \"FK_Node\",wgw.FK_EmpText as \"FK_EmpText\",wgw.RDT as \"RDT\",wgw.IsRead as \"IsRead\",wgw.IsPass as \"IsPass\" FROM WF_GenerWorkerlist wgw WHERE wgw.WorkID = " +
                          workid + (fid == 0 ? (" OR FID=" + workid) : (" OR WorkID=" + fid + " OR FID=" + fid));
                    dt           = DBAccess.RunSQLReturnTable(sql);
                    dt.TableName = "DISPOSE";
                    ds.Tables.Add(dt);



                    //如果流程没有完成.
                    if (wfState != WFState.Complete)
                    {
                        GenerWorkerLists gwls = new GenerWorkerLists();
                        Int64            id   = this.FID;
                        if (id == 0)
                        {
                            id = this.WorkID;
                        }

                        QueryObject qo = new QueryObject(gwls);
                        qo.AddWhere(GenerWorkerListAttr.FID, id);
                        qo.addOr();
                        qo.AddWhere(GenerWorkerListAttr.WorkID, id);
                        qo.DoQuery();

                        DataTable dtGwls = gwls.ToDataTableField("WF_GenerWorkerList");
                        ds.Tables.Add(dtGwls);
                    }
                }
                else
                {
                    var trackTable = "ND" + int.Parse(fk_flow) + "Track";
                    sql = "SELECT NDFrom \"NDFrom\", NDTo \"NDTo\",ActionType \"ActionType\",ActionTypeText \"ActionTypeText\",Msg \"Msg\",RDT \"RDT\",EmpFrom \"EmpFrom\",EmpFromT \"EmpFromT\",EmpToT \"EmpToT\",EmpTo \"EmpTo\" FROM " + trackTable +
                          " WHERE WorkID=0 ORDER BY RDT ASC";
                    dt           = DBAccess.RunSQLReturnTable(sql);
                    dt.TableName = "TRACK";
                    ds.Tables.Add(dt);
                }

                //for (int i = 0; i < ds.Tables.Count; i++)
                //{
                //    dt = ds.Tables[i];
                //    dt.TableName = dt.TableName.ToUpper();
                //    for (int j = 0; j < dt.Columns.Count; j++)
                //    {
                //        dt.Columns[j].ColumnName = dt.Columns[j].ColumnName.ToUpper();
                //    }
                //}

                string str = BP.Tools.Json.DataSetToJson(ds);
                //  DataType.WriteFile("c:\\GetFlowTrackJsonData_CCflow.txt", str);
                return(str);
            }
            catch (Exception ex)
            {
                return("err@" + ex.Message);
            }
            return(json);
        }
コード例 #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            workid    = this.Request.QueryString["WorkID"];
            fk_Flow   = this.Request.QueryString["FK_Flow"];
            fk_Node   = this.Request.QueryString["FK_Node"];
            doType    = this.Request.QueryString["DoType"];
            workIDint = Int64.Parse(workid);

            #region 功能执行
            try
            {
                switch (this.Request.QueryString["DoType"])
                {
                case "Del":
                    WorkFlow wf = new WorkFlow(fk_Flow, workIDint);
                    wf.DoDeleteWorkFlowByReal(true);
                    this.WinCloseWithMsg("流程已经被删除.");
                    break;

                case "HungUp":
                    WorkFlow wf1 = new WorkFlow(fk_Flow, workIDint);
                    //wf1.DoHungUp(HungUpWa;
                    this.WinCloseWithMsg("流程已经被挂起.");
                    break;

                case "UnHungUp":
                    WorkFlow wf2 = new WorkFlow(fk_Flow, workIDint);
                    //  wf2.DoUnHungUp();
                    this.WinCloseWithMsg("流程已经被解除挂起.");
                    break;

                case "ComeBack":
                    WorkFlow wf3 = new WorkFlow(fk_Flow, workIDint);
                    wf3.DoComeBackWrokFlow("无");
                    this.WinCloseWithMsg("流程已经被回复启用.");
                    break;

                case "Takeback": /*取回审批.*/
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                this.Alert("执行功能:" + doType + ",出现错误:" + ex.Message);
            }
            #endregion

            int     wfState     = BP.DA.DBAccess.RunSQLReturnValInt("SELECT WFState FROM WF_GenerWorkFlow WHERE WorkID=" + workid, 1);
            WFState wfstateEnum = (WFState)wfState;
            this.Pub2.AddH3("您可执行的操作<hr>");
            switch (wfstateEnum)
            {
            case WFState.Runing:           /* 运行时*/
                this.FlowOverByCoercion(); /*删除流程.*/
                this.TackBackCheck();      /*取回审批*/
                this.Hurry();              /*催办*/
                this.UnSend();             /*撤销发送*/
                break;

            case WFState.Complete: // 完成.
            case WFState.Delete:   // 逻辑删除..
                this.RollBack();   /*恢复使用流程*/
                break;

            case WFState.HungUp:    // 挂起.
                this.AddUnHungUp(); /*撤销挂起*/
                break;

            default:
                break;
            }
        }
コード例 #18
0
        public override WFState Run()
        {
            WFState retval = new WFState()
            {
                Value = "Success"
            };

            OpenMcdf.CompoundFile cf = null;
            try
            {
                cf = new CompoundFile(this.FileToProcess);
                bool attachfound = false;
                int  attachinc   = 0;
                do
                {
                    CFStorage cfstorage = this.GetStorage(cf.RootStorage, MakeAttachStorageName(attachinc));
                    if (cfstorage != null)
                    {
                        // check if attachment is embedded message - if so do not process
                        if (this.GetStorage(cfstorage, nameOfEmbeddedMessageStream) == null)
                        {
                            string filename = string.Format("attachment{0}", attachinc);

                            // first get filename
                            CFStream cfstream = this.GetStream(cfstorage, MakeSubStorageStreamName(0x3001, 0x001F));
                            if (cfstream != null)
                            {
                                filename = System.Text.UnicodeEncoding.Unicode.GetString(cfstream.GetData());
                            }
                            // second get filename
                            cfstream = this.GetStream(cfstorage, MakeSubStorageStreamName(0x3701, 0x0102));
                            if (cfstream != null)
                            {
                                string filedir = string.Format("{0}\\{1}", this.ExportDirectory, WFUtilities.GetNextDirectoryNumber(this.ExportDirectory));
                                if (!Directory.Exists(filedir))
                                {
                                    Directory.CreateDirectory(filedir);
                                }
                                if (Directory.Exists(filedir))
                                {
                                    using (var bw = new BinaryWriter(File.OpenWrite(string.Format("{0}\\{1}", filedir, filename))))
                                    {
                                        bw.Write(cfstream.GetData());
                                        this.OutputFiles.Add(string.Format("{0}\\{1}", filedir, filename), "Success");
                                    }
                                }
                            }
                        }
                        attachfound = true;
                    }
                    else
                    {
                        attachfound = false;
                    }
                    attachinc++;
                } while(attachfound);
            }
            catch (Exception)
            {
                retval.Value = "Fail";
            }
            finally
            {
                if (cf != null)
                {
                    cf.Close();
                }
            }

            return(retval);
        }
コード例 #19
0
 /// <summary>
 /// 获取当前用户待办工作
 /// </summary>
 /// <param name="state">流程状态</param>
 /// <param name="fk_flow">流程编号</param>
 /// <returns></returns>
 public DataTable GetEmpWorks(WFState state, string fk_flow)
 {
     return(Dev2Interface.DB_GenerEmpWorksOfDataTable(state, fk_flow));
 }
コード例 #20
0
        public void CompletedEx(Guid guid, WFState state)
        {
            Action <Guid, WFState> cd = CompletedExAsync;

            cd.BeginInvoke(guid, state, cd.EndInvoke, null);
        }
コード例 #21
0
 public abstract void CompletedExAsync(Guid guid, WFState state);
コード例 #22
0
ファイル: CallSubFlow.cs プロジェクト: splanton/CCFlow
        /// <summary>
        /// 测试子流程只有一个人
        /// </summary>
        private void Test2()
        {
            string fk_flow = "023";
            string userNo  = "zhanghaicheng";
            Flow   fl      = new Flow(fk_flow);

            // zhanghaicheng 登录.
            BP.WF.Dev2Interface.Port_Login(userNo);

            //创建空白工作, 发起开始节点.
            Int64          workid = BP.WF.Dev2Interface.Node_CreateBlankWork(fk_flow);
            SendReturnObjs objs   = BP.WF.Dev2Interface.Node_SendWork(fk_flow, workid); /*发送到第二个节点上去*/

            /*创建子流程. 指定可以处理子流程的处理人员是一个集合。
             *
             * 此api多了两个参数:
             * 1,该流程隶属于那个部门.
             * 2,该流程的参与人集合,用逗号分开.
             */

            Emp flowStarter = new Emp(WebUser.No);

            Int64 subFlowWorkID = 0; // = new Emp(WebUser.No);

            //Int64 subFlowWorkID = BP.WF.Dev2Interface.Node_CreateStartNodeWork("024", null, null, "zhanghaicheng",
            //    "1", "zhoupeng,zhoushengyu", "子流程发起测试(为开始节点创建多人的工作处理)", "023", workid);


            #region 检查发起的子流程 流程引擎表 是否完整?
            GenerWorkFlow gwf = new GenerWorkFlow(subFlowWorkID);
            if (gwf.PFlowNo != "023")
            {
                throw new Exception("@父流程编号错误,应当是023现在是" + gwf.PFlowNo);
            }

            if (gwf.PWorkID != workid)
            {
                throw new Exception("@父流程WorkID错误,应当是" + workid + "现在是" + gwf.PWorkID);
            }

            if (gwf.Starter != flowStarter.No)
            {
                throw new Exception("@流程发起人编号错误,应当是" + flowStarter.No + "现在是" + gwf.Starter);
            }

            if (gwf.StarterName != flowStarter.Name)
            {
                throw new Exception("@流程发起人 Name 错误,应当是" + flowStarter.Name + "现在是" + gwf.StarterName);
            }

            if (gwf.FK_Dept != "1")
            {
                throw new Exception("@流程隶属部门错误,应当是  1 现在是" + gwf.FK_Dept);
            }

            if (gwf.Title != "子流程发起测试(为开始节点创建多人的工作处理)")
            {
                throw new Exception("@流程标题 子流程发起测试 错误,应当是 子流程发起测试 现在是" + gwf.Title);
            }

            if (gwf.WFState != WFState.Runing)
            {
                throw new Exception("@流程 WFState 错误,应当是 Runing 现在是" + gwf.WFState);
            }

            if (gwf.FID != 0)
            {
                throw new Exception("@FID错误,应当是0现在是" + gwf.FID);
            }

            if (gwf.FK_Flow != "024")
            {
                throw new Exception("@FK_Flow错误,应当是024现在是" + gwf.FK_Flow);
            }

            if (gwf.FK_Node != 2401)
            {
                throw new Exception("@停留的当前节点错误,应当是2401现在是" + gwf.FK_Flow);
            }

            GenerWorkerLists gwls = new GenerWorkerLists(subFlowWorkID, 2401);
            if (gwls.Count != 2)
            {
                throw new Exception("@待办列表个数应当2,现在是" + gwls.Count);
            }

            // 检查发起人列表是否完整?
            foreach (GenerWorkerList gwl in gwls)
            {
                if (gwl.IsPassInt != 0)
                {
                    throw new Exception("@通过状态应当是未通过,现在是:" + gwl.IsPassInt);
                }

                if (gwl.FID != 0)
                {
                    throw new Exception("@流程ID 应当是0 ,现在是:" + gwl.FID);
                }

                if (gwl.FK_Emp == "zhoupeng")
                {
                    Emp tempEmp = new Emp(gwl.FK_Emp);
                    if (gwl.FK_Dept != tempEmp.FK_Dept)
                    {
                        throw new Exception("@FK_Dept  错误, 现在是:" + gwl.FK_Dept);
                    }
                }
            }
            #endregion 检查发起的子流程 流程引擎表 是否完整?

            #region 检查发起的子流程数据是否完整?
            //检查报表数据是否完整?
            sql = "SELECT * FROM ND24Rpt WHERE OID=" + subFlowWorkID;
            DataTable dt = DBAccess.RunSQLReturnTable(sql);
            if (dt.Rows.Count == 0)
            {
                throw new Exception("@发起流程出错误,不应该找不到子流程的报表数据.");
            }

            foreach (DataColumn dc in dt.Columns)
            {
                string val = dt.Rows[0][dc.ColumnName].ToString();
                switch (dc.ColumnName)
                {
                case GERptAttr.PWorkID:
                    if (val != gwf.PWorkID.ToString())
                    {
                        throw new Exception("@应当是父流程的workid,现是在:" + val);
                    }
                    break;

                case GERptAttr.PFlowNo:
                    if (val != "023")
                    {
                        throw new Exception("@应当是023");
                    }
                    break;

                case GERptAttr.FID:
                    if (val != "0")
                    {
                        throw new Exception("@应当是0");
                    }
                    break;

                case GERptAttr.FK_Dept:
                    if (val != "1")
                    {
                        throw new Exception("@应当是  1, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FK_NY:
                    if (val != DataType.CurrentYearMonth)
                    {
                        throw new Exception("@应当是" + DataType.CurrentYearMonth + ", 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowDaySpan:
                    if (val != "0")
                    {
                        throw new Exception("@应当是 0 , 现在是:" + val);
                    }
                    break;

                //case GERptAttr.FlowEmps:
                //    if (val.Contains(empSubFlowStarter.No) == false)
                //        throw new Exception("@应当是包含当前人员, 现在是:" + val);
                //    break;
                //case GERptAttr.FlowEnder:
                //    if (val != empSubFlowStarter.No)
                //        throw new Exception("@应当是 empSubFlowStarter.No, 现在是:" + val);
                //    break;
                case GERptAttr.FlowEnderRDT:
                    if (val.Contains(DataType.CurrentData) == false)
                    {
                        throw new Exception("@应当是 当前日期, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowEndNode:
                    if (val != "2401")
                    {
                        throw new Exception("@应当是 2401, 现在是:" + val);
                    }
                    break;

                //case GERptAttr.FlowStarter:
                //    if (val != empSubFlowStarter.No)
                //        throw new Exception("@应当是  WebUser.No, 现在是:" + val);
                //    break;
                case GERptAttr.FlowStartRDT:
                    if (string.IsNullOrEmpty(val))
                    {
                        throw new Exception("@应当不能为空,现在是:" + val);
                    }
                    break;

                case GERptAttr.Title:
                    if (string.IsNullOrEmpty(val))
                    {
                        throw new Exception("@不能为空title" + val);
                    }
                    break;

                case GERptAttr.WFState:
                    WFState sta = (WFState)int.Parse(val);
                    if (sta != WFState.Runing)
                    {
                        throw new Exception("@应当是  WFState.Runing 现在是" + sta.ToString());
                    }
                    break;

                default:
                    break;
                }
            }
            #endregion 检查是否完整?

            // 测试以子流程向下发送,是否成功?
            BP.WF.Dev2Interface.Port_Login("zhoupeng");
            objs = BP.WF.Dev2Interface.Node_SendWork("024", subFlowWorkID);

            #region 检查返回来的变量数据完整性。
            if (objs.VarToNodeID != 2402)
            {
                throw new Exception("@子流程向下发送时不成功.");
            }

            #endregion 检查数据完整性。

            #region 检查其它的人在开始节点上是否还有待办工作?
            //检查报表数据是否完整?
            sql = "SELECT * FROM WF_EmpWorks WHERE WorkID=" + subFlowWorkID + " AND FK_Emp='zhoushengyu'";
            dt  = DBAccess.RunSQLReturnTable(sql);
            if (dt.Rows.Count != 0)
            {
                throw new Exception("@在开始节点一个人处理完成后,其它人还有待办.");
            }

            #endregion 检查其它的人在开始节点上是否还有待办工作。
        }
コード例 #23
0
        public SimpleTreeNode <TrackingData> ProcessItem(Guid trackingid, string filename, Guid parenttrackingid, WFState state, bool isprocesingcompleted)
        {
            WFLogger.NLogger.Info("Guid={0}  Filename={1}  ParentGuid={2}  IsProcessingComplete={3}", trackingid, filename, parenttrackingid, isprocesingcompleted);
            SimpleTreeNode <TrackingData> parenttreenode = null;
            SimpleTreeNode <TrackingData> parenttree     = this.FirstOrDefault(x => (parenttreenode = x.Find(parenttrackingid)) != null);
            SimpleTreeNode <TrackingData> srctreenode    = null;

            // srctree == null then create tree for filename
            if (parenttree == null)
            {
                TrackingDataTree newtree = new TrackingDataTree();
                newtree.Value = new TrackingData(trackingid, filename);
                this.Add(newtree);
                srctreenode = newtree;
                WFLogger.NLogger.Info("CreateTree: Guid={0}  Filename={1}  Depth={2}  ParentGuid={3}", srctreenode.Value.Guid, srctreenode.Value.Filename, (uint)srctreenode.Depth, srctreenode.Parent != null ? srctreenode.Parent.Value.Guid : srctreenode.Value.Guid);
            }
            else             // srctree is found so is srctreenode
            {
                // now go find node in tree by filename
                srctreenode = parenttree.Find(new TrackingData(trackingid, string.Empty));
//				if(srctreenode == null)
//					srctreenode = parenttreenode.Find(new TrackingData(Guid.Empty, filename));

                // if node by filename not found then create new tree whose root is trackingid
                if (srctreenode == null)
                {
                    srctreenode = parenttreenode.Children.Add(new TrackingData(trackingid, filename, parenttreenode.Value.WFClient));

                    // notify client of new entry
                    if (srctreenode.Value.WFClient != null)
                    {
                        srctreenode.Value.WFClient.Processing(srctreenode.Value.Guid, srctreenode.Value.Filename, (uint)srctreenode.Depth, srctreenode.Parent != null ? srctreenode.Parent.Value.Guid : srctreenode.Value.Guid);
                        WFLogger.NLogger.Info("Processing: Guid={0}  Filename={1}  Depth={2}  ParentGuid={3}", srctreenode.Value.Guid, srctreenode.Value.Filename, (uint)srctreenode.Depth, srctreenode.Parent != null ? srctreenode.Parent.Value.Guid : srctreenode.Value.Guid);
                    }
                }
            }

            if (isprocesingcompleted && srctreenode.Children.Count == 0)
            {
                // send notification processing is completed to client
                if (srctreenode.Value.WFClient != null)
                {
                    srctreenode.Value.WFClient.Completed(srctreenode.Value.Guid, srctreenode.Value.Filename, (uint)srctreenode.Depth, srctreenode.Parent != null ? srctreenode.Parent.Value.Guid : srctreenode.Value.Guid);
                    WFLogger.NLogger.Info("Completed: Guid={0}  Filename={1}  Depth={2}  ParentGuid={3}", srctreenode.Value.Guid, srctreenode.Value.Filename, (uint)srctreenode.Depth, srctreenode.Parent != null ? srctreenode.Parent.Value.Guid : srctreenode.Value.Guid);
                }

                // get and check if node has parent
                SimpleTreeNode <TrackingData> parentnode = srctreenode.Parent;
                if (parentnode != null)
                {
                    // delete node from parent
                    WFLogger.NLogger.Info("RemoveNode: Guid={0}  Filename={1}  Depth={2}  ParentGuid={3}", srctreenode.Value.Guid, srctreenode.Value.Filename, (uint)srctreenode.Depth, srctreenode.Parent != null ? srctreenode.Parent.Value.Guid : srctreenode.Value.Guid);
                    parentnode.Children.Remove(srctreenode);
                    do
                    {
                        if (parentnode == parentnode.Root)
                        {
                            break;
                        }

                        // if parent node has no children then notify client of completion
                        // and remove parentnode from parent
                        if (parentnode.Children.Count == 0)
                        {
                            // notify clients of completion
                            if (parentnode.Value.WFClient != null)
                            {
                                parentnode.Value.WFClient.Completed(parentnode.Value.Guid, parentnode.Value.Filename, (uint)parentnode.Depth, parentnode.Parent != null ? parentnode.Parent.Value.Guid : parentnode.Value.Guid);
                                WFLogger.NLogger.Info("Completed: Guid={0}  Filename={1}  Depth={2}  ParentGuid={3}", parentnode.Value.Guid, parentnode.Value.Filename, (uint)parentnode.Depth, parentnode.Parent != null ? parentnode.Parent.Value.Guid : parentnode.Value.Guid);
                            }
                            // remove parentnode from parent
                            if (parentnode.Parent != null)
                            {
                                WFLogger.NLogger.Info("RemoveNode: Guid={0}  Filename={1}  Depth={2}  ParentGuid={3}", parentnode.Value.Guid, parentnode.Value.Filename, (uint)parentnode.Depth, parentnode.Parent != null ? parentnode.Parent.Value.Guid : parentnode.Value.Guid);
                                parentnode.Parent.Children.Remove(parentnode);
                            }
                        }
                        parentnode = parentnode.Parent;
                    } while (parentnode != null);

                    if ((parentnode != null) && (parentnode == parentnode.Root) && (parentnode.Children.Count == 0))
                    {
                        // notify clients of completion
                        if (parentnode.Value.WFClient != null)
                        {
                            parentnode.Value.WFClient.Completed(parentnode.Value.Guid, parentnode.Value.Filename, (uint)parentnode.Depth, parentnode.Value.Guid);
                            WFLogger.NLogger.Info("Completed: Guid={0}  Filename={1}  Depth={2}  ParentGuid={3}", parentnode.Value.Guid, parentnode.Value.Filename, (uint)parentnode.Depth, parentnode.Value.Guid);
                        }

                        // remove from tracking tree
                        WFLogger.NLogger.Info("RemoveTree: Guid={0}  Filename={1}  Depth={2}  ParentGuid={3}", parentnode.Value.Guid, parentnode.Value.Filename, (uint)parentnode.Depth, parentnode.Parent != null ? parentnode.Parent.Value.Guid : parentnode.Value.Guid);
                        this.Remove((TrackingDataTree)parentnode);
                    }
                }
            }

            return(srctreenode);
        }
コード例 #24
0
 public void CompletedEx(Guid guid, WFState state)
 {
     Action<Guid, WFState> cd = CompletedExAsync;
     cd.BeginInvoke(guid, state, cd.EndInvoke, null);
 }
コード例 #25
0
ファイル: Send024.cs プロジェクト: splanton/CCFlow
        /// <summary>
        /// 步骤1 让zhanghaicheng 发起流程.
        /// </summary>
        public void Step1()
        {
            //给发起人赋值.
            starterEmp = new Port.Emp(userNo);

            //让 userNo 登录.
            BP.WF.Dev2Interface.Port_Login(userNo);

            //创建空白工作, 发起开始节点.
            workID = BP.WF.Dev2Interface.Node_CreateBlankWork(fk_flow);

            #region 检查创建工作是否符合预期.
            //检查流程表的数据.
            sql = "SELECT * FROM " + fl.PTable + " WHERE OID=" + workID;
            dt  = DBAccess.RunSQLReturnTable(sql);
            if (dt.Rows.Count != 1)
            {
                throw new Exception("@流程报表数据被删除了.");
            }
            foreach (DataColumn dc in dt.Columns)
            {
                string val = dt.Rows[0][dc.ColumnName].ToString();
                switch (dc.ColumnName)
                {
                case GERptAttr.FID:
                    if (val != "0")
                    {
                        throw new Exception("@应当是0");
                    }
                    break;

                case GERptAttr.FK_Dept:
                    if (val != WebUser.FK_Dept)
                    {
                        throw new Exception("@应当是" + WebUser.FK_Dept + ", 现在是:" + val);
                    }
                    break;

                case GERptAttr.FK_NY:
                    if (val != DataType.CurrentYearMonth)
                    {
                        throw new Exception("@应当是" + DataType.CurrentYearMonth + ", 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowDaySpan:
                    if (val != "0")
                    {
                        throw new Exception("@应当是 0 , 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowEmps:
                    if (BP.WF.Glo.UserInfoShowModel != UserInfoShowModel.UserNameOnly)
                    {
                        if (val.Contains(WebUser.No) == false)
                        {
                            throw new Exception("@应当是包含当前人员, 现在是:" + val);
                        }
                    }
                    break;

                case GERptAttr.FlowEnder:
                    if (val != WebUser.No)
                    {
                        throw new Exception("@应当是 当前人员, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowEnderRDT:
                    if (val.Contains(DataType.CurrentData) == false)
                    {
                        throw new Exception("@应当是 当前日期, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowEndNode:
                    if (val != "2401")
                    {
                        throw new Exception("@应当是 2401, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowStarter:
                    if (val != WebUser.No)
                    {
                        throw new Exception("@应当是  WebUser.No, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowStartRDT:
                    if (string.IsNullOrEmpty(val))
                    {
                        throw new Exception("@应当不能为空,现在是:" + val);
                    }
                    break;

                case GERptAttr.Title:
                    if (string.IsNullOrEmpty(val))
                    {
                        throw new Exception("@不能为空title" + val);
                    }
                    break;

                case GERptAttr.WFState:
                    WFState sta = (WFState)int.Parse(val);
                    if (sta != WFState.Blank)
                    {
                        throw new Exception("@应当是  WFState.Blank 现在是" + sta.ToString());
                    }
                    break;

                default:
                    break;
                }
            }
            #endregion 检查创建工作是否符合预期

            //执行发送.
            objs = BP.WF.Dev2Interface.Node_SendWork(fk_flow, workID, null, null, 0, "zhoupeng");

            #region 第1步: 检查发送对象.
            //从获取的发送对象里获取到下一个工作者. zhangyifan(张一帆)、zhoushengyu(周升雨).
            if (objs.VarAcceptersID != "zhoupeng")
            {
                throw new Exception("@下一步的接受人不正确, 应当是: zhoupeng.现在是:" + objs.VarAcceptersID);
            }

            if (objs.VarToNodeID != 2402)
            {
                throw new Exception("@应该是 2401 节点. 现在是:" + objs.VarToNodeID);
            }

            if (objs.VarWorkID != workID)
            {
                throw new Exception("@主线程的workid不应该变化:" + objs.VarWorkID);
            }

            if (objs.VarCurrNodeID != 2401)
            {
                throw new Exception("@当前节点的编号不能变化:" + objs.VarCurrNodeID);
            }

            if (objs.VarTreadWorkIDs != null)
            {
                throw new Exception("@不应当获得子线程WorkID.");
            }
            #endregion 第1步: 检查发送对象.

            #region 第2步: 检查流程引擎表.
            //检查创建这个空白是否有数据完整?
            sql = "SELECT * FROM WF_EmpWorks WHERE WorkID=" + workID + " AND FK_Emp='" + objs.VarAcceptersID + "'";
            dt  = DBAccess.RunSQLReturnTable(sql);
            if (dt.Rows.Count == 0)
            {
                throw new Exception("@不应该找不到当前人员的待办.");
            }

            gwf = new GenerWorkFlow(workID);
            if (gwf.Starter != WebUser.No || gwf.StarterName != WebUser.Name)
            {
                throw new Exception("没有写入发起人的信息.");
            }

            if (gwf.FK_Dept != starterEmp.FK_Dept)
            {
                throw new Exception("@发起人的部门有变化,应当是" + starterEmp.FK_Dept + ",现在是:" + gwf.FK_Dept);
            }

            if (gwf.Starter != starterEmp.No)
            {
                throw new Exception("@发起人的 No 有变化,应当是" + starterEmp.No + ",现在是:" + gwf.Starter);
            }

            //判断当前点.
            if (gwf.FK_Node != 2402)
            {
                throw new Exception("@当前点应该是 2402 现在是:" + gwf.FK_Node);
            }

            //判断当前点.
            if (gwf.FID != 0)
            {
                throw new Exception("@当前点应该是 FID=0  现在是:" + gwf.FID);
            }

            //判断PWorkID,没有谁调用它,应当是 0.
            if (gwf.PWorkID != 0)
            {
                throw new Exception("@没有谁调用它, 当前点应该是 PWorkID=0  现在是:" + gwf.PWorkID);
            }

            //判断 WFState .
            if (gwf.WFState != WFState.Runing)
            {
                throw new Exception("@应当是 WFState=Runing 现在是:" + gwf.WFState.ToString());
            }

            //检查开始节点 发送人的WF_GenerWorkerList 的.
            gwl         = new GenerWorkerList();
            gwl.FK_Emp  = Web.WebUser.No;
            gwl.FK_Node = 2401;
            gwl.WorkID  = workID;
            gwl.Retrieve();

            // 没有分合流应当是 0 .
            if (gwl.FID != 0)
            {
                throw new Exception("@没有分合流应当是 0.");
            }

            if (gwl.IsEnable == false)
            {
                throw new Exception("@应该是启用的状态 ");
            }

            if (gwl.IsPass == false)
            {
                throw new Exception("@应该是通过的状态 ");
            }

            //if (gwl.Sender.Contains(WebUser.No) == false)
            //    throw new Exception("@应该是 包含当前状态 . ");


            //检查接受人的 WF_GenerWorkerList 的.
            gwl         = new GenerWorkerList();
            gwl.FK_Emp  = objs.VarAcceptersID;
            gwl.FK_Node = 2402;
            gwl.WorkID  = workID;
            gwl.Retrieve();

            // 没有分合流应当是 0 .
            if (gwl.FID != 0)
            {
                throw new Exception("@没有分合流应当是 0.");
            }

            if (gwl.IsEnable == false)
            {
                throw new Exception("@应该是启用的状态 ");
            }

            if (gwl.IsPass == true)
            {
                throw new Exception("@应该是未通过的状态 ");
            }

            //if (gwl.Sender.Contains(WebUser.No) == false)
            //    throw new Exception("@应该是 当前人发送的,现在是: " + gwl.Sender);
            #endregion 第2步: 检查流程引擎表.

            #region 第3步: 检查节点数据表.
            //检查流程表的数据.
            sql = "SELECT * FROM " + fl.PTable + " WHERE OID=" + workID;
            dt  = DBAccess.RunSQLReturnTable(sql);
            if (dt.Rows.Count != 1)
            {
                throw new Exception("@流程报表数据被删除了.");
            }
            foreach (DataColumn dc in dt.Columns)
            {
                string val = dt.Rows[0][dc.ColumnName].ToString();
                switch (dc.ColumnName)
                {
                case GERptAttr.PWorkID:
                    if (val != "0")
                    {
                        throw new Exception("@PWorkID应当是0, 现在是:" + val);
                    }
                    break;

                case GERptAttr.PFlowNo:
                    if (val != "")
                    {
                        throw new Exception("@PFlowNo应当是 '' 现在是:" + val);
                    }
                    break;

                case GERptAttr.FID:
                    if (val != "0")
                    {
                        throw new Exception("@应当是0");
                    }
                    break;

                case GERptAttr.FK_Dept:
                    if (val != starterEmp.FK_Dept)
                    {
                        throw new Exception("@应当是" + starterEmp.FK_Dept + ", 现在是:" + val);
                    }
                    break;

                case GERptAttr.FK_NY:
                    if (val != DataType.CurrentYearMonth)
                    {
                        throw new Exception("@应当是" + DataType.CurrentYearMonth + ", 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowDaySpan:
                    if (val != "0")
                    {
                        throw new Exception("@应当是 0 , 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowEmps:
                    if (BP.WF.Glo.UserInfoShowModel != UserInfoShowModel.UserNameOnly)
                    {
                        if (val.Contains(WebUser.No) == false)
                        {
                            throw new Exception("@应当是包含当前人员, 现在是:" + val);
                        }
                    }
                    break;

                case GERptAttr.FlowEnder:
                    if (val != WebUser.No)
                    {
                        throw new Exception("@应当是 当前人员, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowEnderRDT:
                    if (val.Contains(DataType.CurrentData) == false)
                    {
                        throw new Exception("@应当是 当前日期, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowEndNode:
                    if (val != "2402")
                    {
                        throw new Exception("@应当是 2402, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowStarter:
                    if (val != starterEmp.No)
                    {
                        throw new Exception("@应当是  " + starterEmp.No + ", 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowStartRDT:
                    if (string.IsNullOrEmpty(val))
                    {
                        throw new Exception("@应当不能为空,现在是:" + val);
                    }
                    break;

                case GERptAttr.Title:
                    if (string.IsNullOrEmpty(val))
                    {
                        throw new Exception("@不能为空title" + val);
                    }
                    break;

                case GERptAttr.WFState:
                    WFState sta = (WFState)int.Parse(val);
                    if (sta != WFState.Runing)
                    {
                        throw new Exception("@应当是  WFState.Runing 现在是" + sta.ToString());
                    }
                    break;

                default:
                    break;
                }
            }
            #endregion 第3步: 检查节点数据表.
        }
コード例 #26
0
ファイル: Send023.cs プロジェクト: zhaoyingju/ccflow
        /// <summary>
        /// 步骤1 让zhanghaicheng 发起流程.
        /// </summary>
        public void Step1()
        {
            //给发起人赋值.
            starterEmp = new Port.Emp(userNo);

            //让 userNo 登录.
            BP.WF.Dev2Interface.Port_Login(userNo);

            //创建空白工作, 发起开始节点.
            workID = BP.WF.Dev2Interface.Node_CreateBlankWork(fk_flow, null, null,
                                                              WebUser.No, null, 0, null);

            #region 检查创建工作是否符合预期.
            //检查开始节点写入的数据是否正确?
            sql = "SELECT * FROM ND2301 WHERE OID=" + workID;
            dt  = DBAccess.RunSQLReturnTable(sql);
            if (dt.Rows.Count != 1)
            {
                throw new Exception("@发起流程出错误,不应该找不到开始节点的数据.");
            }
            foreach (DataColumn dc in dt.Columns)
            {
                string val = dt.Rows[0][dc.ColumnName].ToString();
                switch (dc.ColumnName)
                {
                case WorkAttr.CDT:
                    if (val.Contains(DataType.CurrentData) == false)
                    {
                        throw new Exception("CDT,日期错误.现在的日期是:" + val);
                    }
                    break;

                case WorkAttr.RDT:
                    if (val.Contains(DataType.CurrentData) == false)
                    {
                        throw new Exception("RDT,日期错误.现在的日期是:" + val);
                    }
                    break;

                case WorkAttr.Emps:
                    if (val.Contains(WebUser.No) == false)
                    {
                        throw new Exception("应当包含当前人员,现在是:" + val);
                    }
                    break;

                case WorkAttr.FID:
                    if (val != "0")
                    {
                        throw new Exception("应当 = 0,现在是:" + val);
                    }
                    break;

                case WorkAttr.MD5:
                    //if (Glo.ism
                    //if (val !="0")
                    //    throw new Exception("应当 = 0,现在是:"+val);
                    break;

                case WorkAttr.MyNum:
                    if (val != "1")
                    {
                        throw new Exception("应当 = 1,现在是:" + val);
                    }
                    break;

                case WorkAttr.Rec:
                    if (val != WebUser.No)
                    {
                        throw new Exception("应当 Rec= " + WebUser.No + ",现在是:" + val);
                    }
                    break;

                //case WorkAttr.Sender:
                //    if (val != WebUser.No)
                //        throw new Exception("应当 Sender= " + WebUser.No + ",现在是:" + val);
                //    break;
                default:
                    break;
                }
            }


            //检查流程表的数据.
            sql = "SELECT * FROM " + fl.PTable + " WHERE OID=" + workID;
            dt  = DBAccess.RunSQLReturnTable(sql);
            if (dt.Rows.Count != 1)
            {
                throw new Exception("@流程报表数据被删除了.");
            }
            foreach (DataColumn dc in dt.Columns)
            {
                string val = dt.Rows[0][dc.ColumnName].ToString();
                switch (dc.ColumnName)
                {
                case GERptAttr.FID:
                    if (val != "0")
                    {
                        throw new Exception("@应当是0");
                    }
                    break;

                case GERptAttr.FK_Dept:
                    if (val != WebUser.FK_Dept)
                    {
                        throw new Exception("@应当是" + WebUser.FK_Dept + ", 现在是:" + val);
                    }
                    break;

                case GERptAttr.FK_NY:
                    if (val != DataType.CurrentYearMonth)
                    {
                        throw new Exception("@应当是" + DataType.CurrentYearMonth + ", 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowDaySpan:
                    if (val != "0")
                    {
                        throw new Exception("@应当是 0 , 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowEmps:
                    if (val.Contains(WebUser.No) == false)
                    {
                        throw new Exception("@应当是包含当前人员, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowEnder:
                    if (val != WebUser.No)
                    {
                        throw new Exception("@应当是 当前人员, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowEnderRDT:
                    if (val.Contains(DataType.CurrentData) == false)
                    {
                        throw new Exception("@应当是 当前日期, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowEndNode:
                    if (val != "2301")
                    {
                        throw new Exception("@应当是 2301, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowStarter:
                    if (val != WebUser.No)
                    {
                        throw new Exception("@应当是  WebUser.No, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowStartRDT:
                    if (string.IsNullOrEmpty(val))
                    {
                        throw new Exception("@应当不能为空,现在是:" + val);
                    }
                    break;

                case GERptAttr.Title:
                    if (string.IsNullOrEmpty(val))
                    {
                        throw new Exception("@不能为空title" + val);
                    }
                    break;

                case GERptAttr.WFState:
                    WFState sta = (WFState)int.Parse(val);
                    if (sta != WFState.Blank)
                    {
                        throw new Exception("@应当是  WFState.Blank 现在是" + sta.ToString());
                    }
                    break;

                default:
                    break;
                }
            }

            #endregion 检查创建工作是否符合预期

            //定义一个参数.
            Hashtable ht = new System.Collections.Hashtable();
            ht.Add("GoTo", 1);
            ht.Add("MyPara", "TestPara");

            //执行发送.
            objs = BP.WF.Dev2Interface.Node_SendWork(fk_flow, workID, ht);

            #region 第1步: 检查发送对象.
            //从获取的发送对象里获取到下一个工作者. zhangyifan(张一帆)、zhoushengyu(周升雨).
            if (objs.VarAcceptersID != "zhoupeng")
            {
                throw new Exception("@下一步的接受人不正确, 应当是: zhoupeng.现在是:" + objs.VarAcceptersID);
            }

            if (objs.VarToNodeID != 2302)
            {
                throw new Exception("@应该是 2302 节点. 现在是:" + objs.VarToNodeID);
            }

            if (objs.VarWorkID != workID)
            {
                throw new Exception("@主线程的workid不应该变化:" + objs.VarWorkID);
            }

            if (objs.VarCurrNodeID != 2301)
            {
                throw new Exception("@当前节点的编号不能变化:" + objs.VarCurrNodeID);
            }

            if (objs.VarTreadWorkIDs != null)
            {
                throw new Exception("@不应当获得子线程WorkID.");
            }

            #endregion 第1步: 检查发送对象.

            #region 第2步: 检查流程引擎表.
            //检查创建这个空白是否有数据完整?
            sql = "SELECT * FROM WF_EmpWorks WHERE WorkID=" + workID + " AND FK_Emp='" + objs.VarAcceptersID + "'";
            dt  = DBAccess.RunSQLReturnTable(sql);
            if (dt.Rows.Count == 0)
            {
                throw new Exception("@不应该找不到当前人员的待办.");
            }

            gwf = new GenerWorkFlow(workID);
            if (gwf.Starter != WebUser.No || gwf.StarterName != WebUser.Name)
            {
                throw new Exception("没有写入发起人的信息.");
            }

            if (gwf.FK_Dept != starterEmp.FK_Dept)
            {
                throw new Exception("@发起人的部门有变化,应当是" + starterEmp.FK_Dept + ",现在是:" + gwf.FK_Dept);
            }

            if (gwf.Starter != starterEmp.No)
            {
                throw new Exception("@发起人的 No 有变化,应当是" + starterEmp.No + ",现在是:" + gwf.Starter);
            }


            //判断当前点.
            if (gwf.FK_Node != 2302)
            {
                throw new Exception("@当前点应该是 2302 现在是:" + gwf.FK_Node);
            }

            //判断当前点.
            if (gwf.FID != 0)
            {
                throw new Exception("@当前点应该是 FID=0  现在是:" + gwf.FID);
            }

            //判断PWorkID,没有谁调用它,应当是 0.
            if (gwf.PWorkID != 0)
            {
                throw new Exception("@没有谁调用它, 当前点应该是 PWorkID=0  现在是:" + gwf.PWorkID);
            }

            //判断 WFState .
            if (gwf.WFState != WFState.Runing)
            {
                throw new Exception("@应当是 WFState=Runing 现在是:" + gwf.WFState.ToString());
            }

            //检查开始节点 发送人的WF_GenerWorkerList的.
            gwl = new GenerWorkerList();
            gwl.CheckPhysicsTable();

            gwl.FK_Emp  = Web.WebUser.No;
            gwl.FK_Node = 2301;
            gwl.WorkID  = workID;
            gwl.Retrieve();

            // 没有分合流应当是 0 .
            if (gwl.FID != 0)
            {
                throw new Exception("@没有分合流应当是 0.");
            }

            if (gwl.IsEnable == false)
            {
                throw new Exception("@应该是启用的状态 ");
            }

            if (gwl.IsPass == false)
            {
                throw new Exception("@应该是通过的状态 ");
            }

            if (gwl.Sender.Contains(WebUser.No) == false)
            {
                throw new Exception("@应该是 包含当前状态 . ");
            }

            if (gwl.Paras != "@MyPara=TestPara@GoTo=1")
            {
                throw new Exception("@参数应当是:@MyPara=TestPara@GoTo=1 .现在是:" + gwl.Paras);
            }

            //检查接受人的 WF_GenerWorkerList 的.
            gwl         = new GenerWorkerList();
            gwl.FK_Emp  = objs.VarAcceptersID;
            gwl.FK_Node = 2302;
            gwl.WorkID  = workID;
            gwl.Retrieve();

            // 没有分合流应当是 0 .
            if (gwl.FID != 0)
            {
                throw new Exception("@没有分合流应当是 0.");
            }

            if (gwl.IsEnable == false)
            {
                throw new Exception("@应该是启用的状态 ");
            }

            if (gwl.IsPass == true)
            {
                throw new Exception("@应该是未通过的状态 ");
            }

            if (gwl.Sender.Contains(WebUser.No) == false)
            {
                throw new Exception("@应该是 当前人发送的,现在是: " + gwl.Sender);
            }
            #endregion 第2步: 检查流程引擎表.

            #region 第3步: 检查节点数据表.
            sql = "SELECT * FROM ND2301 WHERE OID=" + workID;
            dt  = DBAccess.RunSQLReturnTable(sql);
            if (dt.Rows.Count != 1)
            {
                throw new Exception("@发起流程出错误,不应该找不到开始节点的数据.");
            }
            foreach (DataColumn dc in dt.Columns)
            {
                string val = dt.Rows[0][dc.ColumnName].ToString();
                switch (dc.ColumnName)
                {
                case WorkAttr.CDT:
                    if (val.Contains(DataType.CurrentData) == false)
                    {
                        throw new Exception("CDT,日期错误.");
                    }
                    break;

                case WorkAttr.RDT:
                    if (val.Contains(DataType.CurrentData) == false)
                    {
                        throw new Exception("RDT,日期错误.");
                    }
                    break;

                case WorkAttr.Emps:
                    if (val.Contains(WebUser.No) == false)
                    {
                        throw new Exception("应当包含当前人员,现在是:" + val);
                    }
                    break;

                case WorkAttr.FID:
                    if (val != "0")
                    {
                        throw new Exception("应当 = 0,现在是:" + val);
                    }
                    break;

                case WorkAttr.MD5:
                    //if (Glo.ism
                    //if (val !="0")
                    //    throw new Exception("应当 = 0,现在是:"+val);
                    break;

                case WorkAttr.MyNum:
                    if (val != "1")
                    {
                        throw new Exception("应当 = 1,现在是:" + val);
                    }
                    break;

                case WorkAttr.Rec:
                    if (val != WebUser.No)
                    {
                        throw new Exception("应当 Rec= " + WebUser.No + ",现在是:" + val);
                    }
                    break;

                //case WorkAttr.Sender:
                //    if (val != WebUser.No)
                //        throw new Exception("应当 Sender= " + WebUser.No + ",现在是:" + val);
                //    break;
                default:
                    break;
                }
            }

            //检查节点2的数据.
            sql = "SELECT * FROM ND2302 WHERE OID=" + workID;
            dt  = DBAccess.RunSQLReturnTable(sql);
            if (dt.Rows.Count != 1)
            {
                throw new Exception("@发起流程出错误,不应该找不到 ND2302 的数据.");
            }
            foreach (DataColumn dc in dt.Columns)
            {
                string val = dt.Rows[0][dc.ColumnName].ToString();
                switch (dc.ColumnName)
                {
                case WorkAttr.CDT:
                    if (val.Contains(DataType.CurrentData) == false)
                    {
                        throw new Exception("CDT,日期错误.");
                    }
                    break;

                case WorkAttr.RDT:
                    if (val.Contains(DataType.CurrentData) == false)
                    {
                        throw new Exception("RDT,日期错误.");
                    }
                    break;

                case WorkAttr.Emps:
                    if (val.Contains("zhoupeng") == false)
                    {
                        throw new Exception("第二步骤的处理人员,应当zhoupeng ,现在是:" + val);
                    }
                    break;

                case WorkAttr.FID:
                    if (val != "0")
                    {
                        throw new Exception("应当 = 0,现在是:" + val);
                    }
                    break;

                case WorkAttr.MD5:
                    //if (Glo.ism
                    //if (val !="0")
                    //    throw new Exception("应当 = 0,现在是:"+val);
                    break;

                case WorkAttr.MyNum:
                    if (val != "1")
                    {
                        throw new Exception("应当 = 1,现在是:" + val);
                    }
                    break;

                case WorkAttr.Rec:
                    if (val != "zhoupeng")
                    {
                        throw new Exception("应当 Rec= zhoupeng,现在是:" + val);
                    }
                    break;

                default:
                    break;
                }
            }

            //检查流程表的数据.
            sql = "SELECT * FROM " + fl.PTable + " WHERE OID=" + workID;
            dt  = DBAccess.RunSQLReturnTable(sql);
            if (dt.Rows.Count != 1)
            {
                throw new Exception("@流程报表数据被删除了.");
            }
            foreach (DataColumn dc in dt.Columns)
            {
                string val = dt.Rows[0][dc.ColumnName].ToString();
                switch (dc.ColumnName)
                {
                case GERptAttr.FID:
                    if (val != "0")
                    {
                        throw new Exception("@应当是0");
                    }
                    break;

                case GERptAttr.FK_Dept:
                    if (val != WebUser.FK_Dept)
                    {
                        throw new Exception("@应当是" + WebUser.FK_Dept + ", 现在是:" + val);
                    }
                    break;

                case GERptAttr.FK_NY:
                    if (val != DataType.CurrentYearMonth)
                    {
                        throw new Exception("@应当是" + DataType.CurrentYearMonth + ", 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowDaySpan:
                    if (val != "0")
                    {
                        throw new Exception("@应当是 0 , 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowEmps:
                    if (val.Contains(WebUser.No) == false)
                    {
                        throw new Exception("@应当是包含当前人员, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowEnder:
                    if (val != WebUser.No)
                    {
                        throw new Exception("@应当是 当前人员, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowEnderRDT:
                    if (val.Contains(DataType.CurrentData) == false)
                    {
                        throw new Exception("@应当是 当前日期, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowEndNode:
                    if (val != "2302")
                    {
                        throw new Exception("@应当是 2302, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowStarter:
                    if (val != WebUser.No)
                    {
                        throw new Exception("@应当是  WebUser.No, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowStartRDT:
                    if (string.IsNullOrEmpty(val))
                    {
                        throw new Exception("@应当不能为空,现在是:" + val);
                    }
                    break;

                case GERptAttr.Title:
                    if (string.IsNullOrEmpty(val))
                    {
                        throw new Exception("@不能为空title" + val);
                    }
                    break;

                case GERptAttr.WFState:
                    WFState sta = (WFState)int.Parse(val);
                    if (sta != WFState.Runing)
                    {
                        throw new Exception("@应当是  WFState.Runing 现在是" + sta.ToString());
                    }
                    break;

                default:
                    break;
                }
            }
            #endregion 第3步: 检查节点数据表.
        }
コード例 #27
0
 public abstract void CompletedExAsync(Guid guid, WFState state);
コード例 #28
0
 public void CompletedEx(Guid guid, WFState state)
 {
 }
コード例 #29
0
        public override WFState Run()
        {
            WFState retval = new WFState();

            IPst rdopststore = null;

            try
            {
                retval.Value = WFState.WFStateFail;
                WFLogger.NLogger.Info("PSTFile={0}  NodeID={1}", this.PSTFile, this.FileToProcess);

                rdopststore = new Pst(this.PSTFile);

                Message rdomail = null;
                try
                {
                    NodeID msgid = Convert.ToUInt32(this.FileToProcess);
                    if (this.ParentMsg != "0")
                    {
                        msgid = Convert.ToUInt32(this.ParentMsg);
                    }

                    rdomail            = (Message)rdopststore.OpenMessage(msgid);          //this.EntryID);
                    rdomail.Pst        = (Pst)rdopststore;
                    rdomail.FolderPath = this.FolderPath;
                    WFLogger.NLogger.Info("EntryID={0}", rdomail.EntryID.ToString());
                }
                catch (Exception ex)
                {
                    WFLogger.NLogger.ErrorException("ERROR: ProcessQueueObjectImplementation", ex);
                }
                if (rdomail != null)
                {
                    try
                    {
                        HandleMessage(rdomail, this.ExportDirectory);
                        this.ExportDirectory = this.ExportDirectory + @"\" + this.FileToProcess;
                        retval.Value         = WFState.WFStateSuccess;
                    }
                    catch (Exception ex)
                    {
                        WFLogger.NLogger.ErrorException("ERROR: HandleMessage", ex);
                    }
                    rdomail.Dispose();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
            }
            finally
            {
                if (rdopststore != null)
                {
                    rdopststore.Dispose();
                }
            }

            return(retval);
        }
コード例 #30
0
ファイル: CallSubFlow.cs プロジェクト: splanton/CCFlow
        /// <summary>
        /// 测试子流程只有一个人
        /// </summary>
        private void Test1()
        {
            string fk_flow = "023";
            string userNo  = "zhanghaicheng";
            Flow   fl      = new Flow(fk_flow);

            // zhanghaicheng 登录.
            BP.WF.Dev2Interface.Port_Login(userNo);

            //创建空白工作, 发起开始节点.
            Int64          workid = BP.WF.Dev2Interface.Node_CreateBlankWork(fk_flow);
            SendReturnObjs objs   = BP.WF.Dev2Interface.Node_SendWork(fk_flow, workid);


            //创建第一个子流程,调用只有一个人的接口.
            Emp   empSubFlowStarter = new Emp("zhoupeng");
            Int64 subFlowWorkID     = BP.WF.Dev2Interface.Node_CreateStartNodeWork("024", null, null, empSubFlowStarter.No,
                                                                                   "子流程发起测试", workid, "023", 0);

            #region 检查发起的子流程 流程引擎表 是否完整?
            GenerWorkFlow gwf = new GenerWorkFlow(subFlowWorkID);
            if (gwf.PFlowNo != "023")
            {
                throw new Exception("@父流程编号错误,应当是023现在是" + gwf.PFlowNo);
            }

            if (gwf.PWorkID != workid)
            {
                throw new Exception("@父流程WorkID错误,应当是" + workid + "现在是" + gwf.PWorkID);
            }

            if (gwf.Starter != empSubFlowStarter.No)
            {
                throw new Exception("@流程发起人编号错误,应当是" + empSubFlowStarter.No + "现在是" + gwf.Starter);
            }

            if (gwf.StarterName != empSubFlowStarter.Name)
            {
                throw new Exception("@流程发起人 Name 错误,应当是" + empSubFlowStarter.Name + "现在是" + gwf.StarterName);
            }

            if (gwf.FK_Dept != empSubFlowStarter.FK_Dept)
            {
                throw new Exception("@流程隶属部门错误,应当是" + empSubFlowStarter.FK_Dept + "现在是" + gwf.FK_Dept);
            }

            if (gwf.Title != "子流程发起测试")
            {
                throw new Exception("@流程标题 子流程发起测试 错误,应当是 子流程发起测试 现在是" + gwf.Title);
            }

            if (gwf.WFState != WFState.Runing)
            {
                throw new Exception("@流程 WFState 错误,应当是 Runing 现在是" + gwf.WFState);
            }

            if (gwf.FID != 0)
            {
                throw new Exception("@FID错误,应当是0现在是" + gwf.FID);
            }

            if (gwf.FK_Flow != "024")
            {
                throw new Exception("@FK_Flow错误,应当是024现在是" + gwf.FK_Flow);
            }

            if (gwf.FK_Node != 2401)
            {
                throw new Exception("@停留的当前节点错误,应当是2401现在是" + gwf.FK_Flow);
            }

            GenerWorkerLists gwls = new GenerWorkerLists(subFlowWorkID, 2401);
            if (gwls.Count != 1)
            {
                throw new Exception("@待办列表个数应当1,现在是" + gwls.Count);
            }


            // 检查发起人列表是否完整?
            GenerWorkerList gwl = (GenerWorkerList)gwls[0];
            if (gwl.FK_Emp != empSubFlowStarter.No)
            {
                throw new Exception("@处理人错误,现在是:" + empSubFlowStarter.No);
            }

            if (gwl.IsPassInt != 0)
            {
                throw new Exception("@通过状态应当是未通过,现在是:" + gwl.IsPassInt);
            }

            if (gwl.FID != 0)
            {
                throw new Exception("@流程ID 应当是0 ,现在是:" + gwl.FID);
            }

            if (gwl.FK_EmpText != empSubFlowStarter.Name)
            {
                throw new Exception("@FK_EmpText  错误, 现在是:" + gwl.FK_EmpText);
            }

            #endregion 检查发起的子流程 流程引擎表 是否完整?

            #region 检查发起的子流程数据是否完整?
            //检查报表数据是否完整?
            sql = "SELECT * FROM ND24Rpt WHERE OID=" + subFlowWorkID;
            DataTable dt = DBAccess.RunSQLReturnTable(sql);
            if (dt.Rows.Count == 0)
            {
                throw new Exception("@发起流程出错误,不应该找不到子流程的报表数据.");
            }

            foreach (DataColumn dc in dt.Columns)
            {
                string val = dt.Rows[0][dc.ColumnName].ToString();
                switch (dc.ColumnName)
                {
                case GERptAttr.FID:
                    if (val != "0")
                    {
                        throw new Exception("@应当是0");
                    }
                    break;

                case GERptAttr.FK_Dept:
                    if (val != empSubFlowStarter.FK_Dept)
                    {
                        throw new Exception("@应当是" + empSubFlowStarter.FK_Dept + ", 现在是:" + val);
                    }
                    break;

                case GERptAttr.FK_NY:
                    if (val != DataType.CurrentYearMonth)
                    {
                        throw new Exception("@应当是" + DataType.CurrentYearMonth + ", 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowDaySpan:
                    if (val != "0")
                    {
                        throw new Exception("@应当是 0 , 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowEmps:
                    if (val.Contains(empSubFlowStarter.No) == false)
                    {
                        throw new Exception("@应当是包含当前人员, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowEnder:
                    if (val != empSubFlowStarter.No)
                    {
                        throw new Exception("@应当是 empSubFlowStarter.No, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowEnderRDT:
                    if (val.Contains(DataType.CurrentData) == false)
                    {
                        throw new Exception("@应当是 当前日期, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowEndNode:
                    if (val != "2401")
                    {
                        throw new Exception("@应当是 2401, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowStarter:
                    if (val != empSubFlowStarter.No)
                    {
                        throw new Exception("@应当是  WebUser.No, 现在是:" + val);
                    }
                    break;

                case GERptAttr.FlowStartRDT:
                    if (string.IsNullOrEmpty(val))
                    {
                        throw new Exception("@应当不能为空,现在是:" + val);
                    }
                    break;

                case GERptAttr.Title:
                    if (string.IsNullOrEmpty(val))
                    {
                        throw new Exception("@不能为空title" + val);
                    }
                    break;

                case GERptAttr.WFState:
                    WFState sta = (WFState)int.Parse(val);
                    if (sta != WFState.Runing)
                    {
                        throw new Exception("@应当是  WFState.Runing 现在是" + sta.ToString());
                    }
                    break;

                default:
                    break;
                }
            }
            #endregion 检查是否完整?

            // 测试以子流程向下发送,是否成功?
            BP.WF.Dev2Interface.Port_Login(empSubFlowStarter.No);
            objs = BP.WF.Dev2Interface.Node_SendWork("024", subFlowWorkID);
            if (objs.VarToNodeID != 2402)
            {
                throw new Exception("@子流程向下发送时不成功.");
            }
        }
コード例 #31
0
ファイル: FlowCommon.cs プロジェクト: gofixiao/HYPDM_Pro
 /// <summary>
 /// 获取当前用户待办工作
 /// </summary>
 /// <param name="state">流程状态</param>
 /// <param name="fk_flow">流程编号</param>
 /// <returns></returns>
 public DataTable GetEmpWorks(WFState state, string fk_flow)
 {
     return Dev2Interface.DB_GenerEmpWorksOfDataTable(state, fk_flow);
 }
コード例 #32
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region 功能执行
            try
            {
                switch (this.DoType)
                {
                case "Del":
                    WorkFlow wf = new WorkFlow(FK_Flow, WorkID);
                    wf.DoDeleteWorkFlowByReal(true);
                    this.WinCloseWithMsg("流程已经被删除.");
                    break;

                case "HungUp":
                    WorkFlow wf1 = new WorkFlow(FK_Flow, WorkID);
                    //wf1.DoHungUp(HungUpWa;
                    this.WinCloseWithMsg("流程已经被挂起.");
                    break;

                case "UnHungUp":
                    WorkFlow wf2 = new WorkFlow(FK_Flow, WorkID);
                    //  wf2.DoUnHungUp();
                    this.WinCloseWithMsg("流程已经被解除挂起.");
                    break;

                case "ComeBack":
                    WorkFlow wf3 = new WorkFlow(FK_Flow, WorkID);
                    wf3.DoComeBackWorkFlow("无");
                    this.WinCloseWithMsg("流程已经被回复启用.");
                    break;

                case "Takeback":     /*取回审批.*/
                    break;

                case "UnSend":
                    // 转化成编号.
                    string message = BP.WF.Dev2Interface.Flow_DoUnSend(FK_Flow, WorkID);

                    Response.Clear();
                    Response.Write(message);
                    Response.End();
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                this.Alert("执行功能:" + DoType + ",出现错误:" + ex.Message);
            }
            #endregion

            int     wfState     = BP.DA.DBAccess.RunSQLReturnValInt("SELECT WFState FROM WF_GenerWorkFlow WHERE WorkID=" + WorkID, 1);
            WFState wfstateEnum = (WFState)wfState;
            //this.Pub2.AddH3("您可执行的操作<hr>");
            switch (wfstateEnum)
            {
            case WFState.Runing:           /* 运行时*/
                this.FlowOverByCoercion(); /*删除流程.*/
                this.TackBackCheck();      /*取回审批*/
                this.Hurry();              /*催办*/
                this.UnSend();             /*撤销发送*/
                break;

            case WFState.Complete:   // 完成.
            case WFState.Delete:     // 逻辑删除..
                this.RollBack();     /*恢复使用流程*/
                break;

            case WFState.HungUp:     // 挂起.
                this.AddUnHungUp();  /*撤销挂起*/
                break;

            default:
                break;
            }
        }
コード例 #33
0
        protected bool ExecCommand()
        {
            TimesByOpearation[NptCommand.WarmingUp] = Slot.CalibrateParam.TimeForDXS;

            if (LastError != "")
            {
                Slot.OnDeviceRemoving(new DevEventArgs());
            }

            if ((new List <NptCommand>()
            {
                NptCommand.WarmingUp, NptCommand.СheckUp, NptCommand.Calibrate, NptCommand.WriteFactorySettings, NptCommand.StartWorkFlow
            }).
                Contains(Command))
            {
                Slot.WorkFlowState      = WFState.Operation;
                Slot.EnableControls     = false;
                Slot.WorkFlowBtnChecked = true;

                if (Slot.CleanLogBeforeStart && (WorkFlow.Count() == 0))
                {
                    Slot.CleanLog();
                }
            }
            else if (Command == NptCommand.AbortOperation)
            {
                Command = NptCommand.ReadState;
                Slot.WorkFlowBtnChecked = false;
                Slot.OnPropertychanged("WarmUpTimerVisi");
                WorkFlow.Clear();
                if (Slot.WorkFlowState == WFState.Operation)
                {
                    Slot.WorkFlowState = WFState.Nothing;
                }
            }

            switch (Command)
            {
            case NptCommand.WaitWarmingUp:
            {
                ExecuteRead(NptRegisters.Registers._STATE);
                Slot.OnPropertychanged("Tempr");
                Slot.OnPropertychanged("ProgressPos");

                if (stopWatch.ElapsedMilliseconds > (1000 * TimesByOpearation[NptCommand.WarmingUp]))
                {
                    Slot.WorkFlowBtnChecked = false;
                    Slot.Log("Восстановление параметров прибора", Brushes.Black);
                    Slot.Log("Прогрев завершён", Brushes.Black);
                    GetRegisters().RestoreParams();
                    ExecuteWrite(NptRegisters.Registers._PARAMS);
                    Slot.OnPropertychanged("WarmUpTimerVisi");

                    Slot.HeartColor = Brushes.Green;

                    Slot.OnPropertychanged("ProgressPos");
                    Slot.WorkFlowState = WFState.Oki;
                    Thread.Sleep(100);
                    PrevOperationMs += stopWatch.ElapsedMilliseconds;
                    Command          = WorkFlow.Count == 0 ? NptCommand.ReadState : WorkFlow.Dequeue();
                }
                break;
            }

            case NptCommand.WarmingUp:
            {
                Slot.HeartColor = Brushes.Yellow;
                Slot.Log("Запись параметров калибровки", Brushes.Black);
                ExecuteRead(NptRegisters.Registers._PARAMS);
                GetRegisters().OnDeviceRegistersRead("PARAMS");
                // записываем настройки каибровки
                Slot.DevParamKey = GetRegisters().DEVTYPE;
                GetRegisters().SetCalibParams(Slot.CalibrateParam);
                LastIOResult = ExecuteWrite(NptRegisters.Registers._PARAMS);
                if (LastIOResult)
                {
                    Slot.Log("Прогрев", Brushes.Black);
                    stopWatch.Restart();
                    Command = NptCommand.WaitWarmingUp;
                    Slot.OnPropertychanged("ProgressPos");
                }
                else
                {
                    Slot.HeartColor = Brushes.Red;
                    Slot.Log("Не удалось записать параметры калибровки", Brushes.Red);
                    Command                 = NptCommand.ReadState;
                    Slot.WorkFlowState      = WFState.Error;
                    Slot.WorkFlowBtnChecked = false;
                }

                break;
            }

            case NptCommand.WriteFactorySettings:
            {
                Slot.WriteFactorySettingsColor = Brushes.Yellow;
                stopWatch.Restart();
                Slot.OnPropertychanged("ProgressPos");
                Slot.DevParamKey = GetRegisters().DEVTYPE;
                GetRegisters().SetParams(Slot.NptParam);
                LastIOResult = ExecuteWrite(NptRegisters.Registers._PARAMS);
                Thread.Sleep(1000);
                Slot.OnPropertychanged("ProgressPos");
                if (!LastIOResult)
                {
                    Slot.Log("Ошибка записи ЗУ", Brushes.Red);
                    Slot.WriteFactorySettingsColor = Brushes.Red;
                    Slot.WorkFlowState             = WFState.Error;
                }
                else
                {
                    Slot.Log("Запись ЗУ - успешно", Brushes.Black);
                    ExecuteRead(NptRegisters.Registers._PARAMS);
                    GetRegisters().OnDeviceRegistersRead("PARAMS");
                    Slot.WorkFlowState             = WFState.Oki;
                    Slot.WriteFactorySettingsColor = Brushes.Green;
                }
                Slot.WorkFlowBtnChecked = false;
                Slot.OnPropertychanged("ProgressPos");
                Thread.Sleep(100);
                PrevOperationMs += stopWatch.ElapsedMilliseconds;
                Command          = WorkFlow.Count == 0 ? NptCommand.ReadState : WorkFlow.Dequeue();
                break;
            }

            case NptCommand.WaitCheckUp:
            {
                Slot.OnPropertychanged("ProgressPos");
                NptCommand rez_cmd = NptCommand.ReadState;
                if (stopWatch.ElapsedMilliseconds > (1000 * TimesByOpearation[NptCommand.СheckUp]))
                {
                    LastIOResult = ExecuteRead(NptRegisters.Registers._STATE);
                    if (!LastIOResult)
                    {
                        Slot.CheckUpColor = Brushes.Red;
                        Slot.Log("Ошибка чтения ", Brushes.Red);
                        Slot.WorkFlowState = WFState.Error;
                        rez_cmd            = NptCommand.ReadState;
                        WorkFlow.Clear();
                    }
                    else
                    {
                        GetRegisters().OnDeviceRegistersRead("STATE");
                        float eps = (GetRegisters().Tempr - Slot.TempDXS);
                        Slot.DevParamKey = GetRegisters().DEVTYPE;
                        if (Math.Abs(eps) > Slot.CalibrateParam.DeltaTempDXS)
                        {
                            Slot.CheckUpColor = Brushes.Red;
                            Slot.Log("Ошибка", Brushes.Red);
                            Slot.WorkFlowState = WFState.Error;
                            rez_cmd            = NptCommand.ReadState;
                            WorkFlow.Clear();
                        }
                        else
                        {
                            Slot.CheckUpColor = Brushes.Green;
                            Slot.Log("Успешно", Brushes.Black);
                            Slot.WorkFlowState = WFState.Oki;
                            rez_cmd            = WorkFlow.Count == 0 ? NptCommand.ReadState : WorkFlow.Dequeue();
                        }
                    }
                    Slot.Log("Восстановление параметров прибора", Brushes.Black);
                    GetRegisters().RestoreParams();
                    ExecuteWrite(NptRegisters.Registers._PARAMS);

                    Slot.WorkFlowBtnChecked = false;
                    Slot.OnPropertychanged("ProgressPos");
                    Thread.Sleep(100);
                    PrevOperationMs += stopWatch.ElapsedMilliseconds;
                    Command          = rez_cmd;
                }

                break;
            }

            case NptCommand.СheckUp:
            {
                Slot.CheckUpColor = Brushes.Yellow;
                ExecuteRead(NptRegisters.Registers._PARAMS);
                GetRegisters().OnDeviceRegistersRead("PARAMS");
                // записываем настройки каибровки
                Slot.Log("Запись параметров калибровки", Brushes.Black);
                Slot.DevParamKey = GetRegisters().DEVTYPE;
                GetRegisters().SetCalibParams(Slot.CalibrateParam);
                LastIOResult = ExecuteWrite(NptRegisters.Registers._PARAMS);
                Slot.Log("Проверка", Brushes.Black);
                stopWatch.Restart();
                Slot.OnPropertychanged("ProgressPos");

                if (LastIOResult && !GetRegisters().ShowDeviceError)
                {
                    Command = NptCommand.WaitCheckUp;
                    break;
                }
                if (GetRegisters().ShowDeviceError)
                {
                    Slot.Log("Ошибка прибора, не удалось выполнить проверку", Brushes.Red);
                }
                else
                {
                    Slot.Log("Не удалось записать параметры калибровки", Brushes.Red);
                }
                Slot.Log("Восстановление параметров прибора", Brushes.Black);
                GetRegisters().RestoreParams();
                ExecuteWrite(NptRegisters.Registers._PARAMS);

                Slot.WorkFlowState      = WFState.Error;
                Slot.WorkFlowBtnChecked = false;
                Slot.CheckUpColor       = Brushes.Red;
                Command = NptCommand.ReadState;
                break;
            }

            case NptCommand.Calibrate:
            {
                Slot.CalibColor = Brushes.Yellow;
                Slot.Log("Калибровка", Brushes.Black);
                stopWatch.Restart();

                // считываем и сохраняем параметры
                ExecuteRead(NptRegisters.Registers._PARAMS);
                GetRegisters().OnDeviceRegistersRead("PARAMS");
                Slot.OnPropertychanged("ProgressPos");

                // записываем настройки каибровки
                Slot.DevParamKey = GetRegisters().DEVTYPE;
                GetRegisters().SetCalibParams(Slot.CalibrateParam);
                LastIOResult = ExecuteWrite(NptRegisters.Registers._PARAMS);
                Slot.OnPropertychanged("ProgressPos");

                if (LastIOResult)
                {
                    // входим в режим калибровки
                    GetRegisters().SetCalibEnterCmd();
                    ExecuteWrite(NptRegisters.Registers._CALIB_CMD);
                    Slot.OnPropertychanged("ProgressPos");

                    Thread.Sleep(500);
                    LastIOResult = ExecuteRead(NptRegisters.Registers._CALIB_REZULT);
                    Slot.OnPropertychanged("ProgressPos");

                    if (GetRegisters().GetCalibRezult() != 0)
                    {
                        Command = NptCommand.WaitCalibRez;
                        break;
                    }
                    else
                    {
                        Slot.Log("Ошибка перехода в режим калибровки (" + GetRegisters().GetCalibRezult() + ")", Brushes.Red);
                        GetRegisters().RestoreParams();
                        ExecuteWrite(NptRegisters.Registers._PARAMS);
                    }
                }
                else
                {
                    Slot.Log("Ошибка установки параметров калибровки", Brushes.Red);
                }
                Slot.CalibColor         = Brushes.Red;
                Slot.WorkFlowState      = WFState.Error;
                Slot.WorkFlowBtnChecked = false;
                Command = NptCommand.ReadState;
                break;
            }

            case NptCommand.WaitCalibRez:
            {
                LastIOResult = ExecuteRead(NptRegisters.Registers._CALIB_REZULT);
                Slot.OnPropertychanged("ProgressPos");
                WFState rez_state = Slot.WorkFlowState;
                if (!LastIOResult)
                {
                    Slot.Log("Ошибка чтения результатов калибровки", Brushes.Red);
                    Slot.CalibColor = Brushes.Red;
                    rez_state       = WFState.Error;
                }
                else
                {
                    if (GetRegisters().GetCalibRezult() == 100 + GetRegisters().CurrentCalibCommand)         // calib - oki
                    {
                        Slot.Log("Запись результатов калибровки", Brushes.Black);
                        GetRegisters().SetCalibCmd(50, 0);
                        ExecuteWrite(NptRegisters.Registers._CALIB_CMD);
                        Slot.CalibColor = Brushes.Green;
                        rez_state       = WFState.Oki;
                        Thread.Sleep(500);
                    }
                    else if (GetRegisters().GetCalibRezult() == 200 + GetRegisters().CurrentCalibCommand)         // calib - err
                    {
                        Slot.Log("Ошибка выполнения команды калибровки", Brushes.Black);
                        Slot.CalibColor = Brushes.Red;
                        rez_state       = WFState.Error;
                    }
                    else if (stopWatch.ElapsedMilliseconds > (1000 * TimesByOpearation[NptCommand.Calibrate]))         // истёк таймаут
                    {
                        Slot.Log("Истёк таймаут выполнения команды калибровки (" + GetRegisters().GetCalibRezult() + ")", Brushes.Black);
                        Slot.CalibColor = Brushes.Red;
                        rez_state       = WFState.Error;
                    }
                    else
                    {
                        break;         // ожидаем
                    }
                }


                //Slot.Log("Выход из режима калибровки", Brushes.Black);
                GetRegisters().SetCalibCmd(60, 0);
                ExecuteWrite(NptRegisters.Registers._CALIB_CMD);
                Slot.OnPropertychanged("ProgressPos");
                Thread.Sleep(500);
                Slot.Log("Восстановление параметров прибора", Brushes.Black);
                GetRegisters().RestoreParams();
                ExecuteWrite(NptRegisters.Registers._PARAMS);
                Slot.WorkFlowBtnChecked = false;
                Slot.WorkFlowState      = rez_state;
                Slot.OnPropertychanged("ProgressPos");
                Thread.Sleep(100);
                PrevOperationMs += stopWatch.ElapsedMilliseconds;
                Command          = WorkFlow.Count == 0 ? NptCommand.ReadState : WorkFlow.Dequeue();
                break;
            }

            case NptCommand.EndWorkFlow:
                WorkFlow.Clear();
                Command = NptCommand.ReadState;
                Slot.OnPropertychanged("ProgressPos");
                break;

            case NptCommand.StartWorkFlow:
            {
                if (Slot.CleanLogBeforeStart)
                {
                    Slot.CleanLog();
                }

                Slot.HeartColor   = Slot.BtnNothingColor;
                Slot.CheckUpColor = Slot.BtnNothingColor;
                Slot.CalibColor   = Slot.BtnNothingColor;
                Slot.WriteFactorySettingsColor = Slot.BtnNothingColor;
                WorkFlow.Clear();
                TotalTimes      = 0;
                PrevOperationMs = 0;
                if (Slot.UseWarmUp)
                {
                    TotalTimes += TimesByOpearation[NptCommand.WarmingUp];
                    WorkFlow.Enqueue(NptCommand.WarmingUp);
                }
                TotalTimes += TimesByOpearation[NptCommand.Calibrate];
                WorkFlow.Enqueue(NptCommand.Calibrate);
                TotalTimes += TimesByOpearation[NptCommand.СheckUp];
                WorkFlow.Enqueue(NptCommand.СheckUp);
                if (Slot.UseWriteFactorySettings)
                {
                    TotalTimes += TimesByOpearation[NptCommand.WriteFactorySettings];
                    WorkFlow.Enqueue(NptCommand.WriteFactorySettings);
                }
                WorkFlow.Enqueue(NptCommand.EndWorkFlow);

                TotalTimes = 1000 * (TotalTimes);
                Command    = WorkFlow.Count == 0 ? NptCommand.ReadState : WorkFlow.Dequeue();
                break;
            }

            case NptCommand.ReadState:
                LastIOResult = ExecuteRead(NptRegisters.Registers._STATE);
                Slot.OnPropertychanged("Tempr");
                break;
            }

            return(true);
        }
コード例 #34
0
        public override WFState Run()
        {
            WFState retval = new WFState();

            IPst rdopststore = null;
            try
            {
                retval.Value = WFState.WFStateFail;
                WFLogger.NLogger.Info("PSTFile={0}  NodeID={1}", this.PSTFile, this.FileToProcess);

                rdopststore = new Pst(this.PSTFile);

                Message rdomail = null;
                try
                {
                    NodeID msgid = Convert.ToUInt32(this.FileToProcess);
                    if (this.ParentMsg != "0")
                        msgid = Convert.ToUInt32(this.ParentMsg);

                    rdomail = (Message)rdopststore.OpenMessage(msgid); //this.EntryID);
                    rdomail.Pst = (Pst)rdopststore;
                    rdomail.FolderPath = this.FolderPath;
                    WFLogger.NLogger.Info("EntryID={0}", rdomail.EntryID.ToString());
                }
                catch (Exception ex)
                {
                    WFLogger.NLogger.ErrorException("ERROR: ProcessQueueObjectImplementation", ex);
                }
                if (rdomail != null)
                {
                    try
                    {
                        HandleMessage(rdomail, this.ExportDirectory);
                        this.ExportDirectory = this.ExportDirectory + @"\" + this.FileToProcess;
                        retval.Value = WFState.WFStateSuccess;
                    }
                    catch (Exception ex)
                    {
                        WFLogger.NLogger.ErrorException("ERROR: HandleMessage", ex);
                    }
                    rdomail.Dispose();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
            }
            finally
            {
                if (rdopststore != null)
                    rdopststore.Dispose();
            }

            return retval;
        }