public virtual CreateOrderCommandResponse CreateOrderCommand(CreateOrderCommandRequest request)
        {
            var response = new CreateOrderCommandResponse();

            try {
                // Raise Initialization Event
                var initialization = CreateOrderCommandInitialization;
                if (initialization != null)
                {
                    initialization(request, response);
                }
                // Raise Execute Event
                var execute = CreateOrderCommandExecute;
                if (execute != null)
                {
                    response = execute(request);
                }
                // Raise Complete Event
                var complete = CreateOrderCommandComplete;
                if (complete != null)
                {
                    complete(request, response);
                }
            }
            catch (Exception exception) {
                // Raise Error Event
                var error = CreateOrderCommandError;
                if (error != null)
                {
                    error(request, response, exception);
                }
            }
            return(response);
        }
Ejemplo n.º 2
0
        public Order CreateBudget(int budgetId, int paymentConditionCode)
        {
            this.UpdateBudgetPaymentCondition(budgetId, paymentConditionCode);

            var createOrderCommandResponse = new CreateOrderCommandResponse();

            createOrderCommandResponse = base._foccoErpApiCommands.CreateOrderCommand(new CreateOrderCommandRequest()
            {
                CreateOrderRequest = new CreateOrderRequest()
                {
                    BudgetId = budgetId
                }
            });

            if (!createOrderCommandResponse.Success)
            {
                throw createOrderCommandResponse.Exception;
            }

            if (createOrderCommandResponse.CreateOrderResponse == null || createOrderCommandResponse.CreateOrderResponse.Order == null)
            {
                throw new Exception("Erro ao criar pedido");
            }


            return(createOrderCommandResponse.CreateOrderResponse.Order);
        }
Ejemplo n.º 3
0
        public override CreateOrderCommandResponse OnCreateOrderCommandExecute(CreateOrderCommandRequest request)
        {
            var response = new CreateOrderCommandResponse();

            try
            {
                response.CreateOrderResponse = _apiCommands.ApiCreateOrder(request.CreateOrderRequest);
            }
            catch (Exception ex)
            {
                response.Exception = ex;
                response.Message   = ex.Message;
            }
            return(response);
        }