Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Alexander Scharfenberg
Raumverwaltung_HMWK
Commits
3d14ea66
Commit
3d14ea66
authored
Oct 04, 2021
by
Alexander Scharfenberg
Browse files
many changes on productive monday
parent
1d3fb9a6
Changes
17
Hide whitespace changes
Inline
Side-by-side
Raumverwaltung_HMWK/AddFloorWindow.xaml
0 → 100644
View file @
3d14ea66
<Window x:Class="Raumverwaltung_HMWK.AddFloorWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Raumverwaltung_HMWK"
mc:Ignorable="d"
Title="Stockwerk anlegen" Height="300" Width="300">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock FontSize="15">Stockwerkname:</TextBlock>
</StackPanel>
<StackPanel Grid.Row="0" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBox Name="StockwerkInput" Width="100"></TextBox>
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock FontSize="15">Standort:</TextBlock>
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<ComboBox Name="StandortSelection" Width="100"></ComboBox>
</StackPanel>
<StackPanel Grid.Row="2" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock FontSize="15">Bild einfügen:</TextBlock>
</StackPanel>
<StackPanel Grid.Row="2" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
<TextBox Name="ImageInput" Width="100"></TextBox>
</StackPanel>
<StackPanel Grid.Row="3" Grid.Column="0">
<Button Click="AddFloor" Content="Hinzufügen" Width="100"/>
</StackPanel>
<StackPanel Grid.Row="3" Grid.Column="1">
<Button Click="Abbort" Content="Abbruch" Width="100"/>
</StackPanel>
</Grid>
</Window>
Raumverwaltung_HMWK/AddFloorWindow.xaml.cs
0 → 100644
View file @
3d14ea66
using
System
;
using
System.Collections.Generic
;
using
System.Windows
;
namespace
Raumverwaltung_HMWK
{
public
partial
class
AddFloorWindow
:
Window
{
private
List
<
Building
>
buildings
;
public
AddFloorWindow
()
{
InitializeComponent
();
buildings
=
SqLiteDataAccess
.
GetLocations
();
StandortSelection
.
ItemsSource
=
buildings
;
}
private
void
AddFloor
(
object
sender
,
RoutedEventArgs
e
)
{
string
Floorname
=
StockwerkInput
.
Text
;
string
Imagepath
=
ImageInput
.
Text
;
Building
selected
=
buildings
[
StandortSelection
.
SelectedIndex
];
if
(!
String
.
IsNullOrEmpty
(
Floorname
)
&&
selected
!=
null
)
{
List
<
Floor
>
existingFloors
=
SqLiteDataAccess
.
GetFloorsToBuilding
(
selected
);
bool
found
=
false
;
for
(
int
i
=
0
;
i
<
existingFloors
.
Count
;
i
++)
{
if
(
existingFloors
[
i
].
Name
.
Equals
(
Floorname
))
{
found
=
true
;
}
}
if
(!
found
)
{
SqLiteDataAccess
.
AddFloor
(
Floorname
,
Imagepath
,
selected
);
MessageBox
.
Show
(
"Stockwerk angelegt!"
,
"Erfolgreich:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
foreach
(
Window
w
in
Application
.
Current
.
Windows
)
{
if
(
w
.
Title
!=
"Raumverwaltung-HMWK"
)
{
w
.
Close
();
}
else
{
w
.
Close
();
MainWindow
window
=
new
MainWindow
();
window
.
Show
();
}
}
}
else
{
MessageBox
.
Show
(
"Stockwerkname bereits hinterlegt!"
,
"Fehler:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Error
);
}
}
else
{
MessageBox
.
Show
(
"Bitte Felder ausfüllen!"
,
"Fehler:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Error
);
}
}
private
void
Abbort
(
object
sender
,
RoutedEventArgs
e
)
{
Close
();
}
}
}
\ No newline at end of file
Raumverwaltung_HMWK/AddLocationWindow.xaml
0 → 100644
View file @
3d14ea66
<Window x:Class="Raumverwaltung_HMWK.AddLocationWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Raumverwaltung_HMWK"
mc:Ignorable="d"
Title="Standorteingabe" Height="200" Width="280">
<Grid>
<StackPanel Orientation="Vertical" Margin="0,20,0,0">
<TextBlock FontSize="15" HorizontalAlignment="Center">Standort eingeben:</TextBlock>
<TextBox Name="LocationInput" FontSize="15" HorizontalAlignment="Center" Width="150" Height="30" Margin="0,20"></TextBox>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="15">
<Button Click="AddLocation" Content="Hinzufügen" Margin="10,0" Width="70"></Button>
<Button Click="Abort" Content="Abbruch" Margin="10,0" Width="70"></Button>
</StackPanel>
</StackPanel>
</Grid>
</Window>
Raumverwaltung_HMWK/AddLocationWindow.xaml.cs
0 → 100644
View file @
3d14ea66
using
System
;
using
System.Collections.Generic
;
using
System.Windows
;
namespace
Raumverwaltung_HMWK
{
public
partial
class
AddLocationWindow
:
Window
{
public
AddLocationWindow
()
{
InitializeComponent
();
}
private
void
AddLocation
(
object
sender
,
RoutedEventArgs
e
)
{
if
(!
String
.
IsNullOrEmpty
(
LocationInput
.
Text
))
{
List
<
Building
>
locations
=
SqLiteDataAccess
.
GetLocations
();
bool
found
=
false
;
for
(
int
i
=
0
;
i
<
locations
.
Count
;
i
++)
{
if
(
LocationInput
.
Text
.
Equals
(
locations
[
i
].
Name
))
{
found
=
true
;
}
}
if
(!
found
)
{
try
{
SqLiteDataAccess
.
AddLocation
(
LocationInput
.
Text
);
MessageBox
.
Show
(
"Standort hinzugefügt"
,
"Erfolgreich:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
}
catch
(
Exception
)
{
MessageBox
.
Show
(
"Standort konnte nicht hinzugefügt werden!"
,
"Fehler:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Error
);
Close
();
}
foreach
(
Window
w
in
Application
.
Current
.
Windows
)
{
if
(
w
.
Title
!=
"Raumverwaltung-HMWK"
)
{
w
.
Close
();
}
else
{
w
.
Close
();
MainWindow
window
=
new
MainWindow
();
window
.
Show
();
}
}
}
else
{
MessageBox
.
Show
(
"Standort bereits vorhanden"
,
"Fehler:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Error
);
}
}
else
{
MessageBox
.
Show
(
"Bitt einen Namen vergeben"
,
"Fehler:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Error
);
}
}
private
void
Abort
(
object
sender
,
RoutedEventArgs
e
)
{
Close
();
}
}
}
\ No newline at end of file
Raumverwaltung_HMWK/AddUserWindow.xaml
View file @
3d14ea66
...
...
@@ -5,10 +5,10 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Raumverwaltung_HMWK"
mc:Ignorable="d"
Title="Benutzer anlegen" Height="
6
00" Width="270" ResizeMode="NoResize">
Title="Benutzer anlegen" Height="
5
00" Width="270" ResizeMode="NoResize">
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="
3
00"></RowDefinition>
<RowDefinition Height="
4
00"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
...
...
@@ -16,18 +16,20 @@
<ColumnDefinition Width="125"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel HorizontalAlignment="Center" Grid.Row="0" Grid.ColumnSpan="2">
<TextBlock Margin="15">N
utzer
name:</TextBlock>
<TextBlock Margin="15">N
ach
name:</TextBlock>
<TextBox Name="NameInput" BorderBrush="Black" Width="200" Height="30"></TextBox>
<TextBlock Margin="15">Vorname:</TextBlock>
<TextBox Name="VorNameInput" BorderBrush="Black" Width="200" Height="30"></TextBox>
<TextBlock Margin="15">Abteilung:</TextBlock>
<TextBox Name="DepartmentInput" BorderBrush="Black" Width="200" Height="30"></TextBox>
<TextBlock Margin="15">Referat:</TextBlock>
<TextBox Name="ReferatInput" BorderBrush="Black" Width="200" Height="30"></TextBox>
<TextBlock Margin="15">Orga:</TextBlock>
<TextBox Name="OrgaInput" BorderBrush="Black" Width="200" Height="30"></TextBox>
</StackPanel>
<Button Grid.Row="1" Grid.Column="0" Click="Add_Clicked" Content="Hinzufügen" Width="100" Height="30" Margin="10"></Button>
<Button Grid.Row="1" Grid.Column="1" Click="Abort_Clicked" Content="Abbrechen" Width="100" Height="30" Margin="10"></Button>
</Grid>
</Window>
Raumverwaltung_HMWK/AddUserWindow.xaml.cs
View file @
3d14ea66
using
System.Windows
;
using
System
;
using
System.Collections.Generic
;
using
System.Windows
;
namespace
Raumverwaltung_HMWK
{
...
...
@@ -13,7 +15,50 @@ namespace Raumverwaltung_HMWK
private
void
Add_Clicked
(
object
sender
,
RoutedEventArgs
e
)
{
string
username
=
NameInput
.
Text
;
string
vorname
=
VorNameInput
.
Text
;
string
department
=
DepartmentInput
.
Text
;
string
referat
=
ReferatInput
.
Text
;
string
orga
=
OrgaInput
.
Text
;
if
(!
String
.
IsNullOrEmpty
(
username
)
&&
!
String
.
IsNullOrEmpty
(
vorname
)
&&
!
String
.
IsNullOrEmpty
(
department
)
&&
!
String
.
IsNullOrEmpty
(
referat
)
&&
!
String
.
IsNullOrEmpty
(
orga
))
{
List
<
User
>
users
=
SqLiteDataAccess
.
LoadUsers
();
bool
found
=
false
;
for
(
int
i
=
0
;
i
<
users
.
Count
;
i
++)
{
if
(
username
.
Equals
(
users
[
i
].
Nachnname
)
&&
vorname
.
Equals
(
users
[
i
].
Vorname
))
{
found
=
true
;
}
}
if
(!
found
)
{
try
{
SqLiteDataAccess
.
AddUser
(
username
,
vorname
,
department
,
referat
,
orga
);
MessageBox
.
Show
(
"Nutzer wurde angelegt!"
,
"Erfolgreich:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
Close
();
}
catch
(
Exception
)
{
MessageBox
.
Show
(
"Fehler beim Einfügen des Nutzers!"
,
"Fehler:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Error
);
Close
();
}
}
else
{
MessageBox
.
Show
(
"Nutzer bereits vorhanden."
,
"Fehler:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Error
);
}
}
else
{
MessageBox
.
Show
(
"Ein Feld wurde nicht befüllt, Anlegen fehlgeschlagen"
,
"Fehler:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Error
);
}
}
private
void
Abort_Clicked
(
object
sender
,
RoutedEventArgs
e
)
...
...
Raumverwaltung_HMWK/Building.cs
View file @
3d14ea66
...
...
@@ -34,6 +34,9 @@ namespace Raumverwaltung_HMWK
set
{
floors
=
value
;
}
}
public
override
string
ToString
()
{
return
name
;
}
}
}
\ No newline at end of file
Raumverwaltung_HMWK/DeleteFloorWindow.xaml
0 → 100644
View file @
3d14ea66
<Window x:Class="Raumverwaltung_HMWK.DeleteFloorWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Raumverwaltung_HMWK"
mc:Ignorable="d"
Title="Stockwerk entfernen" Height="200" Width="200">
<Grid>
<StackPanel Orientation="Vertical" Margin="0,0,0,0">
<TextBlock FontSize="15" HorizontalAlignment="Center">Standort wählen:</TextBlock>
<ComboBox SelectionChanged="LocationSelection_OnSelectionChanged" Name="LocationSelection" FontSize="15" HorizontalAlignment="Center" Width="150" Height="30" Margin="0,10"></ComboBox>
<TextBlock FontSize="15" HorizontalAlignment="Center">Stockwerk wählen:</TextBlock>
<ComboBox Name="FloorSelection" FontSize="15" HorizontalAlignment="Center" Width="150" Margin="0,10"></ComboBox>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="15">
<Button Content="Löschen" Click="DeleteFloor" Margin="10,0" Width="70"></Button>
<Button Content="Abbruch" Click="Abbort" Margin="10,0" Width="70"></Button>
</StackPanel>
</StackPanel>
</Grid>
</Window>
Raumverwaltung_HMWK/DeleteFloorWindow.xaml.cs
0 → 100644
View file @
3d14ea66
using
System
;
using
System.Collections.Generic
;
using
System.Windows
;
using
System.Windows.Controls
;
namespace
Raumverwaltung_HMWK
{
public
partial
class
DeleteFloorWindow
:
Window
{
private
List
<
Building
>
buildings
;
public
DeleteFloorWindow
()
{
InitializeComponent
();
buildings
=
SqLiteDataAccess
.
GetLocations
();
LocationSelection
.
ItemsSource
=
buildings
;
LocationSelection
.
SelectedIndex
=
0
;
}
private
void
Abbort
(
object
sender
,
RoutedEventArgs
e
)
{
Close
();
}
private
void
DeleteFloor
(
object
sender
,
RoutedEventArgs
e
)
{
MessageBoxResult
result
=
MessageBox
.
Show
(
"Möchten Sie das Stockwerk löschen?"
,
"Achtung:"
,
MessageBoxButton
.
YesNo
,
MessageBoxImage
.
Question
);
switch
(
result
)
{
case
MessageBoxResult
.
Yes
:
{
try
{
Floor
selected
=
(
Floor
)
FloorSelection
.
SelectedItem
;
SqLiteDataAccess
.
DeleteFloor
(
selected
.
Id
);
}
catch
(
Exception
)
{
MessageBox
.
Show
(
"Stockwerk konnte nicht gelöscht werden!"
,
"Fehler:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Error
);
}
MessageBox
.
Show
(
"Stockwerk wurde gelöscht!"
,
"Erfolgreich:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
foreach
(
Window
w
in
Application
.
Current
.
Windows
)
{
if
(
w
.
Title
!=
"Raumverwaltung-HMWK"
)
{
w
.
Close
();
}
else
{
w
.
Close
();
MainWindow
window
=
new
MainWindow
();
window
.
Show
();
}
}
break
;
}
case
MessageBoxResult
.
No
:
{
break
;
}
}
}
private
void
LocationSelection_OnSelectionChanged
(
object
sender
,
SelectionChangedEventArgs
e
)
{
FloorSelection
.
ItemsSource
=
null
;
FloorSelection
.
ItemsSource
=
SqLiteDataAccess
.
GetFloorsToBuilding
(
buildings
[
LocationSelection
.
SelectedIndex
]);
}
}
}
\ No newline at end of file
Raumverwaltung_HMWK/DeleteLocationWindow.xaml
0 → 100644
View file @
3d14ea66
<Window x:Class="Raumverwaltung_HMWK.DeleteLocationWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Raumverwaltung_HMWK"
mc:Ignorable="d"
Title="Standort löschen" Height="200" Width="280">
<Grid>
<StackPanel Orientation="Vertical" Margin="0,20,0,0">
<TextBlock FontSize="15" HorizontalAlignment="Center">Standort eingeben:</TextBlock>
<ComboBox Name="LocationSelection" FontSize="15" HorizontalAlignment="Center" Width="150" Height="30" Margin="0,20"></ComboBox>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="15">
<Button Click="DeleteLocation" Content="Löschen" Margin="10,0" Width="70"></Button>
<Button Click="Abbort" Content="Abbruch" Margin="10,0" Width="70"></Button>
</StackPanel>
</StackPanel>
</Grid>
</Window>
Raumverwaltung_HMWK/DeleteLocationWindow.xaml.cs
0 → 100644
View file @
3d14ea66
using
System
;
using
System.Collections.Generic
;
using
System.Windows
;
namespace
Raumverwaltung_HMWK
{
public
partial
class
DeleteLocationWindow
:
Window
{
private
List
<
Building
>
buildings
;
public
DeleteLocationWindow
()
{
InitializeComponent
();
buildings
=
SqLiteDataAccess
.
GetLocations
();
LocationSelection
.
ItemsSource
=
buildings
;
LocationSelection
.
SelectedIndex
=
0
;
}
private
void
DeleteLocation
(
object
sender
,
RoutedEventArgs
e
)
{
Building
selected
=
buildings
[
LocationSelection
.
SelectedIndex
];
if
(
selected
!=
null
)
{
MessageBoxResult
result
=
MessageBox
.
Show
(
"Sind Sie sicher, dass Sie den Standort löschen wollen?"
,
"Achtung:"
,
MessageBoxButton
.
YesNo
,
MessageBoxImage
.
Question
);
switch
(
result
)
{
case
MessageBoxResult
.
Yes
:
{
try
{
SqLiteDataAccess
.
DeleteLocation
(
selected
);
}
catch
(
Exception
)
{
MessageBox
.
Show
(
"Standort konnte nicht gelöscht werden"
,
"Fehler:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
Close
();
}
MessageBox
.
Show
(
"Standort gelöscht!"
,
"Erfolgreich:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
foreach
(
Window
w
in
Application
.
Current
.
Windows
)
{
if
(
w
.
Title
!=
"Raumverwaltung-HMWK"
)
{
w
.
Close
();
}
else
{
w
.
Close
();
MainWindow
window
=
new
MainWindow
();
window
.
Show
();
}
}
break
;
}
case
MessageBoxResult
.
No
:
{
break
;
}
}
}
}
private
void
Abbort
(
object
sender
,
RoutedEventArgs
e
)
{
Close
();
}
}
}
\ No newline at end of file
Raumverwaltung_HMWK/DeleteUserWindow.xaml
View file @
3d14ea66
...
...
@@ -16,7 +16,7 @@
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Grid.ColumnSpan="2" HorizontalAlignment="Center">
<TextBlock Margin="5,20,20,20" HorizontalAlignment="Left" FontSize="15">Nutzer
name
:</TextBlock>
<TextBlock Margin="5,20,20,20" HorizontalAlignment="Left" FontSize="15">Nutzer:</TextBlock>
<ComboBox Name="allUsers" IsEditable="True" Width="200" Height="30"></ComboBox>
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="0">
...
...
Raumverwaltung_HMWK/DeleteUserWindow.xaml.cs
View file @
3d14ea66
using
System.Windows
;
using
System
;
using
System.Collections.Generic
;
using
System.Windows
;
namespace
Raumverwaltung_HMWK
{
public
partial
class
DeleteUserWindow
:
Window
{
private
List
<
User
>
users
;
public
DeleteUserWindow
()
{
InitializeComponent
();
users
=
SqLiteDataAccess
.
LoadUsers
();
allUsers
.
ItemsSource
=
users
;
allUsers
.
SelectedIndex
=
0
;
}
private
void
Click_Delete
(
object
sender
,
RoutedEventArgs
e
)
{
MessageBoxResult
result
=
MessageBox
.
Show
(
"Sind Sie sicher, den ausgewählten Nutzer zu löschen?"
,
"Achtung:"
,
MessageBoxButton
.
YesNo
,
MessageBoxImage
.
Question
);
switch
(
result
)
{
case
MessageBoxResult
.
Yes
:
{
try
{
User
user
=
users
[
allUsers
.
SelectedIndex
];
SqLiteDataAccess
.
DeleteUser
(
user
);
MessageBox
.
Show
(
"Nutzer gelöscht!"
,
"Erfolgreich:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
foreach
(
Window
w
in
Application
.
Current
.
Windows
)
{
if
(
w
.
Title
!=
"Raumverwaltung-HMWK"
)
{
w
.
Close
();
}
else
{
w
.
Close
();
MainWindow
window
=
new
MainWindow
();
window
.
Show
();
}
}
}
catch
(
Exception
)
{
MessageBox
.
Show
(
"Nutzer löschen fehlgeschlagen."
,
"Fehler:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Error
);
}
break
;
}
case
MessageBoxResult
.
No
:
{
break
;
}
}
}
private
void
Click_Abort
(
object
sender
,
RoutedEventArgs
e
)
{