Esempio n. 1
0
        public static DataOrder GetDataOrderFromOrder(Order order)
        {
            var dataOrder = new DataOrder()
            {
                Id                = order.Id,
                OrderDate         = order.OrderDate,
                CustomerId        = order.CustomerId,
                ShippingAddressId = order.ShippingAddressId,
                Discount          = order.Discount,
                ShippingFee       = order.ShippingFee,
                Tax               = order.Tax,
                OrderTotal        = order.OrderTotal,
                ShippingDate      = order.ShippingDate,
            };

            if (dataOrder.CustomerId != 0)
            {
                dataOrder.DataCustomer = GetDataCustomerFromCustomer(order.Customer);
            }

            if (dataOrder.ShippingAddressId != 0)
            {
                dataOrder.DataAddress = GetDataAddressFromAddress(order.ShippingAddress);
            }

            foreach (var orderItem in order.OrderItems)
            {
                var dataOrderItem = GetDataOrderItemFromOrderItem(orderItem);
                dataOrder.DataOrderItems.Add(dataOrderItem);
            }

            return(dataOrder);
        }
Esempio n. 2
0
        public static Order GetOrderFromDataOrder(DataOrder dataOrder)
        {
            var order = new Order()
            {
                Id                = dataOrder.Id,
                OrderDate         = dataOrder.OrderDate,
                CustomerId        = dataOrder.CustomerId,
                ShippingAddressId = dataOrder.ShippingAddressId,
                Discount          = dataOrder.Discount,
                ShippingFee       = dataOrder.ShippingFee,
                Tax               = dataOrder.Tax,
                OrderTotal        = dataOrder.OrderTotal,
                ShippingDate      = dataOrder.ShippingDate,
            };

            order.OrderItems = new List <OrderItem>();
            foreach (var dataOrderItem in dataOrder.DataOrderItems)
            {
                var orderItem = GetOrderItemFromDataOrderItem(dataOrderItem);
                order.OrderItems.Add(orderItem);
            }

            return(order);
        }
 private void detach_DataOrders(DataOrder entity)
 {
     this.SendPropertyChanging();
     entity.DataCustomer = null;
 }
 partial void DeleteDataOrder(DataOrder instance);
 partial void UpdateDataOrder(DataOrder instance);
 partial void InsertDataOrder(DataOrder instance);
 private void detach_DataOrders(DataOrder entity)
 {
     this.SendPropertyChanging();
     entity.DataAddress = null;
 }