Esempio n. 1
0
 public void AdjustSlider(SliderGallery sliderGallery)
 {
     if (sliderGallery.HasSlides)
     {
         CoverImagePath = sliderGallery.CoverImageFileName;
         PromoClipLink.NavigateUrl = sliderGallery.PromoClipUri;
         ShowSlider(sliderGallery.Slides);
     }
 }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string sql = "";

            //Set Domain
            if (HttpContext.Current.Request.ServerVariables["SERVER_NAME"].ToString() != "localhost")
                basedomain = "http://" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"];

            //Show slider since we are on the global home page
            SliderGallery sliderGallery = new SliderGallery();
            ((ER_BestPickReports_Dev.SiteMaster)Master).AdjustSlider(sliderGallery);

            //Set masterpage variable for footer city rel attribute
            ((ER_BestPickReports_Dev.SiteMaster)Master).setnofollow = false;

            //Hide form errors on load
            NewsletterErrorPanel.Visible = false;
            GuideErrorPanel.Visible = false;

            if (!IsPostBack)
            {
                //Redirect if cookie and qs redirect is not false
                if (Request.QueryString["redirect"] == null)
                {
                    if (
                        !String.IsNullOrEmpty(bprPreferences.CityUrlName) &&
                        !String.IsNullOrEmpty(bprPreferences.AreaUrlName))
                    {
                        Response.Redirect(basedomain + "/" + bprPreferences.CityUrlName + "/" +
                                          bprPreferences.AreaUrlName);
                    }
                    else
                    {
                        bprPreferences.RemoveAll();
                    }
                }
            }

            RibbonImage.ImageUrl = "/images/" + DateTime.Today.Year.ToString() + "_ribbon_global_metro.png";

            if (!String.IsNullOrEmpty(bprPreferences.CityUrlName) &&
                !String.IsNullOrEmpty(bprPreferences.AreaUrlName))
            {
                pagecityid = bprPreferences.CityId;
                pageareaid = bprPreferences.AreaId;
            }

            //Add meta info
            HtmlMeta meta1;
            //HtmlMeta meta2;

            //meta2 = new HtmlMeta();
            //meta2.Name = "keywords";
            //meta2.Content = "";
            //Page.Header.Controls.Add(meta2);
            //Page.Header.Controls.Add(new LiteralControl("\n"));

            meta1 = new HtmlMeta();
            meta1.Name = "description";
            meta1.Content = "Best Pick Reports and Home Reports are annual publications produced by EBSCO Research, an independent research firm founded in 1997.";
            Page.Header.Controls.Add(meta1);
            Page.Header.Controls.Add(new LiteralControl("\n"));

            //Get homeowner testimonials
            sql = "SELECT TOP 20 * FROM HomeownerTestimonial WHERE (PublishDate <= @DATE) ORDER BY NEWID()";

            DataTable allitems = DataAccessHelper.Data.ExecuteDataset(sql,
                new SqlParameter("@DATE", DateTime.Now)).Tables[0];

            TList.DataSource = allitems;
            TList.DataBind();

            //// A stackSize of 0 will guarantee that you have 'numLists' lists and
            //// that the items are distributed equally from left to right.
            //List<DataTable> lists = GetListData(allitems, 0, numLists);

            //// How many lists actually have data
            //for (int i = 1; i <= lists.Count; i++)
            //{
            //    if (lists[i - 1].Rows.Count > 0)
            //        dataCount++;
            //}

            //// Bind to the lists.  There could be fewer populated lists based on your settings.
            //for (int i = 1; i <= lists.Count; i++)
            //{
            //    currentList = i;
            //    ListView listView = FindUIControl(i);
            //    listView.DataSource = lists[i - 1];
            //    listView.DataBind();
            //}
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Get value from route handler
            cityID = BWSession.tempCityID;
            areaID = BWSession.tempAreaID;
            strcity = (HttpContext.Current.Items["city"].ToString() == "" || HttpContext.Current.Items["city"].ToString() == null) ? "" : HttpContext.Current.Items["city"].ToString();
            strarea = (HttpContext.Current.Items["area"].ToString() == "" || HttpContext.Current.Items["area"].ToString() == null) ? "" : HttpContext.Current.Items["area"].ToString();

            //Set cityid and areaid on master page
            ((ER_BestPickReports_Dev.SiteMaster)Master).cityID = cityID;
            ((ER_BestPickReports_Dev.SiteMaster)Master).areaID = areaID;

            SliderGallery sliderGallery = new SliderGallery(cityID, areaID);
            ((ER_BestPickReports_Dev.SiteMaster)Master).AdjustSlider(sliderGallery);

            //Hide form errors on load
            NewsletterErrorPanel.Visible = false;
            GuideErrorPanel.Visible = false;

            //Set Domain
            if (HttpContext.Current.Request.ServerVariables["SERVER_NAME"].ToString() != "localhost")
                basedomain = "http://" + HttpContext.Current.Request.ServerVariables["SERVER_NAME"];

            //Hide items for Boston and Philly markets
            if (DataAccessHelper.GetCityUrlFromID(cityID.ToString()) == "philadelphia" || DataAccessHelper.GetCityUrlFromID(cityID.ToString()) == "boston")
            {
                RequestPanel.Visible = false;
            }

            string sql = "";

            using (SqlConnection conn = new SqlConnection(DataAccessHelper.ConnString))
            {
                conn.Open();

                //Show page content
                sql = "SELECT Area.AreaID, Area.CityID, CityInfo.MetaTitle AS CityMetaTitle, CityInfo.MetaDesc AS CityMetaDesc, CityInfo.MetaKey AS CityMetaKey, " +
                    "CityInfo.ShortDesc AS CityRibbonText, CityInfo.LongDesc AS CityBlogText, CityInfo.MobileYear AS DataYear, AreaInfo.MetaTitle AS AreaMetaTitle, AreaInfo.MetaDesc AS AreaMetaDesc, AreaInfo.MetaKey AS AreaMetaKey, " +
                    "AreaInfo.ShortDesc AS AreaRibbonText, AreaInfo.LongDesc AS AreaBlogText, AreaInfo.UrlName AS AreaUrlName, AreaInfo.DisplayName AS AreaDisplayName, CityInfo.UrlName AS CityUrlName, " +
                    "CityInfo.DisplayName AS CityDisplayName FROM Area INNER JOIN CityInfo ON Area.CityID = CityInfo.CityID INNER JOIN AreaInfo ON Area.AreaID = AreaInfo.AreaID " +
                    "WHERE (AreaInfo.AreaID = @AREAID) AND (CityInfo.CityID = @CITYID)";

                SqlDataReader rdr = DataAccessHelper.Data.ExecuteDatareader(conn, sql,
                        new SqlParameter("@AREAID", areaID),
                        new SqlParameter("@CITYID", cityID));

                if (rdr.Read())
                {
                    string ryear = DateTime.Today.Year.ToString();

                    if (rdr["DataYear"].ToString() != "0")
                        ryear = rdr["DataYear"].ToString();

                    RibbonImage.ImageUrl = "/images/" + ryear + "_ribbon_global_metro.png";
                    RibbonImage.AlternateText = ryear + " EBSCO Research Best Pick";
                    RibbonImage.ToolTip = ryear + " EBSCO Research Best Pick";

                    if (rdr["AreaRibbonText"].ToString() != "")
                        RibbonText.Text = rdr["AreaRibbonText"].ToString();
                    else
                        RibbonText.Text = rdr["CityRibbonText"].ToString();

                    //BlogCityLink.NavigateUrl = basedomain + "/blog/" + rdr["CityURLName"].ToString();

                    if (rdr["AreaBlogText"].ToString() != "")
                        BlogText.Text = rdr["AreaBlogText"].ToString();
                    else
                        BlogText.Text = rdr["CityBlogText"].ToString();

                    FeedCityLink.NavigateUrl = basedomain + "/blog/" + rdr["CityURLName"].ToString();
                    FeedCityName.Text = rdr["CityDisplayName"].ToString();

                    //Check for info at the area level - if empty, use city level info
                    string strMetaTitle = "";
                    string strMetaKey = "";
                    string strMetaDesc = "";

                    if (rdr["AreaMetaTitle"].ToString() != "")
                        strMetaTitle = rdr["AreaMetaTitle"].ToString();
                    else
                        strMetaTitle = rdr["CityMetaTitle"].ToString();

                    if (rdr["AreaMetaKey"].ToString() != "")
                        strMetaKey = rdr["AreaMetaKey"].ToString();
                    else
                        strMetaKey = rdr["CityMetaKey"].ToString();

                    if (rdr["AreaMetaDesc"].ToString() != "")
                        strMetaDesc = rdr["AreaMetaDesc"].ToString();
                    else
                        strMetaDesc = rdr["CityMetaDesc"].ToString();

                    //Add meta info
                    HtmlMeta meta1;
                    HtmlMeta meta2;

                    meta2 = new HtmlMeta();
                    meta2.Name = "keywords";
                    meta2.Content = strMetaKey;
                    Page.Header.Controls.Add(meta2);
                    Page.Header.Controls.Add(new LiteralControl("\n"));

                    meta1 = new HtmlMeta();
                    meta1.Name = "description";
                    meta1.Content = strMetaDesc;
                    Page.Header.Controls.Add(meta1);
                    Page.Header.Controls.Add(new LiteralControl("\n"));

                    Page.Title = strMetaTitle;

                    //Set cookie for city/area preference
                    bprPreferences.CityId = int.Parse(cityID.ToString());
                    bprPreferences.CityName = rdr["CityDisplayName"].ToString();
                    bprPreferences.CityUrlName = rdr["CityURLName"].ToString();
                    bprPreferences.AreaId = int.Parse(areaID.ToString());
                    bprPreferences.AreaName = rdr["AreaDisplayName"].ToString();
                    bprPreferences.AreaUrlName = rdr["AreaURLName"].ToString();
                    bprPreferences.SetExpiration(DateTime.Now.AddDays(365));
                }
                rdr.Close();

                conn.Close();
            }

            //Get homeowner testimonials
            sql = "SELECT TOP 20 * FROM HomeownerTestimonial WHERE (CityID = @CITYID) AND (PublishDate <= @DATE) ORDER BY NEWID()";

            DataTable allitems = DataAccessHelper.Data.ExecuteDataset(sql,
                new SqlParameter("@CITYID", cityID),
                new SqlParameter("@DATE", DateTime.Now)).Tables[0];

            TList.DataSource = allitems;
            TList.DataBind();

            //// A stackSize of 0 will guarantee that you have 'numLists' lists and
            //// that the items are distributed equally from left to right.
            //List<DataTable> lists = GetListData(allitems, 0, numLists);

            //// How many lists actually have data
            //for (int i = 1; i <= lists.Count; i++)
            //{
            //    if (lists[i - 1].Rows.Count > 0)
            //        dataCount++;
            //}

            //// Bind to the lists.  There could be fewer populated lists based on your settings.
            //for (int i = 1; i <= lists.Count; i++)
            //{
            //    currentList = i;
            //    ListView listView = FindUIControl(i);
            //    listView.DataSource = lists[i - 1];
            //    listView.DataBind();
            //}
        }