示例#1
0
        public JsonResult SelMyApproval(ApprovalTask _param)
        {
            List <Person> persons   = PersonRepository.SelPersons(new Person {
            });
            List <BPolicy> policies = BPolicyRepository.SelBPolicy(new BPolicy {
                Type = CommonConstant.TYPE_APPROVAL_TASK
            });
            List <ApprovalTask> myApproval = new List <ApprovalTask>();

            DaoFactory.GetList <ApprovalTask>("Comm.SelMyApprovalTask", _param).ForEach(approv =>
            {
                approv.PersonObj       = persons.Find(person => person.OID == approv.PersonOID);
                approv.PersonNm        = approv.PersonObj.Name;
                approv.DepartmentNm    = approv.PersonObj.DepartmentNm;
                approv.BPolicy         = policies.Find(policy => policy.OID == approv.BPolicyOID);
                approv.ApprovalBPolicy = DObjectRepository.SelDObject(new DObject {
                    OID = approv.ApprovalOID
                }).BPolicy;
                if (approv.BPolicy.Name == approv.ApprovalBPolicy.Name)
                {
                    myApproval.Add(approv);
                }
            });
            return(Json(myApproval));
        }
示例#2
0
 public ActionResult ApprovalContent(ApprovalTask _param)
 {
     ViewBag.ApprvalData = ApprovalRepository.SelApproval(new Approval {
         OID = _param.ApprovalOID
     });
     return(PartialView("Dialog/dlgApprovalContent"));
 }
示例#3
0
        public void CreateTasksForNewCreditApplication(CreditApplication creditApplication)
        {
            ApprovalTask task = CreateApprovalTask(creditApplication, ApprovalType.CreditCommittee,
                                                   TaskNames.ApprovalFromCreditCommittee);

            unitOfWork.GetRepository <ApprovalTask>().InsertOrUpdate(task);
            task = CreateApprovalTask(creditApplication, ApprovalType.RiskManagment,
                                      TaskNames.ApprovalFromRiskManager);
            unitOfWork.GetRepository <ApprovalTask>().InsertOrUpdate(task);
            task = CreateApprovalTask(creditApplication, ApprovalType.SecurityService,
                                      TaskNames.ApprovalFromSecurityService);
            unitOfWork.GetRepository <ApprovalTask>().InsertOrUpdate(task);
            unitOfWork.Commit();
        }
        public CommandResponse CreateApprovalTaskFromProcess(TaskApprovmentRequest request)
        {
            var approvalManagerId = request.ManagerId;
            var taskActivity      = GetById(request.HumanResourcesRequestId);

            var approvalTask = new ApprovalTask
            {
                TaskActivity = taskActivity,
                Approver     = approvalManagerId,
                Created      = DateTime.Now
            };

            _repository.ApprovalTasks.Add(approvalTask);
            var count    = _repository.SaveChanges();
            var response = new CommandResponse(Guid.Empty, count > 0, approvalTask.Id);

            return(response);
        }
示例#5
0
        private void CreateFinalApprovalTask(CompletionTaskContext context)
        {
            var finalTask = new ApprovalTask
            {
                CreditApplicationId = context.TaskForComplete.CreditApplicationId,
                ApprovalType        = ApprovalType.Fianl,
                DispalyText         = TaskNames.FinalApproval,
                CreateDate          = DateTime.Now,
                Status          = TaskStatus.New,
                CompleteDate    = null,
                Outcome         = null,
                RejectionReason = null,
                UserId          = null,
            };

            unitOfWork.GetRepository <ApprovalTask>().InsertOrUpdate(finalTask);
            unitOfWork.Commit();
        }
