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)); } } } }
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); }
public void UpdateOrderItemModel(int position, OrderItemModel model) { items.RemoveAt(position); items.Insert(position, model); }
public void AddOrderItemModel(OrderItemModel model) { items.Add(model); }