Skip to content

Commit

Permalink
[NEW] Added columns to the cosplans table: ErstelltAm, Anzeigebild, E…
Browse files Browse the repository at this point in the history
…rledigtAm

[NEW] Checks for database updates at every start
[NEW] The window for cosplans will now get filled with data
[NEW] Pictures can now be added to a cosplan
[NEW] Added pictures will be shown in the cosplan window
[NEW] A frameless window to show a picture in its full size
[IMPR] New static class that contains all constants
  • Loading branch information
AokiMiku committed Mar 10, 2020
1 parent 3c39a63 commit 419317c
Show file tree
Hide file tree
Showing 19 changed files with 445 additions and 116 deletions.
1 change: 1 addition & 0 deletions ACP/ACP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Constants.cs" />
<Compile Include="Core.cs" />
<Compile Include="DbObjects\Business.cs" />
<Compile Include="DbObjects\Cosplans.cs" />
Expand Down
17 changes: 17 additions & 0 deletions ACP/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace ACP
{
public static class Constants
{
public const string MessageBoxDeleteFranchise = "Soll das ausgewählte Franchise wirklich gelöscht werden? Alle zugehörigen Cospläne werden dabei unwiderruflich gelöscht.";
public const string MessageBoxDeleteCosplan = "Soll das ausgewählte Cosplan wirklich gelöscht werden?";
public const string CaptionDelete = "Löschen?";
public const string PictureIcon = @"\Resources\Icons\picture.ico";
public const string Arrow_UpIcon = @"\Resources\Icons\arrow_up.ico";
public const string Arrow_DownIcon = @"\Resources\Icons\arrow_down.ico";
public const string MessageBoxResetCosplanNummer = "Nummern wurden zurückgesetzt.";
public const string CaptionCosplanNummer = "Fertig";
public const string MessageBoxUpdateVerfuegbar = "Es ist eine neue Version verfügbar. Wollen Sie sie jetzt herunterladen und installieren?";
public const string CaptionUpdateVerfuegbar = "Update erforderlich";
public const string OpenFileDialogBilder = "Bitte wählen Sie ein oder mehere Bild/er aus.";
}
}
Binary file modified ACP/Daten/ACP.FDB
Binary file not shown.
18 changes: 18 additions & 0 deletions ACP/DbObjects/Cosplans.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,34 @@ public int Franchise_Nr
set { this.Put("Franchise_Nr", value); }
}

public int Bild_Nr
{
get { return this.GetInt("Bild_Nr"); }
set { this.Put("Bild_Nr", value); }
}

public string Name
{
get { return this.GetString("Name"); }
set { this.Put("Name", value); }
}

public DateTime ErstelltAm
{
get { return this.GetDateTime("ErstelltAm"); }
set { this.Put("ErstelltAm", value); }
}

public bool Erledigt
{
get { return this.GetBool("Erledigt"); }
set { this.Put("Erledigt", value); }
}

public DateTime ErledigtAm
{
get { return this.GetDateTime("ErledigtAm"); }
set { this.Put("ErledigtAm", value); }
}
}
}
6 changes: 4 additions & 2 deletions ACP/Resources/SQL-Skripte/02 CREATE_TABLES.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ CREATE TABLE Cosplans
(
Nummer integer NOT NULL PRIMARY KEY,
Franchise_Nr integer NOT NULL,
Bild_Nr integer,
Name varchar(100) NOT NULL,
--Geburtsdatum date NOT NULL,
Erledigt BOOLEAN DEFAULT 0 NOT NULL
ErstelltAm date DEFAULT CURRENT_DATE NOT NULL,
Erledigt BOOLEAN DEFAULT 0 NOT NULL,
ErledigtAm date
);

CREATE TABLE Bilder
Expand Down
6 changes: 6 additions & 0 deletions ACP/Resources/SQL-Skripte/03 FOREIGNKEYS.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ REFERENCES Franchises (Nummer)
ON DELETE CASCADE
ON UPDATE CASCADE;

ALTER TABLE Cosplans
ADD FOREIGN KEY (Bild_Nr)
REFERENCES Bilder (Nummer)
ON DELETE CASCADE
ON UPDATE CASCADE;

