private void Button_Click(object sender, RoutedEventArgs e) { var a = context.User.Where(i => i.Email == Login.Text && i.Password == PasswordTxt.Password).ToList(); if (a.Any()) { if (a.Where(i => i.RoleId == "C").Any()) { CoordinatorMenu coordinatorMenu = new CoordinatorMenu(); coordinatorMenu.Show(); this.Close(); } else if (a.Where(i => i.RoleId == "R").Any()) { var b = context.Runner.Where(i => i.Email == Login.Text).Select(i => i.RunnerId).First(); var c = context.Registration.Where(i => i.RunnerId == b).Select(i => i.RunnerId).First(); UserClass.UserId = b; UserClass.RegId = c; MenuRunner menuRunner = new MenuRunner(); menuRunner.Show(); this.Close(); } else if (a.Where(i => i.RoleId == "A").Any()) { MenuAdministrator menuAdministrator = new MenuAdministrator(); menuAdministrator.Show(); this.Close(); } } }
private void Button_Click(object sender, RoutedEventArgs e) { var a = context.User.Where(i => i.Email == Login.Text && i.Password == PasswordTxt.Password).ToList(); if (a.Count > 0) { if (a.FirstOrDefault().RoleId == "C") { CoordinatorMenu coordinatorMenu = new CoordinatorMenu(); coordinatorMenu.Show(); this.Close(); } else if (a.FirstOrDefault().RoleId == "R") { MenuRunner menuRunner = new MenuRunner(); menuRunner.Show(); this.Close(); } else if (a.FirstOrDefault().RoleId == "A") { MenuAdministrator menuAdministrator = new MenuAdministrator(); menuAdministrator.Show(); this.Close(); } } else { MessageBox.Show("Неправильный логин или пароль"); } }
private void Exit(object sender, RoutedEventArgs e) { CoordinatorMenu coordinatorMenu = new CoordinatorMenu(); coordinatorMenu.Show(); this.Close(); }