示例#6
0
        public JsonResult PromoteApprovalTask(ApprovalTask _param)
        {
            try
            {
                DaoFactory.BeginTransaction();
                DObjectRepository.StatusPromote(false, CommonConstant.TYPE_APPROVAL_TASK, Convert.ToString(_param.BPolicyOID), Convert.ToInt32(_param.OID), Convert.ToInt32(_param.OID), _param.ActionType, "");
                ApprovalTaskRepository.UdtInboxTask(new ApprovalTask {
                    ActionType = _param.ActionType, Comment = _param.Comment, OID = _param.OID
                });

                if (_param.ActionType == CommonConstant.ACTION_REJECT)
                {
                    Approval tmpApproval = ApprovalRepository.SelApprovalNonStep(new Approval {
                        OID = _param.ApprovalOID
                    });
                    DObjectRepository.StatusPromote(false, CommonConstant.TYPE_APPROVAL, Convert.ToString(tmpApproval.BPolicyOID), Convert.ToInt32(tmpApproval.OID), Convert.ToInt32(tmpApproval.OID), _param.ActionType, "");

                    DObject targetDobj = DObjectRepository.SelDObject(new DObject {
                        OID = tmpApproval.TargetOID
                    });
                    DObjectRepository.StatusPromote(false, targetDobj.Type, Convert.ToString(targetDobj.BPolicyOID), Convert.ToInt32(targetDobj.OID), Convert.ToInt32(targetDobj.OID), _param.ActionType, "");
                    DaoFactory.Commit();
                    return(Json(CommonConstant.RETURN_SUCCESS));
                }

                bool         allSuccess      = true;
                ApprovalStep tmpApprovalStep = ApprovalStepRepository.SelApprovalStep(new ApprovalStep {
                    OID = _param.StepOID
                });
                tmpApprovalStep.InboxTask.ForEach(task =>
                {
                    if (task.BPolicy.Name != CommonConstant.POLICY_APPROVAL_COMPLETED)
                    {
                        allSuccess = false;
                    }
                });

                if (allSuccess)
                {
                    Approval tmpApproval = ApprovalRepository.SelApprovalNonStep(new Approval {
                        OID = _param.ApprovalOID
                    });
                    int cntCurrent = Convert.ToInt32(tmpApproval.CurrentNum);
                    cntCurrent += 1;
                    if (tmpApproval.ApprovalCount >= cntCurrent)
                    {
                        ApprovalRepository.UdtApproval(new Approval {
                            CurrentNum = cntCurrent, OID = tmpApproval.OID
                        });
                        ApprovalRepository.SelApproval(new Approval {
                            OID = tmpApproval.OID
                        }).InboxStep.Find(step => step.Ord == cntCurrent).InboxTask.ForEach(task =>
                        {
                            DObjectRepository.StatusPromote(false, CommonConstant.TYPE_APPROVAL_TASK, Convert.ToString(task.BPolicyOID), Convert.ToInt32(task.OID), Convert.ToInt32(task.OID), _param.ActionType, "");
                        });
                    }
                    else if (tmpApproval.ApprovalCount < cntCurrent)
                    {
                        ApprovalRepository.UdtApproval(new Approval {
                            CurrentNum = cntCurrent, OID = tmpApproval.OID
                        });
                        DObjectRepository.StatusPromote(false, CommonConstant.TYPE_APPROVAL, Convert.ToString(tmpApproval.BPolicyOID), Convert.ToInt32(tmpApproval.OID), Convert.ToInt32(tmpApproval.OID), _param.ActionType, "");

                        DObject targetDobj = DObjectRepository.SelDObject(new DObject {
                            OID = tmpApproval.TargetOID
                        });
                        DObjectRepository.StatusPromote(false, targetDobj.Type, Convert.ToString(targetDobj.BPolicyOID), Convert.ToInt32(targetDobj.OID), Convert.ToInt32(targetDobj.OID), _param.ActionType, "");
                    }
                }
                DaoFactory.Commit();
            }
            catch (Exception ex)
            {
                DaoFactory.Rollback();
                return(Json(new ResultJsonModel {
                    isError = true, resultMessage = ex.Message, resultDescription = ex.ToString()
                }));
            }
            return(Json(CommonConstant.RETURN_SUCCESS));
        }