ALTER TABLE Bilder
ADD FOREIGN KEY (Cosplan_Nr)
REFERENCES Cosplans (Nummer)
Expand Down
2 changes: 1 addition & 1 deletion ACP/Resources/ToDo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ TODO ACP (! - TODO; ? - Testing)
? alle Cosplans anzeigen
? update-funktion
! in franchise dropdown jeweils anzahl anzeigen
!!! Bilder
? Bilder
! Tableheader-Buttons durch Labels mit Click-Event ersetzen, um Hover-Effekt leichter zu ändern ... Dockpanel Click-Event?
! Cosplans in Liste filtern

Expand Down
8 changes: 6 additions & 2 deletions ACP/UpdateDatabase/Version_0_1_3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@

internal class Version_0_1_3 : UpdateDatabase
{
private readonly string CosplansAddErstelltAm = "";
private readonly string CosplansAddAnzeigebild = "";
private readonly string CosplansAddErstelltAm = "EXECUTE BLOCK AS BEGIN IF(NOT EXISTS(SELECT 1 FROM RDB$RELATION_FIELDS R LEFT JOIN RDB$FIELDS F ON R.RDB$FIELD_SOURCE = F.RDB$FIELD_NAME WHERE R.RDB$RELATION_NAME = 'COSPLANS' AND R.RDB$FIELD_NAME = 'ERSTELLTAM')) THEN BEGIN EXECUTE STATEMENT 'ALTER TABLE COSPLANS ADD ERSTELLTAM DATE DEFAULT CURRENT_DATE NOT NULL;'; END END;";
private readonly string CosplansAddAnzeigebild = "EXECUTE BLOCK AS BEGIN IF(NOT EXISTS(SELECT 1 FROM RDB$RELATION_FIELDS R LEFT JOIN RDB$FIELDS F ON R.RDB$FIELD_SOURCE = F.RDB$FIELD_NAME WHERE R.RDB$RELATION_NAME = 'COSPLANS' AND R.RDB$FIELD_NAME = 'BILD_NR')) THEN BEGIN EXECUTE STATEMENT 'ALTER TABLE COSPLANS ADD BILD_NR INTEGER;'; END END;";
private readonly string CosplansAddForeignKeyBilder = "EXECUTE BLOCK AS BEGIN EXECUTE STATEMENT 'ALTER TABLE Cosplans ADD FOREIGN KEY (Bild_Nr) REFERENCES Bilder (Nummer) ON DELETE CASCADE ON UPDATE CASCADE;;'; END;";
private readonly string CosplansAddErledigtAm = "EXECUTE BLOCK AS BEGIN IF(NOT EXISTS(SELECT 1 FROM RDB$RELATION_FIELDS R LEFT JOIN RDB$FIELDS F ON R.RDB$FIELD_SOURCE = F.RDB$FIELD_NAME WHERE R.RDB$RELATION_NAME = 'COSPLANS' AND R.RDB$FIELD_NAME = 'ERLEDIGTAM' )) THEN BEGIN EXECUTE STATEMENT 'ALTER TABLE COSPLANS ADD ERLEDIGTAM DATE;'; END END;";

public Version_0_1_3() : base()
{
base.AddStatements(this.CosplansAddErstelltAm);
base.AddStatements(this.CosplansAddAnzeigebild);
base.AddStatements(this.CosplansAddForeignKeyBilder);
base.AddStatements(this.CosplansAddErledigtAm);
}
}
}
42 changes: 24 additions & 18 deletions ACP/Updater.cs
Original file line number Diff line number Diff line change
@@ -1,41 +1,47 @@
namespace ACP
{
using ApS;
using ApS.Databases.Firebird;

public class Updater : ApS.Update.Updater
{
public void UpdateDatabase()
{
//if (!Core.CoreSettings.GetSetting("Version02Updated").ToBoolean())
//{
// this.UpdateDatabase(Versionen.Version02);
//}
if (!UserSettings.Settings.GetSetting("V0_1_3_Updated").ToBoolean())
{
this.UpdateDatabase(Versionen.V0_1_3);
}
}

private void UpdateDatabase(Versionen vers)
{
//switch (vers)
//{
// case Versionen.Version02:
// Datenbankversionen.Version02 v02 = new Datenbankversionen.Version02();
// v02.ErrorOccured += VersionenErrorOccured;
// v02.RunStatements();
// v02.ErrorOccured -= VersionenErrorOccured;
// CoreSettings.SetSetting("Version02Updated", true);
// break;
// default:
// break;
//}
this.Error = false;
switch (vers)
{
case Versionen.V0_1_3:
Datenbankversionen.Version_0_1_3 v013 = new Datenbankversionen.Version_0_1_3();
v013.ErrorOccured += VersionenErrorOccured;
v013.RunStatements();
v013.ErrorOccured -= VersionenErrorOccured;
if (!this.Error)
{
UserSettings.Settings.SetSetting("V0_1_3_Updated", true);
}
break;
default:
break;
}
}

private void VersionenErrorOccured(object sender, ErrorInUpdate e)
{
ApS.Services.WriteErrorLog(e.ErrorMessage);
this.Error = true;
Services.WriteErrorLog(e.ErrorMessage);
}

public enum Versionen
{

V0_1_3
}
}
}
8 changes: 8 additions & 0 deletions ACP_GUI/ACP_GUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Bild.xaml.cs">
<DependentUpon>Bild.xaml</DependentUpon>
</Compile>
<Compile Include="ByteToImageConverter.cs" />
<Compile Include="Cosplan.xaml.cs">
<DependentUpon>Cosplan.xaml</DependentUpon>
</Compile>
Expand All @@ -88,6 +92,10 @@
<DependentUpon>ApSCosplayplanner.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="Bild.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Cosplan.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down
41 changes: 20 additions & 21 deletions ACP_GUI/ApSCosplayplanner.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,35 +69,34 @@
</DockPanel>

