private void SelectOrders(string searchText, int startRowIndex, int maximumRows)
        {
            if (!string.IsNullOrEmpty(searchText))
            {
                int ordersTotalCount;
                ICollection <Order> orders = _ordersService.SearchOrders(searchText, startRowIndex, maximumRows, out ordersTotalCount);

                ICollection <OrderInfo> ordersInfo = new Collection <OrderInfo>();
                foreach (Order order in orders)
                {
                    OrderInfo info = _ordersConverter.ConvertBusinessToPresentation(order);
                    ordersInfo.Add(info);
                }

                View.ShowOrders(ordersInfo);
                View.TotalOrdersCount = ordersTotalCount;
                View.ShowPagesCounters();
                View.ShowSearchText(searchText);
            }
            else
            {
                View.ShowOrders(new Collection <OrderInfo>());
                View.TotalOrdersCount = 0;
                View.HidePagesPanel();
            }
        }
Exemplo n.º 2
0
        private void LoadApprovers()
        {
            ICollection <Employee>  _employees = _employeeService.AllApprovers;
            IList <EmployeeDisplay> _approvers = new Collection <EmployeeDisplay>();

            foreach (Employee employee in _employees)
            {
                _approvers.Add(_employeeConverter.ConvertBusinessToPresentation(employee));
            }

            View.LoadApproversList(_approvers);
        }
Exemplo n.º 3
0
        public void OnShowOrder(Order order)
        {
            OrderInfo            orderInfo = _ordersConverter.ConvertBusinessToPresentation(order);
            List <OrderItemLine> lines     = new List <OrderItemLine>();

            foreach (OrderDetail detail in order.Details)
            {
                OrderItemLine orderItemLine = _orderDetailsConverter.ConvertBusinessToPresentation(detail);
                lines.Add(orderItemLine);
            }
            View.ShowOrderInfo(orderInfo, lines);
        }
Exemplo n.º 4
0
        public override void OnViewInitialized()
        {
            ICollection <OrderDetail> details = _controller.CurrentOrder.Details;
            List <OrderItemLine>      lines   = new List <OrderItemLine>();

            foreach (OrderDetail detail in details)
            {
                OrderItemLine orderItemLine = _orderDetailsConverter.ConvertBusinessToPresentation(detail);
                UpdateOrderLineTotalPrice(orderItemLine);
                lines.Add(orderItemLine);
            }
            View.ShowOrderItemLines(lines);
        }
        private void LoadOrdersForCurrentApprover()
        {
            string employeeId = this.CurrentEmployee;
            ICollection <OrderInfo> orderInfos = new Collection <OrderInfo>();

            foreach (Order order in _ordersService.GetOrdersForApprover(employeeId))
            {
                OrderInfo info = _ordersConverter.ConvertBusinessToPresentation(order);
                orderInfos.Add(info);
            }

            View.ShowOrders(orderInfos);
        }
Exemplo n.º 6
0
        public OrderInfo ConvertBusinessToPresentation(Order businessEntity)
        {
            OrderInfo orderInfo = new OrderInfo();

            if (businessEntity.OrderId > 0)
            {
                orderInfo.OrderId = businessEntity.OrderId.ToString(CultureInfo.CurrentCulture);
            }
            else
            {
                orderInfo.OrderId = Resources.DraftStatusDescription;
            }

            orderInfo.OrderName   = businessEntity.OrderName;
            orderInfo.Description = businessEntity.Description;
            orderInfo.Address     = businessEntity.ShipAddress;
            orderInfo.City        = businessEntity.ShipCity;
            orderInfo.PostalCode  = businessEntity.ShipPostalCode;
            orderInfo.State       = businessEntity.ShipRegion;

            ConvertOrderStatus(businessEntity, orderInfo);

            Customer customer = _customerService.GetCustomerById(businessEntity.CustomerId);

            orderInfo.CustomerName = customer.CompanyName;

            Employee        employee        = _employeeService.GetEmployeeById(businessEntity.Approver);
            EmployeeDisplay employeeDisplay = _employeeConverter.ConvertBusinessToPresentation(employee);

            orderInfo.Approver = employeeDisplay.Name;

            if (businessEntity.Details != null)
            {
                orderInfo.OrderTotal = businessEntity.OrderTotal;
            }

            return(orderInfo);
        }