コード例 #1
0
ファイル: ProjectBLL.cs プロジェクト: franknew/RiskMgr
        public bool StopWorkflow(string workflowid, string userid)
        {
            WorkflowModel workflow = WorkflowModel.Load(workflowid);

            workflow.Stop(userid);
            return(true);
        }
コード例 #2
0
ファイル: Index.cs プロジェクト: franknew/RiskMgr
        private void button14_Click(object sender, EventArgs e)
        {
            string id       = textBox1.Text;
            string userid   = "9";
            var    workflow = WorkflowModel.Load(id);
            //如果流程当前处理人等于申请人,就直接审批通过,进入下一个流程
            var task = workflow.CurrentActivity.Tasks.Find(t => t.UserID == userid && t.Status == (int)TaskProcessStatus.Started);

            if (task != null)
            {
                workflow.ProcessActivity(new Approval
                {
                    Creator     = userid,
                    LastUpdator = userid,
                    Remark      = "111",
                    Status      = (int)ApprovalStatus.Agree,
                    ActivityID  = workflow.CurrentActivity.Value.ID,
                    WorkflowID  = workflow.Value.ID,
                }, userid, new WorkflowAuthority());
                task = workflow.CurrentActivity.Tasks.Find(t => t.UserID == userid && t.Status == (int)TaskProcessStatus.Started);
                if (task != null)
                {
                    workflow.ProcessActivity(new Approval
                    {
                        Creator     = userid,
                        LastUpdator = userid,
                        Remark      = "1222",
                        Status      = (int)ApprovalStatus.Agree,
                        ActivityID  = workflow.CurrentActivity.Value.ID,
                        WorkflowID  = workflow.Value.ID,
                    }, userid, new WorkflowAuthority());
                }
            }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: franknew/DreamWorkFlow
        private void button1_Click(object sender, EventArgs e)
        {
            WorkflowDao dao = new WorkflowDao();
            var         wf  = new WorkflowQueryForm();

            wf.ID = "1c74c3e0ce2d4c5f983fab3dc6063223";
            var list = dao.Query(wf);

            WorkflowModel model = WorkflowModel.Load("1c74c3e0ce2d4c5f983fab3dc6063223");
        }
コード例 #4
0
ファイル: WorkflowBLL.cs プロジェクト: franknew/RiskMgr
        public bool Approval(string workflowid, string userid, Approval approval)
        {
            WorkflowModel workflow = WorkflowModel.Load(workflowid);

            //var userids = Common.GetDataAuthorityUserIDList();
            //if (userids != null && userids.Exists(t => t.Equals(workflow.Value.Creator))) throw new Exception("该单据不是你用户组的人员创建,你没有权限审批!");
            if (!workflow.CanUserProcess(userid))
            {
                return(true);
            }
            workflow.ProcessActivity(approval, userid, new WorkflowAuthority());
            return(true);
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: franknew/DreamWorkFlow
        private void button10_Click(object sender, EventArgs e)
        {
            RiskMgr.Model.Menu m          = new RiskMgr.Model.Menu();
            string             workflowid = txbworkflowid.Text;
            string             activityid = txbactivityid.Text;
            string             taskid     = txbtaskid.Text;
            var workflow = WorkflowModel.Load(workflowid);

            workflow.ProcessActivity(new Approval
            {
                ActivityID = activityid,
                WorkflowID = workflow.Value.ID,
                //Type = (int)ApprovalStatus.Agree,
                Status = (int)ApprovalStatus.Disagree,
                Remark = "不同意",
            }, "1", new GetUser()
                                     );
        }
コード例 #6
0
ファイル: ProjectBLL.cs プロジェクト: franknew/RiskMgr
        public bool UpdateFinance(string workflowid, Project project, string userid)
        {
            ISqlMapper mapper = Common.GetMapperFromSession();

            this.UpdateFinance(project);
            UserBLL userbll = new UserBLL();

            if (string.IsNullOrEmpty(workflowid))
            {
                return(true);
            }
            WorkflowModel model = WorkflowModel.Load(workflowid);

            if (!model.CanUserProcess(userid))
            {
                return(true);
            }
            model.ProcessActivity(new Approval {
                Status = (int)ApprovalStatus.None
            }, userid, new WorkflowAuthority());
            return(true);
        }
コード例 #7
0
ファイル: ProjectBLL.cs プロジェクト: franknew/RiskMgr
        public bool UpdateTracking(UpdateTrackingServiceForm project, string workflowid, string userid)
        {
            if (project == null || string.IsNullOrEmpty(project.ID))
            {
                throw new Exception("上传数据有误,缺少ID或者Form");
            }
            ISqlMapper             mapper = Common.GetMapperFromSession();
            ProjectDao             dao    = new ProjectDao(mapper);
            TrackingMortgageDao    tmdao  = new TrackingMortgageDao(mapper);
            TrackingChangeOwnerDao tcodao = new TrackingChangeOwnerDao(mapper);

            dao.Update(new ProjectUpdateForm
            {
                Entity = new Project
                {
                    LogoutAssetTime      = project.LogoutAssetTime,
                    PickNewAssetCodeTime = project.PickNewAssetCodeTime,
                    MortgageRemark       = project.MortgageRemark,
                },
                ProjectQueryForm = new ProjectQueryForm {
                    ID = project.ID
                },
            });

            //过户信息处理
            TrackingChangeOwner tco = new TrackingChangeOwner
            {
                ProjectID = project.ID,
                ChangeOwnerProfileCode = project.ChangeOwnerProfileCode,
                ChangeOwnerRemark      = project.ChangeOwnerRemark,
                ChangeOwnerProfileTime = project.ChangeOwnerProfileTime,
                NewAssetCode           = project.NewAssetCode,
                NewAssetDate           = project.NewAssetDate,
            };
            TrackingChangeOwner tcoowner = tcodao.Query(new TrackingChangeOwnerQueryForm {
                ProjectID = project.ID
            }).FirstOrDefault();

            if (tcoowner == null)
            {
                tco.Creator = project.LastUpdator;
                tcodao.Add(tco);
            }
            else
            {
                tco.LastUpdator = project.LastUpdator;
                tcodao.Update(new TrackingChangeOwnerUpdateForm
                {
                    Entity = tco,
                    TrackingChangeOwnerQueryForm = new TrackingChangeOwnerQueryForm {
                        ID = tcoowner.ID
                    },
                });
            }
            TrackingMortgage tm = new TrackingMortgage
            {
                MortgageFeedbackCode = project.MortgageFeedbackCode,
                ProjectID            = project.ID,
                MortgageOverTime     = project.MortgageOverTime,
                MortgagePredictTime  = project.MortgagePredictTime,
            };
            //借贷信息处理
            var tmmodel = tmdao.Query(new TrackingMortgageQueryForm {
                ProjectID = project.ID
            }).FirstOrDefault();

            if (tmmodel == null)
            {
                tm.Creator = project.LastUpdator;
                tmdao.Add(tm);
            }
            else
            {
                tm.LastUpdator = project.LastUpdator;
                tmdao.Update(new TrackingMortgageUpdateForm
                {
                    Entity = tm,
                    TrackingMortgageQueryForm = new TrackingMortgageQueryForm {
                        ID = tmmodel.ID
                    },
                });
            }
            WorkflowModel model = WorkflowModel.Load(workflowid);

            if (!model.CanUserProcess(userid))
            {
                return(true);
            }
            model.ProcessActivity(new Approval {
                Status = (int)ApprovalStatus.None
            }, userid, new WorkflowAuthority());
            return(true);
        }
コード例 #8
0
ファイル: Form1.cs プロジェクト: franknew/DreamWorkFlow
 private void button8_Click(object sender, EventArgs e)
 {
     var workflow = WorkflowModel.Load("66c728aa03bb4f8aa6f26b43c705e70f");
 }
コード例 #9
0
ファイル: Index.cs プロジェクト: franknew/RiskMgr
 private void button23_Click(object sender, EventArgs e)
 {
     WorkflowModel model = WorkflowModel.Load("1c74c3e0ce2d4c5f983fab3dc6063223");
     var           task  = model.GetUserProcessingTask("7");
 }
コード例 #10
0
ファイル: ProjectApi.cs プロジェクト: franknew/RiskMgr
        public string Add(AddProjectServiceForm form)
        {
            ISqlMapper mapper = Common.GetMapperFromSession();
            List <Customer_Project> customers       = new List <Customer_Project>();
            List <Customer>         updateCustomers = new List <Customer>();
            WorkflowDao             workflowdao     = new WorkflowDao(mapper);
            UserBLL userbll = new UserBLL();
            var     user    = userbll.GetCurrentUser();
            string  userid  = user.User.ID;

            form.Project.Report = form.Report;
            var result = bll.Save(form.Project, form.Assets, form.Buyers, form.Sellers, form.ThirdParty, form.Guarantor, form.Project.CreditReceiverInfo, userid);

            //处理流程
            WorkflowDefinitionModel wfdm = WorkflowDefinitionModel.LoadByName("额度申请");
            Workflow wf = workflowdao.Query(new WorkflowQueryForm {
                ProcessID = result
            }).FirstOrDefault();
            WorkflowModel workflow = null;

            if (wf == null)
            {
                workflow = wfdm.StartNew(user.User.ID, result, new WorkflowAuthority());
                //如果流程当前处理人等于申请人,就直接审批通过,进入下一个流程
                var task = workflow.CurrentActivity.Tasks.Find(t => t.UserID == userid);
                if (task != null)
                {
                    workflow.ProcessActivity(new Approval
                    {
                        Creator     = user.User.ID,
                        LastUpdator = user.User.ID,
                        Remark      = form.Report,
                        Status      = (int)ApprovalStatus.Agree,
                        ActivityID  = workflow.CurrentActivity.Value.ID,
                        WorkflowID  = workflow.Value.ID,
                    }, user.User.ID, new WorkflowAuthority());
                }
            }
            else
            {
                workflow = WorkflowModel.Load(wf.ID);
                //如果流程当前处理人等于申请人,就直接审批通过,进入下一个流程
                var task = workflow.CurrentActivity.Tasks.Find(t => t.UserID == userid);
                if (task != null)
                {
                    workflow.ProcessActivity(new Approval
                    {
                        Creator     = user.User.ID,
                        LastUpdator = user.User.ID,
                        Status      = (int)ApprovalStatus.None,
                        ActivityID  = workflow.CurrentActivity.Value.ID,
                        WorkflowID  = workflow.Value.ID,
                    }, user.User.ID, new WorkflowAuthority());
                    task = workflow.CurrentActivity.Tasks.Find(t => t.UserID == userid);
                    if (task != null)
                    {
                        workflow.ProcessActivity(new Approval
                        {
                            Creator     = user.User.ID,
                            LastUpdator = user.User.ID,
                            Remark      = form.Report,
                            Status      = (int)ApprovalStatus.Agree,
                            ActivityID  = workflow.CurrentActivity.Value.ID,
                            WorkflowID  = workflow.Value.ID,
                        }, user.User.ID, new WorkflowAuthority());
                    }
                }
            }

            return(result);
        }