public override CreateOrderResponse OnCreateOrderExecute(CreateOrderRequest request) { var budgetFactory = new BudgetFactory(); var response = new CreateOrderResponse(); try { var budget = budgetFactory.CreateBudget(request.Items, request.ClientCode, request.CnpjCpf, false, false); if (budget.Items != null && budget.Items.Any()) { response.Order = budgetFactory.CreateBudget(budget.Items.FirstOrDefault().BudgetId, request.PaymentConditionCode); } else { throw new Exception("Nenhum item foi criado no orçamento"); } } catch (Exception ex) { response.Exception = ex; response.Message = ex.Message; } return(response); }
public override CreateBudgetResponse OnCreateBudgetExecute(CreateBudgetRequest request) { var budgetFactory = new BudgetFactory(); var response = new CreateBudgetResponse(); try { response.CreateBudget = budgetFactory.CreateBudget(request.Items, request.ClientCode, request.CnpjCpf, false, false); } catch (Exception ex) { response.Exception = ex; response.Message = ex.Message; } return(response); }
public override ListPricesResponse OnListPricesExecute(ListPricesRequest request) { var budgetFactory = new BudgetFactory(); var response = new ListPricesResponse(); try { response.ListPrices = budgetFactory.CreateBudget(request.Items, request.ClientCode, request.CnpjCpf, true, true); } catch (Exception ex) { response.Exception = ex; response.Message = ex.Message; } return(response); }
public void SetUp() { _budgetFactory = new BudgetFactory(); }
/// <summary> /// Add (create) a new budget /// </summary> /// <param name="command">Create new budget command</param> /// <param name="unitOfWork">The event transaction for unpublished events</param> public void Handle(AddBudgetCommand command, IUnitOfWork unitOfWork) { var newBudget = BudgetFactory.Create(command.Id, command.Name, command.CurrencyCode, unitOfWork); }