fix von viel errors in GUI und logik dahinter
This commit is contained in:
@@ -105,6 +105,7 @@
|
|||||||
<DataGridTextColumn Header="Pilot" Binding="{Binding Pilot}" Width="100"/>
|
<DataGridTextColumn Header="Pilot" Binding="{Binding Pilot}" Width="100"/>
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
|
|
||||||
<Button Grid.Row="1" VerticalAlignment="Top" HorizontalAlignment="Right" Content="Flug Löschen" Background="#D32F2F" Foreground="White" Margin="0,-40,0,0" Padding="10,5" Click="DeleteFlight_Click"/>
|
<Button Grid.Row="1" VerticalAlignment="Top" HorizontalAlignment="Right" Content="Flug Löschen" Background="#D32F2F" Foreground="White" Margin="0,-40,0,0" Padding="10,5" Click="DeleteFlight_Click"/>
|
||||||
|
|
||||||
<Border Grid.Row="2" Background="{DynamicResource CardBackground}" CornerRadius="8" Padding="15" BorderBrush="#DDD" BorderThickness="1">
|
<Border Grid.Row="2" Background="{DynamicResource CardBackground}" CornerRadius="8" Padding="15" BorderBrush="#DDD" BorderThickness="1">
|
||||||
@@ -124,12 +125,50 @@
|
|||||||
|
|
||||||
<StackPanel Margin="5">
|
<StackPanel Margin="5">
|
||||||
<Label Content="Von:"/>
|
<Label Content="Von:"/>
|
||||||
<TextBox x:Name="AddFromTxt"/>
|
<ComboBox x:Name="AddFromCombo" IsEditable="True">
|
||||||
|
<ComboBoxItem Content="Berlin"/>
|
||||||
|
<ComboBoxItem Content="München"/>
|
||||||
|
<ComboBoxItem Content="Frankfurt"/>
|
||||||
|
<ComboBoxItem Content="Hamburg"/>
|
||||||
|
<ComboBoxItem Content="Paris"/>
|
||||||
|
<ComboBoxItem Content="London"/>
|
||||||
|
<ComboBoxItem Content="Madrid"/>
|
||||||
|
<ComboBoxItem Content="Rom"/>
|
||||||
|
<ComboBoxItem Content="Lissabon"/>
|
||||||
|
<ComboBoxItem Content="Wien"/>
|
||||||
|
<ComboBoxItem Content="Zürich"/>
|
||||||
|
<ComboBoxItem Content="Amsterdam"/>
|
||||||
|
<ComboBoxItem Content="Prag"/>
|
||||||
|
<ComboBoxItem Content="Budapest"/>
|
||||||
|
<ComboBoxItem Content="Warschau"/>
|
||||||
|
<ComboBoxItem Content="Paderborn"/>
|
||||||
|
</ComboBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Grid.Column="1" Margin="5">
|
<StackPanel Grid.Column="1" Margin="5">
|
||||||
<Label Content="Nach:"/>
|
<Label Content="Nach:"/>
|
||||||
<TextBox x:Name="AddToTxt"/>
|
<ComboBox x:Name="AddToCombo" IsEditable="True">
|
||||||
|
<ComboBoxItem Content="Mallorca"/>
|
||||||
|
<ComboBoxItem Content="Berlin"/>
|
||||||
|
<ComboBoxItem Content="München"/>
|
||||||
|
<ComboBoxItem Content="Frankfurt"/>
|
||||||
|
<ComboBoxItem Content="Hamburg"/>
|
||||||
|
<ComboBoxItem Content="Paris"/>
|
||||||
|
<ComboBoxItem Content="London"/>
|
||||||
|
<ComboBoxItem Content="Madrid"/>
|
||||||
|
<ComboBoxItem Content="Rom"/>
|
||||||
|
<ComboBoxItem Content="Lissabon"/>
|
||||||
|
<ComboBoxItem Content="Wien"/>
|
||||||
|
<ComboBoxItem Content="Zürich"/>
|
||||||
|
<ComboBoxItem Content="Amsterdam"/>
|
||||||
|
<ComboBoxItem Content="Prag"/>
|
||||||
|
<ComboBoxItem Content="Budapest"/>
|
||||||
|
<ComboBoxItem Content="Tokio"/>
|
||||||
|
<ComboBoxItem Content="New York"/>
|
||||||
|
<ComboBoxItem Content="Dubai"/>
|
||||||
|
</ComboBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Grid.Column="2" Margin="5">
|
<StackPanel Grid.Column="2" Margin="5">
|
||||||
<Label Content="Datum:"/>
|
<Label Content="Datum:"/>
|
||||||
<DatePicker x:Name="AddDatePick"/>
|
<DatePicker x:Name="AddDatePick"/>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Navigation;
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
|
|
||||||
namespace SkyTeam
|
namespace SkyTeam
|
||||||
@@ -37,7 +38,6 @@ namespace SkyTeam
|
|||||||
|
|
||||||
if (MessageBox.Show($"User {uid} löschen?", "Confirm", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
if (MessageBox.Show($"User {uid} löschen?", "Confirm", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
||||||
{
|
{
|
||||||
|
|
||||||
ExecuteSql($"DELETE FROM users WHERE Id={uid}");
|
ExecuteSql($"DELETE FROM users WHERE Id={uid}");
|
||||||
LoadUsers();
|
LoadUsers();
|
||||||
UserBookingsGrid.ItemsSource = null;
|
UserBookingsGrid.ItemsSource = null;
|
||||||
@@ -46,8 +46,12 @@ namespace SkyTeam
|
|||||||
|
|
||||||
private void LoadFlights()
|
private void LoadFlights()
|
||||||
{
|
{
|
||||||
string q = @"SELECT f.Id, f.Flugnummer, f.Abflugort, f.Zielort, f.Abflugdatum, f.Preis, z.Modell AS Plane, CONCAT(p.Vorname, ' ', p.Nachname) AS Pilot
|
string q = @"SELECT f.Id, f.Flugnummer, f.Abflugort, f.Zielort, f.Abflugdatum, f.Preis,
|
||||||
FROM fluege f JOIN flugzeuge z ON f.FlugzeugId = z.Id JOIN piloten p ON f.PilotId = p.Id ORDER BY f.Abflugdatum DESC";
|
z.Modell AS Plane, CONCAT(p.Vorname, ' ', p.Nachname) AS Pilot
|
||||||
|
FROM fluege f
|
||||||
|
JOIN flugzeuge z ON f.FlugzeugId = z.Id
|
||||||
|
JOIN piloten p ON f.PilotId = p.Id
|
||||||
|
ORDER BY f.Abflugdatum DESC";
|
||||||
BindGrid(q, AllFlightsGrid);
|
BindGrid(q, AllFlightsGrid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,17 +68,19 @@ namespace SkyTeam
|
|||||||
|
|
||||||
private void AddFlight_Click(object sender, RoutedEventArgs e)
|
private void AddFlight_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(AddFromTxt.Text) || string.IsNullOrWhiteSpace(AddToTxt.Text) || AddDatePick.SelectedDate == null || PlaneCombo.SelectedValue == null || PilotCombo.SelectedValue == null)
|
|
||||||
|
if (string.IsNullOrWhiteSpace(AddFromCombo.Text) ||
|
||||||
|
string.IsNullOrWhiteSpace(AddToCombo.Text) ||
|
||||||
|
AddDatePick.SelectedDate == null ||
|
||||||
|
PlaneCombo.SelectedValue == null ||
|
||||||
|
PilotCombo.SelectedValue == null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Bitte alle Felder ausfüllen.");
|
MessageBox.Show("Bitte alle Felder ausfüllen.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int creatorId = SessionManager.CurrentUserId;
|
int creatorId = SessionManager.CurrentUserId;
|
||||||
if (creatorId == 0)
|
if (creatorId == 0) creatorId = 1;
|
||||||
{
|
|
||||||
creatorId = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
string flightNum = "SYJ-" + new Random().Next(100, 999);
|
string flightNum = "SYJ-" + new Random().Next(100, 999);
|
||||||
string query = @"INSERT INTO fluege (Abflugort, Zielort, Abflugdatum, Ankunftsdatum, Flugnummer, Preis, FlugzeugId, PilotId, ErstelltVon)
|
string query = @"INSERT INTO fluege (Abflugort, Zielort, Abflugdatum, Ankunftsdatum, Flugnummer, Preis, FlugzeugId, PilotId, ErstelltVon)
|
||||||
@@ -86,15 +92,14 @@ namespace SkyTeam
|
|||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
MySqlCommand cmd = new MySqlCommand(query, conn);
|
MySqlCommand cmd = new MySqlCommand(query, conn);
|
||||||
cmd.Parameters.AddWithValue("@from", AddFromTxt.Text);
|
cmd.Parameters.AddWithValue("@from", AddFromCombo.Text);
|
||||||
cmd.Parameters.AddWithValue("@to", AddToTxt.Text);
|
cmd.Parameters.AddWithValue("@to", AddToCombo.Text);
|
||||||
cmd.Parameters.AddWithValue("@date", AddDatePick.SelectedDate.Value);
|
cmd.Parameters.AddWithValue("@date", AddDatePick.SelectedDate.Value);
|
||||||
cmd.Parameters.AddWithValue("@arr", AddDatePick.SelectedDate.Value.AddHours(4));
|
cmd.Parameters.AddWithValue("@arr", AddDatePick.SelectedDate.Value.AddHours(4));
|
||||||
cmd.Parameters.AddWithValue("@fnum", flightNum);
|
cmd.Parameters.AddWithValue("@fnum", flightNum);
|
||||||
cmd.Parameters.AddWithValue("@price", AddPriceTxt.Text);
|
cmd.Parameters.AddWithValue("@price", AddPriceTxt.Text);
|
||||||
cmd.Parameters.AddWithValue("@plane", PlaneCombo.SelectedValue);
|
cmd.Parameters.AddWithValue("@plane", PlaneCombo.SelectedValue);
|
||||||
cmd.Parameters.AddWithValue("@pilot", PilotCombo.SelectedValue);
|
cmd.Parameters.AddWithValue("@pilot", PilotCombo.SelectedValue);
|
||||||
|
|
||||||
cmd.Parameters.AddWithValue("@admin", creatorId);
|
cmd.Parameters.AddWithValue("@admin", creatorId);
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
@@ -110,21 +115,39 @@ namespace SkyTeam
|
|||||||
BindComboBox("SELECT Id, Modell FROM flugzeuge WHERE IstDefekt=0", PlaneCombo, "Modell", "Id");
|
BindComboBox("SELECT Id, Modell FROM flugzeuge WHERE IstDefekt=0", PlaneCombo, "Modell", "Id");
|
||||||
BindComboBox("SELECT Id, CONCAT(Vorname, ' ', Nachname) AS FullName FROM piloten WHERE IstVerfuegbar=1", PilotCombo, "FullName", "Id");
|
BindComboBox("SELECT Id, CONCAT(Vorname, ' ', Nachname) AS FullName FROM piloten WHERE IstVerfuegbar=1", PilotCombo, "FullName", "Id");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BindGrid(string q, DataGrid g)
|
private void BindGrid(string q, DataGrid g)
|
||||||
{
|
{
|
||||||
try { using (var c = new MySqlConnection(DatenbankServices.GetConnection())) { c.Open(); var a = new MySqlDataAdapter(q, c); var t = new DataTable(); a.Fill(t); g.ItemsSource = t.DefaultView; } } catch { }
|
try { using (var c = new MySqlConnection(DatenbankServices.GetConnection())) { c.Open(); var a = new MySqlDataAdapter(q, c); var t = new DataTable(); a.Fill(t); g.ItemsSource = t.DefaultView; } } catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BindComboBox(string q, ComboBox b, string d, string v)
|
private void BindComboBox(string q, ComboBox b, string d, string v)
|
||||||
{
|
{
|
||||||
try { using (var c = new MySqlConnection(DatenbankServices.GetConnection())) { c.Open(); var a = new MySqlDataAdapter(q, c); var t = new DataTable(); a.Fill(t); b.ItemsSource = t.DefaultView; b.DisplayMemberPath = d; b.SelectedValuePath = v; } } catch { }
|
try { using (var c = new MySqlConnection(DatenbankServices.GetConnection())) { c.Open(); var a = new MySqlDataAdapter(q, c); var t = new DataTable(); a.Fill(t); b.ItemsSource = t.DefaultView; b.DisplayMemberPath = d; b.SelectedValuePath = v; } } catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExecuteSql(string s)
|
private void ExecuteSql(string s)
|
||||||
{
|
{
|
||||||
try { using (var c = new MySqlConnection(DatenbankServices.GetConnection())) { c.Open(); new MySqlCommand(s, c).ExecuteNonQuery(); } } catch (Exception ex) { MessageBox.Show(ex.Message); }
|
try { using (var c = new MySqlConnection(DatenbankServices.GetConnection())) { c.Open(); new MySqlCommand(s, c).ExecuteNonQuery(); } } catch (Exception ex) { MessageBox.Show(ex.Message); }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowUsers_Click(object sender, RoutedEventArgs e) { UserManagementGrid.Visibility = Visibility.Visible; FlightManagementGrid.Visibility = Visibility.Collapsed; }
|
private void ShowUsers_Click(object sender, RoutedEventArgs e)
|
||||||
private void ShowFlights_Click(object sender, RoutedEventArgs e) { UserManagementGrid.Visibility = Visibility.Collapsed; FlightManagementGrid.Visibility = Visibility.Visible; }
|
{
|
||||||
private void Logout_Click(object sender, RoutedEventArgs e) { SessionManager.CurrentUserId = 0; NavigationService.Navigate(new LogInPage()); }
|
UserManagementGrid.Visibility = Visibility.Visible;
|
||||||
|
FlightManagementGrid.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowFlights_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
UserManagementGrid.Visibility = Visibility.Collapsed;
|
||||||
|
FlightManagementGrid.Visibility = Visibility.Visible;
|
||||||
|
LoadFlights();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Logout_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
SessionManager.CurrentUserId = 0;
|
||||||
|
NavigationService.Navigate(new LogInPage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,24 +26,28 @@
|
|||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<StackPanel Grid.Row="1" Grid.Column="0" Background="{DynamicResource SidebarBackground}">
|
<StackPanel Grid.Row="1" Grid.Column="0" Background="{DynamicResource SidebarBackground}">
|
||||||
<Button Height="50" Margin="5" Click="HomeButton_Click">
|
|
||||||
|
<Button Height="50" Margin="5" Click="HomeButton_Click" Background="Transparent" BorderThickness="0">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<iconPacks:PackIconMaterial Kind="Home" Width="20" Margin="0,0,10,0"/>
|
<iconPacks:PackIconMaterial Kind="Home" Width="20" Margin="0,0,10,0" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
<TextBlock Text="Home"/>
|
<TextBlock Text="Home" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Height="50" Margin="5" Background="#FFBBDEFB" Click="BookingsButton_Click">
|
|
||||||
|
<Button Height="50" Margin="5" Click="BookingsButton_Click" Background="{DynamicResource CardBackground}" BorderThickness="0">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<iconPacks:PackIconMaterial Kind="Airplane" Width="20" Margin="0,0,10,0"/>
|
<iconPacks:PackIconMaterial Kind="Airplane" Width="20" Margin="0,0,10,0" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
<TextBlock Text="Meine Buchungen"/>
|
<TextBlock Text="Meine Buchungen" FontWeight="Bold" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Height="50" Margin="5" Click="SettingsButton_Click">
|
|
||||||
|
<Button Height="50" Margin="5" Click="SettingsButton_Click" Background="Transparent" BorderThickness="0">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<iconPacks:PackIconMaterial Kind="Cog" Width="20" Margin="0,0,10,0"/>
|
<iconPacks:PackIconMaterial Kind="Cog" Width="20" Margin="0,0,10,0" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
<TextBlock Text="Einstellungen"/>
|
<TextBlock Text="Einstellungen" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button Height="50" Margin="5" Background="#FFEBEB" BorderBrush="#FFB71C1C" Foreground="#D32F2F" FontWeight="Bold" Click="LogoutButton_Click">
|
<Button Height="50" Margin="5" Background="#FFEBEB" BorderBrush="#FFB71C1C" Foreground="#D32F2F" FontWeight="Bold" Click="LogoutButton_Click">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<iconPacks:PackIconMaterial Kind="Logout" Width="20" Margin="0,0,10,0"/>
|
<iconPacks:PackIconMaterial Kind="Logout" Width="20" Margin="0,0,10,0"/>
|
||||||
@@ -65,7 +69,14 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<DataGrid x:Name="BookingsGrid" Visibility="Collapsed" AutoGenerateColumns="False" CanUserAddRows="False" IsReadOnly="True" Height="400" Background="{DynamicResource CardBackground}">
|
<DataGrid x:Name="BookingsGrid"
|
||||||
|
Visibility="Collapsed"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
CanUserAddRows="False"
|
||||||
|
IsReadOnly="True"
|
||||||
|
Height="400"
|
||||||
|
Background="{DynamicResource CardBackground}"
|
||||||
|
SelectionMode="Single">
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn Header="Buchungs ID" Binding="{Binding BuchungId}" Width="80"/>
|
<DataGridTextColumn Header="Buchungs ID" Binding="{Binding BuchungId}" Width="80"/>
|
||||||
<DataGridTextColumn Header="Flug Nr." Binding="{Binding Flugnummer}" Width="*"/>
|
<DataGridTextColumn Header="Flug Nr." Binding="{Binding Flugnummer}" Width="*"/>
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace SkyTeam
|
|
||||||
{
|
|
||||||
class FlugeRepo
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace SkyTeam
|
|
||||||
{
|
|
||||||
class FlugzeugRepo
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,150 +2,77 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
|
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
|
||||||
Title="NavigationPage">
|
Title="NavigationPage"
|
||||||
|
Background="{DynamicResource PageBackground}">
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="180"/>
|
<ColumnDefinition Width="180"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<Border Grid.Row="0"
|
<Border Grid.Row="0" Grid.ColumnSpan="2" Background="#FF1E88E5" Padding="15">
|
||||||
Grid.ColumnSpan="2"
|
<StackPanel Orientation="Horizontal">
|
||||||
Background="#FF1E88E5"
|
<Ellipse Width="36" Height="36" Fill="White" Margin="0,0,10,0"/>
|
||||||
Padding="15">
|
|
||||||
<StackPanel Orientation="Horizontal"
|
|
||||||
VerticalAlignment="Center">
|
|
||||||
|
|
||||||
<Ellipse Width="36"
|
|
||||||
Height="36"
|
|
||||||
Fill="White"
|
|
||||||
Margin="0,0,10,0"/>
|
|
||||||
|
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Text="Sky Team Airlines"
|
<TextBlock Text="Sky Team Airlines" FontSize="20" FontWeight="Bold" Foreground="White"/>
|
||||||
FontSize="20"
|
<TextBlock Text="Sichere und komfortable Flüge weltweit" FontSize="12" Foreground="White"/>
|
||||||
FontWeight="Bold"
|
|
||||||
Foreground="White"/>
|
|
||||||
<TextBlock Text="Sichere und komfortable Flüge weltweit"
|
|
||||||
FontSize="12"
|
|
||||||
Foreground="White"/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<StackPanel Grid.Row="1"
|
<StackPanel Grid.Row="1" Grid.Column="0" Background="{DynamicResource SidebarBackground}">
|
||||||
Grid.Column="0"
|
|
||||||
Background="#FFE3F2FD"
|
|
||||||
Orientation="Vertical">
|
|
||||||
|
|
||||||
|
<Button x:Name="HomeButton" Height="50" Margin="5" Click="HomeButton_Click" Background="{DynamicResource CardBackground}" BorderThickness="0">
|
||||||
<Button x:Name="HomeButton"
|
<StackPanel Orientation="Horizontal">
|
||||||
Height="50"
|
<iconPacks:PackIconMaterial Kind="Home" Width="20" Margin="0,0,10,0" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
Margin="5"
|
<TextBlock Text="Home" FontWeight="Bold" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
Click="HomeButton_Click"
|
|
||||||
Background="#FFBBDEFB">
|
|
||||||
<StackPanel Orientation="Horizontal"
|
|
||||||
VerticalAlignment="Center">
|
|
||||||
<iconPacks:PackIconMaterial Kind="Home"
|
|
||||||
Width="20"
|
|
||||||
Height="20"
|
|
||||||
Margin="0,0,10,0"/>
|
|
||||||
<TextBlock Text="Home"/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button x:Name="BookingsButton"
|
<Button x:Name="BookingsButton" Height="50" Margin="5" Click="BookingsButton_Click" Background="Transparent" BorderThickness="0">
|
||||||
Height="50"
|
<StackPanel Orientation="Horizontal">
|
||||||
Margin="5"
|
<iconPacks:PackIconMaterial Kind="Airplane" Width="20" Margin="0,0,10,0" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
Click="BookingsButton_Click">
|
<TextBlock Text="Meine Buchungen" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
<StackPanel Orientation="Horizontal"
|
|
||||||
VerticalAlignment="Center">
|
|
||||||
<iconPacks:PackIconMaterial Kind="Airplane"
|
|
||||||
Width="20"
|
|
||||||
Height="20"
|
|
||||||
Margin="0,0,10,0"/>
|
|
||||||
<TextBlock Text="Meine Buchungen"/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button x:Name="SettingsButton"
|
<Button x:Name="SettingsButton" Height="50" Margin="5" Click="SettingsButton_Click" Background="Transparent" BorderThickness="0">
|
||||||
Height="50"
|
<StackPanel Orientation="Horizontal">
|
||||||
Margin="5"
|
<iconPacks:PackIconMaterial Kind="Cog" Width="20" Margin="0,0,10,0" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
Click="SettingsButton_Click">
|
<TextBlock Text="Einstellungen" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
<StackPanel Orientation="Horizontal"
|
|
||||||
VerticalAlignment="Center">
|
|
||||||
<iconPacks:PackIconMaterial Kind="Cog"
|
|
||||||
Width="20"
|
|
||||||
Height="20"
|
|
||||||
Margin="0,0,10,0"/>
|
|
||||||
<TextBlock Text="Einstellungen"/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button x:Name="LogoutButton"
|
<Button x:Name="LogoutButton" Height="50" Margin="5" Background="#FFEBEB" BorderBrush="#FFB71C1C" Foreground="#D32F2F" FontWeight="Bold" Click="LogoutButton_Click">
|
||||||
Height="50"
|
<StackPanel Orientation="Horizontal">
|
||||||
Margin="5"
|
<iconPacks:PackIconMaterial Kind="Logout" Width="20" Margin="0,0,10,0"/>
|
||||||
Background="#FFEBEB"
|
|
||||||
BorderBrush="#FFB71C1C"
|
|
||||||
Foreground="#D32F2F"
|
|
||||||
FontWeight="Bold"
|
|
||||||
Click="LogoutButton_Click">
|
|
||||||
<StackPanel Orientation="Horizontal"
|
|
||||||
VerticalAlignment="Center">
|
|
||||||
<iconPacks:PackIconMaterial Kind="Logout"
|
|
||||||
Width="20"
|
|
||||||
Height="20"
|
|
||||||
Margin="0,0,10,0"/>
|
|
||||||
<TextBlock Text="Abmelden"/>
|
<TextBlock Text="Abmelden"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<ScrollViewer Grid.Row="1"
|
<ScrollViewer Grid.Row="1" Grid.Column="1" Margin="30" VerticalScrollBarVisibility="Auto">
|
||||||
Grid.Column="1"
|
|
||||||
Margin="30"
|
|
||||||
VerticalScrollBarVisibility="Auto">
|
|
||||||
<StackPanel Margin="0,0,0,30">
|
<StackPanel Margin="0,0,0,30">
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal"
|
<StackPanel Orientation="Horizontal" Margin="0,0,0,30">
|
||||||
Margin="0,0,0,30">
|
<iconPacks:PackIconMaterial Kind="AirplaneTakeoff" Width="48" Height="48" Foreground="{DynamicResource PrimaryText}" Margin="0,0,15,0"/>
|
||||||
<iconPacks:PackIconMaterial Kind="AirplaneTakeoff"
|
|
||||||
Width="48"
|
|
||||||
Height="48"
|
|
||||||
Margin="0,0,15,0"/>
|
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Text="Willkommen bei Sky Team Airlines"
|
<TextBlock Text="Willkommen bei Sky Team Airlines" FontSize="28" FontWeight="Bold" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
FontSize="28"
|
<TextBlock Text="Exklusive Flugservices für Privatjets" FontSize="16" Foreground="{DynamicResource SecondaryText}"/>
|
||||||
FontWeight="Bold"/>
|
|
||||||
<TextBlock Text="Exklusive Flugservices für Privatzylinder"
|
|
||||||
FontSize="16"
|
|
||||||
Foreground="Gray"/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<Border Background="#F8F9FA"
|
<Border Background="{DynamicResource CardBackground}" Padding="25" CornerRadius="8" Margin="0,0,0,25">
|
||||||
Padding="25"
|
<TextBlock Text="Sky Team Airlines bietet komfortable Veranstaltung von Privatjets für Geschäftsreisende. Unsere moderne Flotte mit den neuesten Businessjets garantiert Ihnen maximalen Komfort auf Ihren Flügen."
|
||||||
CornerRadius="8"
|
FontSize="14" LineHeight="22" TextWrapping="Wrap" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
Margin="0,0,0,25">
|
|
||||||
<TextBlock Text="Sky Team Airlines bietet konfortable Veranstaltung von Privatjets für Geschäftsreisende. Unsere moderne Flotte mit den neuesten Businessjets garantiert Ihnen maximale Komfort auf Ihren Flügen."
|
|
||||||
FontSize="14"
|
|
||||||
LineHeight="22"
|
|
||||||
TextWrapping="Wrap"/>
|
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<TextBlock Text="Unsere Services"
|
<TextBlock Text="Unsere Services" FontSize="20" FontWeight="Bold" Foreground="{DynamicResource PrimaryText}" Margin="0,0,15,0"/>
|
||||||
FontSize="20"
|
|
||||||
FontWeight="Bold"
|
|
||||||
Margin="0,0,15,0"/>
|
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@@ -153,63 +80,27 @@
|
|||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<Border Grid.Column="0"
|
<Border Grid.Column="0" Margin="0,0,15,0" Padding="20" Background="{DynamicResource CardBackground}" CornerRadius="8">
|
||||||
Margin="0,0,15,0"
|
|
||||||
Padding="20"
|
|
||||||
Background="#E3F2FD"
|
|
||||||
CornerRadius="8">
|
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<iconPacks:PackIconMaterial Kind="AccountGroup"
|
<iconPacks:PackIconMaterial Kind="AccountGroup" Width="32" Height="32" Foreground="#1E88E5"/>
|
||||||
Width="32"
|
<TextBlock Text="Persönliche Kundenbetreuung" FontSize="16" FontWeight="Bold" Foreground="{DynamicResource PrimaryText}" Margin="0,10,0,5"/>
|
||||||
Height="32"
|
<TextBlock Text="Dedizierte Flugplanung und individuelle Bedürfnisse" FontSize="13" Foreground="{DynamicResource SecondaryText}" TextWrapping="Wrap"/>
|
||||||
Foreground="#1E88E5"/>
|
|
||||||
<TextBlock Text="Persönliche Kundenbetreuung"
|
|
||||||
FontSize="16"
|
|
||||||
FontWeight="Bold"
|
|
||||||
Margin="0,10,0,5"/>
|
|
||||||
<TextBlock Text="Dedizierte Flugplanung und individuelle Bedürfnisse"
|
|
||||||
FontSize="13"
|
|
||||||
Foreground="Gray"
|
|
||||||
TextWrapping="Wrap"/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<Border Grid.Column="1"
|
<Border Grid.Column="1" Padding="20" Background="{DynamicResource CardBackground}" CornerRadius="8">
|
||||||
Padding="20"
|
|
||||||
Background="#E8F5E8"
|
|
||||||
CornerRadius="8">
|
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<iconPacks:PackIconMaterial Kind="Database"
|
<iconPacks:PackIconMaterial Kind="Database" Width="32" Height="32" Foreground="#388E3C"/>
|
||||||
Width="32"
|
<TextBlock Text="Sichere Datenverwaltung" FontSize="16" FontWeight="Bold" Foreground="{DynamicResource PrimaryText}" Margin="0,10,0,5"/>
|
||||||
Height="32"
|
<TextBlock Text="Vollständiger CRUD für Kunden, Flüge, Piloten" FontSize="13" Foreground="{DynamicResource SecondaryText}" TextWrapping="Wrap"/>
|
||||||
Foreground="#388E3C"/>
|
|
||||||
<TextBlock Text="Sichere Datenverwaltung"
|
|
||||||
FontSize="16"
|
|
||||||
FontWeight="Bold"
|
|
||||||
Margin="0,10,0,5"/>
|
|
||||||
<TextBlock Text="Vollständiger CRUD für Kunden, Flüge, Piloten"
|
|
||||||
FontSize="13"
|
|
||||||
Foreground="Gray"
|
|
||||||
TextWrapping="Wrap"/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal"
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,40,0,0">
|
||||||
HorizontalAlignment="Center"
|
<Button Width="200" Height="50" Background="#FF1E88E5" Foreground="White" FontSize="16" FontWeight="Bold" Click="BookFlightButton_Click">
|
||||||
Margin="0,40,0,0">
|
|
||||||
<Button Width="200"
|
|
||||||
Height="50"
|
|
||||||
Background="#FF1E88E5"
|
|
||||||
Foreground="White"
|
|
||||||
FontSize="16"
|
|
||||||
FontWeight="Bold"
|
|
||||||
Click="BookFlightButton_Click">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<iconPacks:PackIconMaterial Kind="Airplane"
|
<iconPacks:PackIconMaterial Kind="Airplane" Width="24" Height="24" Margin="0,0,12,0"/>
|
||||||
Width="24"
|
|
||||||
Height="24"
|
|
||||||
Margin="0,0,12,0"/>
|
|
||||||
<TextBlock Text="Jetzt Flug buchen"/>
|
<TextBlock Text="Jetzt Flug buchen"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
@@ -217,6 +108,5 @@
|
|||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Page>
|
</Page>
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace SkyTeam
|
|
||||||
{
|
|
||||||
class PilotenRepo
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
using BCrypt.Net;
|
using BCrypt.Net;
|
||||||
|
|
||||||
@@ -15,33 +16,54 @@ namespace SkyTeam
|
|||||||
|
|
||||||
private void RegisterButton_Click(object sender, RoutedEventArgs e)
|
private void RegisterButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(PasswordBox.Password))
|
if (string.IsNullOrWhiteSpace(EmailTextBox.Text) || string.IsNullOrWhiteSpace(PasswordBox.Password))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Bitte geben Sie ein Passwort ein.");
|
MessageBox.Show("Bitte geben Sie Email und Passwort ein.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string hashedPassword = BCrypt.Net.BCrypt.HashPassword(PasswordBox.Password);
|
if (!IsValidEmail(EmailTextBox.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Bitte geben Sie eine gültige E-Mail-Adresse ein (z.B. name@domain.com).");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
string query = "INSERT INTO users (Vorname, Nachname, Email, PasswortHash, Rolle, Stadt, Anrede, Geburtsdatum) " +
|
string emailToCheck = EmailTextBox.Text;
|
||||||
"VALUES (@vorname, @nachname, @email, @password, 'User', @stadt, @anrede, @geburtsdatum)";
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (MySqlConnection conn = new MySqlConnection(DatenbankServices.GetConnection()))
|
using (MySqlConnection conn = new MySqlConnection(DatenbankServices.GetConnection()))
|
||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
using (MySqlCommand cmd = new MySqlCommand(query, conn))
|
|
||||||
|
string checkQuery = "SELECT COUNT(*) FROM users WHERE Email = @email";
|
||||||
|
using (MySqlCommand checkCmd = new MySqlCommand(checkQuery, conn))
|
||||||
|
{
|
||||||
|
checkCmd.Parameters.AddWithValue("@email", emailToCheck);
|
||||||
|
long userCount = (long)checkCmd.ExecuteScalar();
|
||||||
|
|
||||||
|
if (userCount > 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Sie haben bereits ein Konto mit dieser E-Mail. Bitte löschen Sie es, bevor Sie ein neues erstellen.",
|
||||||
|
"Konto existiert bereits", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string hashedPassword = BCrypt.Net.BCrypt.HashPassword(PasswordBox.Password);
|
||||||
|
string insertQuery = "INSERT INTO users (Vorname, Nachname, Email, PasswortHash, Rolle, Stadt, Anrede, Geburtsdatum) " +
|
||||||
|
"VALUES (@vorname, @nachname, @email, @password, 'User', @stadt, @anrede, @geburtsdatum)";
|
||||||
|
|
||||||
|
using (MySqlCommand cmd = new MySqlCommand(insertQuery, conn))
|
||||||
{
|
{
|
||||||
string selectedAnrede = (SalutationComboBox.SelectedItem as ComboBoxItem)?.Content.ToString();
|
string selectedAnrede = (SalutationComboBox.SelectedItem as ComboBoxItem)?.Content.ToString();
|
||||||
DateTime? selectedDate = BirthDatePicker.SelectedDate;
|
DateTime? selectedDate = BirthDatePicker.SelectedDate;
|
||||||
|
|
||||||
cmd.Parameters.AddWithValue("@vorname", FirstNameTextBox.Text);
|
cmd.Parameters.AddWithValue("@vorname", FirstNameTextBox.Text);
|
||||||
cmd.Parameters.AddWithValue("@nachname", LastNameTextBox.Text);
|
cmd.Parameters.AddWithValue("@nachname", LastNameTextBox.Text);
|
||||||
cmd.Parameters.AddWithValue("@email", EmailTextBox.Text);
|
cmd.Parameters.AddWithValue("@email", emailToCheck);
|
||||||
cmd.Parameters.AddWithValue("@password", hashedPassword);
|
cmd.Parameters.AddWithValue("@password", hashedPassword);
|
||||||
cmd.Parameters.AddWithValue("@stadt", CityTextBox.Text);
|
cmd.Parameters.AddWithValue("@stadt", CityTextBox.Text);
|
||||||
|
|
||||||
cmd.Parameters.AddWithValue("@anrede", selectedAnrede ?? (object)DBNull.Value);
|
cmd.Parameters.AddWithValue("@anrede", selectedAnrede ?? (object)DBNull.Value);
|
||||||
cmd.Parameters.AddWithValue("@geburtsdatum", selectedDate.HasValue ? selectedDate.Value : (object)DBNull.Value);
|
cmd.Parameters.AddWithValue("@geburtsdatum", selectedDate.HasValue ? selectedDate.Value : (object)DBNull.Value);
|
||||||
|
|
||||||
@@ -69,5 +91,22 @@ namespace SkyTeam
|
|||||||
mainWindow.MainFrame.Navigate(new LogInPage());
|
mainWindow.MainFrame.Navigate(new LogInPage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool IsValidEmail(string email)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(email))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return Regex.IsMatch(email,
|
||||||
|
@"^[^@\s]+@[^@\s]+\.[^@\s]+$",
|
||||||
|
RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250));
|
||||||
|
}
|
||||||
|
catch (RegexMatchTimeoutException)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<StackPanel Grid.Row="1" Grid.Column="0" Background="{DynamicResource SidebarBackground}">
|
<StackPanel Grid.Row="1" Grid.Column="0" Background="{DynamicResource SidebarBackground}">
|
||||||
|
|
||||||
<Button Height="50" Margin="5" Click="HomeButton_Click" Background="Transparent" BorderThickness="0">
|
<Button Height="50" Margin="5" Click="HomeButton_Click" Background="Transparent" BorderThickness="0">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<iconPacks:PackIconMaterial Kind="Home" Width="20" Margin="0,0,10,0" Foreground="{DynamicResource PrimaryText}"/>
|
<iconPacks:PackIconMaterial Kind="Home" Width="20" Margin="0,0,10,0" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
@@ -69,11 +70,7 @@
|
|||||||
<TextBlock Text="Dunkles Design aktivieren" FontSize="14" Foreground="{DynamicResource SecondaryText}"/>
|
<TextBlock Text="Dunkles Design aktivieren" FontSize="14" Foreground="{DynamicResource SecondaryText}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<ToggleButton x:Name="DarkModeToggle"
|
<ToggleButton x:Name="DarkModeToggle" Width="60" Height="30" Checked="DarkModeToggle_Checked" Unchecked="DarkModeToggle_Unchecked">
|
||||||
Width="60"
|
|
||||||
Height="30"
|
|
||||||
Checked="DarkModeToggle_Checked"
|
|
||||||
Unchecked="DarkModeToggle_Unchecked">
|
|
||||||
<ToggleButton.Style>
|
<ToggleButton.Style>
|
||||||
<Style TargetType="ToggleButton">
|
<Style TargetType="ToggleButton">
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace SkyTeam
|
|
||||||
{
|
|
||||||
class mitarbeiterRepo
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
|
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
|
||||||
Title="ReservierungssuchePage">
|
Title="ReservierungssuchePage"
|
||||||
|
Background="{DynamicResource PageBackground}">
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
@@ -16,95 +16,100 @@
|
|||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<Border Grid.Row="0"
|
<Border Grid.Row="0" Grid.ColumnSpan="2" Background="#FF1E88E5" Padding="15">
|
||||||
Grid.ColumnSpan="2"
|
|
||||||
Background="#FF1E88E5"
|
|
||||||
Padding="15">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Ellipse Width="36" Height="36" Fill="White" Margin="0,0,10,0"/>
|
<Ellipse Width="36" Height="36" Fill="White" Margin="0,0,10,0"/>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Text="Sky Team Airlines"
|
<TextBlock Text="Sky Team Airlines" FontSize="20" FontWeight="Bold" Foreground="White"/>
|
||||||
FontSize="20"
|
<TextBlock Text="Sichere und komfortable Flüge weltweit" FontSize="12" Foreground="White"/>
|
||||||
FontWeight="Bold"
|
|
||||||
Foreground="White"/>
|
|
||||||
<TextBlock Text="Sichere und komfortable Flüge weltweit"
|
|
||||||
FontSize="12"
|
|
||||||
Foreground="White"/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<StackPanel Grid.Row="1"
|
<StackPanel Grid.Row="1" Grid.Column="0" Background="{DynamicResource SidebarBackground}">
|
||||||
Grid.Column="0"
|
|
||||||
Background="#FFE3F2FD">
|
|
||||||
|
|
||||||
<Button Height="50" Margin="5" Click="HomeButton_Click">
|
<Button Height="50" Margin="5" Click="HomeButton_Click" Background="Transparent" BorderThickness="0">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<iconPacks:PackIconMaterial Kind="Home" Width="20" Margin="0,0,10,0"/>
|
<iconPacks:PackIconMaterial Kind="Home" Width="20" Margin="0,0,10,0" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
<TextBlock Text="Home"/>
|
<TextBlock Text="Home" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button Height="50" Margin="5" Click="BookingsButton_Click">
|
<Button Height="50" Margin="5" Click="BookingsButton_Click" Background="{DynamicResource CardBackground}" BorderThickness="0">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<iconPacks:PackIconMaterial Kind="Airplane" Width="20" Margin="0,0,10,0"/>
|
<iconPacks:PackIconMaterial Kind="Airplane" Width="20" Margin="0,0,10,0" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
<TextBlock Text="Meine Buchungen"/>
|
<TextBlock Text="Meine Buchungen" FontWeight="Bold" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button Height="50" Margin="5" Click="SettingsButton_Click">
|
<Button Height="50" Margin="5" Click="SettingsButton_Click" Background="Transparent" BorderThickness="0">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<iconPacks:PackIconMaterial Kind="Cog" Width="20" Margin="0,0,10,0"/>
|
<iconPacks:PackIconMaterial Kind="Cog" Width="20" Margin="0,0,10,0" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
<TextBlock Text="Einstellungen"/>
|
<TextBlock Text="Einstellungen" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button Height="50"
|
<Button Height="50" Margin="5" Background="#FFEBEB" BorderBrush="#FFB71C1C" Foreground="#D32F2F" FontWeight="Bold" Click="LogoutButton_Click">
|
||||||
Margin="5"
|
|
||||||
Background="#FFEBEB"
|
|
||||||
BorderBrush="#FFB71C1C"
|
|
||||||
Foreground="#D32F2F"
|
|
||||||
FontWeight="Bold"
|
|
||||||
Click="LogoutButton_Click">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<iconPacks:PackIconMaterial Kind="Logout" Width="20" Margin="0,0,10,0"/>
|
<iconPacks:PackIconMaterial Kind="Logout" Width="20" Margin="0,0,10,0"/>
|
||||||
<TextBlock Text="Abmelden"/>
|
<TextBlock Text="Abmelden"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<Grid Grid.Row="1" Grid.Column="1" Margin="30">
|
<Grid Grid.Row="1" Grid.Column="1" Margin="30">
|
||||||
|
|
||||||
<StackPanel Margin="0,0,0,25">
|
<StackPanel Margin="0,0,0,25">
|
||||||
<TextBlock Text="Flug suchen"
|
<TextBlock Text="Flug suchen" FontSize="28" FontWeight="Bold" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
FontSize="28"
|
<TextBlock Text="Wählen Sie Ihr Ziel aus der Liste" FontSize="16" Foreground="{DynamicResource SecondaryText}"/>
|
||||||
FontWeight="Bold"/>
|
|
||||||
<TextBlock Text="Datum und Strecke eingeben"
|
|
||||||
FontSize="16"
|
|
||||||
Foreground="#666"/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<Border Background="#F5F7FA"
|
<Border Background="{DynamicResource CardBackground}" CornerRadius="12" Padding="30">
|
||||||
CornerRadius="12"
|
|
||||||
Padding="30">
|
|
||||||
|
|
||||||
<StackPanel Width="350">
|
<StackPanel Width="350">
|
||||||
|
|
||||||
<TextBlock Text="Von"
|
<TextBlock Text="Von" FontWeight="SemiBold" Margin="0,0,0,5" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
FontWeight="SemiBold"
|
<ComboBox x:Name="FromBox" Height="40" Margin="0,0,0,15" IsEditable="True">
|
||||||
Margin="0,0,0,5"/>
|
<ComboBoxItem Content="Berlin"/>
|
||||||
<TextBox Height="40" Margin="0,0,0,15"/>
|
<ComboBoxItem Content="München"/>
|
||||||
|
<ComboBoxItem Content="Frankfurt"/>
|
||||||
|
<ComboBoxItem Content="Hamburg"/>
|
||||||
|
<ComboBoxItem Content="Paris"/>
|
||||||
|
<ComboBoxItem Content="London"/>
|
||||||
|
<ComboBoxItem Content="Madrid"/>
|
||||||
|
<ComboBoxItem Content="Rom"/>
|
||||||
|
<ComboBoxItem Content="Lissabon"/>
|
||||||
|
<ComboBoxItem Content="Wien"/>
|
||||||
|
<ComboBoxItem Content="Zürich"/>
|
||||||
|
<ComboBoxItem Content="Amsterdam"/>
|
||||||
|
<ComboBoxItem Content="Prag"/>
|
||||||
|
<ComboBoxItem Content="Budapest"/>
|
||||||
|
<ComboBoxItem Content="Warschau"/>
|
||||||
|
<ComboBoxItem Content="Paderborn"/>
|
||||||
|
</ComboBox>
|
||||||
|
|
||||||
<TextBlock Text="Nach"
|
<TextBlock Text="Nach" FontWeight="SemiBold" Margin="0,0,0,5" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
FontWeight="SemiBold"
|
<ComboBox x:Name="ToBox" Height="40" Margin="0,0,0,15" IsEditable="True">
|
||||||
Margin="0,0,0,5"/>
|
<ComboBoxItem Content="Mallorca"/>
|
||||||
<TextBox Height="40" Margin="0,0,0,15"/>
|
<ComboBoxItem Content="Berlin"/>
|
||||||
|
<ComboBoxItem Content="München"/>
|
||||||
|
<ComboBoxItem Content="Frankfurt"/>
|
||||||
|
<ComboBoxItem Content="Hamburg"/>
|
||||||
|
<ComboBoxItem Content="Paris"/>
|
||||||
|
<ComboBoxItem Content="London"/>
|
||||||
|
<ComboBoxItem Content="Madrid"/>
|
||||||
|
<ComboBoxItem Content="Rom"/>
|
||||||
|
<ComboBoxItem Content="Lissabon"/>
|
||||||
|
<ComboBoxItem Content="Wien"/>
|
||||||
|
<ComboBoxItem Content="Zürich"/>
|
||||||
|
<ComboBoxItem Content="Amsterdam"/>
|
||||||
|
<ComboBoxItem Content="Prag"/>
|
||||||
|
<ComboBoxItem Content="Budapest"/>
|
||||||
|
<ComboBoxItem Content="Tokio"/>
|
||||||
|
<ComboBoxItem Content="New York"/>
|
||||||
|
<ComboBoxItem Content="Dubai"/>
|
||||||
|
</ComboBox>
|
||||||
|
|
||||||
<TextBlock Text="Abflugdatum"
|
<TextBlock Text="Abflugdatum" FontWeight="SemiBold" Margin="0,0,0,5" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
FontWeight="SemiBold"
|
<DatePicker x:Name="DateBox" Height="40" Margin="0,0,0,25"/>
|
||||||
Margin="0,0,0,5"/>
|
|
||||||
<DatePicker Height="40" Margin="0,0,0,25"/>
|
|
||||||
|
|
||||||
<Button Content="Flüge suchen"
|
<Button Content="Flüge suchen"
|
||||||
Height="45"
|
Height="45"
|
||||||
@@ -113,10 +118,7 @@
|
|||||||
Foreground="White"
|
Foreground="White"
|
||||||
Click="SearchFlights_Click"/>
|
Click="SearchFlights_Click"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Page>
|
</Page>
|
||||||
@@ -1,21 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace SkyTeam
|
namespace SkyTeam
|
||||||
{
|
{
|
||||||
|
|
||||||
public partial class ReservierungssuchePage : Page
|
public partial class ReservierungssuchePage : Page
|
||||||
{
|
{
|
||||||
public ReservierungssuchePage()
|
public ReservierungssuchePage()
|
||||||
@@ -23,42 +12,19 @@ namespace SkyTeam
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void SearchFlights_Click(object sender, RoutedEventArgs e)
|
private void SearchFlights_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
((MainWindow)Application.Current.MainWindow).MainFrame.Navigate(new verfuegbareFluge());
|
|
||||||
|
|
||||||
}
|
string from = FromBox.Text;
|
||||||
private void HomeButton_Click(object sender, RoutedEventArgs e)
|
string to = ToBox.Text;
|
||||||
{
|
DateTime? date = DateBox.SelectedDate;
|
||||||
((MainWindow)Application.Current.MainWindow).MainFrame.Navigate(new NavigationPage());
|
|
||||||
|
NavigationService.Navigate(new verfuegbareFluge(from, to, date));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BookingsButton_Click(object sender, RoutedEventArgs e)
|
private void HomeButton_Click(object sender, RoutedEventArgs e) => NavigationService.Navigate(new NavigationPage());
|
||||||
{
|
private void BookingsButton_Click(object sender, RoutedEventArgs e) => NavigationService.Navigate(new BuchungenPage());
|
||||||
((MainWindow)Application.Current.MainWindow).MainFrame.Navigate(new BuchungenPage());
|
private void SettingsButton_Click(object sender, RoutedEventArgs e) => NavigationService.Navigate(new SettingsPage());
|
||||||
}
|
private void LogoutButton_Click(object sender, RoutedEventArgs e) => NavigationService.Navigate(new LogInPage());
|
||||||
|
|
||||||
private void SettingsButton_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
((MainWindow)Application.Current.MainWindow).MainFrame.Navigate(new SettingsPage());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LogoutButton_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
var result = MessageBox.Show(
|
|
||||||
"Möchten Sie sich wirklich abmelden?",
|
|
||||||
"Abmelden",
|
|
||||||
MessageBoxButton.YesNo,
|
|
||||||
MessageBoxImage.Question);
|
|
||||||
if (result == MessageBoxResult.Yes)
|
|
||||||
{
|
|
||||||
((MainWindow)Application.Current.MainWindow).MainFrame.Navigate(new LogInPage());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,94 +2,67 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
|
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
|
||||||
Title="verfuegbareFluge">
|
Title="verfuegbareFluge"
|
||||||
|
Background="{DynamicResource PageBackground}">
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
|
|
||||||
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="180"/>
|
<ColumnDefinition Width="180"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<Border Grid.Row="0"
|
<Border Grid.Row="0" Grid.ColumnSpan="2" Background="#FF1E88E5" Padding="15">
|
||||||
Grid.ColumnSpan="2"
|
|
||||||
Background="#FF1E88E5"
|
|
||||||
Padding="15">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Ellipse Width="36" Height="36" Fill="White" Margin="0,0,10,0"/>
|
<Ellipse Width="36" Height="36" Fill="White" Margin="0,0,10,0"/>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Text="Sky Team Airlines"
|
<TextBlock Text="Sky Team Airlines" FontSize="20" FontWeight="Bold" Foreground="White"/>
|
||||||
FontSize="20"
|
<TextBlock Text="Sichere und komfortable Flüge weltweit" FontSize="12" Foreground="White"/>
|
||||||
FontWeight="Bold"
|
|
||||||
Foreground="White"/>
|
|
||||||
<TextBlock Text="Sichere und komfortable Flüge weltweit"
|
|
||||||
FontSize="12"
|
|
||||||
Foreground="White"/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<StackPanel Grid.Row="1"
|
<StackPanel Grid.Row="1" Grid.Column="0" Background="{DynamicResource SidebarBackground}">
|
||||||
Grid.Column="0"
|
|
||||||
Background="#FFE3F2FD">
|
|
||||||
|
|
||||||
<Button Height="50" Margin="5" Click="HomeButton_Click">
|
<Button Height="50" Margin="5" Click="HomeButton_Click" Background="Transparent" BorderThickness="0">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<iconPacks:PackIconMaterial Kind="Home" Width="20" Margin="0,0,10,0"/>
|
<iconPacks:PackIconMaterial Kind="Home" Width="20" Margin="0,0,10,0" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
<TextBlock Text="Home"/>
|
<TextBlock Text="Home" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button Height="50" Margin="5" Click="BookingsButton_Click">
|
<Button Height="50" Margin="5" Click="BookingsButton_Click" Background="{DynamicResource CardBackground}" BorderThickness="0">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<iconPacks:PackIconMaterial Kind="Airplane" Width="20" Margin="0,0,10,0"/>
|
<iconPacks:PackIconMaterial Kind="Airplane" Width="20" Margin="0,0,10,0" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
<TextBlock Text="Meine Buchungen"/>
|
<TextBlock Text="Meine Buchungen" FontWeight="Bold" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button Height="50" Margin="5" Click="SettingsButton_Click">
|
<Button Height="50" Margin="5" Click="SettingsButton_Click" Background="Transparent" BorderThickness="0">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<iconPacks:PackIconMaterial Kind="Cog" Width="20" Margin="0,0,10,0"/>
|
<iconPacks:PackIconMaterial Kind="Cog" Width="20" Margin="0,0,10,0" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
<TextBlock Text="Einstellungen"/>
|
<TextBlock Text="Einstellungen" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button Height="50"
|
<Button Height="50" Margin="5" Background="#FFEBEB" BorderBrush="#FFB71C1C" Foreground="#D32F2F" FontWeight="Bold" Click="LogoutButton_Click">
|
||||||
Margin="5"
|
|
||||||
Background="#FFEBEB"
|
|
||||||
BorderBrush="#FFB71C1C"
|
|
||||||
Foreground="#D32F2F"
|
|
||||||
FontWeight="Bold"
|
|
||||||
Click="LogoutButton_Click">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<iconPacks:PackIconMaterial Kind="Logout" Width="20" Margin="0,0,10,0"/>
|
<iconPacks:PackIconMaterial Kind="Logout" Width="20" Margin="0,0,10,0"/>
|
||||||
<TextBlock Text="Abmelden"/>
|
<TextBlock Text="Abmelden"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<Grid Grid.Row="1" Grid.Column="1" Margin="30">
|
<Grid Grid.Row="1" Grid.Column="1" Margin="30">
|
||||||
|
|
||||||
<StackPanel Margin="0,0,0,25">
|
<StackPanel Margin="0,0,0,25">
|
||||||
<TextBlock Text="Verfügbare Flüge"
|
<TextBlock Text="Verfügbare Flüge" FontSize="28" FontWeight="Bold" Foreground="{DynamicResource PrimaryText}"/>
|
||||||
FontSize="28"
|
<TextBlock Text="Wählen Sie einen Flug aus und klicken Sie auf Buchen" FontSize="16" Foreground="{DynamicResource SecondaryText}"/>
|
||||||
FontWeight="Bold"/>
|
|
||||||
<TextBlock Text="Wählen Sie einen Flug aus und klicken Sie auf Buchen"
|
|
||||||
FontSize="16"
|
|
||||||
Foreground="#666"/>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<Border Background="#F5F7FA"
|
<Border Background="{DynamicResource CardBackground}" CornerRadius="12" Padding="20">
|
||||||
CornerRadius="12"
|
|
||||||
Padding="20">
|
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
@@ -125,10 +98,7 @@
|
|||||||
FontWeight="Bold"
|
FontWeight="Bold"
|
||||||
Click="BookFlight_Click"/>
|
Click="BookFlight_Click"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Page>
|
</Page>
|
||||||
@@ -2,15 +2,25 @@
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Navigation;
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
|
|
||||||
namespace SkyTeam
|
namespace SkyTeam
|
||||||
{
|
{
|
||||||
public partial class verfuegbareFluge : Page
|
public partial class verfuegbareFluge : Page
|
||||||
{
|
{
|
||||||
public verfuegbareFluge()
|
private string _fromCity;
|
||||||
|
private string _toCity;
|
||||||
|
private DateTime? _flightDate;
|
||||||
|
|
||||||
|
public verfuegbareFluge(string from = "", string to = "", DateTime? date = null)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
_fromCity = from;
|
||||||
|
_toCity = to;
|
||||||
|
_flightDate = date;
|
||||||
|
|
||||||
LoadFlights();
|
LoadFlights();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,15 +29,52 @@ namespace SkyTeam
|
|||||||
string query = @"SELECT f.Id, f.Flugnummer, f.Abflugort AS 'From', f.Zielort AS 'To',
|
string query = @"SELECT f.Id, f.Flugnummer, f.Abflugort AS 'From', f.Zielort AS 'To',
|
||||||
z.Modell AS Plane, f.Abflugdatum AS Date
|
z.Modell AS Plane, f.Abflugdatum AS Date
|
||||||
FROM fluege f
|
FROM fluege f
|
||||||
JOIN flugzeuge z ON f.FlugzeugId = z.Id";
|
JOIN flugzeuge z ON f.FlugzeugId = z.Id
|
||||||
|
WHERE 1=1";
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(_fromCity))
|
||||||
|
{
|
||||||
|
query += " AND f.Abflugort LIKE @from";
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrWhiteSpace(_toCity))
|
||||||
|
{
|
||||||
|
query += " AND f.Zielort LIKE @to";
|
||||||
|
}
|
||||||
|
if (_flightDate.HasValue)
|
||||||
|
{
|
||||||
|
query += " AND DATE(f.Abflugdatum) = @date";
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
using (MySqlConnection conn = new MySqlConnection(DatenbankServices.GetConnection()))
|
using (MySqlConnection conn = new MySqlConnection(DatenbankServices.GetConnection()))
|
||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
MySqlDataAdapter adapter = new MySqlDataAdapter(query, conn);
|
MySqlCommand cmd = new MySqlCommand(query, conn);
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(_fromCity))
|
||||||
|
cmd.Parameters.AddWithValue("@from", "%" + _fromCity + "%");
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(_toCity))
|
||||||
|
cmd.Parameters.AddWithValue("@to", "%" + _toCity + "%");
|
||||||
|
|
||||||
|
if (_flightDate.HasValue)
|
||||||
|
cmd.Parameters.AddWithValue("@date", _flightDate.Value.ToString("yyyy-MM-dd"));
|
||||||
|
|
||||||
|
MySqlDataAdapter adapter = new MySqlDataAdapter(cmd);
|
||||||
DataTable dt = new DataTable();
|
DataTable dt = new DataTable();
|
||||||
adapter.Fill(dt);
|
adapter.Fill(dt);
|
||||||
AvailableFlightsDataGrid.ItemsSource = dt.DefaultView;
|
AvailableFlightsDataGrid.ItemsSource = dt.DefaultView;
|
||||||
|
|
||||||
|
if (dt.Rows.Count == 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Keine Flüge gefunden.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Fehler beim Laden: " + ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,6 +89,12 @@ namespace SkyTeam
|
|||||||
DataRowView row = (DataRowView)AvailableFlightsDataGrid.SelectedItem;
|
DataRowView row = (DataRowView)AvailableFlightsDataGrid.SelectedItem;
|
||||||
int flightId = Convert.ToInt32(row["Id"]);
|
int flightId = Convert.ToInt32(row["Id"]);
|
||||||
|
|
||||||
|
if (SessionManager.CurrentUserId == 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Fehler: Nicht eingeloggt.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
string query = "INSERT INTO buchungen (UserId, FlugId) VALUES (@uid, @fid)";
|
string query = "INSERT INTO buchungen (UserId, FlugId) VALUES (@uid, @fid)";
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -50,13 +103,13 @@ namespace SkyTeam
|
|||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
MySqlCommand cmd = new MySqlCommand(query, conn);
|
MySqlCommand cmd = new MySqlCommand(query, conn);
|
||||||
cmd.Parameters.AddWithValue("@uid",SessionManager.CurrentUserId);
|
cmd.Parameters.AddWithValue("@uid", SessionManager.CurrentUserId);
|
||||||
cmd.Parameters.AddWithValue("@fid", flightId);
|
cmd.Parameters.AddWithValue("@fid", flightId);
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageBox.Show("Erfolgreich gebucht!");
|
MessageBox.Show("Erfolgreich gebucht!");
|
||||||
((MainWindow)Application.Current.MainWindow).MainFrame.Navigate(new BuchungenPage());
|
NavigationService.Navigate(new BuchungenPage());
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user