示例#1
0
 private void LoginButton_Click(object sender, RoutedEventArgs e)
 {
     if (CheckAuth())
     {
         Window adminMainWindow = new AdminMainWindow();
         adminMainWindow.Owner = this;
         this.Hide();
         adminMainWindow.Show();
     }
 }
示例#2
0
        private void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            string          sql        = $"select * from users where Login='******' and Password='******'";
            string          connString = "Server=26.146.217.182;Port=3306;Database=hotel;Uid=DoomSlayer;pwd=lilboss;charset=utf8;";
            MySqlConnection connect    = new MySqlConnection(connString);

            connect.Open();
            MySqlDataAdapter sda   = new MySqlDataAdapter(sql, connect);
            DataTable        table = new DataTable();

            sda.Fill(table);
            connect.Close();



            if (table.Rows.Count == 1)
            {
                MessageBox.Show("Вход выполнен успешно! ");
                switch (table.Rows[0].ItemArray.GetValue(3).ToString())
                {
                case "Admin":
                    Window adminMainWindow = new AdminMainWindow();
                    adminMainWindow.Owner = this;
                    this.Hide();
                    adminMainWindow.Show();
                    break;

                case "Director":
                    Window actionsForDirector = new ActionsForDirector();
                    actionsForDirector.Owner = this;
                    this.Hide();
                    actionsForDirector.Show();
                    break;

                case "Reception":
                    Window receptionActions = new ReceptionActions();
                    receptionActions.Owner = this;
                    this.Hide();
                    receptionActions.Show();
                    break;

                case "Maid":
                    Window actionsForMaid = new ActionsForMaid();
                    actionsForMaid.Owner = this;
                    this.Hide();
                    actionsForMaid.Show();
                    break;
                }
            }
        }