public ActionResult ByCategory(string name, int CategoryID) { #region Init BusinessLogicHandler myHandler = new BusinessLogicHandler(); SearchViewModel model = new SearchViewModel(); Book helper = new Book(); #endregion #region Get Books By Category if (name != null) { model.BookResults = myHandler.CategoryBookSearch(name); model.BCategory = new BookCategory(); helper = (Book)model.BookResults.Take(1).FirstOrDefault(); model.BCategory = myHandler.GetBookType(helper.BookCategoryID); } else if (CategoryID != 0) { model.BookResults = myHandler.GetBooksByCategory(CategoryID); model.BCategory = new BookCategory(); model.BCategory = myHandler.GetBookType(CategoryID); } #endregion return View(model); }
public ActionResult AdminDeviceSearch(FormCollection collection) { #region Get Search Query string query = collection.GetValue("query").AttemptedValue; #endregion #region Prep Utilities BusinessLogicHandler myHandler = new BusinessLogicHandler(); SearchViewModel model = new SearchViewModel(); #endregion #region Execute Search model.Query = query; model.GadgetResults = myHandler.TechnologyGlobalSearch(query); model.GadgetCategoryResults = myHandler.DeviceGlobalSearch(query); model.ManufacturerResults = myHandler.ManufacturerGlobalSearch(query); #endregion return View(model); }
public ActionResult AdminBookSearch(FormCollection collection) { #region Get Search Query string query = collection.GetValue("query").AttemptedValue; #endregion #region Prep Utilities BusinessLogicHandler myHandler = new BusinessLogicHandler(); SearchViewModel model = new SearchViewModel(); #endregion #region Execute Search model.Query = query; model.BookResults = myHandler.BookGlobalSearch(query); model.BookCategoryResults = myHandler.BookCategoryGlobalSearch(query); model.AuthorResults = myHandler.AuthorGlobalSearch(query); model.PublisherResults = myHandler.PublisherGlobalSearch(query); #endregion return View(model); }
public ActionResult Books(int PublisherID) { #region Prep Utilities BusinessLogicHandler myHandler = new BusinessLogicHandler(); SearchViewModel model = new SearchViewModel(); #endregion #region Get Publisher Books model.BookResults = myHandler.GetBooksByPublisher(PublisherID); #endregion return View(model); }
public ActionResult Categories() { #region Init Categories BusinessLogicHandler myHandler = new BusinessLogicHandler(); SearchViewModel model = new SearchViewModel(); #endregion #region Get Categories From db model.BookCategoryResults = myHandler.GetBookCategoryList(); #endregion return View(model); }
public ActionResult ByCategory(string name, int CategoryID) { #region Init BusinessLogicHandler myHandler = new BusinessLogicHandler(); SearchViewModel model = new SearchViewModel(); Technology helper = new Technology(); #endregion #region Get Devices By Category if (name != null) { try { model.GadgetResults = myHandler.CategoryDeviceSearch(name); model.TCategory = new TechCategory(); helper = (Technology)model.GadgetResults.Take(1).FirstOrDefault(); model.TCategory = myHandler.GetTechnologyType(helper.TechCategoryID); } catch { model.GadgetResults = myHandler.DevicesByCategory(CategoryID);//Replace model.TCategory = new TechCategory(); model.TCategory = myHandler.GetTechnologyType(CategoryID); } } if (CategoryID != 0) { model.GadgetResults = myHandler.DevicesByCategory(CategoryID);//Replace model.TCategory = new TechCategory(); model.TCategory = myHandler.GetTechnologyType(CategoryID); } #endregion return View(model); }
public ActionResult Categories() { #region Categories Init BusinessLogicHandler myHandler = new BusinessLogicHandler(); SearchViewModel model = new SearchViewModel(); #endregion #region Get Categories From db model.GadgetCategoryResults = myHandler.GetTechnologyTypeList(); #endregion return View(model); }
public ActionResult BooksAdvanced(Book_Advanced model) { #region init Search BusinessLogicHandler myHandler = new BusinessLogicHandler(); SearchViewModel SModel = new SearchViewModel(); #endregion #region Execute Book Search if (model.Author == true) { if (model.RangeFrom != null && model.RangeTo == null) { //DUE TO MULTIPLE AUTHORS NOT WORKING AS EXPECTED ! } else if (model.RangeTo != null && model.RangeFrom == null) { //DUE TO MULTIPLE AUTHORS NOT WORKING AS EXPECTED ! } else if (model.RangeFrom != null && model.RangeTo != null) { //DUE TO MULTIPLE AUTHORS NOT WORKING AS EXPECTED ! } else { //DUE TO MULTIPLE AUTHORS NOT WORKING AS EXPECTED ! //SP_AUTHORBOOKSEARCH } } if(model.BookTitle == true) { if (model.RangeFrom != null && model.RangeTo == null) { if (model.Query == null) SModel.BookResults = myHandler.BookTitleFromQueryBookSearch("", model.RangeFrom.GetValueOrDefault()); else SModel.BookResults = myHandler.BookTitleFromQueryBookSearch(model.Query, model.RangeFrom.GetValueOrDefault()); } else if (model.RangeTo != null && model.RangeFrom == null) { if (model.Query == null) SModel.BookResults = myHandler.BookTitleToQueryBookSearch("", model.RangeTo.GetValueOrDefault()); else SModel.BookResults = myHandler.BookTitleToQueryBookSearch(model.Query, model.RangeTo.GetValueOrDefault()); } else if (model.RangeFrom != null && model.RangeTo != null) { if (model.Query == null) SModel.BookResults = myHandler.BookTitleBETWEENQueryBookSearch("", model.RangeFrom.GetValueOrDefault(), model.RangeTo.GetValueOrDefault()); else SModel.BookResults = myHandler.BookTitleBETWEENQueryBookSearch(model.Query, model.RangeFrom.GetValueOrDefault(), model.RangeTo.GetValueOrDefault()); } else { if (model.Query == null) SModel.BookResults = myHandler.BookTitleBookSearch(""); else SModel.BookResults = myHandler.BookTitleBookSearch(model.Query); } } if (model.Category == true) { if (model.RangeFrom != null && model.RangeTo == null) { if (model.Query == null) SModel.BookResults = myHandler.CategoryFromQueryBookSearch("", model.RangeFrom.GetValueOrDefault()); else SModel.BookResults = myHandler.CategoryFromQueryBookSearch(model.Query, model.RangeFrom.GetValueOrDefault()); } else if (model.RangeTo != null && model.RangeFrom == null) { if (model.Query == null) SModel.BookResults = myHandler.CategoryToQueryBookSearch("", model.RangeTo.GetValueOrDefault()); else SModel.BookResults = myHandler.CategoryToQueryBookSearch(model.Query, model.RangeTo.GetValueOrDefault()); } else if (model.RangeFrom != null && model.RangeTo != null) { if (model.Query == null) SModel.BookResults = myHandler.CategoryBETWEENQueryBookSeach("", model.RangeFrom.GetValueOrDefault(), model.RangeTo.GetValueOrDefault()); else SModel.BookResults = myHandler.CategoryBETWEENQueryBookSeach(model.Query, model.RangeFrom.GetValueOrDefault(), model.RangeTo.GetValueOrDefault()); } else { if (model.Query == null) SModel.BookResults = myHandler.CategoryBookSearch(""); else SModel.BookResults = myHandler.BookTitleBookSearch(model.Query); } } if(model.ISBN == true) { if (model.RangeFrom != null && model.RangeTo == null) { if (model.Query == null) SModel.BookResults = myHandler.ISBNFromQueryBookSearch("", model.RangeFrom.GetValueOrDefault()); else SModel.BookResults = myHandler.ISBNFromQueryBookSearch(model.Query, model.RangeFrom.GetValueOrDefault()); } else if (model.RangeTo != null && model.RangeFrom == null) { if (model.Query == null) SModel.BookResults = myHandler.ISBNToQueryBookSearch("", model.RangeTo.GetValueOrDefault()); else SModel.BookResults = myHandler.ISBNToQueryBookSearch(model.Query, model.RangeTo.GetValueOrDefault()); } else if (model.RangeFrom != null && model.RangeTo != null) { if (model.Query == null) SModel.BookResults = myHandler.ISBNBETWEENQueryBookSearch("", model.RangeFrom.GetValueOrDefault(), model.RangeTo.GetValueOrDefault()); else SModel.BookResults = myHandler.ISBNBETWEENQueryBookSearch(model.Query, model.RangeFrom.GetValueOrDefault(), model.RangeTo.GetValueOrDefault()); } else { if (model.Query == null) SModel.BookResults = myHandler.ISBNBookSearch(""); else SModel.BookResults = myHandler.ISBNBookSearch(model.Query); } } if (model.Publisher == true) { if (model.RangeFrom != null && model.RangeTo == null) { if (model.Query == null) SModel.BookResults = myHandler.PublisherFromQueryBookSearch("", model.RangeFrom.GetValueOrDefault()); else SModel.BookResults = myHandler.PublisherFromQueryBookSearch(model.Query, model.RangeFrom.GetValueOrDefault()); } else if (model.RangeTo != null && model.RangeFrom == null) { if (model.Query == null) SModel.BookResults = myHandler.PublisherToQueryBookSearch("", model.RangeTo.GetValueOrDefault()); else SModel.BookResults = myHandler.PublisherToQueryBookSearch(model.Query, model.RangeTo.GetValueOrDefault()); } else if (model.RangeFrom != null && model.RangeTo != null) { if (model.Query == null) SModel.BookResults = myHandler.PublisherBETWEENQueryBookSearch("", model.RangeFrom.GetValueOrDefault(), model.RangeTo.GetValueOrDefault()); else SModel.BookResults = myHandler.PublisherBETWEENQueryBookSearch(model.Query, model.RangeFrom.GetValueOrDefault(), model.RangeTo.GetValueOrDefault()); } else { if (model.Query == null) SModel.BookResults = myHandler.PublisherBookSearch(""); else SModel.BookResults = myHandler.PublisherBookSearch(model.Query); } } if (model.RangeFrom != null && model.RangeTo == null && model.ISBN == false && model.Publisher == false && model.Author == false && model.BookTitle == false && model.Category == false && model.Query == null) { SModel.BookResults = myHandler.BookTitleFromQueryBookSearch("", model.RangeFrom.GetValueOrDefault()); } if (model.RangeTo != null && model.RangeFrom == null && model.ISBN == false && model.Publisher == false && model.Author == false && model.BookTitle == false && model.Category == false && model.Query == null) { SModel.BookResults = myHandler.BookTitleToQueryBookSearch("", model.RangeTo.GetValueOrDefault()); } if (model.RangeFrom != null && model.RangeTo != null && model.ISBN == false && model.Publisher == false && model.Author == false && model.BookTitle == false && model.Category == false && model.Query == null) { SModel.BookResults = myHandler.BookTitleBETWEENQueryBookSearch("", model.RangeFrom.GetValueOrDefault(), model.RangeTo.GetValueOrDefault()); } #endregion return View(SModel); }
public ActionResult Search(FormCollection collect) { #region Get Search Term string query = collect.GetValue("query").AttemptedValue; #endregion #region init search BusinessLogicHandler myHandler = new BusinessLogicHandler(); SearchViewModel result = new SearchViewModel(); #endregion #region execute search result.Query = query; result.BookResults = myHandler.BookGlobalSearch(query); result.BookCategoryResults = myHandler.BookCategoryGlobalSearch(query); result.AuthorResults = myHandler.AuthorGlobalSearch(query); result.GadgetResults = myHandler.TechnologyGlobalSearch(query); result.GadgetCategoryResults = myHandler.DeviceGlobalSearch(query); result.ManufacturerResults = myHandler.ManufacturerGlobalSearch(query); result.PublisherResults = myHandler.PublisherGlobalSearch(query); #endregion return View(result); }
public ActionResult DevicesAdvanced(Device_Advanced model) { #region init Search BusinessLogicHandler myHandler = new BusinessLogicHandler(); SearchViewModel SModel = new SearchViewModel(); #endregion #region Execute Device Search if(model.Category == true) { if (model.RangeFrom != null && model.RangeTo == null) { if (model.Query == null) SModel.GadgetResults = myHandler.CategoryFromQueryDeviceSeach("", model.RangeFrom.GetValueOrDefault()); else SModel.GadgetResults = myHandler.CategoryFromQueryDeviceSeach(model.Query, model.RangeFrom.GetValueOrDefault()); } if (model.RangeTo != null && model.RangeFrom == null) { if (model.Query == null) SModel.GadgetResults = myHandler.CategoryToQueryDeviceSearch("", model.RangeTo.GetValueOrDefault()); else SModel.GadgetResults = myHandler.CategoryToQueryDeviceSearch(model.Query, model.RangeTo.GetValueOrDefault()); } if (model.RangeFrom != null && model.RangeTo != null) { if (model.Query == null) SModel.GadgetResults = myHandler.CategoryBETWEENQueryDeviceSearch("", model.RangeFrom.GetValueOrDefault(), model.RangeTo.GetValueOrDefault()); else SModel.GadgetResults = myHandler.CategoryBETWEENQueryDeviceSearch(model.Query, model.RangeFrom.GetValueOrDefault(), model.RangeTo.GetValueOrDefault()); } else { if (model.Query == null) SModel.GadgetResults = myHandler.CategoryDeviceSearch(""); else SModel.GadgetResults = myHandler.CategoryDeviceSearch(model.Query); } } if (model.Manufacturer == true) { if (model.RangeFrom != null && model.RangeTo == null) { if (model.Query == null) SModel.GadgetResults = myHandler.ManufacturerFromQueryDeviceSearch("", model.RangeFrom.GetValueOrDefault()); else SModel.GadgetResults = myHandler.ManufacturerFromQueryDeviceSearch(model.Query, model.RangeFrom.GetValueOrDefault()); } if (model.RangeTo != null && model.RangeFrom == null) { if (model.Query == null) SModel.GadgetResults = myHandler.ManufacturerToQueryDeviceSearch("", model.RangeTo.GetValueOrDefault()); else SModel.GadgetResults = myHandler.ManufacturerToQueryDeviceSearch(model.Query, model.RangeTo.GetValueOrDefault()); } if (model.RangeFrom != null && model.RangeTo != null) { if (model.Query == null) SModel.GadgetResults = myHandler.ManufacturerBETWEENQueryDeviceSearch("", model.RangeFrom.GetValueOrDefault(), model.RangeTo.GetValueOrDefault()); else SModel.GadgetResults = myHandler.ManufacturerBETWEENQueryDeviceSearch(model.Query, model.RangeFrom.GetValueOrDefault(), model.RangeTo.GetValueOrDefault()); } else { if (model.Query == null) SModel.GadgetResults = myHandler.ManufacturerDeviceSearch(""); else SModel.GadgetResults = myHandler.ManufacturerDeviceSearch(model.Query); } } if(model.ModelName == true) { if (model.RangeFrom != null && model.RangeTo == null) { if (model.Query == null) SModel.GadgetResults = myHandler.ModelNameFromQueryDeviceSearch("", model.RangeFrom.GetValueOrDefault()); else SModel.GadgetResults = myHandler.ModelNameFromQueryDeviceSearch(model.Query, model.RangeFrom.GetValueOrDefault()); } if (model.RangeTo != null && model.RangeFrom == null) { if (model.Query == null) SModel.GadgetResults = myHandler.ModelNameToQueryDeviceSearch("", model.RangeTo.GetValueOrDefault()); else SModel.GadgetResults = myHandler.ModelNameToQueryDeviceSearch(model.Query, model.RangeTo.GetValueOrDefault()); } if (model.RangeFrom != null && model.RangeTo != null) { if (model.Query == null) SModel.GadgetResults = myHandler.ModelNameBETWEENQueryDeviceSearch("", model.RangeFrom.GetValueOrDefault(), model.RangeTo.GetValueOrDefault()); else SModel.GadgetResults = myHandler.ModelNameBETWEENQueryDeviceSearch(model.Query, model.RangeFrom.GetValueOrDefault(), model.RangeTo.GetValueOrDefault()); } else { if (model.Query == null) SModel.GadgetResults = myHandler.ModelNameDeviceSearch(""); else SModel.GadgetResults = myHandler.ModelNameDeviceSearch(model.Query); } } if(model.ModelNumber == true) { if (model.RangeFrom != null && model.RangeTo == null) { if (model.Query == null) SModel.GadgetResults = myHandler.ModelNumberFromQueryDeviceSearch("", model.RangeFrom.GetValueOrDefault()); else SModel.GadgetResults = myHandler.ModelNumberFromQueryDeviceSearch(model.Query, model.RangeFrom.GetValueOrDefault()); } if (model.RangeTo != null && model.RangeFrom == null) { if (model.Query == null) SModel.GadgetResults = myHandler.ModelNumberToQueryDeviceSearch("", model.RangeTo.GetValueOrDefault()); else SModel.GadgetResults = myHandler.ModelNumberToQueryDeviceSearch(model.Query, model.RangeTo.GetValueOrDefault()); } if (model.RangeFrom != null && model.RangeTo != null) { if (model.Query == null) SModel.GadgetResults = myHandler.ModelNumberBETWEENQueryDeviceSearch("", model.RangeFrom.GetValueOrDefault(), model.RangeTo.GetValueOrDefault()); else SModel.GadgetResults = myHandler.ModelNumberBETWEENQueryDeviceSearch(model.Query, model.RangeFrom.GetValueOrDefault(), model.RangeTo.GetValueOrDefault()); } else { if (model.Query == null) SModel.GadgetResults = myHandler.ModelNumberSearch(""); else SModel.GadgetResults = myHandler.ModelNumberSearch(model.Query); } } if(model.RangeFrom != null && model.RangeTo == null && model.ModelNumber == false && model.Manufacturer == false && model.ModelName == false && model.Category == false && model.Query == null) { SModel.GadgetResults = myHandler.ModelNumberFromQueryDeviceSearch("", model.RangeFrom.GetValueOrDefault()); } if (model.RangeTo != null && model.RangeFrom == null && model.ModelNumber == false && model.Manufacturer == false && model.ModelName == false && model.Category == false && model.Query == null) { SModel.GadgetResults = myHandler.ModelNumberToQueryDeviceSearch("", model.RangeTo.GetValueOrDefault()); } if (model.RangeFrom != null && model.RangeTo != null && model.ModelNumber == false && model.Manufacturer == false && model.ModelName == false && model.Category == false && model.Query == null) { SModel.GadgetResults = myHandler.ModelNumberBETWEENQueryDeviceSearch("", model.RangeFrom.GetValueOrDefault(), model.RangeTo.GetValueOrDefault()); } #endregion return View(SModel); }
public ActionResult Index() { #region Cart and wishlist actions if (User.Identity.IsAuthenticated) { #region Check iDentity if (HttpContext.User.IsInRole("admin")) { return RedirectToAction("Index", "Admin"); } else if (HttpContext.User.IsInRole("supplier")) { return RedirectToAction("Home", "Supplier"); } else if (HttpContext.User.IsInRole("employee")) { return RedirectToAction("Index", "Employee"); } #endregion #region Getting cart total CartActions act = new CartActions(); WishlistActions wish = new WishlistActions(); ApplicationDbContext mycontext = new ApplicationDbContext(); UserStore<ApplicationUser> myStore = new UserStore<ApplicationUser>(mycontext); ApplicationUserManager mgr = new ApplicationUserManager(myStore); var thisUser = mgr.FindByNameAsync(User.Identity.Name); int cartId = Convert.ToInt32(thisUser.Result.Carts.CartID); // try { double nm = GetCartTotal(cartId); string[] xn = nm.ToString().Split('.'); Session["cartTotal"] = xn[0] + "," + xn[1]; } catch { Session["cartTotal"] = (double)GetCartTotal(cartId); } Session["wishlistTotal"] = wish.GetWishlistTotal(thisUser.Result.Wishlists.WishlistID); #endregion } else { Session["cartTotal"] = "0,00"; Session["wishlistTotal"] = 0; } #endregion #region Prep utilities BusinessLogicHandler myHandler = new BusinessLogicHandler(); SearchViewModel model = new SearchViewModel(); #endregion #region Get New Books model.BookResults = myHandler.GetNewBooks(); #endregion #region Get Devices model.GadgetResults = myHandler.GetNewDevices(); #endregion return View(model); }