Esempio n. 1
0
        public void TempWorkflow(TempWorkflowDocumentInput input)
        {
            var isNeedSendNotif = true;

            switch (input.ActionType)
            {
            case Enums.ActionType.Created:
                CreateDocument(input);
                isNeedSendNotif = false;
                break;

            case Enums.ActionType.Submit:
                SubmitDocument(input);
                break;

            case Enums.ActionType.Cancel:
                CancelDocument(input);
                var _checkDocDraft = _workflowService.GetWorkflowHistoryByUser((int)Enums.MenuList.TraTmp, input.UserId)
                                     .Where(x => x.ACTION == (int)Enums.ActionType.Submit && x.FORM_ID == input.DocumentId).FirstOrDefault();

                if (_checkDocDraft == null)
                {
                    isNeedSendNotif = false;
                }

                break;

            case Enums.ActionType.Approve:
                ApproveDocument(input);
                break;

            case Enums.ActionType.Reject:
                RejectDocument(input);
                break;

            case Enums.ActionType.Completed:
                CompleteDocument(input);
                break;
            }

            //todo sent mail
            if (isNeedSendNotif)
            {
                SendEmailWorkflow(input);
            }

            _uow.SaveChanges();
        }
Esempio n. 2
0
        public List <TraCafDto> GetCafPersonal(Login CurrentUser)
        {
            var allData = this.GetCaf();
            var data    = allData.Where(x => x.IsActive && (x.EmployeeId == CurrentUser.EMPLOYEE_ID ||
                                                            x.CreatedBy == CurrentUser.USER_ID)).ToList();

            var dataIds      = data.Select(x => x.TraCafId).ToList();
            var dataWorkflow = _workflowService.GetWorkflowHistoryByUser((int)Enums.DocumentType.CAF, CurrentUser.USER_ID);
            var formIdList   = dataWorkflow.Where(x => x.FORM_ID != null && !dataIds.Contains(x.FORM_ID.Value)).GroupBy(x => x.FORM_ID).Select(x => x.Key).ToList();


            var myWorkflowData = allData.Where(x => formIdList.Contains(x.TraCafId)).ToList();

            data.AddRange(myWorkflowData);
            return(data);
        }
Esempio n. 3
0
        public List <TraCrfDto> GetCrfPersonal(Login CurrentUser)
        {
            var allData = this.GetList();
            var data    = allData.Where(x => x.IS_ACTIVE &&
                                        (x.EMPLOYEE_ID == CurrentUser.EMPLOYEE_ID ||
                                         x.CREATED_BY == CurrentUser.USER_ID)).ToList();

            var dataIds      = data.Select(x => x.TRA_CRF_ID).ToList();
            var dataWorkflow = _workflowService.GetWorkflowHistoryByUser((int)Enums.DocumentType.CRF, CurrentUser.USER_ID);
            var formIdList   = dataWorkflow.Where(x => x.FORM_ID != null && !dataIds.Contains(x.FORM_ID.Value)).GroupBy(x => x.FORM_ID).Select(x => x.Key).ToList();


            var myWorkflowData = allData.Where(x => formIdList.Contains(x.TRA_CRF_ID)).ToList();

            data.AddRange(myWorkflowData);
            return(data);
        }