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
c93111ed
Commit
c93111ed
authored
Oct 13, 2021
by
Alexander Scharfenberg
Browse files
Anleitung + small changes
parent
337995b4
Changes
7
Hide whitespace changes
Inline
Side-by-side
Raumverwaltung_HMWK/AddRoomWindow.xaml.cs
View file @
c93111ed
...
...
@@ -45,33 +45,42 @@ namespace Raumverwaltung_HMWK
if
(!
String
.
IsNullOrEmpty
(
RaumName
.
Text
)
&&
!
String
.
IsNullOrEmpty
(
Gr
öß
e
.
Text
)
&&
!
String
.
IsNullOrEmpty
(
Arbeitspl
ä
tze
.
Text
))
{
try
if
(
Gr
öß
e
.
Text
.
Contains
(
"."
))
{
name
=
RaumName
.
Text
;
gr
ö
sse
=
Double
.
Parse
(
Gr
öß
e
.
Text
);
arbeitspl
ä
tze
=
Int32
.
Parse
(
Arbeitspl
ä
tze
.
Text
);
// Der Raum wird mit den gelisteten Parametern in die Tabelle "Room" eingefügt.
SqLiteDataAccess
.
AddRoom
(
name
,
gr
ö
sse
,
arbeitspl
ä
tze
,
floorId
);
MessageBox
.
Show
(
"Raum angelegt!"
,
"Erfolgreich:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
foreach
(
Window
w
in
Application
.
Current
.
Windows
)
MessageBox
.
Show
(
"Raumgröße muss ein Komma statt Punkt verwenden."
,
"Fehler:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Error
);
}
else
{
try
{
if
(
w
.
Title
!=
"Raumverwaltung-HMWK"
)
{
w
.
Close
();
}
else
name
=
RaumName
.
Text
;
gr
ö
sse
=
Double
.
Parse
(
Gr
öß
e
.
Text
);
arbeitspl
ä
tze
=
Int32
.
Parse
(
Arbeitspl
ä
tze
.
Text
);
// Der Raum wird mit den gelisteten Parametern in die Tabelle "Room" eingefügt.
SqLiteDataAccess
.
AddRoom
(
name
,
gr
ö
sse
,
arbeitspl
ä
tze
,
floorId
);
MessageBox
.
Show
(
"Raum angelegt!"
,
"Erfolgreich:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
foreach
(
Window
w
in
Application
.
Current
.
Windows
)
{
w
.
Close
();
MainWindow
window
=
new
MainWindow
();
window
.
Show
();
FloorWindow
floorWindow
=
new
FloorWindow
(
floorId
);
floorWindow
.
Show
();
if
(
w
.
Title
!=
"Raumverwaltung-HMWK"
)
{
w
.
Close
();
}
else
{
w
.
Close
();
MainWindow
window
=
new
MainWindow
();
window
.
Show
();
FloorWindow
floorWindow
=
new
FloorWindow
(
floorId
);
floorWindow
.
Show
();
}
}
}
}
catch
(
Exception
)
{
MessageBox
.
Show
(
"Raum anlegen hat nicht geklappt!"
,
"Fehler:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Error
);
catch
(
Exception
)
{
MessageBox
.
Show
(
"Raum anlegen hat nicht geklappt!"
,
"Fehler:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Error
);
}
}
}
else
...
...
Raumverwaltung_HMWK/Anleitung.pdf
0 → 100644
View file @
c93111ed
File added
Raumverwaltung_HMWK/ChangeUserWindow.xaml.cs
View file @
c93111ed
...
...
@@ -60,6 +60,15 @@ namespace Raumverwaltung_HMWK
{
case
MessageBoxResult
.
Yes
:
{
if
(
SqLiteDataAccess
.
UserExists
(
NameInput
.
Text
,
VorNameInput
.
Text
,
users
[
AllUsers
.
SelectedIndex
].
Id
))
{
MessageBox
.
Show
(
"Den User gibt es bereits mit dem Vor- und Nachnamen."
,
"Fehler:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Error
);
}
else
{
}
try
{
SqLiteDataAccess
.
ChangeUser
(
NameInput
.
Text
,
VorNameInput
.
Text
,
DepartmentInput
.
Text
,
...
...
Raumverwaltung_HMWK/MainWindow.xaml
View file @
c93111ed
...
...
@@ -40,7 +40,7 @@
<MenuItem Header="Suchen" Click="SearchUser"/>
<MenuItem Header="Ändern" Click="ChangeUser"/>
</MenuItem>
<MenuItem Header="Hilfe" FontSize="15" BorderBrush="Black" Margin="10,0" Background="Thistle"></MenuItem>
<MenuItem
Click="Help"
Header="Hilfe" FontSize="15" BorderBrush="Black" Margin="10,0" Background="Thistle"></MenuItem>
</Menu>
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="0" Orientation="Vertical" VerticalAlignment="Top">
...
...
Raumverwaltung_HMWK/MainWindow.xaml.cs
View file @
c93111ed
...
...
@@ -292,5 +292,22 @@ namespace Raumverwaltung_HMWK
window
.
Show
();
}
private
void
Help
(
object
sender
,
RoutedEventArgs
e
)
{
String
filename
=
"Anleitung.pdf"
;
System
.
Diagnostics
.
Process
process
=
new
System
.
Diagnostics
.
Process
();
process
.
StartInfo
.
FileName
=
filename
;
if
(
process
.
Start
())
{
}
else
{
MessageBox
.
Show
(
"Anleitung konnte nicht geöffnet werden. Bitte vom Ordner aus öffnen!"
,
"Fehler:"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Error
);
}
}
}
}
\ No newline at end of file
Raumverwaltung_HMWK/Raumverwaltung_HMWK.csproj
View file @
c93111ed
...
...
@@ -295,6 +295,9 @@
</ItemGroup>
<ItemGroup>
<Content
Include=
".gitignore"
/>
<Content
Include=
"Anleitung.pdf"
>
<CopyToOutputDirectory>
Always
</CopyToOutputDirectory>
</Content>
<Content
Include=
"DB.db"
>
<CopyToOutputDirectory>
PreserveNewest
</CopyToOutputDirectory>
</Content>
...
...
Raumverwaltung_HMWK/SqLiteDataAccess.cs
View file @
c93111ed
...
...
@@ -639,6 +639,28 @@ namespace Raumverwaltung_HMWK
}
public
static
bool
UserExists
(
string
name
,
string
vorname
,
int
userId
)
{
using
(
IDbConnection
cnn
=
new
SQLiteConnection
(
new
SQLiteConnection
(
LoadConnectionString
())))
{
bool
exists
=
false
;
string
sql
=
""
;
var
dynamicParameters
=
new
DynamicParameters
();
dynamicParameters
.
Add
(
"name"
,
name
);
dynamicParameters
.
Add
(
"vorname"
,
vorname
);
dynamicParameters
.
Add
(
"userId"
,
userId
);
var
output
=
cnn
.
ExecuteScalar
<
int
>(
sql
,
dynamicParameters
);
if
(
output
!=
0
)
{
exists
=
true
;
}
return
exists
;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment