示例#1
0
        public ActionResult AddOrder()
        {
            if (Request.Form["product_id"] != null)
            {
                order ord = new order
                {
                    product_id = Convert.ToInt32(Request.Form["product_id"].ToString()),
                    customer_id = Convert.ToInt32(Request.Form["customer_id"].ToString()),
                    quantity = Convert.ToInt32(Request.Form["quantity"].ToString()),
                    currency_id = Convert.ToInt32(Request.Form["currency_id"].ToString()),
                    supplier_id = Convert.ToInt32(Request.Form["supplier_id"].ToString()),
                    progress = 0
                };
                db.orders.InsertOnSubmit(ord);

                try
                {
                    db.SubmitChanges();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    // Make some adjustments.
                    // ...
                    // Try again.
                    db.SubmitChanges();
                }
                return RedirectToAction("Index", "Orders");
            }

            List<customer> Customers = new List<customer>();
            Customers = db.customers.ToList();
            ViewData["Customers"] = Customers;

            List<currency> Currencies = new List<currency>();
            Currencies = db.currencies.ToList();
            ViewData["Currencies"] = Currencies;

            List<supplier> Suppliers = new List<supplier>();
            Suppliers = db.suppliers.ToList();
            ViewData["Suppliers"] = Suppliers;

            List<product> model = new List<product>();
            model = db.products.ToList();
            return View(model);
        }
示例#2
0
		private void attach_orders(order entity)
		{
			this.SendPropertyChanging();
			entity.currency = this;
		}
示例#3
0
		private void detach_orders(order entity)
		{
			this.SendPropertyChanging();
			entity.currency = null;
		}
示例#4
0
		private void attach_orders(order entity)
		{
			this.SendPropertyChanging();
			entity.product = this;
		}
示例#5
0
		private void detach_orders(order entity)
		{
			this.SendPropertyChanging();
			entity.product = null;
		}
示例#6
0
 partial void Deleteorder(order instance);
示例#7
0
 partial void Updateorder(order instance);
示例#8
0
 partial void Insertorder(order instance);
示例#9
0
		private void detach_orders(order entity)
		{
			this.SendPropertyChanging();
			entity.supplier = null;
		}
示例#10
0
		private void attach_orders(order entity)
		{
			this.SendPropertyChanging();
			entity.supplier = this;
		}