Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.TreeView1.Load += TreeView1_Load;
            dbAccess             = new blAccess();

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

            DAL_Library.User connectedUser = Session["ConnectedUser"] as DAL_Library.User;


            if (Session["ConnectedUser"] == null)
            {
                MenuLoader.loadMenu(Menu1, strUrl, UserType.NONE);
            }
            else if (connectedUser.Right == dbAccess.getRight("Admin").Id)
            {
                MenuLoader.loadMenu(Menu1, strUrl, UserType.ADMIN);
            }
            else if (connectedUser.Status == dbAccess.getStatus("Active").Id)
            {
                MenuLoader.loadMenu(Menu1, strUrl, UserType.READER);
            }
            else
            {
                MenuLoader.loadMenu(Menu1, strUrl, UserType.NONE);
            }
        }
Exemplo n.º 2
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;
        }