예제 #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            int curZone = Convert.ToInt32(Request.QueryString["Zone"]);

            if (curZone == 0)
            {
                Page_Error("No zone specified");
            }

            if (!Request.IsAuthenticated)
            {
                ucLogin.Visible = true;
            }
            else
            {
                ucLogout.Visible = true;
            }

            Zone    zone = new Zone(appEnv.GetConnection());
            DataRow dr   = zone.GetZone(curZone);

            lbZone.Text = dr["Title"].ToString();

            if (Convert.ToInt32(dr["Protected"]) > 0)
            {
                if (!Request.IsAuthenticated)
                {
                    Response.Redirect("../Login.aspx?URL=" + HttpUtility.UrlEncode(Request.RawUrl));
                }
            }

            Distribution dist = new Distribution(appEnv.GetConnection());
            DataTable    dtd  = dist.GetOrdered(Convert.ToInt32(dr["ZoneID"]));

            if (dtd.Rows.Count > 0)
            {
                htLead.ContentID = Convert.ToInt32(dtd.Rows[0]["ContentID"]);
                htLead.Version   = Convert.ToInt32(dtd.Rows[0]["Version"]);

                int i;
                for (i = 0; i < (int)Math.Ceiling((float)(dtd.Rows.Count - 1) / 2.0); i++)
                {
                    HeadlineTeaser hlt = (HeadlineTeaser)LoadControl("HeadlineTeaser.ascx");
                    hlt.ContentID = Convert.ToInt32(dtd.Rows[i + 1]["ContentID"]);
                    hlt.Version   = Convert.ToInt32(dtd.Rows[i + 1]["Version"]);
                    tcLeft.Controls.Add(hlt);
                }
                for ( ; i < dtd.Rows.Count - 1; i++)
                {
                    HeadlineTeaser hlt = (HeadlineTeaser)LoadControl("HeadlineTeaser.ascx");
                    hlt.ContentID = Convert.ToInt32(dtd.Rows[i + 1]["ContentID"]);
                    hlt.Version   = Convert.ToInt32(dtd.Rows[i + 1]["Version"]);
                    tcRight.Controls.Add(hlt);
                }
            }
        }
예제 #2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            int curDomain = Convert.ToInt32(Request.QueryString["Domain"]);

            if (curDomain == 0)
            {
                Page_Error("No domain specified");
            }

            MainNavBar.Domain = curDomain;

            if (!Request.IsAuthenticated)
            {
                ucLogin.Visible = true;
            }
            else
            {
                ucLogout.Visible = true;
            }

            Domain    domain = new Domain(appEnv.GetConnection());
            DataTable dt     = domain.GetDomainForID(curDomain);

            lbDomain.Text = dt.Rows[0]["Title"].ToString();

            if (Convert.ToInt32(dt.Rows[0]["Protected"]) > 0)
            {
                if (!Request.IsAuthenticated)
                {
                    Response.Redirect("../Login.aspx?URL=" + HttpUtility.UrlEncode(Request.RawUrl));
                }
            }

            Zone zone = new Zone(appEnv.GetConnection());

            dt = zone.GetZonesForDomain(curDomain);

            Distribution dist = new Distribution(appEnv.GetConnection());

            int       i;
            HyperLink link;

            for (i = 0; i < (int)Math.Ceiling((float)(dt.Rows.Count) / 2.0); i++)
            {
                link             = new HyperLink();
                link.Text        = dt.Rows[i]["Title"].ToString();
                link.NavigateUrl = buildDirectory(dt.Rows[i]) +
                                   "ZonePg.aspx?zone=" + dt.Rows[i]["ZoneID"];
                link.Font.Size = new FontUnit(FontSize.Large);
                tcLeft.Controls.Add(link);

                DataTable      dtd = dist.GetOrdered(Convert.ToInt32(dt.Rows[i]["ZoneID"]));
                HeadlineTeaser hlt = (HeadlineTeaser)LoadControl("HeadlineTeaser.ascx");
                if (dtd.Rows.Count > 0)
                {
                    hlt.ContentID = Convert.ToInt32(dtd.Rows[0]["ContentID"]);
                    hlt.Version   = Convert.ToInt32(dtd.Rows[0]["Version"]);
                }
                tcLeft.Controls.Add(hlt);
            }

            for ( ; i < dt.Rows.Count; i++)
            {
                link             = new HyperLink();
                link.Text        = dt.Rows[i]["Title"].ToString();
                link.NavigateUrl = buildDirectory(dt.Rows[i]) +
                                   "ZonePg.aspx?zone=" + dt.Rows[i]["ZoneID"];
                link.Font.Size = new FontUnit(FontSize.Large);
                tcRight.Controls.Add(link);

                DataTable      dtd = dist.GetOrdered(Convert.ToInt32(dt.Rows[i]["ZoneID"]));
                HeadlineTeaser hlt = (HeadlineTeaser)LoadControl("HeadlineTeaser.ascx");
                if (dtd.Rows.Count > 0)
                {
                    hlt.ContentID = Convert.ToInt32(dtd.Rows[0]["ContentID"]);
                    hlt.Version   = Convert.ToInt32(dtd.Rows[0]["Version"]);
                }
                tcRight.Controls.Add(hlt);
            }
        }