Exemplo n.º 1
0
        public int SaveProgress(TraCafProgressDto traCafProgressDto, string sirsNumber, BusinessObject.Business.Login CurrentUser)
        {
            var data = Mapper.Map <TRA_CAF_PROGRESS>(traCafProgressDto);

            data.CREATED_BY   = CurrentUser.USER_ID;
            data.CREATED_DATE = DateTime.Now;

            var caf          = _CafService.GetCafByNumber(sirsNumber);
            var lastStatus   = caf.DOCUMENT_STATUS;
            var countDetails = _CafService.SaveProgress(data, sirsNumber, CurrentUser);

            if (lastStatus != data.STATUS_ID)
            {
                if (countDetails == 0)
                {
                    _workflowService.Save(new WorkflowHistoryDto()
                    {
                        ACTION      = Enums.ActionType.Modified,
                        ACTION_DATE = DateTime.Now,
                        ACTION_BY   = CurrentUser.USER_ID,
                        FORM_ID     = caf.TRA_CAF_ID,
                        MODUL_ID    = Enums.MenuList.TraCaf
                    });
                    _uow.SaveChanges();
                }


                caf.DOCUMENT_STATUS = data.STATUS_ID.HasValue ? data.STATUS_ID.Value : caf.DOCUMENT_STATUS;


                var dataCaf = Mapper.Map <TraCafDto>(caf);
                SendEmailWorkflow(dataCaf, Enums.ActionType.Submit);
            }
            return(lastStatus);
        }
Exemplo n.º 2
0
        private void AddWorkflowHistory(TraCrfDto input, Login currentUserLogin, Enums.ActionType action, int?RemarkId)
        {
            var dbData = new WorkflowHistoryDto();

            dbData.ACTION_BY   = currentUserLogin.USER_ID;
            dbData.FORM_ID     = input.TRA_CRF_ID;
            dbData.MODUL_ID    = Enums.MenuList.TraCrf;
            dbData.REMARK_ID   = RemarkId;
            dbData.ACTION_DATE = DateTime.Now;
            dbData.ACTION      = action;
            dbData.REMARK_ID   = RemarkId;

            switch (input.DOCUMENT_STATUS)
            {
            case (int)Enums.DocumentStatus.AssignedForUser:
                SendEmailWorkflow(input, Enums.ActionType.Submit);
                break;

            case (int)Enums.DocumentStatus.WaitingHRApproval:
                if (action == Enums.ActionType.Approve)
                {
                    SendEmailWorkflow(input, Enums.ActionType.Approve);
                }
                else if (action == Enums.ActionType.Submit)
                {
                    SendEmailWorkflow(input, Enums.ActionType.Approve);
                }
                else
                {
                    SendEmailWorkflow(input, Enums.ActionType.Reject);
                }

                break;

            case (int)Enums.DocumentStatus.WaitingFleetApproval:
                if (action == Enums.ActionType.Approve)
                {
                    SendEmailWorkflow(input, Enums.ActionType.Approve);
                }
                else if (action == Enums.ActionType.Submit)
                {
                    SendEmailWorkflow(input, Enums.ActionType.Approve);
                }
                else
                {
                    SendEmailWorkflow(input, Enums.ActionType.Reject);
                }
                break;

            case (int)Enums.DocumentStatus.InProgress:
                SendEmailWorkflow(input, Enums.ActionType.Approve);
                break;
            }

            _workflowService.Save(dbData);
        }
Exemplo n.º 3
0
        private void AddWorkflowHistory(TempWorkflowDocumentInput input)
        {
            var dbData = Mapper.Map <WorkflowHistoryDto>(input);

            dbData.ACTION_DATE = DateTime.Now;
            dbData.MODUL_ID    = Enums.MenuList.TraTmp;
            dbData.REMARK_ID   = null;

            _workflowService.Save(dbData);
        }