Example #1
0
        protected void Page_Init(object sender, EventArgs e)
        {
            var log = from u in db.User
                      where u.Name == WindowsIdentity.GetCurrent().Name
                      select u;

            if (log.Count() != 0)
            {
                us = log.First();
                if (us.Distrikt != null)
                {
                    Session["Distrikt"] = us.Distrikt;
                }

            }

            if (log.Count() == 0)
            {
                User usr = new User() { Name = WindowsIdentity.GetCurrent().Name };
                db.User.InsertOnSubmit(usr);
                db.SubmitChanges();

            }
            else if (log.First().Rechte == "Admin")
            {
                NavigationMenu.Items.Add(new MenuItem { Text = "Suche", NavigateUrl = "~/Seiten/Suche.aspx" });
                NavigationMenu.Items.Add(new MenuItem { Text = "Bereiche", NavigateUrl = "~/Seiten/BereichPage.aspx" });
                NavigationMenu.Items.Add(new MenuItem { Text = "Benutzer", NavigateUrl = "~/Seiten/BenutzerPage.aspx" });
                NavigationMenu.Items.Add(new MenuItem { Text = "Anwendungen", NavigateUrl = "~/Seiten/AnwendungenPage.aspx" });
                NavigationMenu.Items.Add(new MenuItem { Text = "Info", NavigateUrl = "~/About.aspx" });

                NavigationMenu.Items.Add(new MenuItem { Text = "User", NavigateUrl = "~/Account/User.aspx" });
                Session["Distrikt"] = null;
            }
            else if (log.First().Rechte == "Schreiben")
            {
                NavigationMenu.Items.Add(new MenuItem { Text = "Suche", NavigateUrl = "~/Seiten/Suche.aspx" });
                NavigationMenu.Items.Add(new MenuItem { Text = "Bereiche", NavigateUrl = "~/Seiten/BereichPage.aspx" });
                NavigationMenu.Items.Add(new MenuItem { Text = "Benutzer", NavigateUrl = "~/Seiten/BenutzerPage.aspx" });
                NavigationMenu.Items.Add(new MenuItem { Text = "Anwendungen", NavigateUrl = "~/Seiten/AnwendungenPage.aspx" });
                NavigationMenu.Items.Add(new MenuItem { Text = "Info", NavigateUrl = "~/About.aspx" });
            }
            else if (log.First().Rechte == "Lesen")
            {
                NavigationMenu.Items.Add(new MenuItem { Text = "Suche", NavigateUrl = "~/Seiten/Suche.aspx" });
                NavigationMenu.Items.Add(new MenuItem { Text = "Info", NavigateUrl = "~/About.aspx" });
            }
            //else
            //{
            //    string url = HttpContext.Current.Request.Url.AbsoluteUri;
            //    if (!url.Contains("Neu.aspx"))
            //    {
            //        Server.Transfer("Neu.aspx");
            //    }
            //    ////Trägt Bereich für mögliche Begrenzungen ein
            //    //Session["Distrikt"] = log.First().Distrikt.Value;
            //}

            try
            {
                db.SubmitChanges();

            }
            catch (Exception)
            {

            }
        }
Example #2
0
 partial void DeleteUser(User instance);
Example #3
0
 partial void UpdateUser(User instance);
Example #4
0
 partial void InsertUser(User instance);
Example #5
0
		private void detach_User(User entity)
		{
			this.SendPropertyChanging();
			entity.Bereiche = null;
		}
Example #6
0
		private void attach_User(User entity)
		{
			this.SendPropertyChanging();
			entity.Bereiche = this;
		}