private void go_main(object sender, RoutedEventArgs e) { WindowAdmin rec = new WindowAdmin(); rec.Show(); this.Close(); }
private void go_admzap(object sender, RoutedEventArgs e) { WindowAdmin adm = new WindowAdmin(); this.Close(); adm.Show(); }
private void Button_Click(object sender, RoutedEventArgs e) { string login = Email_box.Text.Trim(); string password = password_box.Password.Trim(); try { DB db = new DB(); DataTable table = new DataTable(); SqlDataAdapter adapter = new SqlDataAdapter(); SqlCommand command = new SqlCommand("SELECT * FROM Client WHERE Email= @uL AND Password = @uP", db.getConnection()); db.openConnection(); command.Parameters.Add("@uL", SqlDbType.VarChar).Value = login; command.Parameters.Add("@uP", SqlDbType.VarChar).Value = password; adapter.SelectCommand = command; adapter.Fill(table); if (table.Rows.Count > 0) { if (CheckRole()) { WindowAdmin windowCompany = new WindowAdmin(); this.Close(); windowCompany.Show(); } else { WindowClient client = new WindowClient(login); this.Close(); client.Show(); } } else { MessageBox.Show("Неправильный логин или пароль"); } } catch (SqlException) { MessageBox.Show("Отсутствует подключение с базой данных"); } }
private void StartUp() { if (mainGrid.Children.Contains(loginView)) { mainGrid.Children.Remove(loginView); } else if (mainGrid.Children.Contains(connectView)) { mainGrid.Children.Remove(connectView); } WindowAdmin windowAdmin = new WindowAdmin(); mainGrid.Children.Add(windowAdmin); this.WindowState = WindowState.Maximized; this.ResizeMode = ResizeMode.CanResize; this.Width = 1000; this.Height = 700; }
private void btnlog_Click(object sender, RoutedEventArgs e) { var user = Ent.context.Worker.ToList(). Where(i => i.Login == tblog.Text && i.Password == pbpas.Password).FirstOrDefault(); if (user != null) { UserData.worker = user; switch (user.RoleId) { case 1: WindowAdmin winad = new WindowAdmin(); Hide(); winad.ShowDialog(); Close(); break; case 2: WindowUser winuser = new WindowUser(); Hide(); winuser.ShowDialog(); Close(); break; case 3: WindowManager winmanager = new WindowManager(); Hide(); winmanager.ShowDialog(); Close(); break; default: break; } } else { MessageBox.Show("Пользователь не найден", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void UserType() { WindowAdmin ventana = new WindowAdmin(); ventana.Show(); }