Exemplo n.º 1
0
        private void PopulateContributorsList()
        {
            BHLProvider provider = new BHLProvider();

            CustomDataAccess.CustomGenericList <Institution> institutions = null;

            // Cache the results of the institutions query for 24 hours
            String cacheKey = "InstitutionsWithPubItems";

            if (Cache[cacheKey] != null)
            {
                // Use cached version
                institutions = (CustomDataAccess.CustomGenericList <Institution>)Cache[cacheKey];
            }
            else
            {
                // Refresh cache
                institutions = provider.InstitutionSelectWithPublishedItems(true);
                Cache.Add(cacheKey, institutions, null, DateTime.Now.AddMinutes(
                              Convert.ToDouble(ConfigurationManager.AppSettings["InstitutionsListQueryCacheTime"])),
                          System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Normal, null);
            }

            ddlContributors.DataSource = institutions;
            ddlContributors.DataBind();
            ddlContributors.Items.Insert(0, new ListItem("(All Contributors)", ""));

            // Select the appropriate item in the list
            if (this.Request.Cookies["ddlContributors"] != null)
            {
                ddlContributors.SelectedValue = this.Request.Cookies["ddlContributors"].Value;
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BHLProvider provider = new BHLProvider();

            if (!this.IsPostBack)
            {
                CustomGenericList <Institution> institutions = provider.InstitutionSelectWithPublishedItems(false);
                foreach (Institution institution in institutions)
                {
                    ddlInstitutions.Items.Add(new ListItem(institution.InstitutionName, institution.InstitutionName));
                }

                this.BuildCharts("", -6);
            }
        }