示例#1
0
        private void DelUserButton_Click(object sender, RoutedEventArgs e)
        {
            DataRowView selectedUser = (DataRowView)UsersData.SelectedItem;
            int         id           = Convert.ToInt32(selectedUser["ID"]);
            string      sqlRequest   = $"DELETE FROM `users` WHERE `users`.`ID` = {id}";

            XApp.openDBConnection();
            MySqlCommand cmd = XApp.connection.CreateCommand();

            cmd.CommandText = sqlRequest;
            cmd.ExecuteNonQuery();
            XApp.closeDBConnection();
            UpdateTable();
        }
示例#2
0
        private void DelRoomButton_Click(object sender, RoutedEventArgs e)
        {
            DataRowView selectedRoom = (DataRowView)RoomsData.SelectedItem;
            int         Number       = Convert.ToInt32(selectedRoom["Number"]);
            string      sqlRequest   = $"DELETE FROM `rooms` WHERE `rooms`.`Number` = {Number};";

            XApp.openDBConnection();
            MySqlCommand cmd = XApp.connection.CreateCommand();

            cmd.CommandText = sqlRequest;
            cmd.ExecuteNonQuery();
            XApp.closeDBConnection();
            UpdateTable();
        }
示例#3
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            newUser.Login    = UserLoginTextBox.Text;
            newUser.Password = UserPassTextBox.Text;
            newUser.Role     = RoleTextBox.Text;
            string sqlRequest = $"INSERT INTO `users` (`ID`, `Login`, `Password`, `Role`)" +
                                $" VALUES (NULL, '{newUser.Login}', '{newUser.Password}', '{newUser.Role}');";

            XApp.openDBConnection();
            MySqlCommand cmd = XApp.connection.CreateCommand();

            cmd.CommandText = sqlRequest;
            cmd.ExecuteNonQuery();
            XApp.closeDBConnection();
            ownerWin.UpdateTable();
            this.Close();
        }
示例#4
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            newRoom.Cost   = Convert.ToInt32(CostTextBox.Text);
            newRoom.Number = Convert.ToInt32(RoomNumTextBox.Text);
            newRoom.Person = Convert.ToInt32(RoomPersonNumTextBox.Text);
            string sqlRequest = $"INSERT INTO `rooms` (`ID`, `Number`, `Person`, `BusyStatus`, `CleanStatus`, " +
                                $"`BookingStatus`, `Cost`) VALUES (NULL, '{newRoom.Number}', '{newRoom.Person}'," +
                                $" '{newRoom.BusyStatus}', '{newRoom.CleanStatus}', '{newRoom.BookingStatus}', '{newRoom.Cost}');";

            XApp.openDBConnection();
            MySqlCommand cmd = XApp.connection.CreateCommand();

            cmd.CommandText = sqlRequest;
            cmd.ExecuteNonQuery();
            XApp.closeDBConnection();
            ownerWin.UpdateTable();
            this.Close();
        }