<DockPanel HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2">
<Label Content="Cosplans: " />
<Label Content="Cosplans: " />
<DockPanel Name="addCosplan" MouseLeftButtonUp="AddCosplan_Click" Background="Transparent" MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave" >
<Image Source="Resources/Icons/add.ico" Width="20" />
</DockPanel>
<Label Width="3" />
<DockPanel Name="delCosplan" MouseLeftButtonUp="DelCosplan_Click" Background="Transparent" MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave" >
<Label Width="23" />
<!--<DockPanel Name="delCosplan" MouseLeftButtonUp="DelCosplan_Click" Background="Transparent" MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave" >
<Image Source="Resources/Icons/del.ico" Width="20" />
</DockPanel>
</DockPanel>-->
</DockPanel>

<StackPanel Name="colNummer" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="1" MouseLeftButtonUp="ColNummer_Click">
<Label Background="Black" Height="2" />
<DockPanel HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,12">
<TextBlock Text="Nummer" />
<Label Width="3" />
<Image Name="colNummerIcon" Source="Resources/Icons/arrow_down.ico" Width="20" Visibility="Visible" />
<Border BorderThickness="0,2" BorderBrush="Black" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="1" >
<DockPanel Name="colNummer" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MouseLeftButtonUp="ColNummer_Click" MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave" >
<DockPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="Nummer" />
<Label Width="3" />
<Image Name="colNummerIcon" Source="Resources/Icons/arrow_down.ico" Width="20" Visibility="Visible" />
</DockPanel>
</DockPanel>
<Label Background="Black" Height="2" />
</StackPanel>

<StackPanel Name="colName" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="8" MouseLeftButtonUp="ColName_Click">
<Label Background="Black" Height="2" />
<DockPanel HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,12">
<TextBlock Text="Bezeichnung" />
<Label Width="3" />
<Image Name="colNameIcon" Source="Resources/Icons/arrow_down.ico" Width="20" Visibility="Hidden"/>
</Border>
<Border BorderThickness="0,2" BorderBrush="Black" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="8" >
<DockPanel Name="colName" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="8" MouseLeftButtonUp="ColName_Click" MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave">
<DockPanel HorizontalAlignment="Center" VerticalAlignment="Center" >
<TextBlock Text="Bezeichnung" />
<Label Width="3" />
<Image Name="colNameIcon" Source="Resources/Icons/arrow_down.ico" Width="20" Visibility="Hidden"/>
</DockPanel>
</DockPanel>
<Label Background="Black" Height="2" />
</StackPanel>
</Border>

<!--<StackPanel Name="colErledigt" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="2" Grid.Column="7" Grid.ColumnSpan="1" MouseLeftButtonUp="ColErledigt_Click">
<Label Background="Black" Height="2" />
Expand Down
Loading

0 comments on commit 419317c

Please sign in to comment.