diff --git a/.gitignore b/.gitignore index 1f974a3..9666a9c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,7 @@ -/XMLParser/bin/* -/XMLParser/obj/* -/XMLParserTest/bin/Debug/* -/XMLParserTest/obj/Debug/* -/XMLParserTest/obj/* -/XMLProgramm/bin/* -/XMLProgramm/obj/* +*/bin/* +*/obj/* data.csv .vs/XMLParser/DesignTimeBuild/.dtbcache.v2 .vs/XMLParser/v16/.suo .vs/XMLParser/v16/TestStore/* +*/obj/* diff --git a/XMLParser.Contract/ICSVWriter.cs b/XMLParser.Contract/ICSVWriter.cs new file mode 100644 index 0000000..33b0865 --- /dev/null +++ b/XMLParser.Contract/ICSVWriter.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; +using XMLParser.Model; + +namespace XMLParser.Contract +{ + public interface ICSVWriter + { + void WriteEntry(Dictionary calculated, List inspektionenAmTag); + } +} diff --git a/XMLParser.Contract/ICalculate.cs b/XMLParser.Contract/ICalculate.cs new file mode 100644 index 0000000..0b89538 --- /dev/null +++ b/XMLParser.Contract/ICalculate.cs @@ -0,0 +1,9 @@ +using System; + +namespace XMLParser.Contract +{ + public interface ICalculate + { + + } +} diff --git a/XMLParser.Contract/IUmsatzCalculator.cs b/XMLParser.Contract/IUmsatzCalculator.cs new file mode 100644 index 0000000..4b51554 --- /dev/null +++ b/XMLParser.Contract/IUmsatzCalculator.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; +using XMLParser.Model; + +namespace XMLParser.Contract +{ + public interface IUmsatzCalculator + { + void Calculate(ICSVWriter csvWriter,List objekte); + } +} diff --git a/XMLParser.Contract/XMLParser.Contract.csproj b/XMLParser.Contract/XMLParser.Contract.csproj new file mode 100644 index 0000000..78241cc --- /dev/null +++ b/XMLParser.Contract/XMLParser.Contract.csproj @@ -0,0 +1,11 @@ + + + + + + + + net5.0 + + + diff --git a/XMLProgramm/CSVWriter.cs b/XMLParser.Functions/CSVWriter.cs similarity index 91% rename from XMLProgramm/CSVWriter.cs rename to XMLParser.Functions/CSVWriter.cs index af5bcdf..3567eb4 100644 --- a/XMLProgramm/CSVWriter.cs +++ b/XMLParser.Functions/CSVWriter.cs @@ -4,12 +4,13 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Text; -using XMLParser; +using XMLParser.Contract; +using XMLParser.Model; namespace XMLProgramm { [DebuggerDisplay("{" + nameof(GetDebuggerDisplay) + "(),nq}")] - class CSVWriter + public class CSVWriter : ICSVWriter { FileStream handle = null; void writeToFile(string content) @@ -31,7 +32,13 @@ namespace XMLProgramm handle.Close(); } - internal void WriteDay(Dictionary calculated, List inspektionenAmTag) + private string GetDebuggerDisplay() + { + return ToString(); + } + + + public void WriteEntry(Dictionary calculated, List inspektionenAmTag) { int anzahlStraßenablaufe = (int)calculated[ECalculatedResult.STRASSENABLAUFANZAHL]; int sonstigeLeitungen = (int)calculated[ECalculatedResult.SONSTIGEANZAHL]; @@ -44,10 +51,6 @@ namespace XMLProgramm string entry = last.Inspektionsdaten.OptischeInspektion.Inspektionsdatum + "#"+anzahlStraßenablaufe+"#"+Strassenablaufzulage+"#"+sonstigeLeitungen+"#"+Sonstigezulage+"#"+HauptkanalLänge; writeToFile(entry); } - - private string GetDebuggerDisplay() - { - return ToString(); - } + } } diff --git a/XMLParser/CalculateDay.cs b/XMLParser.Functions/CalculateDay.cs similarity index 99% rename from XMLParser/CalculateDay.cs rename to XMLParser.Functions/CalculateDay.cs index 466fa58..381178d 100644 --- a/XMLParser/CalculateDay.cs +++ b/XMLParser.Functions/CalculateDay.cs @@ -2,8 +2,9 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using XMLParser.Model; -namespace XMLParser +namespace XMLParser.Functions { public static class Calculate { diff --git a/XMLParser.Functions/UmsatzCalculator/Strassenumsatz.cs b/XMLParser.Functions/UmsatzCalculator/Strassenumsatz.cs new file mode 100644 index 0000000..80bed1a --- /dev/null +++ b/XMLParser.Functions/UmsatzCalculator/Strassenumsatz.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using XMLParser.Contract; +using XMLParser.Model; + +namespace XMLParser.Functions.UmsatzCalculator +{ + public class StrassenUmsatz : IUmsatzCalculator + { + public void Calculate(ICSVWriter csvWriter, List objekte) + { + XMLParse ser = new XMLParse("2021-07-29_KR_H_L_Oldenburg_Eichenstraße.xml"); + objekte.AddRange(ser.KanalObjekte); + Dictionary d = XMLParser.Functions.Calculate.CalculateStreet(objekte); + } + } +} diff --git a/XMLParser.Functions/UmsatzCalculator/Tagesumsatz.cs b/XMLParser.Functions/UmsatzCalculator/Tagesumsatz.cs new file mode 100644 index 0000000..3488f1f --- /dev/null +++ b/XMLParser.Functions/UmsatzCalculator/Tagesumsatz.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using XMLParser.Contract; +using XMLParser.Model; + +namespace XMLParser.Functions.UmsatzCalculator +{ + public class TagesUmsatz : IUmsatzCalculator + { + public void Calculate(ICSVWriter csvWriter, List objekte) + { + DirectoryInfo info = new DirectoryInfo("./"); + FileInfo[] daten = info.GetFiles("*.xml"); + foreach(FileInfo aktuell in daten) { + XMLParse ser = new XMLParse(aktuell.FullName); + objekte.AddRange(ser.KanalObjekte); + } + IEnumerable datums = objekte.OrderBy(d => d.Inspektionsdaten.OptischeInspektion.Inspektionstime).Select(x => x.Inspektionsdaten.OptischeInspektion.Inspektionsdatum).Distinct(); + + decimal gesamt = 0.0m; + //Dictionary s = CalculateDay(objekte.FindAll(x => x.Inspektionsdaten.OptischeInspektion.Inspektionsdatum.Equals("05.08.2021"))); + foreach(string datum in datums) { + List InspektionenAmTag = objekte.FindAll(x => x.Inspektionsdaten.OptischeInspektion.Inspektionsdatum.Equals(datum)); + Dictionary s = XMLParser.Functions.Calculate.CalculateDay(InspektionenAmTag); + csvWriter.WriteEntry(s,InspektionenAmTag); + Console.WriteLine("Umsatz am : "+datum + " " + s[ECalculatedResult.GESAMTUMSATZ]); + gesamt +=s[ECalculatedResult.GESAMTUMSATZ]; + //if(datum.Equals("05.08.2021")) Debugger.Break(); + } + int anzahlTage = datums.Count(); + decimal Durchschnitt = gesamt / anzahlTage; + int prognosedays = 63; + Console.WriteLine(string.Format("Tage : {0} \nGesamt umsatz: {1}\nDurchschnitt : {2}\nPrognose für {3} tage {4}",anzahlTage,gesamt,Durchschnitt,prognosedays,prognosedays*Durchschnitt)); + } + } +} diff --git a/XMLParser/XMLParse.cs b/XMLParser.Functions/XMLParse.cs similarity index 99% rename from XMLParser/XMLParse.cs rename to XMLParser.Functions/XMLParse.cs index 830077c..cc2dee3 100644 --- a/XMLParser/XMLParse.cs +++ b/XMLParser.Functions/XMLParse.cs @@ -6,6 +6,7 @@ using System.Text; using System.Threading.Tasks; using System.Xml; using System.IO; +using XMLParser.Model; namespace XMLParser { diff --git a/XMLParser.Functions/XMLParser.Functions.csproj b/XMLParser.Functions/XMLParser.Functions.csproj new file mode 100644 index 0000000..e6c30c4 --- /dev/null +++ b/XMLParser.Functions/XMLParser.Functions.csproj @@ -0,0 +1,12 @@ + + + + + + + + + net5.0 + + + diff --git a/XMLParser/AbwassertechnischeAnlage.cs b/XMLParser.Model/AbwassertechnischeAnlage.cs similarity index 96% rename from XMLParser/AbwassertechnischeAnlage.cs rename to XMLParser.Model/AbwassertechnischeAnlage.cs index 2aa26cc..c732cc9 100644 --- a/XMLParser/AbwassertechnischeAnlage.cs +++ b/XMLParser.Model/AbwassertechnischeAnlage.cs @@ -1,4 +1,4 @@ -namespace XMLParser +namespace XMLParser.Model { public class AbwassertechnischeAnlage { @@ -17,4 +17,4 @@ namespace XMLParser public Geometrie Geometrie { get => geometrie; set => geometrie = value; } public Knoten Knoten { get => knoten; set => knoten = value; } } -} \ No newline at end of file +} diff --git a/XMLParser/Anschlussdaten.cs b/XMLParser.Model/Anschlussdaten.cs similarity index 96% rename from XMLParser/Anschlussdaten.cs rename to XMLParser.Model/Anschlussdaten.cs index b5766b5..385bf5a 100644 --- a/XMLParser/Anschlussdaten.cs +++ b/XMLParser.Model/Anschlussdaten.cs @@ -1,4 +1,4 @@ -namespace XMLParser +namespace XMLParser.Model { public class Anschlussdaten { diff --git a/XMLParser/Anschlusspunkt.cs b/XMLParser.Model/Anschlusspunkt.cs similarity index 85% rename from XMLParser/Anschlusspunkt.cs rename to XMLParser.Model/Anschlusspunkt.cs index f136add..20ebd20 100644 --- a/XMLParser/Anschlusspunkt.cs +++ b/XMLParser.Model/Anschlusspunkt.cs @@ -1,4 +1,4 @@ -namespace XMLParser +namespace XMLParser.Model { public class Anschlusspunkt { @@ -6,4 +6,4 @@ namespace XMLParser public string Punktkennung { get => punktkennung; set => punktkennung = value; } } -} \ No newline at end of file +} diff --git a/XMLParser/Enums.cs b/XMLParser.Model/Enums.cs similarity index 98% rename from XMLParser/Enums.cs rename to XMLParser.Model/Enums.cs index b953752..95d19b0 100644 --- a/XMLParser/Enums.cs +++ b/XMLParser.Model/Enums.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace XMLParser +namespace XMLParser.Model { public enum EAnlagetyp { diff --git a/XMLParser/Geometrie.cs b/XMLParser.Model/Geometrie.cs similarity index 95% rename from XMLParser/Geometrie.cs rename to XMLParser.Model/Geometrie.cs index 078650a..df794ff 100644 --- a/XMLParser/Geometrie.cs +++ b/XMLParser.Model/Geometrie.cs @@ -1,4 +1,4 @@ -namespace XMLParser +namespace XMLParser.Model { public class Geometrie { @@ -21,4 +21,4 @@ namespace XMLParser public PolyKanteAttribute Rap1 { get => rap1; set => rap1 = value; } public PolyKanteAttribute Rap2 { get => rap2; set => rap2 = value; } } -} \ No newline at end of file +} diff --git a/XMLParser/Geometriedaten.cs b/XMLParser.Model/Geometriedaten.cs similarity index 92% rename from XMLParser/Geometriedaten.cs rename to XMLParser.Model/Geometriedaten.cs index ed946b9..65e240f 100644 --- a/XMLParser/Geometriedaten.cs +++ b/XMLParser.Model/Geometriedaten.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace XMLParser +namespace XMLParser.Model { public class Geometriedaten { @@ -18,4 +18,4 @@ namespace XMLParser } } } -} \ No newline at end of file +} diff --git a/XMLParser/InspizierteAbwassertechnischeAnlage.cs b/XMLParser.Model/InspizierteAbwassertechnischeAnlage.cs similarity index 97% rename from XMLParser/InspizierteAbwassertechnischeAnlage.cs rename to XMLParser.Model/InspizierteAbwassertechnischeAnlage.cs index 1583186..fc3c534 100644 --- a/XMLParser/InspizierteAbwassertechnischeAnlage.cs +++ b/XMLParser.Model/InspizierteAbwassertechnischeAnlage.cs @@ -1,4 +1,4 @@ -namespace XMLParser +namespace XMLParser.Model { public sealed class InspizierteAbwassertechnischeAnlage { diff --git a/XMLParser/KanalObjekt.cs b/XMLParser.Model/KanalObjekt.cs similarity index 75% rename from XMLParser/KanalObjekt.cs rename to XMLParser.Model/KanalObjekt.cs index fa7c9d7..e76b231 100644 --- a/XMLParser/KanalObjekt.cs +++ b/XMLParser.Model/KanalObjekt.cs @@ -1,10 +1,10 @@ -namespace XMLParser +namespace XMLParser.Model { public class KanalObjekt { public string XmlFileName {get;set;} - public AbwassertechnischeAnlage Stammdaten { get; internal set; } - public InspizierteAbwassertechnischeAnlage Inspektionsdaten { get; internal set; } + public AbwassertechnischeAnlage Stammdaten { get; set; } + public InspizierteAbwassertechnischeAnlage Inspektionsdaten { get; set; } public override string ToString() { return string.Format("{0} ({1})",Stammdaten.Objektbezeichnung,Inspektionsdaten.OptischeInspektion.Rohrleitung.Grunddaten.Profilbreite); diff --git a/XMLParser/Kante.cs b/XMLParser.Model/Kante.cs similarity index 97% rename from XMLParser/Kante.cs rename to XMLParser.Model/Kante.cs index 242267d..1083eca 100644 --- a/XMLParser/Kante.cs +++ b/XMLParser.Model/Kante.cs @@ -1,4 +1,4 @@ -namespace XMLParser +namespace XMLParser.Model { public class Kante { @@ -23,4 +23,4 @@ namespace XMLParser public bool IsFiktiveLeitung { get => isFiktiveLeitung; set => isFiktiveLeitung = value; } public Profil Profil { get => profil; set => profil = value; } } -} \ No newline at end of file +} diff --git a/XMLParser/Knoten.cs b/XMLParser.Model/Knoten.cs similarity index 93% rename from XMLParser/Knoten.cs rename to XMLParser.Model/Knoten.cs index d279df5..8c8f3e4 100644 --- a/XMLParser/Knoten.cs +++ b/XMLParser.Model/Knoten.cs @@ -1,4 +1,4 @@ -namespace XMLParser +namespace XMLParser.Model { public class Knoten { @@ -10,4 +10,4 @@ namespace XMLParser public Schacht Schacht { get => schacht; set => schacht = value; } public Anschlusspunkt Anschlusspunkt { get => anschlusspunkt; set => anschlusspunkt = value; } } -} \ No newline at end of file +} diff --git a/XMLParser/Lage.cs b/XMLParser.Model/Lage.cs similarity index 95% rename from XMLParser/Lage.cs rename to XMLParser.Model/Lage.cs index a5d40d8..a955fd4 100644 --- a/XMLParser/Lage.cs +++ b/XMLParser.Model/Lage.cs @@ -1,4 +1,4 @@ -namespace XMLParser +namespace XMLParser.Model { public class Lage { @@ -33,4 +33,4 @@ namespace XMLParser this.ortname = ortname; } } -} \ No newline at end of file +} diff --git a/XMLParser/OptischeInspektion.cs b/XMLParser.Model/OptischeInspektion.cs similarity index 98% rename from XMLParser/OptischeInspektion.cs rename to XMLParser.Model/OptischeInspektion.cs index 41b231f..cec7893 100644 --- a/XMLParser/OptischeInspektion.cs +++ b/XMLParser.Model/OptischeInspektion.cs @@ -1,6 +1,6 @@ using System; -namespace XMLParser +namespace XMLParser.Model { public class OptischeInspektion { diff --git a/XMLParser/PolyKante.cs b/XMLParser.Model/PolyKante.cs similarity index 96% rename from XMLParser/PolyKante.cs rename to XMLParser.Model/PolyKante.cs index 2a630e1..3989bf2 100644 --- a/XMLParser/PolyKante.cs +++ b/XMLParser.Model/PolyKante.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -namespace XMLParser +namespace XMLParser.Model { public class PolyKante { @@ -22,4 +22,4 @@ namespace XMLParser public decimal Punkthoehe { get => punkthoehe; set => punkthoehe = value; } public string PunktattributAbwasser { get => punktattributAbwasser; set => punktattributAbwasser = value; } } -} \ No newline at end of file +} diff --git a/XMLParser/Profil.cs b/XMLParser.Model/Profil.cs similarity index 95% rename from XMLParser/Profil.cs rename to XMLParser.Model/Profil.cs index 257c1f8..e410c2a 100644 --- a/XMLParser/Profil.cs +++ b/XMLParser.Model/Profil.cs @@ -1,4 +1,4 @@ -namespace XMLParser +namespace XMLParser.Model { public class Profil { @@ -17,4 +17,4 @@ namespace XMLParser public int Profilbreite { get => profilbreite; set => profilbreite = value; } public int Profilhoehe { get => profilhoehe; set => profilhoehe = value; } } -} \ No newline at end of file +} diff --git a/XMLParser/RGrunddaten.cs b/XMLParser.Model/RGrunddaten.cs similarity index 98% rename from XMLParser/RGrunddaten.cs rename to XMLParser.Model/RGrunddaten.cs index d09c349..78a88a0 100644 --- a/XMLParser/RGrunddaten.cs +++ b/XMLParser.Model/RGrunddaten.cs @@ -1,4 +1,4 @@ -namespace XMLParser +namespace XMLParser.Model { public class RGrunddaten { @@ -43,4 +43,4 @@ namespace XMLParser public string Innenschutz { get => innenschutz; set => innenschutz = value; } } -} \ No newline at end of file +} diff --git a/XMLParser/RZustand.cs b/XMLParser.Model/RZustand.cs similarity index 98% rename from XMLParser/RZustand.cs rename to XMLParser.Model/RZustand.cs index 4589e21..0b29998 100644 --- a/XMLParser/RZustand.cs +++ b/XMLParser.Model/RZustand.cs @@ -1,4 +1,4 @@ -namespace XMLParser +namespace XMLParser.Model { public struct Quantifizierung { diff --git a/XMLParser/Rohrleitung.cs b/XMLParser.Model/Rohrleitung.cs similarity index 98% rename from XMLParser/Rohrleitung.cs rename to XMLParser.Model/Rohrleitung.cs index 3ac1914..87218a5 100644 --- a/XMLParser/Rohrleitung.cs +++ b/XMLParser.Model/Rohrleitung.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace XMLParser +namespace XMLParser.Model { public class Rohrleitung { diff --git a/XMLParser/Schacht.cs b/XMLParser.Model/Schacht.cs similarity index 91% rename from XMLParser/Schacht.cs rename to XMLParser.Model/Schacht.cs index 79379be..1a8f968 100644 --- a/XMLParser/Schacht.cs +++ b/XMLParser.Model/Schacht.cs @@ -1,4 +1,4 @@ -namespace XMLParser +namespace XMLParser.Model { public class Schacht { @@ -8,4 +8,4 @@ namespace XMLParser public ESchachtFunktion SchachtFunktion { get => schachtFunktion; set => schachtFunktion = value; } public decimal SchachtTiefe { get => schachtTiefe; set => schachtTiefe = value; } } -} \ No newline at end of file +} diff --git a/XMLParser/XMLParser.csproj b/XMLParser.Model/XMLParser.Model.csproj similarity index 100% rename from XMLParser/XMLParser.csproj rename to XMLParser.Model/XMLParser.Model.csproj diff --git a/XMLParser.sln b/XMLParser.sln index 41b5f1d..7568b67 100644 --- a/XMLParser.sln +++ b/XMLParser.sln @@ -3,12 +3,14 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.6.30114.105 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XMLParser", "XMLParser\XMLParser.csproj", "{55DEEE0A-8AED-403B-B2C7-F8EEAA45ED1F}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XMLParserTest", "XMLParserTest\XMLParserTest.csproj", "{089D18AE-F5F0-4371-BC0A-AEF00FBBFB55}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XMLProgramm", "XMLProgramm\XMLProgramm.csproj", "{641D9B83-D358-4015-9873-E5787DFC70D1}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XMLParser.Contract", "XMLParser.Contract\XMLParser.Contract.csproj", "{E32C7894-5512-46A4-A868-49A834291056}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XMLParser.Model", "XMLParser.Model\XMLParser.Model.csproj", "{4EC6DA2E-EF68-4E9E-8471-B0B59BBD96AD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -58,5 +60,29 @@ Global {641D9B83-D358-4015-9873-E5787DFC70D1}.Release|x64.Build.0 = Release|Any CPU {641D9B83-D358-4015-9873-E5787DFC70D1}.Release|x86.ActiveCfg = Release|Any CPU {641D9B83-D358-4015-9873-E5787DFC70D1}.Release|x86.Build.0 = Release|Any CPU + {E32C7894-5512-46A4-A868-49A834291056}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E32C7894-5512-46A4-A868-49A834291056}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E32C7894-5512-46A4-A868-49A834291056}.Debug|x64.ActiveCfg = Debug|Any CPU + {E32C7894-5512-46A4-A868-49A834291056}.Debug|x64.Build.0 = Debug|Any CPU + {E32C7894-5512-46A4-A868-49A834291056}.Debug|x86.ActiveCfg = Debug|Any CPU + {E32C7894-5512-46A4-A868-49A834291056}.Debug|x86.Build.0 = Debug|Any CPU + {E32C7894-5512-46A4-A868-49A834291056}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E32C7894-5512-46A4-A868-49A834291056}.Release|Any CPU.Build.0 = Release|Any CPU + {E32C7894-5512-46A4-A868-49A834291056}.Release|x64.ActiveCfg = Release|Any CPU + {E32C7894-5512-46A4-A868-49A834291056}.Release|x64.Build.0 = Release|Any CPU + {E32C7894-5512-46A4-A868-49A834291056}.Release|x86.ActiveCfg = Release|Any CPU + {E32C7894-5512-46A4-A868-49A834291056}.Release|x86.Build.0 = Release|Any CPU + {4EC6DA2E-EF68-4E9E-8471-B0B59BBD96AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4EC6DA2E-EF68-4E9E-8471-B0B59BBD96AD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4EC6DA2E-EF68-4E9E-8471-B0B59BBD96AD}.Debug|x64.ActiveCfg = Debug|Any CPU + {4EC6DA2E-EF68-4E9E-8471-B0B59BBD96AD}.Debug|x64.Build.0 = Debug|Any CPU + {4EC6DA2E-EF68-4E9E-8471-B0B59BBD96AD}.Debug|x86.ActiveCfg = Debug|Any CPU + {4EC6DA2E-EF68-4E9E-8471-B0B59BBD96AD}.Debug|x86.Build.0 = Debug|Any CPU + {4EC6DA2E-EF68-4E9E-8471-B0B59BBD96AD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4EC6DA2E-EF68-4E9E-8471-B0B59BBD96AD}.Release|Any CPU.Build.0 = Release|Any CPU + {4EC6DA2E-EF68-4E9E-8471-B0B59BBD96AD}.Release|x64.ActiveCfg = Release|Any CPU + {4EC6DA2E-EF68-4E9E-8471-B0B59BBD96AD}.Release|x64.Build.0 = Release|Any CPU + {4EC6DA2E-EF68-4E9E-8471-B0B59BBD96AD}.Release|x86.ActiveCfg = Release|Any CPU + {4EC6DA2E-EF68-4E9E-8471-B0B59BBD96AD}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/XMLParserTest/CalculateTest.cs b/XMLParserTest/CalculateTest.cs index 0191db4..47bb07a 100644 --- a/XMLParserTest/CalculateTest.cs +++ b/XMLParserTest/CalculateTest.cs @@ -2,7 +2,7 @@ using System.Diagnostics; using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; -using XMLParser; +//using XMLParser; namespace XMLParserTest { @@ -12,7 +12,7 @@ namespace XMLParserTest [TestMethod] public void TestCalculate() { - + /* List kanalObjekts = new XMLParse("input.xml").KanalObjekte.FindAll(x => x.Inspektionsdaten.OptischeInspektion.Inspektionsdatum.Equals("20.07.2021")); Assert.AreEqual(35,kanalObjekts.Count); @@ -22,6 +22,7 @@ namespace XMLParserTest Assert.AreEqual(102.00m,umsatz[ECalculatedResult.STRASSENABLAUFUMSATZ]); Assert.AreEqual(1305.00m,umsatz[ECalculatedResult.SONSTIGEUMSATZ]); Assert.AreEqual(27.50m,umsatz[ECalculatedResult.LAENGEZULAGEUMSATZ]); + */ } } } diff --git a/XMLParserTest/ParserTest.cs b/XMLParserTest/ParserTest.cs index da515fa..003009f 100644 --- a/XMLParserTest/ParserTest.cs +++ b/XMLParserTest/ParserTest.cs @@ -11,12 +11,13 @@ namespace XMLParserTest [TestMethod] public void TestMethod1() { - XMLParser.XMLParse xml = new XMLParser.XMLParse("input.xml"); + /*XMLParser.XMLParse xml = new XMLParser.XMLParse("input.xml"); IEnumerable datumsDistinct = xml.KanalObjekte.Select(x => x.Inspektionsdaten.OptischeInspektion.Inspektionsdatum).Distinct(); foreach(string aktuellDatum in datumsDistinct) { var m = xml.KanalObjekte.FindAll(x => x.Inspektionsdaten.OptischeInspektion.Inspektionsdatum.Equals(aktuellDatum)); Debugger.Break(); } + */ } } } diff --git a/XMLParserTest/XMLParserTest.csproj b/XMLParserTest/XMLParserTest.csproj index 3289cf6..db7e1fe 100644 --- a/XMLParserTest/XMLParserTest.csproj +++ b/XMLParserTest/XMLParserTest.csproj @@ -13,8 +13,4 @@ - - - - diff --git a/XMLProgramm/Program.cs b/XMLProgramm/Program.cs index 9be8751..0675372 100644 --- a/XMLProgramm/Program.cs +++ b/XMLProgramm/Program.cs @@ -3,7 +3,8 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; -using XMLParser; +using XMLParser.Contract; +using XMLParser.Model; namespace XMLProgramm { @@ -11,46 +12,16 @@ namespace XMLProgramm { static void Main(string[] args) { - CSVWriter csvWriter = new CSVWriter(); + + ICSVWriter csvWriter = new CSVWriter(); + //CSVWriter csvWriter = new CSVWriter(); List objekte = new List(); + IUmsatzCalculator calculator = new XMLParser.Functions.UmsatzCalculator.TagesUmsatz(); + calculator.Calculate(csvWriter,objekte); - StrassenUmsatz(csvWriter,objekte); + //StrassenUmsatz(csvWriter,objekte); //TagesUmsatz(csvWriter,objekte); - } - - private static void StrassenUmsatz(CSVWriter csvWriter, List objekte) - { - // KS_Oldenburg_Lönsweg.xml - XMLParse ser = new XMLParse("2021-07-29_KR_H_L_Oldenburg_Eichenstraße.xml"); - objekte.AddRange(ser.KanalObjekte); - Dictionary d = Calculate.CalculateStreet(objekte); } - - static void TagesUmsatz(CSVWriter csvWriter, List objekte) - { - DirectoryInfo info = new DirectoryInfo("./"); - FileInfo[] daten = info.GetFiles("*.xml"); - foreach(FileInfo aktuell in daten) { - XMLParse ser = new XMLParse(aktuell.FullName); - objekte.AddRange(ser.KanalObjekte); - } - IEnumerable datums = objekte.OrderBy(d => d.Inspektionsdaten.OptischeInspektion.Inspektionstime).Select(x => x.Inspektionsdaten.OptischeInspektion.Inspektionsdatum).Distinct(); - - decimal gesamt = 0.0m; - //Dictionary s = CalculateDay(objekte.FindAll(x => x.Inspektionsdaten.OptischeInspektion.Inspektionsdatum.Equals("05.08.2021"))); - foreach(string datum in datums) { - List InspektionenAmTag = objekte.FindAll(x => x.Inspektionsdaten.OptischeInspektion.Inspektionsdatum.Equals(datum)); - Dictionary s = Calculate.CalculateDay(InspektionenAmTag); - csvWriter.WriteDay(s,InspektionenAmTag); - Console.WriteLine("Umsatz am : "+datum + " " + s[ECalculatedResult.GESAMTUMSATZ]); - gesamt +=s[ECalculatedResult.GESAMTUMSATZ]; - //if(datum.Equals("05.08.2021")) Debugger.Break(); - } - int anzahlTage = datums.Count(); - decimal Durchschnitt = gesamt / anzahlTage; - int prognosedays = 63; - Console.WriteLine(string.Format("Tage : {0} \nGesamt umsatz: {1}\nDurchschnitt : {2}\nPrognose für {3} tage {4}",anzahlTage,gesamt,Durchschnitt,prognosedays,prognosedays*Durchschnitt)); - } } } diff --git a/XMLProgramm/XMLProgramm.csproj b/XMLProgramm/XMLProgramm.csproj index 2b4fae4..ac668a2 100644 --- a/XMLProgramm/XMLProgramm.csproj +++ b/XMLProgramm/XMLProgramm.csproj @@ -1,14 +1,16 @@ - - - - Always + + + + + + Exe