private void SaveButton_Click(object sender, RoutedEventArgs e) { newRoom.cost = Convert.ToInt32(CostTextBox.Text); newRoom.id = Convert.ToInt32(RoomNumTextBox.Text); newRoom.personCount = Convert.ToInt32(RoomPersonNumTextBox.Text); ownerWin.UpdateTable(); this.Close(); }
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(); }