public void OnInit() { this.sortmode = "name"; this.item = new Items(); this.SubstringFind = ""; this.ddl1items = new string[2] { "name", "description" }; this.ddl2items = new string [3] { "Item", "Box", "Package" }; }
public ActionResult Duplicate(Items item) { if (ModelState.IsValid) { db.Items.AddObject(item); db.SaveChanges(); return RedirectToAction("Index"); } return View(item); }
public ActionResult Create(Items item) { //TODO:Right validation of price! if (ModelState.IsValid) { db.Items.AddObject(item); db.SaveChanges(); return RedirectToAction("Index"); } return View(item); }
public void CopyItem(Items tmp) { if (tmp.Image != null) { this.item.Image = tmp.Image; } else { this.item.Image = null; } this.item.ItemDescriprion = tmp.ItemDescriprion; this.item.ItemID = tmp.ItemID; this.item.ItemName = tmp.ItemName; this.item.Price = tmp.Price; this.item.Quantity = tmp.Quantity; }
public ActionResult ItemSearch(string ddl1, string SubstringFind, string button, string selecteditem, string quantity, string ddl2) { ismodel = RestoreState(); switch (button) { case " Search ": { if (SubstringFind == "") { ismodel.SetFilterOption(ddl1, ""); } else { ismodel.SetFilterOption(ddl1, SubstringFind); } break; } case " Add ": { ismodel.ResetSelectedItem(); int i = int.Parse(selecteditem); Items tmp = new Items(); tmp = ReadList(ismodel.sortmode, ismodel.SubstringFind).ElementAt<Items>(i); if (Session["err"] != "") { return RedirectToAction("Errored", "ItemSearch"); } if (i >= 0) { ismodel.SelectedItem = tmp.ItemID; ismodel.CopyItem(tmp); } break; } case " Done ": { if (ismodel.SelectedItem == -1) { break; } int qu; ismodel.Dimension = ddl2; ItemsOrder rw = new ItemsOrder(); if (int.TryParse(quantity, out qu)) { ismodel.Quantity = qu; ismodel.order = 123; rw = ismodel.WriteToOrder(); OutRecord(rw); if (Session["err"] != "") { return RedirectToAction("Errored", "ItemSearch"); } else { Session["ismodel"] = ""; return RedirectToAction("~/CustomerOrdering/OrderList.cshtml"); } } else { ismodel.Quantity = 1; } break; } case " Close ": { Session["ismodel"] = ""; return RedirectToAction("~/CustomerOrdering/OrderList.cshtml"); } } WriteView(); SaveState(ismodel); List<Items> tmpview = ReadList(ismodel.sortmode, ismodel.SubstringFind); if (Session["err"] != "") { return RedirectToAction("Errored", "ItemSearch"); } return View(tmpview); }
public ActionResult Edit(Items items) { if (ModelState.IsValid) { db.Items.Attach(items); db.ObjectStateManager.ChangeObjectState(items, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } return View(items); }
/// <summary> /// Create a new Items object. /// </summary> /// <param name="itemID">Initial value of the ItemID property.</param> /// <param name="itemName">Initial value of the ItemName property.</param> /// <param name="itemDescriprion">Initial value of the ItemDescriprion property.</param> /// <param name="price">Initial value of the Price property.</param> /// <param name="quantity">Initial value of the Quantity property.</param> public static Items CreateItems(global::System.Int32 itemID, global::System.String itemName, global::System.String itemDescriprion, global::System.Decimal price, global::System.Int32 quantity) { Items items = new Items(); items.ItemID = itemID; items.ItemName = itemName; items.ItemDescriprion = itemDescriprion; items.Price = price; items.Quantity = quantity; return items; }
/// <summary> /// Deprecated Method for adding a new object to the Items EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToItems(Items items) { base.AddObject("Items", items); }