public OrderModel(int id)
        {
            if (id == 0)
            {
                return;
            }

            Order order = Database.GetOrder(id, true);

            this.id           = id;
            this.name         = order.Name;
            this.customerType = order.CustomerType;
            this.date         = order.Date;
            this.OrderNumber  = order.OrderNumber;

            foreach (OrderItem item in order.OrderItems)
            {
                OrderItemModel newItemModel = new OrderItemModel(item.Id, id, item.Id, item.DisplayName, item.InOutStatus, item.DiscountId, item.State);
                items.Add(item.Id, newItemModel);

                foreach (OrderItemComponent component in item.Components)
                {
                    OrderItemComponentModel componentModel = new OrderItemComponentModel(component);
                    newItemModel.AddComponentModel(componentModel);

                    foreach (OrderItemComponentComponent subComponent in component.Components)
                    {
                        OrderItemComponentComponentModel subComponentModel = new OrderItemComponentComponentModel(subComponent);
                        componentModel.AddComponent(subComponentModel);
                    }
                }
            }
        }
Exemple #2
0
        public OrderItemModel GetOrderItemModel(int id)
        {
            OrderItem      item  = Database.GetOrderItem(id);
            OrderItemModel model = new OrderItemModel(item);

            return(model);
        }
 public void UpdateOrderItemModel(int key, OrderItemModel model)
 {
     items.Remove(key);
     items.Add(key, model);
 }
 public void AddOrderItemModel(OrderItemModel model)
 {
     items.Add(model.Id, model);
 }