コード例 #1
0
ファイル: ApprovmentVM.cs プロジェクト: hatefi-arman/Modules
        public ApprovmentVM(IFuelController mainController, IApprovalFlowServiceWrapper serviceWrapper)
            : this()
        {
            this.mainController = mainController;
            this.serviceWrapper = serviceWrapper;
            Entity = new ApprovmentDto();
            DisplayName = "تایید/لغو عملیات ";

            this.RequestClose += ApprovmentVM_RequestClose;
        }
コード例 #2
0
        public void ActRejectFlow(Action<ApprovmentDto, Exception> action, long entityId, ActionEntityTypeEnum entityTypeId)
        {
            var url = string.Format(approvalFlowAddressStringFormat, entityId);
            var ent = new ApprovmentDto
                          {
                              EntityId = entityId,
                              DecisionType = DecisionTypeEnum.Rejected,
                              ActionEntityType = entityTypeId
                          };

            WebClientHelper.Put<ApprovmentDto, ApprovmentDto>(new Uri(url, UriKind.Absolute),
                                                       (res, exp) => action(res, exp), ent,
                                                       WebClientHelper.MessageFormat.Json, ApiConfig.Headers);
        }
コード例 #3
0
 private static WorkflowActions MapDesicionToAction(ApprovmentDto entity)
 {
     WorkflowActions action;
     switch (entity.DecisionType)
     {
         case DecisionTypeEnum.Approved:
             action = WorkflowActions.Approve;
             break;
         case DecisionTypeEnum.Rejected:
             action = WorkflowActions.Reject;
             break;
         case DecisionTypeEnum.Canceled:
             action = WorkflowActions.Cancel;
             break;
         default:
             throw new ArgumentOutOfRangeException();
     }
     return action;
 }
コード例 #4
0
        public ApprovmentDto ActApprovalFlow(ApprovmentDto entity)
        {
            var result = approvalFlowAppService.ActApprovalFlow(entity.EntityId,
                (WorkflowEntities)(int)entity.ActionEntityType,
                entity.ActorId,
                entity.Remark,
                MapDesicionToAction(entity)
                );

            var retVal = new ApprovmentDto
                {
                    EntityId = result.EntityId,
                    ActorId = result.ActorId,
                    ActionType = MapEntityActionTypeToDtoActionType(result.WorkflowAction),
                    ActionEntityType = (ActionEntityTypeEnum)(int)result.Entity,
                    DecisionType = (DecisionTypeEnum)(int)result.DecisionType,
                    Remark = entity.Remark
                };
            return retVal;
        }