Exemple #1
0
        private void mbtnPurchare_Click(object sender, EventArgs e)
        {
            try
            {
                OrdersObj o = new OrdersObj();
                o.CustomerIDObj = userID;
                o.OrderDateObj  = DateTime.Now;
                o.EmployeeIDObj = 1;
                int id = businessRuleOrder.AddOrder(o);

                foreach (ProductsObj p in cart)
                {
                    OrderDetailsObj od = new OrderDetailsObj();
                    od.OrderIDObj   = id;
                    od.ProductIDObj = p.ProductIDObj;
                    od.QuantityObj  = 1;
                    od.UnitPriceObj = p.UnitPriceObj;
                    businessRuleOrder.AddOrderDetail(od);
                }
                cart = new List <ProductsObj>();
                MessageBox.Show("Order Success!");
            }
            catch
            {
            }
        }
        public int AddOrder(OrdersObj order)
        {
            Order o = new Order();

            o.CustomerID = order.CustomerIDObj;
            o.OrderDate  = DateTime.Now;
            o.EmployeeID = 1;
            data.Orders.InsertOnSubmit(o);
            data.SubmitChanges();
            return(o.OrderID);
        }
 public int AddOrder(OrdersObj o)
 {
     return(obj.AddOrder(o));
 }
 public int AddOrder(OrdersObj o)
 {
     return(crudOrders.AddOrder(o));
 }