protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { MainSecurity objSecu = new MainSecurity(); Role objRole = objSecu.GetRole(Page.User.Identity.Name, DFISYS.API.Config.CurrentChannel); Permission objPermission = objSecu.GetPermission(Page.User.Identity.Name); // Check permission doi voi tung loai thong ke if (objPermission.isXuat_Ban_Bai) { ltrSumNewsPublished.Text = NewslistHelper.GetCountNews("publishedlist", false).ToString(); hplPublished.NavigateUrl = "/office/publishedlist.aspx"; } else { hplPublished.Visible = false; } if (objPermission.isDuyet_Bai) { ltrSumNewsWaitingApprove.Text = NewslistHelper.GetCountNews("approvalwaitlist", false).ToString(); hplNewsWaitingApprove.NavigateUrl = "/office/approvalwaitlist.aspx"; } else { hplNewsWaitingApprove.Visible = false; } if (objPermission.isBien_Tap_Bai) { ltrSumNewsWaitingEdit.Text = NewslistHelper.GetCountNews("editwaitlist", false).ToString(); hplNewsWaitingEdit.NavigateUrl = "/office/editwaitlist.aspx"; } else { hplNewsWaitingEdit.Visible = false; } } }
public static string getNewsCountStr(string cpMode, bool isClear) { string strCpMode = cpMode.ToString().ToLower(); string cacheName = string.Empty, str = string.Empty; switch (strCpMode) { case "allnewstemplist": cacheName = "allnewstemplist"; if (isClear) { HttpContext.Current.Cache.Remove(cacheName); } str = HttpContext.Current.Cache.Get(cacheName) as string; if (str == null) { str = DFISYS.BO.Editoral.Newslist.NewslistHelper.News_GetAllNewsTemplistCount("").ToString(); //HttpContext.Current.Cache.Insert(cacheName, str, null, DateTime.Now.AddMinutes(cacheTime), Cache.NoSlidingExpiration); } break; case "approvalwaitspeciallist": //cacheName = "approvalwaitspeciallist"; //if (isClear) HttpContext.Current.Cache.Remove(cacheName); //str = HttpContext.Current.Cache.Get(cacheName) as string; //if (str == null) //{ str = DFISYS.BO.Editoral.Newslist.NewslistHelper.GetRowsCountOfNewsSpecialListControl(" News_status = 2 and IsUserRate =1 ").ToString(); //HttpContext.Current.Cache.Insert(cacheName, str, null, DateTime.Now.AddMinutes(cacheTime), Cache.NoSlidingExpiration); // } break; default: str = NewslistHelper.GetCountNews(Convert.ToString(cpMode), isClear).ToString(); break; } return(str.Equals("0") ? str : int.Parse(str).ToString("#,###")); }