public ActionResult Details(int ProductID) { try // handle exogenous exceptions { try // log all exceptions { CategoriesBusinessModelLayers categoriesLUBusinessModelLayers = new CategoriesBusinessModelLayers(); ViewBag.Categoriess = new SelectList(categoriesLUBusinessModelLayers.CategoriesSelect, "CategoryID", "CategoryName"); SuppliersBusinessModelLayers suppliersLUBusinessModelLayers = new SuppliersBusinessModelLayers(); ViewBag.Supplierss = new SelectList(suppliersLUBusinessModelLayers.SuppliersSelect, "SupplierID", "CompanyName"); ProductsBusinessModelLayers productsBusinessModelLayers = new ProductsBusinessModelLayers(); BusinessModelLayer.ProductsSingle products = productsBusinessModelLayers.GetAllProductss().FirstOrDefault(x => x.ProductID == ProductID); return(View(products)); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ActionResult Delete_Post(int ProductID) { try // handle exogenous exceptions { try // log all exceptions { ProductsBusinessModelLayers productsBusinessModelLayers = new ProductsBusinessModelLayers(); //mm productsBusinessModelLayers.DeleteProducts(ProductID); return(RedirectToAction("List")); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public IHttpActionResult Get() { try // handle exogenous exceptions { try // log all exceptions { ProductsBusinessModelLayers productsBusinessModelLayers = new ProductsBusinessModelLayers(); List <BusinessModelLayer.ProductsSingle> productss = productsBusinessModelLayers.GetAllProductss(); return(Ok(productss)); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ActionResult Edit(int OrderID, int?ProductID) { try // handle exogenous exceptions { try // log all exceptions { OrdersBusinessModelLayers ordersLUBusinessModelLayers = new OrdersBusinessModelLayers(); ViewBag.Orderss = new SelectList(ordersLUBusinessModelLayers.OrdersSelect, "OrderID", "CustomerID"); ProductsBusinessModelLayers productsLUBusinessModelLayers = new ProductsBusinessModelLayers(); ViewBag.Productss = new SelectList(productsLUBusinessModelLayers.ProductsSelect, "ProductID", "ProductName"); Order_DetailsBusinessModelLayers order_detailsBusinessModelLayers = new Order_DetailsBusinessModelLayers(); BusinessModelLayer.Order_DetailsSingle order_details; if (ProductID == null) { order_details = order_detailsBusinessModelLayers.GetAllOrder_Detailss().FirstOrDefault(x => x.OrderID == OrderID); } else { order_details = order_detailsBusinessModelLayers.GetAllOrder_Detailss().FirstOrDefault(x => x.OrderID == OrderID && x.ProductID == ProductID); } return(View(order_details)); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ActionResult Create_Post() { try // handle exogenous exceptions { try // log all exceptions { OrdersBusinessModelLayers ordersLUBusinessModelLayers = new OrdersBusinessModelLayers(); ViewBag.Orderss = new SelectList(ordersLUBusinessModelLayers.OrdersSelect, "OrderID", "CustomerID"); ProductsBusinessModelLayers productsLUBusinessModelLayers = new ProductsBusinessModelLayers(); ViewBag.Productss = new SelectList(productsLUBusinessModelLayers.ProductsSelect, "ProductID", "ProductName"); Order_DetailsBusinessModelLayers order_detailsBusinessModelLayers = new Order_DetailsBusinessModelLayers(); BusinessModelLayer.Order_DetailsSingle order_details = new BusinessModelLayer.Order_DetailsSingle(); TryUpdateModel(order_details); if (ModelState.IsValid) { //mm order_detailsBusinessModelLayers.AddOrder_Details(order_details); return(RedirectToAction("List")); } else { return(View()); } } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ActionResult Create_Post() { try // handle exogenous exceptions { try // log all exceptions { CategoriesBusinessModelLayers categoriesLUBusinessModelLayers = new CategoriesBusinessModelLayers(); ViewBag.Categoriess = new SelectList(categoriesLUBusinessModelLayers.CategoriesSelect, "CategoryID", "CategoryName"); SuppliersBusinessModelLayers suppliersLUBusinessModelLayers = new SuppliersBusinessModelLayers(); ViewBag.Supplierss = new SelectList(suppliersLUBusinessModelLayers.SuppliersSelect, "SupplierID", "CompanyName"); ProductsBusinessModelLayers productsBusinessModelLayers = new ProductsBusinessModelLayers(); BusinessModelLayer.ProductsSingle products = new BusinessModelLayer.ProductsSingle(); TryUpdateModel(products); if (ModelState.IsValid) { //mm productsBusinessModelLayers.AddProducts(products); return(RedirectToAction("List")); } else { return(View()); } } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ActionResult Create_Get() { try // handle exogenous exceptions { try // log all exceptions { OrdersBusinessModelLayers ordersLUBusinessModelLayers = new OrdersBusinessModelLayers(); ViewBag.Orderss = new SelectList(ordersLUBusinessModelLayers.OrdersSelect, "OrderID", "CustomerID"); ProductsBusinessModelLayers productsLUBusinessModelLayers = new ProductsBusinessModelLayers(); ViewBag.Productss = new SelectList(productsLUBusinessModelLayers.ProductsSelect, "ProductID", "ProductName"); return(View()); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ActionResult Edit(int CategoryID, string sortOrder, string currentFilter, string searchString, int?page, string PgeSize) { try // handle exogenous exceptions { try // log all exceptions { ViewBag.CurrentSort = sortOrder; ViewBag.CategoryID = CategoryID; BusinessLayer.Validation pge = new BusinessLayer.Validation(); List <SelectListItem> PgeSizes = pge.PageSize(); //Assigning generic list to ViewBag ViewBag.PgeSizeList = PgeSizes; if (searchString != null) { page = 1; } else { searchString = currentFilter; } ViewBag.CurrentFilter = searchString; //CATEGORIES TABLE MASTER BusinessModelLayer.Categories.CategoriesMasterDetailModel pageModel = new BusinessModelLayer.Categories.CategoriesMasterDetailModel(); CategoriesBusinessModelLayers categoriesBusinessModelLayers = new CategoriesBusinessModelLayers(); Categories.CategoriesMasterDetailModel categoriesMasterDetailModel = new Categories.CategoriesMasterDetailModel(); pageModel.Categories = categoriesBusinessModelLayers.GetAllCategoriess().FirstOrDefault(x => x.CategoryID == CategoryID); int pageSize = 10; if (PgeSize != null) { Int32.TryParse(PgeSize, out pageSize); } ViewBag.PgeSize = pageSize; int pageNumber = (page ?? 1); //PRODUCTS DETAIL BEGIN ViewBag.CategoryIDSortParm = String.IsNullOrEmpty(sortOrder) ? "CategoryID_desc" : ""; ProductsBusinessModelLayers productsBusinessModelLayers = new ProductsBusinessModelLayers(); List <BusinessModelLayer.Vwproducts> productss = productsBusinessModelLayers.GetAllVwproductss().FindAll(x => x.CategoryID == CategoryID).ToList(); if (!String.IsNullOrEmpty(searchString)) { productss = productss.Where(s => s.CategoryID == CategoryID && s.ProductName.ToString().ToLower().Contains(searchString.ToLower())).ToList(); } switch (sortOrder) { case "CategoryID_desc": productss = productss.OrderByDescending(s => s.CategoryID).ToList(); break; default: // CategoryID ascending productss = productss.OrderBy(s => s.CategoryID).ToList(); break; } pageModel.ProductsVwDetl = productss.ToPagedList(pageNumber, pageSize); //PRODUCTS DETAIL END return(View(pageModel)); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ActionResult Edit_Post(SuppliersSingle suppliers, string sortOrder, string currentFilter, string searchString, int?page, string PgeSize) { try // handle exogenous exceptions { try // log all exceptions { SuppliersBusinessModelLayers suppliersBusinessModelLayers = new SuppliersBusinessModelLayers(); if (ModelState.IsValid) { //mm suppliersBusinessModelLayers.UpdateSuppliers(suppliers); return(RedirectToAction("List")); } ViewBag.CurrentSort = sortOrder; ViewBag.SupplierID = suppliers.SupplierID; BusinessLayer.Validation pge = new BusinessLayer.Validation(); List <SelectListItem> PgeSizes = pge.PageSize(); //Assigning generic list to ViewBag ViewBag.PgeSizeList = PgeSizes; if (searchString != null) { page = 1; } else { searchString = currentFilter; } ViewBag.CurrentFilter = searchString; //SUPPLIERS TABLE MASTER BusinessModelLayer.Suppliers.SuppliersMasterDetailModel pageModel = new BusinessModelLayer.Suppliers.SuppliersMasterDetailModel { Suppliers = suppliersBusinessModelLayers.GetAllSupplierss().Single(x => x.SupplierID == suppliers.SupplierID) }; int pageSize = 10; if (PgeSize != null) { Int32.TryParse(PgeSize, out pageSize); } ViewBag.PgeSize = pageSize; int pageNumber = (page ?? 1); //PRODUCTS DETAIL BEGIN ViewBag.ProductNameSortParm = String.IsNullOrEmpty(sortOrder) ? "ProductName_desc" : ""; ProductsBusinessModelLayers productsBusinessModelLayers = new ProductsBusinessModelLayers(); pageModel.ProductsVwDetl = productsBusinessModelLayers.GetAllVwproductss().FindAll(x => x.SupplierID == suppliers.SupplierID).ToList().ToPagedList(pageNumber, pageSize); if (!String.IsNullOrEmpty(searchString)) { pageModel.ProductsVwDetl = pageModel.ProductsVwDetl.Where(s => s.ProductName.ToString().ToLower().Contains(searchString.ToLower())).ToList().ToPagedList(pageNumber, pageSize); } switch (sortOrder) { case "ProductName_desc": pageModel.ProductsVwDetl = pageModel.ProductsVwDetl.OrderByDescending(s => s.ProductName).ToList().ToPagedList(pageNumber, pageSize); break; default: // ProductName ascending pageModel.ProductsVwDetl = pageModel.ProductsVwDetl.OrderBy(s => s.ProductName).ToList().ToPagedList(pageNumber, pageSize); break; } //PRODUCTS DETAIL END return(View(pageModel)); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }
public ViewResult List(string sortOrder, string currentFilter, string searchString, int?page, string PgeSize) { try // handle exogenous exceptions { try // log all exceptions { ViewBag.CurrentSort = sortOrder; ViewBag.ProductNameSortParm = String.IsNullOrEmpty(sortOrder) ? "ProductName_desc" : ""; BusinessLayer.Validation pge = new BusinessLayer.Validation(); List <SelectListItem> PgeSizes = pge.PageSize(); //Assigning generic list to ViewBag ViewBag.PgeSizeList = PgeSizes; if (searchString != null) { page = 1; } else { searchString = currentFilter; } ViewBag.CurrentFilter = searchString; ProductsBusinessModelLayers productsBusinessModelLayers = new ProductsBusinessModelLayers(); List <BusinessModelLayer.Vwproducts> vwproductss = productsBusinessModelLayers.GetAllVwproductss(); if (!String.IsNullOrEmpty(searchString)) { vwproductss = vwproductss.Where(s => s.ProductName.ToString().ToLower().Contains(searchString.ToLower())).ToList(); } switch (sortOrder) { case "ProductName_desc": vwproductss = vwproductss.OrderByDescending(s => s.ProductName).ToList(); break; //case "!!!": // vwproductss = vwproductss.OrderBy(s => s.!!!).ToList(); // break; //case "!!!_desc": // vwproductss = vwproductss.OrderByDescending(s => s.!!!).ToList(); // break; default: // ProductName ascending vwproductss = vwproductss.OrderBy(s => s.ProductName).ToList(); break; } int pageSize = 10; if (PgeSize != null) { Int32.TryParse(PgeSize, out pageSize); } ViewBag.PgeSize = pageSize; int pageNumber = (page ?? 1); return(View(vwproductss.ToPagedList(pageNumber, pageSize))); } catch (Exception ex) { BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging(); exlog.SendExcepToDB(ex); throw; } } catch (Exception) { throw; } }