public async Task <ActionResult> Index3(int page = 1, int catId = 0, String search = "", String filters = "") { try { if (!IsModulActive(StoreConstants.ProductType)) { return(HttpNotFound("Not Found")); } var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, IndexPageDesingName); var pageSize = GetSettingValueInt("ProductsIndex_PageSize", StoreConstants.DefaultPageSize); var productsTask = ProductService.GetProductsCategoryIdAsync(StoreId, catId, StoreConstants.ProductType, true, page, pageSize, search, filters); var categoriesTask = ProductCategoryService.GetProductCategoriesByStoreIdAsync(StoreId, StoreConstants.ProductType, true); var settings = GetStoreSettings(); ProductService2.ImageWidth = GetSettingValueInt("ProductsIndex_ImageWidth", 50); ProductService2.ImageHeight = GetSettingValueInt("ProductsIndex_ImageHeight", 50); await Task.WhenAll(pageDesignTask, productsTask, categoriesTask); var products = productsTask.Result; var pageDesign = pageDesignTask.Result; var categories = categoriesTask.Result; if (pageDesign == null) { throw new Exception("PageDesing is null:" + IndexPageDesingName); } var pageOutput = ProductService2.GetProductsIndexPage(products, pageDesign, categories); var pagingPageDesignTask = PageDesignService.GetPageDesignByName(StoreId, "Paging"); PagingService2.PageOutput = pageOutput; PagingService2.HttpRequestBase = this.Request; PagingService2.RouteData = this.RouteData; PagingService2.ActionName = this.ControllerContext.RouteData.Values["action"].ToString(); PagingService2.ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); await Task.WhenAll(pagingPageDesignTask); var pagingDic = PagingService2.GetPaging(pagingPageDesignTask.Result); pagingDic.StoreSettings = settings; pagingDic.PageTitle = "Products"; pagingDic.MyStore = this.MyStore; return(View(pagingDic)); } catch (Exception ex) { Logger.Error(ex, "ProductsController:Index:" + ex.StackTrace, page); return(new HttpStatusCodeResult(500)); } }
public virtual async Task <ActionResult> Index(int page = 1, String search = "", int?categoryId = null) { try { if (!IsModulActive(Type)) { Logger.Trace("Navigation Modul is not active:" + Type); return(HttpNotFound("Not Found")); } var newsPageDesignTask = PageDesignService.GetPageDesignByName(StoreId, PageDesingIndexPageName); var pageSize = GetSettingValueInt(Type + "IndexPageSize", StoreConstants.DefaultPageSize); var contentsTask = ContentService.GetContentsCategoryIdAsync(StoreId, categoryId, Type, true, page, pageSize, search); var categoriesTask = CategoryService.GetCategoriesByStoreIdAsync(StoreId, Type, true); var settings = GetStoreSettings(); ContentService2.ImageWidth = GetSettingValueInt(Type + "Index_ImageWidth", 50); ContentService2.ImageHeight = GetSettingValueInt(Type + "Index_ImageHeight", 50); await Task.WhenAll(newsPageDesignTask, contentsTask, categoriesTask); var contents = contentsTask.Result; var pageDesign = newsPageDesignTask.Result; var categories = categoriesTask.Result; if (pageDesign == null) { Logger.Error("PageDesing is null:" + PageDesingIndexPageName); throw new Exception("PageDesing is null:" + PageDesingIndexPageName); } var pageOutput = ContentService2.GetContentsIndexPage(contents, pageDesign, categories, Type); var pagingPageDesignTask = PageDesignService.GetPageDesignByName(StoreId, "Paging"); PagingService2.PageOutput = pageOutput; PagingService2.HttpRequestBase = this.Request; PagingService2.RouteData = this.RouteData; PagingService2.ActionName = this.ControllerContext.RouteData.Values["action"].ToString(); PagingService2.ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); await Task.WhenAll(pagingPageDesignTask); var pagingDic = PagingService2.GetPaging(pagingPageDesignTask.Result); pagingDic.StoreSettings = settings; pageOutput.MyStore = this.MyStore; pageOutput.PageTitle = this.PageTitle; return(View(pagingDic)); } catch (Exception ex) { Logger.Error(ex, Type + "Controller:Index:" + ex.StackTrace, page); return(new HttpStatusCodeResult(500)); } }
public async Task <ActionResult> Index(int page = 1) { try { if (!IsModulActive(StoreConstants.ProductType)) { Logger.Trace("Navigation Modul is not active:" + StoreConstants.ProductType); return(HttpNotFound("Not Found")); } var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, IndexPageDesingName); var pageSize = GetSettingValueInt("ProductCategories_PageSize", StoreConstants.DefaultPageSize); var categoriesTask = ProductCategoryService.GetProductCategoriesByStoreIdAsync(StoreId, StoreConstants.ProductType, true, page, pageSize); await Task.WhenAll(pageDesignTask, categoriesTask); var pageDesign = pageDesignTask.Result; var categories = categoriesTask.Result; if (pageDesign == null) { throw new Exception("PageDesing is null:" + IndexPageDesingName); } var pageOutput = ProductCategoryService2.GetCategoriesIndexPage(pageDesign, categories); var pagingPageDesignTask = PageDesignService.GetPageDesignByName(StoreId, "Paging"); PagingService2.PageOutput = pageOutput; PagingService2.HttpRequestBase = this.Request; PagingService2.RouteData = this.RouteData; PagingService2.ActionName = this.ControllerContext.RouteData.Values["action"].ToString(); PagingService2.ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); await Task.WhenAll(pagingPageDesignTask); var pagingDic = PagingService2.GetPaging(pagingPageDesignTask.Result); pagingDic.MyStore = this.MyStore; pageOutput.PageTitle = "Product Categories"; return(View(pagingDic)); } catch (Exception ex) { Logger.Error(ex, "ProductCategories:Index:" + ex.StackTrace, page); throw ex; } }
public virtual async Task <ActionResult> Index(int page = 1) { try { var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, PageDesingIndexPageName); var pageSize = GetSettingValueInt(Type + "Categories_PageSize", StoreConstants.DefaultPageSize); var categoriesTask = CategoryService.GetCategoriesByStoreIdWithPagingAsync(StoreId, Type, true, page, pageSize); var settings = GetStoreSettings(); await Task.WhenAll(pageDesignTask, categoriesTask); var pageDesign = pageDesignTask.Result; var categories = categoriesTask.Result; if (pageDesign == null) { Logger.Error("PageDesing is null:" + PageDesingIndexPageName); throw new Exception("PageDesing is null:" + PageDesingIndexPageName); } var pageOutput = CategoryService2.GetCategoriesIndexPage(pageDesign, categories, Type); var pagingPageDesignTask = PageDesignService.GetPageDesignByName(StoreId, "Paging"); PagingService2.PageOutput = pageOutput; PagingService2.HttpRequestBase = this.Request; PagingService2.RouteData = this.RouteData; PagingService2.ActionName = this.ControllerContext.RouteData.Values["action"].ToString(); PagingService2.ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); await Task.WhenAll(pagingPageDesignTask); var pagingDic = PagingService2.GetPaging(pagingPageDesignTask.Result); pagingDic.StoreSettings = settings; pagingDic.MyStore = this.MyStore; pagingDic.PageTitle = this.PageTitle; return(View(pagingDic)); } catch (Exception ex) { Logger.Error(ex, Type + "Categories:Index:" + ex.StackTrace, page); return(new HttpStatusCodeResult(500)); } }
public async Task <ActionResult> Index( String search = "", String filters = "", String page = "", String id = "clothes-shoes-and-jewelry") { search = search.ToStr(); id = String.IsNullOrEmpty(id) ? "clothes-shoes-and-jewelry" : id; String categoryApiId = id; RouteData.Values["id"] = id; String headerText = ""; var fltrs = FilterHelper.ParseFiltersFromString(filters); if (fltrs.Any()) { headerText = String.Join("– ", fltrs.Select(r => r.Text.ToTitleCase())); } if (!string.IsNullOrEmpty(search)) { headerText += " '" + search.ToTitleCase() + "'"; } int iPage = page.ToInt(); if (iPage == 0) { iPage = 1; } var pageSize = GetSettingValueInt("ProductsIndex_PageSize", StoreConstants.DefaultPageSize); int skip = (iPage - 1) * pageSize; var categoriesTask = ProductCategoryService.GetProductCategoriesByStoreIdAsync(StoreId, StoreConstants.ProductType, true); var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, "ProductsSearchIndexPage"); var productSearchResultTask = ProductService.GetProductsSearchResult(StoreId, search, filters, pageSize, skip, false, categoryApiId); await Task.WhenAll(productSearchResultTask, categoriesTask, pageDesignTask); var productSearchResult = productSearchResultTask.Result; var pageDesign = pageDesignTask.Result; var categories = categoriesTask.Result; if (pageDesign == null) { throw new Exception("PageDesing is null:" + IndexPageDesingName); } var settings = GetStoreSettings(); var pageOutput = ProductService2.GetProductsSearchPage(this, productSearchResult, pageDesign, categories, search, filters, headerText, categoryApiId); var pagingPageDesignTask = PageDesignService.GetPageDesignByName(StoreId, "Paging"); PagingService2.PageOutput = pageOutput; PagingService2.HttpRequestBase = this.Request; PagingService2.RouteData = this.RouteData; PagingService2.ActionName = this.ControllerContext.RouteData.Values["action"].ToStr(); PagingService2.ControllerName = this.ControllerContext.RouteData.Values["controller"].ToStr(); await Task.WhenAll(pagingPageDesignTask); var pagingDic = PagingService2.GetPaging(pagingPageDesignTask.Result); pagingDic.StoreSettings = settings; pagingDic.PageTitle = pageOutput.PageTitle; pagingDic.MyStore = this.MyStore; pagingDic.DetailLink = "/products/" + categoryApiId; pagingDic.PageTitle = String.IsNullOrEmpty(headerText) ? pagingDic.PageTitle : headerText; string mmm = GetFilter(productSearchResult.Filters, "category", 4) + " " + GetFilter(productSearchResult.Filters, "brand", 20); ViewData[StoreConstants.MetaTagKeywords] = pagingDic.PageTitle + ", " + mmm; ViewData[StoreConstants.MetaTagDescription] = GeneralHelper.TruncateAtWord(pagingDic.PageTitle + ", " + mmm, 155); return(View(pagingDic)); }