public ShoppingController() { context = new ShoppingCartDBEntities1(); shoppingCartModels = new List <ShoppingCartModel>(); _shoppingLogic = new ShoppingLogic(); _OrderLogic = new OrderLogic(); }
// Converts table entries for a particular product type into a list of products for the website private List <Product> LoadViewTableData(string pType, int viewIndex) { using (ShoppingCartDBEntities1 db1 = new ShoppingCartDBEntities1()) { var productItems = from wp in db1.Products where (wp.ProductType == pType) select wp; int index = 1; foreach (var p in productItems) { string pathlabel = ""; Session[pType + "ProductName" + index] = ""; if (String.IsNullOrWhiteSpace(p.ProductName) && String.IsNullOrWhiteSpace(p.ImageFile)) { pathlabel = "[No Image]"; } else { if (!String.IsNullOrWhiteSpace(p.ProductName)) { pathlabel = p.ProductName.Trim(); Session[pType + "ProductName" + index] = pathlabel; if (!String.IsNullOrWhiteSpace(p.ImageFile)) { pathlabel += ":<br />"; } } if (!String.IsNullOrWhiteSpace(p.ImageFile)) { pathlabel += "<img src=\"/Images/" + p.ImageFile.Trim() + "\" alt=\"Store Product Image\" />"; } } Session[pType + "Path" + index] = pathlabel; Session[pType + "UnitPrice" + index] = p.UnitPrice; int amount; if (Session[pType + "Amount" + index] == null) { amount = (p.DefaultAmount >= 0) ? p.DefaultAmount : 0; } else { amount = Int32.Parse(Session[pType + "Amount" + index].ToString()); } ViewData["DefaultChoice" + index] = Convert.ToString(amount); ++index; } Session[pType + "ItemAmount"] = productItems.Count(); return(productItems.ToList()); } }
public ShoppingLogic() { dataContext = new ShoppingCartDBEntities1(); shoppingCartListItems = new List <ShoppingCartModel>(); }
public ItemLogic() { dataContext = new ShoppingCartDBEntities1(); }
public ItemsController() { context = new ShoppingCartDBEntities1(); _Logic = new ItemLogic(); }
public OrderLogic() { dataContext = new ShoppingCartDBEntities1(); shoppingCartModels = HttpContext.Current.Session["CartItems"] as List <ShoppingCartModel>; }