diff --git a/FileIndexer/CommonTypes/CommonTypes.csproj b/FileIndexer/CommonTypes/CommonTypes.csproj new file mode 100644 index 0000000..309c941 --- /dev/null +++ b/FileIndexer/CommonTypes/CommonTypes.csproj @@ -0,0 +1,52 @@ + + + + + Debug + AnyCPU + {D75E8DFA-02AD-4D16-9F76-3DC0783B5A52} + Library + Properties + CommonTypes + CommonTypes + v4.7.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FileIndexer/CommonTypes/Entity/IEntity.cs b/FileIndexer/CommonTypes/Entity/IEntity.cs new file mode 100644 index 0000000..39b4b51 --- /dev/null +++ b/FileIndexer/CommonTypes/Entity/IEntity.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CommonTypes +{ + public interface IEntity + { + int ID { get; set; } + } +} diff --git a/FileIndexer/CommonTypes/Entity/KFZ.cs b/FileIndexer/CommonTypes/Entity/KFZ.cs new file mode 100644 index 0000000..9b59572 --- /dev/null +++ b/FileIndexer/CommonTypes/Entity/KFZ.cs @@ -0,0 +1,26 @@ + +namespace CommonTypes +{ + public class KFZ : IEntity + { + public KFZ() + { + + } + + public int ID { get; set; } + public string Typ { get; set; } + public string FahrgestellNR { get; set; } + public string Kennzeichen { get; set; } + public int Leistung { get; set; } + + public bool Equals(KFZ other) + { + return ID == other.ID && + Typ == other.Typ && + FahrgestellNR == other.FahrgestellNR && + Kennzeichen == other.Kennzeichen && + Leistung == other.Leistung; + } + } +} diff --git a/FileIndexer/CommonTypes/Entity/KFZTyp.cs b/FileIndexer/CommonTypes/Entity/KFZTyp.cs new file mode 100644 index 0000000..a2e6785 --- /dev/null +++ b/FileIndexer/CommonTypes/Entity/KFZTyp.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CommonTypes +{ + public class KFZTyp : IEntity + { + public KFZTyp() + { + + } + + public int ID { get; set; } + public string Beschreibung { get; set; } + } +} diff --git a/FileIndexer/CommonTypes/EntityWrapper/KFZViewModel.cs b/FileIndexer/CommonTypes/EntityWrapper/KFZViewModel.cs new file mode 100644 index 0000000..b8fcfd6 --- /dev/null +++ b/FileIndexer/CommonTypes/EntityWrapper/KFZViewModel.cs @@ -0,0 +1,100 @@ +using Utility; +using CommonTypes; + +namespace KFZApp.ViewModel.EntityWrapper +{ + public class KFZViewModel : BindableBase + { + public KFZViewModel(KFZ entity) + { + _Entity = entity; + } + + private KFZ _Entity; + + #region EntityProperties + + public KFZ Entity + { + get { return _Entity; } + } + + public int ID + { + get { return _Entity.ID; } + set + { + _Entity.ID = value; + OnPropertyChanged(); + } + } + + public string Typ + { + get { return _Entity.Typ; } + set + { + _Entity.Typ = value; + OnPropertyChanged(); + } + } + + public string FahrgestellNR + { + get { return _Entity.FahrgestellNR; } + set + { + _Entity.FahrgestellNR = value; + OnPropertyChanged(); + } + } + + public string Kennzeichen + { + get { return _Entity.Kennzeichen; } + set + { + _Entity.Kennzeichen = value; + OnPropertyChanged(); + } + } + + public int Leistung + { + get { return _Entity.Leistung; } + set + { + _Entity.Leistung = value; + OnPropertyChanged(); + } + } + + #endregion + + #region NonEntityProperties + + private bool _IsDirty = false; + public bool IsDirty + { + get { return _IsDirty; } + set + { + _IsDirty = value; + OnPropertyChanged(); + } + } + + private bool _IsNew = false; + public bool IsNew + { + get { return _IsNew; } + set + { + _IsNew = value; + OnPropertyChanged(); + } + } + + #endregion + } +} diff --git a/FileIndexer/CommonTypes/Properties/AssemblyInfo.cs b/FileIndexer/CommonTypes/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..2383577 --- /dev/null +++ b/FileIndexer/CommonTypes/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("CommonTypes")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CommonTypes")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly +// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("d75e8dfa-02ad-4d16-9f76-3dc0783b5a52")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +// indem Sie "*" wie unten gezeigt eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/FileIndexer/CommonTypes/Utility/BindableBase.cs b/FileIndexer/CommonTypes/Utility/BindableBase.cs new file mode 100644 index 0000000..38702ff --- /dev/null +++ b/FileIndexer/CommonTypes/Utility/BindableBase.cs @@ -0,0 +1,14 @@ +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace Utility +{ + public class BindableBase : INotifyPropertyChanged + { + public event PropertyChangedEventHandler PropertyChanged; + public void OnPropertyChanged([CallerMemberName]string property = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property)); + } + } +} diff --git a/FileIndexer/DB_Connector/Class4.cs b/FileIndexer/CommonTypes1/Class1.cs similarity index 74% rename from FileIndexer/DB_Connector/Class4.cs rename to FileIndexer/CommonTypes1/Class1.cs index 3ea258f..56bd4b9 100644 --- a/FileIndexer/DB_Connector/Class4.cs +++ b/FileIndexer/CommonTypes1/Class1.cs @@ -4,9 +4,9 @@ using System.Text; using System.Threading.Tasks; -namespace DB_Connector +namespace CommonTypes1 { - class Class4 + public class Class1 { } } diff --git a/FileIndexer/CommonTypes1/CommonTypes1.csproj b/FileIndexer/CommonTypes1/CommonTypes1.csproj new file mode 100644 index 0000000..0464daa --- /dev/null +++ b/FileIndexer/CommonTypes1/CommonTypes1.csproj @@ -0,0 +1,51 @@ + + + + + Debug + AnyCPU + {FB296032-61B0-47A4-9905-49C89EDDD359} + Library + Properties + CommonTypes1 + CommonTypes1 + v4.7.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/FileIndexer/CommonTypes1/Entity/Files.cs b/FileIndexer/CommonTypes1/Entity/Files.cs new file mode 100644 index 0000000..73aab65 --- /dev/null +++ b/FileIndexer/CommonTypes1/Entity/Files.cs @@ -0,0 +1,27 @@ + +namespace CommonTypes +{ + public class Files : IEntity + { + public Files() + { + + } + + public int ID { get; set; } + public string Pfad { get; set; } + + public string Content { get; set; } + + + + + public bool Equals(Files other) + { + return ID == other.ID && + Pfad == other.Pfad && + Content == other.Content; + + } + } +} diff --git a/FileIndexer/CommonTypes1/Entity/FilesList.cs b/FileIndexer/CommonTypes1/Entity/FilesList.cs new file mode 100644 index 0000000..c9123b9 --- /dev/null +++ b/FileIndexer/CommonTypes1/Entity/FilesList.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CommonTypes1; + +namespace CommonTypes +{ + public class FilesList : IEntity + { + public FilesList() + { + + } + + public int ID { get; set; } + + } +} diff --git a/FileIndexer/CommonTypes1/Entity/IEntity.cs b/FileIndexer/CommonTypes1/Entity/IEntity.cs new file mode 100644 index 0000000..f815718 --- /dev/null +++ b/FileIndexer/CommonTypes1/Entity/IEntity.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CommonTypes1; + +namespace CommonTypes +{ + public interface IEntity + { + int ID { get; set; } + } +} diff --git a/FileIndexer/CommonTypes1/Properties/AssemblyInfo.cs b/FileIndexer/CommonTypes1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..22e4460 --- /dev/null +++ b/FileIndexer/CommonTypes1/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("CommonTypes1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CommonTypes1")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly +// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("fb296032-61b0-47a4-9905-49c89eddd359")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +// indem Sie "*" wie unten gezeigt eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/FileIndexer/DB_Connector/DB_Connector.csproj b/FileIndexer/DB_Connector/DB_Connector.csproj index d3e694d..9bc1e12 100644 --- a/FileIndexer/DB_Connector/DB_Connector.csproj +++ b/FileIndexer/DB_Connector/DB_Connector.csproj @@ -59,7 +59,7 @@ - + diff --git a/FileIndexer/DB_Connector/MySqlConnection.cs b/FileIndexer/DB_Connector/MySqlConnection.cs index 0a81488..23f1572 100644 --- a/FileIndexer/DB_Connector/MySqlConnection.cs +++ b/FileIndexer/DB_Connector/MySqlConnection.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Mk.DBConnector; + namespace DB_Connector { public class MySqlConnection : IConnection diff --git a/FileIndexer/DB_Connector/Table.cs b/FileIndexer/DB_Connector/Table.cs index 768b8a6..9bfcb7c 100644 --- a/FileIndexer/DB_Connector/Table.cs +++ b/FileIndexer/DB_Connector/Table.cs @@ -4,9 +4,36 @@ using System.Text; using System.Threading.Tasks; + + namespace DB_Connector { - class Table + public abstract class Table { + public Table() + { + Initialize(); + } + + + + public List GetFiles() + { + if (_Connection != null) + { + if (_LoadedData == null) + { + LoadObjects(out _LoadedData); + } + } + } + + + protected abstract void Initialize(); + protected IConnection _Connection; + protected List _LoadedData = null; + protected abstract void LoadObjects(); + + } } diff --git a/FileIndexer/DB_Connector/TableFiles.cs b/FileIndexer/DB_Connector/TableFiles.cs new file mode 100644 index 0000000..250e9ed --- /dev/null +++ b/FileIndexer/DB_Connector/TableFiles.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Data; + + +namespace DB_Connector +{ + class TableFiles + { + + + } + + + public override void Save(IEntity entity) + { + File obj = (File)entity; + string query = string.Format("INSERT INTO {0} VALUES(0, \"{1}\", \"{2}\", {3}, \"{4}\")", TableName, obj.FahrgestellNR, obj.Kennzeichen, obj.Leistung, obj.Typ); + _Connection.GetAdapter().Adapter.ExecuteSQL(query); + } +} diff --git a/FileIndexer/FileIndexer.sln b/FileIndexer/FileIndexer.sln index 884ca45..d8a84f3 100644 --- a/FileIndexer/FileIndexer.sln +++ b/FileIndexer/FileIndexer.sln @@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DB_Connector", "DB_Connecto EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BusinessLogic", "BusinessLogic\BusinessLogic.csproj", "{79C20004-7A82-4082-BB9E-CD7416CCCCD3}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommonTypes1", "CommonTypes1\CommonTypes1.csproj", "{FB296032-61B0-47A4-9905-49C89EDDD359}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -27,6 +29,10 @@ Global {79C20004-7A82-4082-BB9E-CD7416CCCCD3}.Debug|Any CPU.Build.0 = Debug|Any CPU {79C20004-7A82-4082-BB9E-CD7416CCCCD3}.Release|Any CPU.ActiveCfg = Release|Any CPU {79C20004-7A82-4082-BB9E-CD7416CCCCD3}.Release|Any CPU.Build.0 = Release|Any CPU + {FB296032-61B0-47A4-9905-49C89EDDD359}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FB296032-61B0-47A4-9905-49C89EDDD359}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FB296032-61B0-47A4-9905-49C89EDDD359}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FB296032-61B0-47A4-9905-49C89EDDD359}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE