public ActionResult PostDetails(string html) { int _categoryId = 0; ListAccess la = new ListAccess(); ArticleModel model = new ArticleModel(); model.ArticleContent.LoadArticle(html); model.Comments = la.ArticleComments(model.ArticleContent.ArticleId); if (model.ArticleContent.CategoryId > 0) { _categoryId = model.ArticleContent.CategoryId; } else if (model.ArticleContent.SecondLevCategoryId > 0) {_categoryId = model.ArticleContent.SecondLevCategoryId; } else { _categoryId = model.ArticleContent.ThirdLevCategoryId; } PageModel.ArticleContent.Title = model.ArticleContent.Title; PageModel.ArticleContent.Description = model.ArticleContent.Description; PageModel.ArticleContent.Author = model.ArticleContent.Author; PageModel.ArticleContent.Keywords = model.ArticleContent.Keywords; model.MostViewed = la.MostViewed(_categoryId, 20); model.RelatedTreeView = DIYFEHelper.GenerateTreeViewSecondLev(_categoryId, linkPrefix); return View(model); }
public static void LoadStaticCache() { //EXAMPLE OF HOW TO USE WITH A ORM TOOL //using (var context = new MDMContext()) //{ // HttpContext.Current.Application["communicationType"] = context.CommunicationType.ToList(); //} HttpContext.Current.Application["someVarName"] = "This is a test. Normally a list of objects but since no DB connection is made it's only a string...le sigh, poor string."; DIYFELib.ListAccess la = new DIYFELib.ListAccess(); HttpContext.Current.Application["Categories"] = la.AllCategory(); }
// // GET: /Products/ public ActionResult Index() { PageModel.ArticleContent.Title = "DiyFe Products"; PageModel.ArticleContent.Description = "List of products dealing with "; PageModel.ArticleContent.Author = "Do it yourself for everyone."; PageModel.ArticleContent.Keywords = "DIY, DIYFE, do it yourself, homesteading, transition"; ListAccess la = new ListAccess(); ArticleModel model = new ArticleModel(); model.MostViewed = la.MostViewed(11, 20); model.CrumbLinkList = new List<CustomHtmlLink>(); return View(model); }
public ActionResult ProjectDetails(string html) { int articleId = 2; ListAccess la = new ListAccess(); ArticleModel model = new ArticleModel(); model.ArticleContent.LoadArticle(html); model.Comments = la.ArticleComments(articleId); PageModel.ArticleContent.Title = model.ArticleContent.Title; PageModel.ArticleContent.Description = model.ArticleContent.Description; PageModel.ArticleContent.Author = model.ArticleContent.Author; PageModel.ArticleContent.Keywords = model.ArticleContent.Keywords; return View(model); }
public ActionResult Index() { ArticleModel model = new ArticleModel(); model.ArticleContent.LoadArticle(5); PageModel.ArticleContent.Title = model.ArticleContent.Title; PageModel.ArticleContent.Description = model.ArticleContent.Description; PageModel.ArticleContent.Author = model.ArticleContent.Author; PageModel.ArticleContent.Keywords = model.ArticleContent.Keywords; ListAccess la = new ListAccess(); model.MostViewed = la.MostViewed(11, 20); string url = HttpContext.Request.RawUrl; int catigoryId = DIYFEHelper.GetCatigoryRowId(url); model.CrumbLinkList = DIYFEHelper.GenerateCrumbLinks(catigoryId, linkPrefix); //model.ArticleList = la.ArticleList(catigoryId, 1); return View(model); }
public ActionResult FirstLevCategoryList(string categoryUrl) { ListAccess la = new ListAccess(); ArticleModel model = new ArticleModel(); model.MostViewed = la.MostViewed(11, 20); //model.CrumbLinkList = new List<CustomHtmlLink>(); //AppStatic.Categories.Where(c => c.CategoryUrl == categoryUrl); PageModel.ArticleContent.Title = model.ArticleContent.Title; PageModel.ArticleContent.Description = model.ArticleContent.Description; PageModel.ArticleContent.Author = model.ArticleContent.Author; PageModel.ArticleContent.Keywords = model.ArticleContent.Keywords; string url = HttpContext.Request.RawUrl; int catigoryId = DIYFEHelper.GetCatigoryRowId(categoryUrl, "", ""); model.CrumbLinkList = DIYFEHelper.GenerateCrumbLinks(catigoryId, linkPrefix); model.ArticleList = la.ArticleList(catigoryId, 1); // model.RelatedTreeView = DIYFEHelper.GenerateRelatedTreeView(catigoryId, linkPrefix); return View(model); }
public ActionResult SecondLevCategoryList(string categoryUrl, string subCategoryUrl) { string url = HttpContext.Request.RawUrl; int catigoryId = DIYFEHelper.GetCatigoryRowId(categoryUrl, subCategoryUrl, ""); ListAccess la = new ListAccess(); ArticleModel model = new ArticleModel(); PageModel.ArticleContent.Title = model.ArticleContent.Title; PageModel.ArticleContent.Description = model.ArticleContent.Description; PageModel.ArticleContent.Author = model.ArticleContent.Author; PageModel.ArticleContent.Keywords = model.ArticleContent.Keywords; model.MostViewed = la.MostViewed(11, 20); model.CrumbLinkList = DIYFEHelper.GenerateCrumbLinks(catigoryId, linkPrefix); model.ArticleList = la.ArticleList(catigoryId, 1); //model.RelatedTreeView = DIYFEHelper.GenerateRelatedTreeView(catigoryId, linkPrefix); model.RelatedTreeView = DIYFEHelper.GenerateTreeViewSecondLev(catigoryId, linkPrefix); return View(model); }
public static List<CustomHtmlLink> GenerateRelatedTreeView(int categoryRowId, string linkPrefix) { List<CustomHtmlLink> linkList = new List<CustomHtmlLink>(); ListAccess la = new ListAccess(); Category cat = AppStatic.Categories .Where(c => c.CategoryRowId == categoryRowId) .FirstOrDefault(); linkList.Add(new CustomHtmlLink { LinkText = cat.CategoryName, Href = AppStatic.BaseSiteUrl + linkPrefix + "/" + cat.CategoryUrl, Title = cat.CategoryName, SubLinks = GenerateTreeViewSecondLev(categoryRowId, linkPrefix)//la.RelatedArticleLinks(cat, linkPrefix, 3) }); //if (!String.IsNullOrEmpty(cat.ThirdLevCategoryUrl)) //{ // CustomHtmlLink htmlLink = new CustomHtmlLink // { // LinkText = cat.ThirdLevCategoryName, // Href = "/" + linkPrefix + "/" + cat.CategoryUrl + "/" + cat.SecondLevCategoryUrl + "/" + cat.ThirdLevCategoryUrl, // Title = cat.ThirdLevCategoryName, // SubLinks = la.RelatedArticleLinks(cat, linkPrefix, 3) // }; // //linkList[0].SubLinks=la.RelatedArticleLinks(cat, linkPrefix, 3); // List<Category> secondLevelCats = AppStatic.Categories // .Where(c => c.SecondLevCategoryId == cat.SecondLevCategoryId // && c.CategoryRowId != categoryRowId).ToList(); // foreach (Category _cat in secondLevelCats) // { // //linkList.Add(new CustomHtmlLink // //{ // // LinkText = _cat.SecondLevCategoryName, // // Href = "/" + linkPrefix + "/" + _cat.CategoryUrl + "/" + _cat.SecondLevCategoryUrl, // // Title = _cat.SecondLevCategoryName + "-category", // //}); // //(!String.IsNullOrEmpty(_cat.ThirdLevCategoryUrl)) // //{ // //} // //linkList.Last().SubLinks = la.RelatedArticleLinks(_cat, linkPrefix); // } // return linkList; //} //if (!String.IsNullOrEmpty(cat.SecondLevCategoryUrl)) //{ // List<Category> secondLevelCats = AppStatic.Categories // .Where(c => c.CategoryId == cat.CategoryId).ToList(); // foreach (Category _cat in secondLevelCats) // { // linkList.Add(new CustomHtmlLink // { // LinkText = _cat.CategoryName, // Href = "/" + linkPrefix + "/" + _cat.CategoryUrl, // Title = _cat.CategoryName // }); // if (!String.IsNullOrEmpty(_cat.ThirdLevCategoryUrl)) // { // linkList.Last().SubLinks = GenerateRelatedTreeView(_cat.CategoryRowId, linkPrefix); // } // else // { // linkList.Last().SubLinks = la.RelatedArticleLinks(_cat, linkPrefix, 3); // } // } // return linkList; //} //ListAccess la = new ListAccess(); //linkList = la.RelatedLinks(cat, linkPrefix); return linkList; }
//public static List<CustomHtmlLink> GenerateTreeViewFirstLev(int categoryRowId, string linkPrefix) //{ // List<CustomHtmlLink> linkList = new List<CustomHtmlLink>(); // ListAccess la = new ListAccess(); // Category cat = AppStatic.Categories // .Where(c => c.CategoryRowId == categoryRowId) // .FirstOrDefault(); // if (!String.IsNullOrEmpty(cat.ThirdLevCategoryUrl)) // { // CustomHtmlLink htmlLink = new CustomHtmlLink // { // LinkText = cat.ThirdLevCategoryName, // Href = "/" + linkPrefix + "/" + cat.CategoryUrl + "/" + cat.SecondLevCategoryUrl + "/" + cat.ThirdLevCategoryUrl, // Title = cat.ThirdLevCategoryName, // SubLinks = la.RelatedArticleLinks(cat, linkPrefix, 3) // }; // //linkList[0].SubLinks=la.RelatedArticleLinks(cat, linkPrefix, 3); // List<Category> secondLevelCats = AppStatic.Categories // .Where(c => c.SecondLevCategoryId == cat.SecondLevCategoryId // && c.CategoryRowId != categoryRowId).ToList(); // foreach (Category _cat in secondLevelCats) // { // //linkList.Add(new CustomHtmlLink // //{ // // LinkText = _cat.SecondLevCategoryName, // // Href = "/" + linkPrefix + "/" + _cat.CategoryUrl + "/" + _cat.SecondLevCategoryUrl, // // Title = _cat.SecondLevCategoryName + "-category", // //}); // //(!String.IsNullOrEmpty(_cat.ThirdLevCategoryUrl)) // //{ // //} // //linkList.Last().SubLinks = la.RelatedArticleLinks(_cat, linkPrefix); // } // return linkList; // } // if (!String.IsNullOrEmpty(cat.SecondLevCategoryUrl)) // { // List<Category> secondLevelCats = AppStatic.Categories // .Where(c => c.CategoryId == cat.CategoryId).ToList(); // foreach (Category _cat in secondLevelCats) // { // linkList.Add(new CustomHtmlLink // { // LinkText = _cat.CategoryName, // Href = "/" + linkPrefix + "/" + _cat.CategoryUrl, // Title = _cat.CategoryName // }); // if (!String.IsNullOrEmpty(_cat.ThirdLevCategoryUrl)) // { // linkList.Last().SubLinks = GenerateRelatedTreeView(_cat.CategoryRowId, linkPrefix); // } // else // { // linkList.Last().SubLinks = la.RelatedArticleLinks(_cat, linkPrefix, 3); // } // } // return linkList; // } // //ListAccess la = new ListAccess(); // //linkList = la.RelatedLinks(cat, linkPrefix); // return linkList; //} public static List<CustomHtmlLink> GenerateTreeViewThirdLev(int secondLevCatId, string linkPrefix) { List<CustomHtmlLink> linkList = new List<CustomHtmlLink>(); ListAccess la = new ListAccess(); List<Category> thirdLevCats = AppStatic.Categories .Where(c => c.SecondLevCategoryId == secondLevCatId && c.ThirdLevCategoryId > 0) .ToList(); //List<Category> thirdLevelCats = AppStatic.Categories // .Where(c => c.SecondLevCategoryId == cat.SecondLevCategoryId // && !String.IsNullOrEmpty(c.ThirdLevCategoryName)) // .ToList(); foreach (Category _thirdLevCat in thirdLevCats) { CustomHtmlLink newCat = new CustomHtmlLink { LinkText = _thirdLevCat.ThirdLevCategoryName, Href = AppStatic.BaseSiteUrl + linkPrefix + "/" + _thirdLevCat.CategoryUrl + "/" + _thirdLevCat.SecondLevCategoryUrl + "/" + _thirdLevCat.ThirdLevCategoryUrl, Title = _thirdLevCat.ThirdLevCategoryName, SubLinks = la.RelatedArticleLinks(_thirdLevCat, AppStatic.BaseSiteUrl + linkPrefix, 3) }; linkList.Add(newCat); //newCat.SubLinks.AddRange(GenerateTreeViewThirdLev(_secondLevCat.SecondLevCategoryId, linkPrefix)); } return linkList; }