protected void BindData() { StoryCategoriesCollection<StoryCategories> _cat = new StoryCategoriesCollection<StoryCategories>(this.ConnectionString); _cat.LitePopulate(new CoreLibrary.ArgumentsList()); dg_category.DataSource = _cat; dg_category.DataBind(); PortalCacheFactory.RefreshStoryCategory(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { HtmlGenericControl _nc = (HtmlGenericControl)Master.FindControl("navHistory"); _nc.Attributes.Add("class", "active"); StoryCategoriesCollection<StoryCategories> _cat = new StoryCategoriesCollection<StoryCategories>(this.ConnectionString); _cat.LitePopulate(new CoreLibrary.ArgumentsList()); dd_Category.DataSource = _cat; dd_Category.DataTextField = "Description"; dd_Category.DataValueField = "ID"; dd_Category.DataBind(); dd_Category.Items.Insert(0, new ListItem("---- Select One ----", "")); dd_Status.DataSource = this.LogedInUser.GetAllStatuses(); dd_Status.DataTextField = "Description"; dd_Status.DataValueField = "ID"; dd_Status.DataBind(); String _storId = Request.QueryString["storId"]; if (!String.IsNullOrEmpty(_storId)) { ViewState.Add("storId", _storId); Stories _stor = new Stories(this.ConnectionString); _stor.LitePopulate(_storId, false); if (dd_Category.Items.FindByValue(_stor.CategoryId.ToString()) != null) { dd_Category.Items.FindByValue(_stor.CategoryId.ToString()).Selected = true; } txt_Title.Text = HttpUtility.HtmlDecode(_stor.Title); txt_Story.Text = HttpUtility.HtmlDecode(_stor.Story); txt_YouTube.Text = _stor.YouTubeLink; if (dd_Status.Items.FindByValue(_stor.Status.ToString()) != null) { dd_Status.Items.FindByValue(_stor.Status.ToString()).Selected = true; } } } }
/// <summary> /// Refresh Story Category /// </summary> public static void RefreshStoryCategory() { CacheManager _cf = CacheFactory.GetCacheManager(); StoryCategoriesCollection<StoryCategories> _cat = new StoryCategoriesCollection<StoryCategories>(ConnectionString); _cat.LitePopulate(new CoreLibrary.ArgumentsList()); _cf.Add(STORY_CATEGORY_KEY, _cat, CacheItemPriority.Normal, null, new SlidingTime(TimeSpan.FromHours(Convert.ToInt32(ConfigurationManager.AppSettings["DefaultCacheingHours"])))); }