Ejemplo n.º 1
0
 public static void AddOrder(Order order)
 {
     Console.WriteLine(order.Total);
     OrderDb.AddOrder(order.OrderId, order.Total, order.Note,
                      order.DateTime, order.UserId);
     foreach (var entry in order.OrderEntries)
     {
         OrderEntry.AddOrderEntry(entry);
     }
 }
Ejemplo n.º 2
0
        public static IEnumerable <Order> GetOrders(string orderId = "%", string dateTime = "",
                                                    string note    = "")
        {
            var reader = OrderDb.GetOrders(orderId, dateTime, note).CreateDataReader();

            while (reader.Read())
            {
                yield return(new Order(
                                 int.Parse(reader["Order_ID"].ToString()),
                                 int.Parse(reader["User_ID"].ToString()),
                                 OrderEntry.GetOrderEntries(reader["Order_ID"].ToString()).ToList()
                                 /*GetOrderEntries(orderId).ToList()*/ /*meth is below*/,
                                 reader["Note"].ToString(),
                                 DateTime.Parse(reader["DateTime"].ToString())));
            }
        }
Ejemplo n.º 3
0
        public static IEnumerable <CreditOrder> GetCreditOrders(string orderId  = "", string customerId = "",
                                                                string dateTime = "", string note       = "")
        {
            var reader = OrderDb.GetCreditOrders(orderId, customerId, dateTime, note).CreateDataReader();

            while (reader.Read())
            {
                yield return(new CreditOrder(
                                 int.Parse(reader["Order_ID"].ToString()),
                                 int.Parse(reader["User_ID"].ToString()),
                                 OrderEntry.GetOrderEntries(reader["Order_ID"].ToString()).ToList(),
                                 reader["Note"].ToString(),
                                 DateTime.Parse(reader["DateTime"].ToString()),
                                 int.Parse(reader["Customer_ID"].ToString())));
            }
        }
Ejemplo n.º 4
0
        public static IEnumerable <OrderEntry> GetOrderEntries(string orderId)
        {
            var entriesList = OrderEntry.GetOrderEntries(orderId);

            return(entriesList);
        }
Ejemplo n.º 5
0
 public void RemoveEntry(OrderEntry entry)
 {
     OrderEntries.Remove(entry);
 }
Ejemplo n.º 6
0
 public void AddEntry(OrderEntry entry)
 {
     OrderEntries.Add(entry);
 }
Ejemplo n.º 7
0
 public static void AddOrderEntry(OrderEntry entry)
 {
     OrderDb.AddOrderEntry(entry.OrderId, entry.ProductId, entry.UnitPrice, entry.Quantity,
                           entry.DiscountPercent, entry.NetPrice);
 }