Exemplo n.º 1
0
        public string Save(AddProjectServiceForm form)
        {
            UserBLL userbll = new UserBLL();
            var     user    = userbll.GetCurrentUser();
            string  userid  = user.User.ID;

            form.Project.Report = form.Report;
            return(bll.Save(form.Project, form.Assets, form.Buyers, form.Sellers, form.ThirdParty, form.Guarantor, form.Project.CreditReceiverInfo, userid));
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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;
        }
Exemplo n.º 4
0
 public string Save(AddProjectServiceForm form)
 {
     UserBLL userbll = new UserBLL();
     var user = userbll.GetCurrentUser();
     string userid = user.User.ID;
     form.Project.Report = form.Report;
     return bll.Save(form.Project, form.Assets, form.Buyers, form.Sellers, form.ThirdParty, form.Guarantor, form.Project.CreditReceiverInfo, userid);
 }