public DestinationPresenter(IDestinationView view, ProductModel selectedProduct) { _view = view; SelectedProduct = selectedProduct; _destinationMapper = new DestinationMapper(); _transportMapper = new TransportMapper(); _productMapper = new ProductMapper(); _orderMapper = new OrderMapper(); _orderStatusMapper = new OrderStatusMapper(); _unitOfWork = new UnitOfWork(new ApplicationContext()); destinationService = new DestinationService(_unitOfWork); transportService = new TransportService(_unitOfWork); orderService = new OrderService(_unitOfWork); OrderStatusService = new OrderStatusService(_unitOfWork); destinations = destinationService.GetAllDestinations().Select(dest => _destinationMapper.FromDomainToModel(dest)).ToList(); _view.DisplayData(destinations); _view.DestinationSelected += BeginOrderCreation; }
private bool OrderStatusChangedTo(string targetStatus) { string newStatus = OrderStatusMapper.ToEnglish(OrderStatusCombo.Text); return(order.Status != newStatus && newStatus == targetStatus); }
private void Save(object sender, RoutedEventArgs e) { if (OrderStatusChangedTo("Delivered")) { order.DeliveryDate = DateTime.Now; } order.Status = OrderStatusMapper.ToEnglish(OrderStatusCombo.Text); order.PaymentStatus = PaymentStatusMapper.ToEnglish(PaymentStatusCombo.Text); this.controller.Update(order); this.Close(); }
public OrderView(Order order) : this() { this.order = order; order.SetAccount(new AccountService().GetAccount(order.AccountId)); InitializeComponent(); LoadAvaiableFieldValues(); if (OrderIsCancelled(order)) { DisableCombosAndButtons(); } PizzaListView.ItemsSource = order.GetPizzas(); BeverageListView.ItemsSource = order.GetBeverages(); TotalPriceLabel.Content = order.GetTotalPrice(); OrderStatusCombo.SelectedItem = OrderStatusMapper.ToPortuguese(order.Status); PaymentStatusCombo.SelectedItem = PaymentStatusMapper.ToPortuguese(order.PaymentStatus); }
public OrderStatusService(IUnitOfWork unitOfWork) { _unitOfWork = unitOfWork; _orderStatusMapper = new OrderStatusMapper(); }