public ActionResult Detail(Int32? id, string category, string level) { Dictionary<string, string> sitemaster = GetSiteMaster(); ViewData["SiteMaster"] = sitemaster; int categoryInt = 0; categoryInt = GetCategory(category); if (id!=0) { ContentPageDao dao = new ContentPageDao(); IDictionary list = dao.QueryDetail(id); ViewData["Detail"] = list; ViewData["Title"] = DifferentUI(categoryInt, levelInt); ViewData["titlename"] = list["Title"]; return View(); } else { return RedirectToAction("List"); } }
public ActionResult List(string category, string level, int? id, string parm, FormCollection collection) { Dictionary<string, string> sitemaster = GetSiteMaster(); ViewData["SiteMaster"] = sitemaster; int PageNo = id ?? 1; categoryInt = GetCategory(category); Dictionary<string, string> dict = ParmHelper.Analysis(collection); ContentPageDao dao = new ContentPageDao(); if (dict.Count == 0) { Dictionary<string, string> use = ParmHelper.AnalysisParm(parm); if (use==null) { ViewData["Query"] = PolicyQueryHelper.GetPolicyListQueryForm(use); //Hashtable ht = new Hashtable(); //获取总数 Hashtable ht = new Hashtable(); ht = ParmHelper.GetPageIndexEx(PageNo, PageSizeList); ht["Category"] = categoryInt; int total = dao.PolicyQueryCount(ht); IList<IDictionary> idlist; string key = category + level + PageNo.ToString(); if (cache.Get(key) == null) { lock (olock) { if (cache.Get(key) == null) { idlist = dao.PolicyQueryList(ht); cache.Insert(key, idlist, null, DateTime.Now.AddMinutes(5), Cache.NoSlidingExpiration); } else { idlist = (IList<IDictionary>)cache.Get(key); } } } else { idlist = (IList<IDictionary>)cache.Get(key); } PagedList<IDictionary> list = new PagedList<IDictionary>(idlist, PageNo, 10,total); ViewData["Count"] = total; ViewData["List"] = list; ViewData["Title"] = DifferentUI(categoryInt, levelInt); ViewData["detaillink"] = category + "/" + level; return View(list); } else { ViewData["Query"] = PolicyQueryHelper.GetPolicyListQueryForm(use); Hashtable ht = new Hashtable(); Hashtable parmHt = ParmHelper.GetPageIndex(PageNo, PageSizeList, use, out ht); parmHt["Category"] = categoryInt; IList<IDictionary> idlist = dao.QueryListByUser(parmHt); int total = dao.PolicyCategroyCount(parmHt); PagedList<IDictionary> list = new PagedList<IDictionary>(idlist,PageNo, PageSizeList, total); ViewData["Count"] = total; ViewData["Title"] = DifferentUI(categoryInt, levelInt); ViewData["List"] = list; ViewData["detaillink"] = category + "/" + level; return View(list); } } if (dict.Count != 0) { string parmeter = ParmHelper.BuildParm(dict); return RedirectToAction("List", new { parm = parmeter }); } ViewData["titlename"] = DifferentUI(categoryInt, levelInt); return View(); }