public ApprovmentVM(IFuelController mainController, IApprovalFlowServiceWrapper serviceWrapper) : this() { this.mainController = mainController; this.serviceWrapper = serviceWrapper; Entity = new ApprovmentDto(); DisplayName = "تایید/لغو عملیات "; this.RequestClose += ApprovmentVM_RequestClose; }
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); }
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; }
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; }