protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                StationPageBase parent = (StationPageBase)this.Page;

                int stationId = parent.StationId;

                DollarSaverDB.StationRow station = parent.Station;


                headerLink.NavigateUrl = parent.GetUrl("~/Default.aspx");

                if (!station.IsStationUrlNull())
                {
                    stationUrlHolder.Visible = true;
                    stationLink.Text         = "Return to " + station.Name;
                    stationLink.NavigateUrl  = station.StationUrl;
                }
                else
                {
                    stationUrlHolder.Visible = false;
                }


                if (File.Exists(Request.PhysicalApplicationPath + station.StationDirUrl + "station.css"))
                {
                    stationStyleSheet.Href = "~/" + station.StationDirUrl + "station.css";
                }
                else
                {
                    stationStyleSheet.Href = "~/styles/station.css";
                }

                String ImageDir = Request.PhysicalApplicationPath + station.ImageDirUrl;
                if (!station.Content.IsTopperImageNull() && File.Exists(ImageDir + station.Content.TopperImage))
                {
                    topperImage.ImageUrl = "~/" + station.ImageDirUrl + station.Content.TopperImage;
                }
                if (!station.Content.IsTopperImageNull() && File.Exists(ImageDir + station.Content.TopperImage))
                {
                    topperImagem.ImageUrl = "~/" + station.ImageDirUrl + station.Content.TopperImage;
                }
                if (!station.Content.IsLocalSavingsImageNull() && File.Exists(ImageDir + station.Content.LocalSavingsImage))
                {
                    localSavingsImagem.ImageUrl = "~/" + station.ImageDirUrl + station.Content.LocalSavingsImage;
                }
                if (!station.Content.IsLocalSavingsImageNull() && File.Exists(ImageDir + station.Content.LocalSavingsImage))
                {
                    localSavingsImage.ImageUrl = "~/" + station.ImageDirUrl + station.Content.LocalSavingsImage;
                }

                if (!station.Content.IsHeaderImageNull() && File.Exists(ImageDir + station.Content.HeaderImage))
                {
                    headerImage.ImageUrl = "~/" + station.ImageDirUrl + station.Content.HeaderImage;
                }


                if (File.Exists(Request.PhysicalApplicationPath + station.StationDirUrl + "end_include.html"))
                {
                    endIncludeLiteral.Text = File.ReadAllText(Request.PhysicalApplicationPath + station.StationDirUrl + "end_include.html");
                }


                //topMenu.Station = station;

                endYearLabel.Text = DateTime.Now.ToString("yyyy");

                signUpBottomLink.NavigateUrl = parent.GetUrl(signUpBottomLink.NavigateUrl);
                cartLink.NavigateUrl         = parent.GetUrl(cartLink.NavigateUrl);
                contactLink.NavigateUrl      = parent.GetUrl(contactLink.NavigateUrl);
                privacyLink.NavigateUrl      = parent.GetUrl(privacyLink.NavigateUrl);
                termsLink.NavigateUrl        = parent.GetUrl(termsLink.NavigateUrl);
                faqLink.NavigateUrl          = parent.GetUrl(faqLink.NavigateUrl);
                rssLink.NavigateUrl          = parent.GetUrl(rssLink.NavigateUrl);
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            recentDealsRepeater.ItemDataBound += new RepeaterItemEventHandler(recentDealsRepeater_ItemDataBound);

            if (!Page.IsPostBack)
            {
                StationPageBase parent = (StationPageBase)this.Parent;

                int stationId = parent.StationId;

                headerLink.NavigateUrl = parent.GetUrl("~/Default.aspx");

                DollarSaverDB.StationRow station = parent.Station;

                //stationNameLabel.Text = station.Name;
                content1Label.Text = station.Content1;
                content2Label.Text = station.Content2;

                if (!station.IsStationUrlNull())
                {
                    stationUrlHolder.Visible = true;
                    stationLink.Text         = "Return to " + station.Name;
                    stationLink.NavigateUrl  = station.StationUrl;
                }
                else
                {
                    stationUrlHolder.Visible = false;
                }

                if (File.Exists(Request.PhysicalApplicationPath + station.StationDirUrl + "station.css"))
                {
                    stationStyleSheet.Href = station.StationDirUrl + "station.css";
                }
                else
                {
                    stationStyleSheet.Href = "~/styles/station.css";
                }

                String ImageDir = Request.PhysicalApplicationPath + station.ImageDirUrl;
                if (!station.Content.IsTopperImageNull() && File.Exists(ImageDir + station.Content.TopperImage))
                {
                    topperImage.ImageUrl = station.ImageDirUrl + station.Content.TopperImage;
                }
                if (!station.Content.IsTopperImageNull() && File.Exists(ImageDir + station.Content.TopperImage))
                {
                    topperImagem.ImageUrl = "~/" + station.ImageDirUrl + station.Content.TopperImage;
                }
                if (!station.Content.IsLocalSavingsImageNull() && File.Exists(ImageDir + station.Content.LocalSavingsImage))
                {
                    localSavingsImagem.ImageUrl = "~/" + station.ImageDirUrl + station.Content.LocalSavingsImage;
                }
                if (!station.Content.IsLocalSavingsImageNull() && File.Exists(ImageDir + station.Content.LocalSavingsImage))
                {
                    localSavingsImage.ImageUrl = station.ImageDirUrl + station.Content.LocalSavingsImage;
                }

                if (!station.Content.IsHeaderImageNull() && File.Exists(ImageDir + station.Content.HeaderImage))
                {
                    headerImage.ImageUrl = station.ImageDirUrl + station.Content.HeaderImage;
                }

                if (!station.Content.IsLogoImageNull() && File.Exists(ImageDir + station.Content.LogoImage))
                {
                    logoImage.ImageUrl = station.ImageDirUrl + station.Content.LogoImage;
                }

                if (File.Exists(Request.PhysicalApplicationPath + station.StationDirUrl + "end_include.html"))
                {
                    endIncludeLiteral.Text = File.ReadAllText(Request.PhysicalApplicationPath + station.StationDirUrl + "end_include.html");
                }


                signUpTopLink.NavigateUrl    = parent.GetUrl(signUpTopLink.NavigateUrl);
                signUpBottomLink.NavigateUrl = parent.GetUrl(signUpBottomLink.NavigateUrl);
                cartLink.NavigateUrl         = parent.GetUrl(cartLink.NavigateUrl);
                contactLink.NavigateUrl      = parent.GetUrl(contactLink.NavigateUrl);
                privacyLink.NavigateUrl      = parent.GetUrl(privacyLink.NavigateUrl);
                termsLink.NavigateUrl        = parent.GetUrl(termsLink.NavigateUrl);
                faqLink.NavigateUrl          = parent.GetUrl(faqLink.NavigateUrl);
                rssLink.NavigateUrl          = parent.GetUrl(rssLink.NavigateUrl);


                CertificateTableAdapter            certificateAdapter = new CertificateTableAdapter();
                DollarSaverDB.CertificateDataTable onSaleDeals        = certificateAdapter.GetOnSale(station.StationId);

                var latestDeals =
                    (from DollarSaverDB.CertificateRow cert in onSaleDeals
                     orderby cert.OnSaleDate descending select cert).Take(10);


                if (latestDeals.Count() > 0)
                {
                    recentDealsHolder.Visible = true;

                    recentDealsRepeater.DataSource = latestDeals;
                    recentDealsRepeater.DataBind();
                }
                else
                {
                    recentDealsHolder.Visible = false;
                }
            }
        }