Esempio n. 1
0
        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.VariationId, item.InOutStatus, item.DiscountId, item.State);
                items.Add(newItemModel);

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

                    foreach (OrderItemComponentComponent subComponent in component.Components)
                    {
                        componentModel.AddComponent(new OrderItemComponentComponentModel(subComponent));
                    }
                }
            }
        }
Esempio n. 2
0
        public OrderItemModel Clone()
        {
            OrderItemModel newModel = new OrderItemModel(this.id, this.orderId, this.variationId, this.inOutStatus, this.discountId, this.state);

            foreach (OrderItemComponentModel model in components)
            {
                newModel.AddComponentModel(model.Clone());
            }

            return(newModel);
        }
Esempio n. 3
0
 public void UpdateOrderItemModel(int position, OrderItemModel model)
 {
     items.RemoveAt(position);
     items.Insert(position, model);
 }
Esempio n. 4
0
 public void AddOrderItemModel(OrderItemModel model)
 {
     items.Add(model);
 }