Geld wird geändert
This commit is contained in:
@@ -104,6 +104,22 @@ namespace Casino
|
||||
|
||||
return soundBytes;
|
||||
}
|
||||
public void UpdateGeld(string id, int geld)
|
||||
{
|
||||
using (MySqlConnection conn = new MySqlConnection(myConnectionString))
|
||||
{
|
||||
conn.Open();
|
||||
|
||||
using (MySqlCommand cmd = new MySqlCommand(
|
||||
"UPDATE Users SET Geld = @geld WHERE id = @id", conn))
|
||||
{
|
||||
cmd.Parameters.AddWithValue("@geld", geld);
|
||||
cmd.Parameters.AddWithValue("@id", id);
|
||||
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@
|
||||
|
||||
<Button Content="Spin" HorizontalAlignment="Center" Grid.Row="4" Grid.Column="0" Height="50" Width="100" Click="Spin" Margin="0,100,0,0" Background="DarkRed" Foreground="Silver"/>
|
||||
<Button Grid.Row="0" Content="Hauptmenü" HorizontalAlignment="Center" Click="Hauptmenue" Width="100" Height="50"/>
|
||||
<TextBlock x:Name="Konto" Grid.Column="12" Grid.Row="4" Height="30" Width="100" Margin="0,100,0,0" Background="DarkRed" Foreground="Silver" TextAlignment="Right" FontSize="25" Text="{Binding Path=Geld}"/>
|
||||
<TextBlock x:Name="Konto" Grid.Column="12" Grid.Row="4" Height="30" Width="100" Margin="0,100,0,0" Background="DarkRed" Foreground="Silver" TextAlignment="Right" FontSize="25" Text="{Binding Path=Geld }"/>
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace Casino
|
||||
Database db = new Database();
|
||||
private List<Byte[]> AlleBilder;
|
||||
ObservableCollection<User> users = new ObservableCollection<User>();
|
||||
private int[,] currentSlot = new int[3, 6];
|
||||
|
||||
public Slots()
|
||||
{
|
||||
@@ -49,6 +50,7 @@ namespace Casino
|
||||
};
|
||||
Konto.Text = users[MainWindow.currentUser].Geld.ToString();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -72,8 +74,6 @@ namespace Casino
|
||||
}
|
||||
private async Task Spin()
|
||||
{
|
||||
int[,] currentSlot = new int[3, 6];
|
||||
users[MainWindow.currentUser].Geld += 100;
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
|
||||
@@ -114,8 +114,14 @@ namespace Casino
|
||||
|
||||
private async void Spin(object sender, RoutedEventArgs e)
|
||||
{
|
||||
await Spin();
|
||||
users[MainWindow.currentUser].Geld++;
|
||||
Konto.Text = users[MainWindow.currentUser].Geld.ToString();
|
||||
await Spin();
|
||||
|
||||
|
||||
db.UpdateGeld(
|
||||
users[MainWindow.currentUser].ID,
|
||||
users[MainWindow.currentUser].Geld);
|
||||
}
|
||||
|
||||
private void Hauptmenue(object sender, RoutedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user