Example #1
0
        private void TreeView1_Load(object sender, EventArgs e)
        {
            listNews     = new List <New>(dbAccess.getNews());
            listArticles = new List <Article>(dbAccess.getArticles());

            TreeNodeCollection newsNodes     = TreeView1.FindNode("News.Root").ChildNodes;
            TreeNodeCollection articlesNodes = TreeView1.FindNode("Articles.Root").ChildNodes;

            newsNodes.Clear();
            foreach (New news in listNews)
            {
                TreeNode newNode = new TreeNode(news.Title);
                TreeNode nodeTxt = new TreeNode(news.Text);
                nodeTxt.SelectAction = TreeNodeSelectAction.None;
                newNode.ChildNodes.Add(nodeTxt);
                newNode.SelectAction = TreeNodeSelectAction.None;
                newsNodes.Add(newNode);
            }

            articlesNodes.Clear();
            foreach (Article article in listArticles)
            {
                TreeNode newNode = new TreeNode(article.Title);
                TreeNode nodeTxt = new TreeNode(article.Text);
                nodeTxt.SelectAction = TreeNodeSelectAction.None;
                newNode.ChildNodes.Add(nodeTxt);
                newNode.SelectAction = TreeNodeSelectAction.None;
                articlesNodes.Add(newNode);
            }
        }
Example #2
0
        public List <Paper> getPapers()
        {
            List <Paper> papersList = new List <Paper>();

            foreach (Article a in bl.getArticles())
            {
                if (a != null)
                {
                    papersList.Add(new Paper(a));
                }
            }
            return(papersList);
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            dbAccess = new blAccess();

            //ListBox1.SelectedIndexChanged += ListBox1_SelectedIndexChanged;
            ListBox1.AutoPostBack = true;


            //Create Menu
            String strUrl = HttpContext.Current.Request.Url.AbsoluteUri.Replace(HttpContext.Current.Request.Url.PathAndQuery, "/");

            MenuLoader.loadMenu(Menu1, strUrl, UserType.THEME);

            //Menu1.MenuItemClick += Menu1_MenuItemClick;


            if (Session["Theme"] == null)
            {
                Session["Theme"] = dbAccess.getThemes().First().Type1;
            }
            if (Session["ChangedTheme"] == null)
            {
                Session["ChangedTheme"] = true;
            }

            List <Article> articles = dbAccess.getArticles((string)Session["Theme"]);

            if ((Boolean)Session["ChangedTheme"] == true)
            {
                ListBox1.Items.Clear();
                foreach (Article item in articles)
                {
                    if (item.Status == dbAccess.getStatus("Active").Id)
                    {
                        ListBox1.Items.Add(new ListItem(item.Title, item.Id.ToString()));
                    }
                }
            }
            Session["ChangedTheme"] = false;
            Theme.Text           = (string)Session["Theme"];
            ArticleImage.Visible = false;
        }