Example #1
0
        public bool FinanceConfirmAction(string projectid, string userid)
        {
            ISqlMapper mapper = Common.GetMapperFromSession();
            //处理流程
            WorkflowModel model = WorkflowModel.LoadByProcessID(projectid);

            model.ProcessActivity(new Approval {
                Status = (int)ApprovalStatus.None
            }, userid, new WorkflowAuthority());
            TaskDao taskdao = new TaskDao(mapper);

            taskdao.Update(new TaskUpdateForm
            {
                Entity = new Task
                {
                    Status      = (int)TaskProcessStatus.Processed,
                    LastUpdator = userid,
                },
                TaskQueryForm = new TaskQueryForm
                {
                    WorkflowID = model.Value.ID,
                    Status     = (int)TaskProcessStatus.Started,
                }
            });
            return(true);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }
Example #5
0
        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);
        }