public async Task <ActionResult> Index() { try { var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, IndexPageDesingName); var retailersTask = RetailerService.GetRetailersAsync(StoreId, null, true); var settings = GetStoreSettings(); RetailerService2.ImageWidth = GetSettingValueInt("RetailersIndex_ImageWidth", 50); RetailerService2.ImageHeight = GetSettingValueInt("RetailersIndex_ImageHeight", 50); await Task.WhenAll(pageDesignTask, retailersTask); var pageDesign = pageDesignTask.Result; var retailers = retailersTask.Result; if (pageDesign == null) { throw new Exception("PageDesing is null:" + IndexPageDesingName); } var pageOutput = RetailerService2.GetRetailers(retailers, pageDesign); pageOutput.StoreSettings = settings; pageOutput.PageTitle = "Retailers"; pageOutput.MyStore = this.MyStore; return(View(pageOutput)); } catch (Exception ex) { Logger.Error(ex, "Index:" + ex.StackTrace); return(new HttpStatusCodeResult(500)); } }
private async Task <String> GetProductCategoriesHtml(string designName, int imageWidth, int imageHeight) { string returnHtml; var categoriesTask = ProductCategoryService.GetProductCategoriesByStoreIdAsync(StoreId, StoreConstants.ProductType, true); var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, designName); ProductCategoryHelper.StoreSettings = GetStoreSettings(); ProductCategoryHelper.ImageWidth = imageWidth == 0 ? GetSettingValueInt("ProductCategoriesPartial_ImageWidth", 50) : imageWidth; ProductCategoryHelper.ImageHeight = imageHeight == 0 ? GetSettingValueInt("ProductCategoriesPartial_ImageHeight", 50) : imageHeight; await Task.WhenAll(categoriesTask, pageDesignTask); var categories = categoriesTask.Result; var pageDesign = pageDesignTask.Result; var pageOuput = ProductCategoryHelper.GetProductCategoriesPartial(categories, pageDesign); returnHtml = pageOuput.PageOutputText; return(returnHtml); }
public async Task <ActionResult> Index() { try { var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, "ContactsIndexPage"); ContactService2.ImageWidth = GetSettingValueInt("ContactsIndex_ImageWidth", 50); ContactService2.ImageHeight = GetSettingValueInt("ContactsIndex_ImageHeight", 50); var contactsTask = ContactService.GetContactsByStoreIdAsync(StoreId, null, true); await Task.WhenAll(pageDesignTask, contactsTask); var pageDesign = pageDesignTask.Result; var contacts = contactsTask.Result; if (pageDesign == null) { throw new Exception("PageDesing is null"); } var pageOutput = ContactService2.GetContactIndexPage(pageDesign, contacts); return(View(pageOutput)); } catch (Exception ex) { Logger.Error(ex, "Index:" + ex.StackTrace); return(new HttpStatusCodeResult(500)); } }
public async Task <ActionResult> Index() { try { var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, IndexPageDesingName); var activitiesTask = ActivityService.GetActivitiesAsync(StoreId, null, true); var settings = GetStoreSettings(); ActivityHelper.StoreSettings = settings; ActivityHelper.ImageWidth = GetSettingValueInt("ActivitiesIndex_ImageWidth", 50); ActivityHelper.ImageHeight = GetSettingValueInt("ActivitiesIndex_ImageHeight", 50); await Task.WhenAll(pageDesignTask, activitiesTask); var pageDesign = pageDesignTask.Result; var activities = activitiesTask.Result; if (pageDesign == null) { throw new Exception("PageDesing is null:" + IndexPageDesingName); } var pageOutput = ActivityHelper.GetActivityIndexPage(pageDesign, activities); pageOutput.StoreSettings = settings; pageOutput.MyStore = this.MyStore; pageOutput.PageTitle = "Activities"; return(View(pageOutput)); } catch (Exception ex) { Logger.Error(ex, "Index:" + ex.StackTrace); return(new HttpStatusCodeResult(500)); } }
private async Task <String> GetBrandsHtml(string designName, int take, int imageWidth, int imageHeight) { string returnHtml; take = take == 0 ? GetSettingValueInt("BrandsPartial_ItemsNumber", 50) : take; var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, designName); var brandsTask = BrandService.GetBrandsAsync(StoreId, take, true); BrandHelper.StoreSettings = GetStoreSettings(); BrandHelper.ImageWidth = imageWidth == 0 ? GetSettingValueInt("BrandsPartial_ImageWidth", 50) : imageWidth; BrandHelper.ImageHeight = imageHeight == 0 ? GetSettingValueInt("BrandsPartial_ImageHeight", 50) : imageHeight; await Task.WhenAll(pageDesignTask, brandsTask); var pageDesign = pageDesignTask.Result; var brands = brandsTask.Result; if (pageDesign == null) { throw new Exception("PageDesing is null"); } var pageOuput = BrandHelper.GetBrandsPartial(brands, pageDesign); returnHtml = pageOuput.PageOutputText; return(returnHtml); }
private async Task <String> GetProductLabelsHtml(int id, string designName, int imageWidth, int imageHeight) { string returnHtml; var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, designName); var labelsTask = LabelService.GetLabelsByItemTypeId(StoreId, id, StoreConstants.ProductType); LabelHelper.StoreSettings = GetStoreSettings(); LabelHelper.ImageWidth = imageWidth == 0 ? GetSettingValueInt("ProductLabels_ImageWidth", 50) : imageWidth; LabelHelper.ImageHeight = imageHeight == 0 ? GetSettingValueInt("ProductLabels_ImageHeight", 50) : imageHeight; await Task.WhenAll(pageDesignTask, labelsTask); var labels = labelsTask.Result; var pageDesign = pageDesignTask.Result; if (pageDesign == null) { throw new Exception("PageDesing is null"); } var pageOuput = LabelHelper.GetProductLabels(labels, pageDesign); returnHtml = pageOuput.PageOutputText; return(returnHtml); }
private async Task <String> GetRelatedContentsHtml(int categoryId, string contentType, int excludedContentId, string designName, int take, int imageWidth, int imageHeight) { string returnHtml; var categoryTask = CategoryService.GetCategoryAsync(categoryId); if (take == 0 && contentType.Equals(StoreConstants.NewsType)) { take = GetSettingValueInt("RelatedNews_ItemsNumber", 5); } else if (take == 0 && contentType.Equals(StoreConstants.BlogsType)) { take = GetSettingValueInt("RelatedBlogs_ItemsNumber", 5); } var relatedContentsTask = ContentService.GetContentByTypeAndCategoryIdAsync(StoreId, contentType, categoryId, take, excludedContentId); var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, designName); ContentService2.ImageWidth = imageWidth; ContentService2.ImageHeight = imageHeight; await Task.WhenAll(pageDesignTask, relatedContentsTask, categoryTask); var contents = relatedContentsTask.Result; var pageDesign = pageDesignTask.Result; var category = categoryTask.Result; var pageOutput = ContentService2.GetRelatedContentsPartial(category, contents, pageDesign, contentType); returnHtml = pageOutput.PageOutputText; return(returnHtml); }
public async Task <ActionResult> Index2() { int sliderTake = GetSettingValueInt("HomePageSliderImages_ItemsNumber", StoreConstants.DefaultPageSize); var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, "HomePage"); var sliderTask = FileManagerService.GetStoreCarouselsAsync(StoreId, sliderTake); Stopwatch stopwatch = new Stopwatch(); // Begin timing. stopwatch.Start(); await Task.WhenAll(pageDesignTask, sliderTask); var settings = GetStoreSettings(); var pageDesing = pageDesignTask.Result; var sliderImages = sliderTask.Result; StoreLiquidResult liquidResult = ProductService2.GetHomePageDesign(pageDesing, sliderImages); liquidResult.PageTitle = GetSettingValue("HomePage_Title", ""); liquidResult.StoreSettings = settings; liquidResult.MyStore = this.MyStore; // Stop timing. stopwatch.Stop(); Logger.Info("Home:Index:Time elapsed: {0} elapsed milliseconds", stopwatch.ElapsedMilliseconds); return(View(liquidResult)); }
public async Task <ActionResult> Index() { try { var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, "LocationsIndexPage"); var locationsTask = LocationService.GetLocationsAsync(StoreId, null, true); var settings = GetStoreSettings(); LocationHelper.StoreSettings = settings; LocationHelper.ImageWidth = GetSettingValueInt("LocationsIndex_ImageWidth", 50); LocationHelper.ImageHeight = GetSettingValueInt("LocationsIndex_ImageHeight", 50); await Task.WhenAll(pageDesignTask, locationsTask); var pageDesign = pageDesignTask.Result; var locations = locationsTask.Result; var pageOutput = LocationHelper.GetLocationIndexPage(pageDesign, locations); pageOutput.StoreSettings = settings; pageOutput.MyStore = this.MyStore; return(View(pageOutput)); } catch (Exception ex) { Logger.Error(ex, "Index:" + ex.StackTrace); return(new HttpStatusCodeResult(500)); } }
private async Task <String> GetContentsByContentTypeHtml(int page, int pageSize, string designName, int categoryId, int imageWidth, int imageHeight, string type, string contentType) { string returnHtml; var catId = categoryId == 0 ? (int?)null : categoryId; ContentService2.ImageWidth = imageWidth; ContentService2.ImageHeight = imageHeight; Task <List <Content> > contentsTask = ContentService.GetContentsByContentKeywordAsync(StoreId, catId, type, page, pageSize, true, contentType); var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, designName); var categoriesTask = CategoryService.GetCategoriesByStoreIdAsync(StoreId, type, true); await Task.WhenAll(pageDesignTask, contentsTask, categoriesTask); var contents = contentsTask.Result; var pageDesign = pageDesignTask.Result; var categories = categoriesTask.Result; var pageOuput = ContentService2.GetContentsByContentType(contents, categories, pageDesign, type); returnHtml = pageOuput.PageOutputText; return(returnHtml); }
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(); ContentHelper.StoreSettings = settings; ContentHelper.ImageWidth = GetSettingValueInt(Type + "Index_ImageWidth", 50); ContentHelper.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 = ContentHelper.GetContentsIndexPage(contents, pageDesign, categories, Type); var pagingPageDesignTask = PageDesignService.GetPageDesignByName(StoreId, "Paging"); PagingHelper.StoreSettings = GetStoreSettings(); PagingHelper.StoreId = StoreId; PagingHelper.PageOutput = pageOutput; PagingHelper.HttpRequestBase = this.Request; PagingHelper.RouteData = this.RouteData; PagingHelper.ActionName = this.ControllerContext.RouteData.Values["action"].ToString(); PagingHelper.ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); await Task.WhenAll(pagingPageDesignTask); var pagingDic = PagingHelper.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> 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 async Task <ActionResult> Product(String id = "") { try { if (!IsModulActive(StoreConstants.ProductType)) { Logger.Trace("Navigation Modul is not active:" + StoreConstants.ProductType); return(HttpNotFound("Not Found")); } int productId = id.Split("-".ToCharArray()).Last().ToInt(); var categoryTask = ProductCategoryService.GetProductCategoryAsync(StoreId, productId); var productsPageDesignTask = PageDesignService.GetPageDesignByName(StoreId, ProductDetailPage); var productsTask = ProductService.GetProductsByIdAsync(productId); await Task.WhenAll(productsTask, categoryTask, productsPageDesignTask); var product = productsTask.Result; var pageDesign = productsPageDesignTask.Result; var category = categoryTask.Result; var settings = GetStoreSettings(); ViewData[StoreConstants.MetaTagKeywords] = product.Name; ViewData[StoreConstants.MetaTagDescription] = GeneralHelper.TruncateAtWord(GeneralHelper.StripHtml(product.Name + ", " + product.Description), 155); if (pageDesign == null) { throw new Exception("PageDesing is null:" + ProductDetailPage); } if (product == null) { throw new Exception("Product is NULL. ProductId:" + productId); } if (category == null) { throw new Exception("ProductCategory is NULL.ProductId:" + productId); } ProductHelper.StoreSettings = settings; ProductHelper.ImageWidth = GetSettingValueInt("ProductsDetail_ImageWidth", 50); ProductHelper.ImageHeight = GetSettingValueInt("ProductsDetail_ImageHeight", 50); ProductHelper.StoreSettings = GetStoreSettings(); var dic = ProductHelper.GetProductsDetailPage(product, pageDesign, category); dic.MyStore = this.MyStore; dic.StoreSettings = settings; dic.PageTitle = product.Name; dic.MyStore = this.MyStore; dic.PageTitle = product.Name; return(View(dic)); } catch (Exception ex) { Logger.Error(ex, "ProductsController:Product:" + ex.StackTrace); return(RedirectToAction("Index")); } }
public async Task <ActionResult> Index() { int blogsTake = GetSettingValueInt("HomePageMainBlogsContents_ItemsNumber", StoreConstants.DefaultPageSize); int newsTake = GetSettingValueInt("HomePageMainNewsContents_ItemsNumber", StoreConstants.DefaultPageSize); int productsTake = GetSettingValueInt("HomePageMainProductsContents_ItemsNumber", StoreConstants.DefaultPageSize); int sliderTake = GetSettingValueInt("HomePageSliderImages_ItemsNumber", StoreConstants.DefaultPageSize); int? categoryId = null; String key = String.Format("Home:Index-{0}-{1}-{2}-{3}-{4}", StoreId, blogsTake, newsTake, productsTake, sliderTake); var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, "HomePageWithMainData"); var blogsTask = ContentService.GetMainPageContentsAsync(StoreId, categoryId, StoreConstants.BlogsType, blogsTake); var newsTask = ContentService.GetMainPageContentsAsync(StoreId, categoryId, StoreConstants.NewsType, newsTake); var productsTask = ProductService.GetMainPageProductsAsync(StoreId, productsTake); var sliderTask = FileManagerService.GetStoreCarouselsAsync(StoreId, sliderTake); var categoriesTask = CategoryService.GetCategoriesByStoreIdAsync(StoreId, "", true); var productCategoriesTask = ProductCategoryService.GetProductCategoriesByStoreIdAsync(StoreId, StoreConstants.ProductType, true); // Create new stopwatch. Stopwatch stopwatch = new Stopwatch(); // Begin timing. stopwatch.Start(); await Task.WhenAll(productsTask, blogsTask, newsTask, pageDesignTask, sliderTask, categoriesTask, productCategoriesTask); var settings = GetStoreSettings(); HomePageHelper.StoreId = this.StoreId; HomePageHelper.StoreSettings = settings; var products = productsTask.Result; var blogs = blogsTask.Result; var news = newsTask.Result; var pageDesing = pageDesignTask.Result; var sliderImages = sliderTask.Result; var categories = categoriesTask.Result; var productCategories = productCategoriesTask.Result; StoreLiquidResult liquidResult = HomePageHelper.GetHomePageDesign(pageDesing, sliderImages, products, blogs, news, categories, productCategories); liquidResult.PageTitle = GetSettingValue("HomePage_Title", ""); liquidResult.StoreSettings = settings; liquidResult.MyStore = this.MyStore; // Stop timing. stopwatch.Stop(); Logger.Info("Home:Index:Time elapsed: {0} elapsed milliseconds", stopwatch.ElapsedMilliseconds); return(View(liquidResult)); }
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); var settings = GetStoreSettings(); ProductCategoryHelper.StoreSettings = settings; 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 = ProductCategoryHelper.GetCategoriesIndexPage(pageDesign, categories); var pagingPageDesignTask = PageDesignService.GetPageDesignByName(StoreId, "Paging"); PagingHelper.StoreSettings = GetStoreSettings(); PagingHelper.StoreId = StoreId; PagingHelper.PageOutput = pageOutput; PagingHelper.HttpRequestBase = this.Request; PagingHelper.RouteData = this.RouteData; PagingHelper.ActionName = this.ControllerContext.RouteData.Values["action"].ToString(); PagingHelper.ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); await Task.WhenAll(pagingPageDesignTask); var pagingDic = PagingHelper.GetPaging(pagingPageDesignTask.Result); pagingDic.StoreSettings = settings; 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 async Task <ActionResult> Index(int page = 1) { try { var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, IndexPageDesingName); var pageSize = GetSettingValueInt("PhotoGallery_PageSize", StoreConstants.DefaultPageSize); var fileManagersTask = FileManagerService.GetImagesByFileSizeAsync(StoreId, "ShopStyle", "Best,Large", page, pageSize); var settings = GetStoreSettings(); PhotoGalleryHelper.StoreSettings = settings; PhotoGalleryHelper.ImageWidth = GetSettingValueInt("PhotoGallery_ImageWidth", 500); PhotoGalleryHelper.ImageHeight = GetSettingValueInt("PhotoGallery_ImageHeight", 500); await Task.WhenAll(pageDesignTask, fileManagersTask); var pageDesign = pageDesignTask.Result; // PhotoGalleryHelper.StoreSettings = GetStoreSettings(); if (pageDesign == null) { throw new Exception("PageDesing is null:" + IndexPageDesingName); } var fileManagers = fileManagersTask.Result; var pageOutput = PhotoGalleryHelper.GetPhotoGalleryIndexPage(pageDesign, fileManagers); var pagingPageDesignTask = PageDesignService.GetPageDesignByName(StoreId, "Paging"); PagingHelper.StoreSettings = settings; PagingHelper.StoreId = StoreId; PagingHelper.PageOutput = pageOutput; PagingHelper.HttpRequestBase = this.Request; PagingHelper.RouteData = this.RouteData; PagingHelper.ActionName = this.ControllerContext.RouteData.Values["action"].ToString(); PagingHelper.ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); await Task.WhenAll(pagingPageDesignTask); var pagingDic = PagingHelper.GetPaging(pagingPageDesignTask.Result); pagingDic.StoreSettings = GetStoreSettings(); pagingDic.MyStore = this.MyStore; pageOutput.PageTitle = "Photo Gallery"; return(View(pagingDic)); } catch (Exception ex) { Logger.Error(ex, "PhotoGallery:Index:" + ex.StackTrace); return(new HttpStatusCodeResult(500)); } }
public async Task <ContentResult> GetTheme() { var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, CssFilePageDesingName); await Task.WhenAll(pageDesignTask); var pageDesign = pageDesignTask.Result; if (pageDesign == null) { throw new Exception("PageDesing is null:" + CssFilePageDesingName); } return(Content(pageDesign.PageTemplate, "text/css")); }
// // GET: /Blogs/ public virtual async Task <ActionResult> Detail(String id = "") { try { if (!IsModulActive(Type)) { Logger.Trace("Navigation Modul is not active:" + Type); return(HttpNotFound("Not Found")); } int newsId = id.Split("-".ToCharArray()).Last().ToInt(); var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, PageDesingDetailPageName); var contentTask = ContentService.GetContentByIdAsync(newsId); var categoryTask = CategoryService.GetCategoryByContentIdAsync(StoreId, newsId); ContentHelper.StoreId = this.StoreId; var settings = GetStoreSettings(); ContentHelper.StoreSettings = settings; ContentHelper.ImageWidth = GetSettingValueInt(Type + "Detail_ImageWidth", 50); ContentHelper.ImageHeight = GetSettingValueInt(Type + "Detail_ImageHeight", 50); await Task.WhenAll(pageDesignTask, contentTask, categoryTask); var content = contentTask.Result; var pageDesign = pageDesignTask.Result; var category = categoryTask.Result; if (pageDesign == null) { throw new Exception("PageDesing is null:" + PageDesingDetailPageName); } var dic = ContentHelper.GetContentDetailPage(content, pageDesign, category, Type); dic.StoreSettings = settings; dic.MyStore = this.MyStore; dic.PageTitle = content.Name; return(View(dic)); } catch (Exception ex) { Logger.Error(ex, Type + "Controller" + ex.StackTrace); return(new HttpStatusCodeResult(500)); } }
private async Task <String> GetProductsByProductTypeHtml(int page, string designName, int categoryId, int brandId, int retailerId, int pageSize, int imageWidth, int imageHeight, string productType, int excludedProductId) { string returnHtml = ""; Task <List <Product> > productsTask = null; var catId = categoryId == 0 ? (int?)null : categoryId; var retId = retailerId == 0 ? (int?)null : retailerId; var bId = brandId == 0 ? (int?)null : brandId; var eProductId = excludedProductId == 0 ? (int?)null : excludedProductId; Logger.Trace("StoreId " + StoreId + " designName:" + designName + " categoryId:" + categoryId + " brandId:" + brandId + " pageSize:" + pageSize + " page:" + page + " imageWidth:" + imageWidth + " imageHeight:" + imageHeight + " productType:" + productType); ProductService2.ImageWidth = imageWidth; ProductService2.ImageHeight = imageHeight; int take = pageSize; int skip = (page - 1) * pageSize; productsTask = ProductService.GetProductsByProductTypeAsync(StoreId, catId, bId, retId, StoreConstants.ProductType, take, skip, true, productType, eProductId); var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, designName); var productCategoriesTask = ProductCategoryService.GetProductCategoriesByStoreIdAsync(StoreId, StoreConstants .ProductType, true); await Task.WhenAll(pageDesignTask, productsTask, productCategoriesTask); var products = productsTask.Result; var pageDesign = pageDesignTask.Result; var productCategories = productCategoriesTask.Result; var pageOuput = ProductService2.GetPopularProducts(products, productCategories, pageDesign); returnHtml = pageOuput.PageOutputText; return(returnHtml); }
private async Task <String> GetMainFooter(string designName) { string returnHtml; var navigationsTask = NavigationService.GetStoreActiveNavigationsAsync(StoreId); var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, designName); await Task.WhenAll(pageDesignTask, navigationsTask); var navigations = navigationsTask.Result; var pageDesign = pageDesignTask.Result; var pageOutput = NavigationService2.GetMainLayoutFooterLink(navigations, pageDesign); returnHtml = pageOutput.PageOutputText; return(returnHtml); }
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(); CategoryHelper.StoreSettings = settings; 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 = CategoryHelper.GetCategoriesIndexPage(pageDesign, categories, Type); var pagingPageDesignTask = PageDesignService.GetPageDesignByName(StoreId, "Paging"); PagingHelper.StoreSettings = GetStoreSettings(); PagingHelper.StoreId = StoreId; PagingHelper.PageOutput = pageOutput; PagingHelper.HttpRequestBase = this.Request; PagingHelper.RouteData = this.RouteData; PagingHelper.ActionName = this.ControllerContext.RouteData.Values["action"].ToString(); PagingHelper.ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); await Task.WhenAll(pagingPageDesignTask); var pagingDic = PagingHelper.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)); } }
private async Task <String> GetCommentsHtml(int itemId, string itemType, int page, string designName, int pageSize) { string returnHtml; var commentsTask = CommentService.GetCommentsByItemIdAsync(StoreId, itemId, itemType, page, pageSize); var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, designName); await Task.WhenAll(pageDesignTask, commentsTask); var pageDesign = pageDesignTask.Result; var comments = commentsTask.Result; var pageOuput = CommentService2.GetCommentsPartial(comments, pageDesign); returnHtml = pageOuput.PageOutputText; return(returnHtml); }
public async Task <ActionResult> Category(String id = "", int page = 1) { try { if (!IsModulActive(StoreConstants.ProductType)) { Logger.Trace("Navigation Modul is not active:" + StoreConstants.ProductType); return(HttpNotFound("Not Found")); } int categoryId = id.Split("-".ToCharArray()).Last().ToInt(); var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, CategoryPageDesingName); var categoryTask = ProductCategoryService.GetProductCategoryAsync(categoryId); var settings = GetStoreSettings(); ProductCategoryHelper.StoreSettings = settings; ProductCategoryHelper.ImageWidth = GetSettingValueInt("ProductCategoryPage_ImageWidth", 50); ProductCategoryHelper.ImageHeight = GetSettingValueInt("ProductCategoryPage_ImageHeight", 50); await Task.WhenAll(pageDesignTask, categoryTask); var pageDesign = pageDesignTask.Result; var category = categoryTask.Result; if (pageDesign == null) { throw new Exception("PageDesing is null" + CategoryPageDesingName); } var pageOutput = ProductCategoryHelper.GetCategoryPage(pageDesign, category); pageOutput.StoreSettings = settings; pageOutput.MyStore = this.MyStore; pageOutput.PageTitle = category.Name; return(View(pageOutput)); } catch (Exception ex) { Logger.Error(ex, "Category:Index:" + ex.StackTrace, id); throw ex; } }
public async Task <ActionResult> Index(int page = 1) { try { var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, PageDesingIndexPageName); var pageSize = GetSettingValueInt("Brands_PageSize", StoreConstants.DefaultPageSize); var brandsTask = BrandService.GetBrandsByStoreIdWithPagingAsync(StoreId, true, page, pageSize); var settings = GetStoreSettings(); await Task.WhenAll(pageDesignTask, brandsTask); var pageDesign = pageDesignTask.Result; var brands = brandsTask.Result; if (pageDesign == null) { Logger.Error("PageDesing is null:" + PageDesingIndexPageName); throw new Exception("PageDesing is null:" + PageDesingIndexPageName); } var pageOutput = BrandService2.GetBrandsIndexPage(pageDesign, brands); 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 = "Brands"; return(View(pagingDic)); } catch (Exception ex) { Logger.Error(ex, "Brands:Index:" + ex.StackTrace, page); return(new HttpStatusCodeResult(500)); } }
public async Task <ActionResult> Detail(String id = "") { try { int retailerId = id.Split("-".ToCharArray()).Last().ToInt(); var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, RetailerDetailPageDesignName); var retailerTask = RetailerService.GetRetailerAsync(retailerId); var take = GetSettingValueInt("RetailerProducts_ItemNumber", 20); var productsTask = ProductService.GetProductsByProductTypeAsync(StoreId, null, null, retailerId, StoreConstants.ProductType, 1, take, true, "normal", null); var productCategoriesTask = ProductCategoryService.GetCategoriesByRetailerIdAsync(StoreId, retailerId); var settings = GetStoreSettings(); RetailerHelper.StoreSettings = settings; RetailerHelper.ImageWidth = GetSettingValueInt("RetailerDetail_ImageWidth", 50); RetailerHelper.ImageHeight = GetSettingValueInt("RetailerDetail_ImageHeight", 50); await Task.WhenAll(retailerTask, pageDesignTask, productsTask, productCategoriesTask); var pageDesign = pageDesignTask.Result; var products = productsTask.Result; var productCategories = productCategoriesTask.Result; var retailer = retailerTask.Result; if (pageDesign == null) { throw new Exception("PageDesing is null:" + RetailerDetailPageDesignName); } var dic = RetailerHelper.GetRetailerDetailPage(retailer, products, pageDesign, productCategories); dic.StoreSettings = settings; dic.MyStore = this.MyStore; dic.PageTitle = retailer.Name; return(View(dic)); } catch (Exception ex) { Logger.Error(ex, "Stack Trace:" + ex.StackTrace, id); return(new HttpStatusCodeResult(500)); } }
public async Task <ActionResult> Detail(String id = "") { try { int brandId = id.Split("-".ToCharArray()).Last().ToInt(); var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, BrandDetailPageDesignName); var brandTask = BrandService.GetBrandAsync(brandId); var take = GetSettingValueInt("BrandProducts_ItemNumber", 20); var productsTask = ProductService.GetProductsByBrandAsync(StoreId, brandId, take, 0); var productCategoriesTask = ProductCategoryService.GetCategoriesByBrandIdAsync(StoreId, brandId); var settings = GetStoreSettings(); BrandService2.ImageWidth = GetSettingValueInt("BrandDetail_ImageWidth", 50); BrandService2.ImageHeight = GetSettingValueInt("BrandDetail_ImageHeight", 50); await Task.WhenAll(brandTask, pageDesignTask, productsTask, productCategoriesTask); var pageDesign = pageDesignTask.Result; var products = productsTask.Result; var productCategories = productCategoriesTask.Result; var brand = brandTask.Result; if (pageDesign == null) { throw new Exception("PageDesing is null:" + BrandDetailPageDesignName); } var dic = BrandService2.GetBrandDetailPage(brand, products, pageDesign, productCategories); dic.StoreSettings = settings; dic.MyStore = this.MyStore; dic.PageTitle = brand.Name; return(View(dic)); } catch (Exception ex) { Logger.Error(ex, "Stack Trace:" + ex.StackTrace, id); return(new HttpStatusCodeResult(500)); } }
public virtual async Task <ActionResult> Category(String id = "", int page = 1) { try { if (!IsModulActive(StoreConstants.ProductType)) { return(HttpNotFound("Not Found")); } int categoryId = id.Split("-".ToCharArray()).Last().ToInt(); var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, PageDesingCategoryPageName); var categoryTask = CategoryService.GetCategoryAsync(categoryId); var settings = GetStoreSettings(); CategoryService2.ImageWidth = GetSettingValueInt(Type + "CategoryPage_ImageWidth", 50); CategoryService2.ImageHeight = GetSettingValueInt(Type + "CategoryPage_ImageHeight", 50); await Task.WhenAll(pageDesignTask, categoryTask); var pageDesign = pageDesignTask.Result; var category = categoryTask.Result; if (pageDesign == null) { Logger.Error("PageDesing is null:" + PageDesingCategoryPageName); throw new Exception("PageDesing is null:" + PageDesingIndexPageName); } var pageOutput = CategoryService2.GetCategoryPage(pageDesign, category, Type); pageOutput.StoreSettings = settings; pageOutput.MyStore = this.MyStore; pageOutput.PageTitle = category.Name; return(View(pageOutput)); } catch (Exception ex) { Logger.Error(ex, Type + "Category:Index:" + ex.StackTrace, id); return(new HttpStatusCodeResult(500)); } }
public async Task <JsonResult> GetContactForm(String designName = "ContactFormPartial") { String returnHtml = ""; try { var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, designName); await Task.WhenAll(pageDesignTask); var pageDesign = pageDesignTask.Result; returnHtml = pageDesign.PageTemplate; } catch (Exception ex) { Logger.Error(ex, "ContactFormPartial:" + ex.StackTrace, StoreId, designName); } return(Json(returnHtml, JsonRequestBehavior.AllowGet)); }
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)); }
private async Task <String> GetContentsByContentTypeHtml(int page, int pageSize, string designName, int categoryId, int imageWidth, int imageHeight, string type, string contentType) { string returnHtml; var catId = categoryId == 0 ? (int?)null : categoryId; if (contentType.Equals("random")) { pageSize = pageSize == 0 ? GetSettingValueInt("RandomContents_PageSize", StoreConstants.DefaultPageSize) : pageSize; ContentHelper.ImageWidth = imageWidth == 0 ? GetSettingValueInt("PopularContents_ImageWidth", 99) : imageWidth; ContentHelper.ImageHeight = imageHeight == 0 ? GetSettingValueInt("PopularContents_ImageHeight", 99) : imageHeight; } else if (contentType.Equals("normal")) { pageSize = pageSize == 0 ? GetSettingValueInt("NormalContents_PageSize", StoreConstants.DefaultPageSize) : pageSize; ContentHelper.ImageWidth = imageWidth == 0 ? GetSettingValueInt("PopularContents_ImageWidth", 99) : imageWidth; ContentHelper.ImageHeight = imageHeight == 0 ? GetSettingValueInt("PopularContents_ImageHeight", 99) : imageHeight; } else if (contentType.Equals("popular")) { pageSize = pageSize == 0 ? GetSettingValueInt("PopularContents_PageSize", StoreConstants.DefaultPageSize) : pageSize; ContentHelper.ImageWidth = imageWidth == 0 ? GetSettingValueInt("PopularContents_ImageWidth", 99) : imageWidth; ContentHelper.ImageHeight = imageHeight == 0 ? GetSettingValueInt("PopularContents_ImageHeight", 99) : imageHeight; } else if (contentType.Equals("recent")) { pageSize = pageSize == 0 ? GetSettingValueInt("RecentContents_PageSize", StoreConstants.DefaultPageSize) : pageSize; ContentHelper.ImageWidth = imageWidth == 0 ? GetSettingValueInt("RecentContents_ImageWidth", 99) : imageWidth; ContentHelper.ImageHeight = imageHeight == 0 ? GetSettingValueInt("RecentContents_ImageHeight", 99) : imageHeight; } else if (contentType.Equals("main")) { pageSize = pageSize == 0 ? GetSettingValueInt("MainContents_PageSize", StoreConstants.DefaultPageSize) : pageSize; ContentHelper.ImageWidth = imageWidth == 0 ? GetSettingValueInt("MainContents_ImageWidth", 99) : imageWidth; ContentHelper.ImageHeight = imageHeight == 0 ? GetSettingValueInt("MainContents_ImageHeight", 99) : imageHeight; } Task <List <Content> > contentsTask = ContentService.GetContentsByContentKeywordAsync(StoreId, catId, type, page, pageSize, true, contentType); var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, designName); var categoriesTask = CategoryService.GetCategoriesByStoreIdAsync(StoreId, type, true); await Task.WhenAll(pageDesignTask, contentsTask, categoriesTask); var contents = contentsTask.Result; var pageDesign = pageDesignTask.Result; var categories = categoriesTask.Result; ContentHelper.StoreSettings = GetStoreSettings(); var pageOuput = ContentHelper.GetContentsByContentType(contents, categories, pageDesign, type); returnHtml = pageOuput.PageOutputText; return(returnHtml); }