protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                AppEnv          appEnv   = new AppEnv(Context);
                MyContent       content  = new MyContent(appEnv.GetConnection());
                AccountProperty property = new AccountProperty(appEnv.GetConnection());

                DataRow dr = content.GetContentForIDVer(m_contentid, m_version);

                if (dr != null)
                {
                    lbHeadline.Text        = dr["Headline"].ToString();
                    lbSource.Text          = dr["Source"].ToString();
                    lbByline.Text          = property.GetValue(Convert.ToInt32(dr["Byline"]), "UserName").Trim();
                    lbTeaser.Text          = dr["Teaser"].ToString();
                    hlReadMore.NavigateUrl = buildDirectory(dr) +
                                             "StoryPg.aspx?ID=" + m_contentid + "&Ver=" + m_version;
                }
                else
                {
                    lbHeadline.Text    = "No Stories";
                    hlReadMore.Visible = false;
                    lbBy.Visible       = false;
                    imgPlus.Visible    = false;
                }
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            appEnv   = new AppEnv(Context);
            zone     = new Zone(appEnv.GetConnection());
            property = new AccountProperty(appEnv.GetConnection());

            if (!IsPostBack)
            {
                DataTable dtz = zone.GetAllZones();

                ddlZones.Items.Add(new ListItem("Select a zone", "0"));

                foreach (DataRow dr in dtz.Rows)
                {
                    ddlZones.Items.Add(new ListItem(dr["Title"].ToString(),
                                                    dr["ZoneID"].ToString()));
                }
            }

            strZoneIds = property.GetValue(AccountID, "ZoneCards").Split(',');
            ZoneID     = Convert.ToInt32(strZoneIds[Card]);

            if (ZoneID == 0)
            {
                pnlTitle.Visible   = false;
                pnlBody.Visible    = false;
                ibnEditNew.Visible = true;
                lbEmpty.Visible    = true;

                return;
            }

            if (ZoneID > 0)
            {
                DataRow drz = zone.GetZone(ZoneID);
                hlZoneName.Text        = drz["Title"].ToString();
                hlZoneName.NavigateUrl = "ZonePg.aspx?zone=" + drz["ZoneID"];
                BuildBody();
            }
            else
            {
                DataRow drz = zone.GetZone(-ZoneID);
                hlZoneName.Text        = drz["Title"].ToString();
                hlZoneName.NavigateUrl = "ZonePg.aspx?zone=" + drz["ZoneID"];
                pnlBody.Visible        = false;
            }
        }
        private void BuildBody()
        {
            Distribution dist = new Distribution(appEnv.GetConnection());
            DataTable    dtd  = dist.GetOrdered(ZoneID);

            int contentid = 0;
            int version   = 0;

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

            Content content = new Content(appEnv.GetConnection());
            DataRow dr      = content.GetContentForIDVer(contentid, version);

            if (dr != null)
            {
                lbHeadline.Text        = dr["Headline"].ToString();
                lbSource.Text          = dr["Source"].ToString().Trim();
                lbByline.Text          = property.GetValue(Convert.ToInt32(dr["Byline"]), "UserName").Trim();
                lbTeaser.Text          = dr["Teaser"].ToString().Trim();
                hlReadMore.NavigateUrl = "StoryPg.aspx?ID=" + contentid + "&Ver=" + version;
                hlReadMore.Visible     = true;
                lbBy.Visible           = true;
                imgPlus.Visible        = true;
            }
            else
            {
                lbHeadline.Text    = "No Stories";
                lbSource.Text      = "";
                lbByline.Text      = "";
                lbTeaser.Text      = "";
                hlReadMore.Visible = false;
                lbBy.Visible       = false;
                imgPlus.Visible    = false;
            }
        }
示例#4
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            bool authorized = false;

            XmlReader reader = new XmlTextReader(File.OpenRead(Server.MapPath("..\\XMLFiles\\CMAMenu.xml")));

            XmlDocument doc = new XmlDocument();

            doc.Load(reader);
            reader.Close();

            string expand = Request.QueryString["Expand"];

            int ExpandWhich;

            if (expand == null)
            {
                ExpandWhich = -1;
            }
            else
            {
                ExpandWhich = Convert.ToInt16(expand);
            }

            TableCell cell;
            HyperLink link;

            XmlNodeList Menus = doc.GetElementsByTagName("Menu");

            for (int i = 0; i < Menus.Count; i++)
            {
                int currnode = 0;

                XmlNodeList MenuNodes = Menus[i].ChildNodes;

                if (MenuNodes[currnode].Name.Equals("authorization"))
                {
                    AppEnv       appEnv       = new AppEnv(Context);
                    AccountRoles accountRoles = new AccountRoles(appEnv.GetConnection());
                    if (accountRoles.Authorization(
                            Roles(MenuNodes[currnode++].InnerText),
                            User.Identity.Name))
                    {
                        authorized = true;
                    }
                    else
                    {
                        authorized = false;
                    }
                }
                else
                {
                    authorized = true;
                }

                if (authorized)
                {
                    TableRow row = new TableRow();
                    tblMenu.Rows.Add(row);

                    if (ExpandWhich == i)
                    {
                        cell       = new TableCell();
                        cell.Width = Unit.Percentage(1.0);
                        cell.Controls.Add(AddImage("Images/minus.gif"));
                        row.Cells.Add(cell);

                        link             = new HyperLink();
                        link.Text        = MenuNodes[currnode++].InnerText;
                        link.NavigateUrl = "NavBar.aspx?Expand=-1";

                        cell       = new TableCell();
                        cell.Width = Unit.Percentage(99.0);
                        cell.Controls.Add(link);

                        row.Cells.Add(cell);

                        // start at 1 since 0 is the Menu Name
                        for (int j = currnode; j < MenuNodes.Count; j++)
                        {
                            row = new TableRow();
                            tblMenu.Rows.Add(row);

                            cell       = new TableCell();
                            cell.Width = Unit.Percentage(1.0);
                            cell.Controls.Add(AddImage("Images/blank.gif"));
                            row.Cells.Add(cell);

                            link             = new HyperLink();
                            link.Text        = MenuNodes[j].ChildNodes[0].InnerText;
                            link.NavigateUrl = MenuNodes[j].ChildNodes[1].InnerText;
                            link.Target      = "main";

                            cell       = new TableCell();
                            cell.Width = Unit.Percentage(99.0);
                            cell.Controls.Add(link);

                            row.Cells.Add(cell);
                        }
                    }
                    else
                    {
                        cell       = new TableCell();
                        cell.Width = Unit.Percentage(1.0);
                        cell.Controls.Add(AddImage("Images/plus.gif"));
                        row.Cells.Add(cell);

                        link             = new HyperLink();
                        link.Text        = MenuNodes[currnode++].InnerText;
                        link.NavigateUrl = "NavBar.aspx?Expand=" + i;

                        cell       = new TableCell();
                        cell.Width = Unit.Percentage(99.0);
                        cell.Controls.Add(link);

                        row.Cells.Add(cell);
                    }
                }
            }
        }