From ee6eb210b7382addba9261da860cd26bf5167d90 Mon Sep 17 00:00:00 2001 From: Damian Wessels Date: Tue, 8 Aug 2023 11:58:09 +0200 Subject: [PATCH] Nullverweise warnings bereinigt --- ConsoleApp3/CardMarketParser.cs | 2 +- ConsoleApp3/CheckSevDeskPublicList.cs | 6 +- ConsoleApp3/DataContracts/Invoice.cs | 62 +++++++++---------- ConsoleApp3/DataContracts/Invoices.cs | 2 +- ConsoleApp3/DataContracts/ModelCategory.cs | 20 +++--- ConsoleApp3/DataContracts/ModelContact.cs | 38 ++++++------ .../DataContracts/ModelContactAddress.cs | 22 +++---- ConsoleApp3/DataContracts/ModelCostCentre.cs | 10 +-- ConsoleApp3/DataContracts/ModelEntryType.cs | 4 +- .../DataContracts/ModelPaymentMethod.cs | 6 +- ConsoleApp3/DataContracts/ModelRechnung.cs | 4 +- ConsoleApp3/DataContracts/ModelSevUser.cs | 2 +- .../DataContracts/ModelStaticCountry.cs | 10 +-- ConsoleApp3/DataContracts/ModelTaxSet.cs | 12 ++-- ConsoleApp3/InvoiceParser.cs | 2 + ConsoleApp3/Kunde.cs | 1 + ConsoleApp3/Program.cs | 1 + ConsoleApp3/SevdeskService.cs | 8 ++- ConsoleApp3/test_BRIEF085.csv | 6 ++ ConsoleApp3/test_BRIEF100.csv | 3 + ConsoleApp3/test_FAILED.csv | 3 + ConsoleApp3/test_PRIO210.csv | 3 + 22 files changed, 125 insertions(+), 102 deletions(-) create mode 100644 ConsoleApp3/test_BRIEF085.csv create mode 100644 ConsoleApp3/test_BRIEF100.csv create mode 100644 ConsoleApp3/test_FAILED.csv create mode 100644 ConsoleApp3/test_PRIO210.csv diff --git a/ConsoleApp3/CardMarketParser.cs b/ConsoleApp3/CardMarketParser.cs index 7aac4ae..0ccad66 100644 --- a/ConsoleApp3/CardMarketParser.cs +++ b/ConsoleApp3/CardMarketParser.cs @@ -79,7 +79,7 @@ namespace CardmarketBot ids.Add(datas[i]); } } - catch(OpenQA.Selenium.NotFoundException ex) + catch(OpenQA.Selenium.NotFoundException) { Console.WriteLine("Keine Verkäufe aktuell"); return kunden; diff --git a/ConsoleApp3/CheckSevDeskPublicList.cs b/ConsoleApp3/CheckSevDeskPublicList.cs index 711388a..6f16eeb 100644 --- a/ConsoleApp3/CheckSevDeskPublicList.cs +++ b/ConsoleApp3/CheckSevDeskPublicList.cs @@ -27,14 +27,14 @@ namespace CardMarketBot { try { - SocketShutdown reason = SocketShutdown.Send; + //SocketShutdown reason = SocketShutdown.Send; lock (_lock) { BinaryWriter writer = new BinaryWriter(client.GetStream()); writer.Write(str); if (_closed) { - reason = SocketShutdown.Both; + //reason = SocketShutdown.Both; } } //client.Client.Shutdown(reason); @@ -99,7 +99,7 @@ namespace CardMarketBot return result == EResult.OK; } - catch(SocketException e) + catch(SocketException) { throw new SocketException(); } diff --git a/ConsoleApp3/DataContracts/Invoice.cs b/ConsoleApp3/DataContracts/Invoice.cs index a9ac9f3..11316c9 100644 --- a/ConsoleApp3/DataContracts/Invoice.cs +++ b/ConsoleApp3/DataContracts/Invoice.cs @@ -15,14 +15,14 @@ namespace ConsoleApp3.DataContracts public int? Id { get; set; } [JsonProperty(PropertyName = "objectName")] - public string ObjectName { get; set; } + public string ObjectName { get; set; } = ""; /// /// /// /// [DataMember(Name = "invoiceNumber", EmitDefaultValue = false)] [JsonProperty(PropertyName = "invoiceNumber")] - public string InvoiceNumber { get; set; } + public string InvoiceNumber { get; set; } = ""; /// /// the contact the invoice belongs to @@ -30,7 +30,7 @@ namespace ConsoleApp3.DataContracts /// the contact the invoice belongs to [DataMember(Name = "contact", EmitDefaultValue = false)] [JsonProperty(PropertyName = "contact")] - public ModelContact Contact { get; set; } + public ModelContact? Contact { get; set; } /// /// the date the invoice was created @@ -62,7 +62,7 @@ namespace ConsoleApp3.DataContracts /// header/subject of the invoice [DataMember(Name = "header", EmitDefaultValue = false)] [JsonProperty(PropertyName = "header")] - public string Header { get; set; } + public string Header { get; set; } = ""; /// /// head text of the invoice @@ -70,7 +70,7 @@ namespace ConsoleApp3.DataContracts /// head text of the invoice [DataMember(Name = "headText", EmitDefaultValue = false)] [JsonProperty(PropertyName = "headText")] - public string HeadText { get; set; } + public string HeadText { get; set; } = ""; /// /// foot text of the invoice @@ -78,7 +78,7 @@ namespace ConsoleApp3.DataContracts /// foot text of the invoice [DataMember(Name = "footText", EmitDefaultValue = false)] [JsonProperty(PropertyName = "footText")] - public string FootText { get; set; } + public string FootText { get; set; } = ""; /// /// time left for paying the invoice, use format dd.MM.yyyy or number for number of days left @@ -110,7 +110,7 @@ namespace ConsoleApp3.DataContracts /// the name in the address, equals the contacts name [DataMember(Name = "addressName", EmitDefaultValue = false)] [JsonProperty(PropertyName = "addressName")] - public string AddressName { get; set; } + public string AddressName { get; set; } = ""; /// /// the street in the address, equals the contacts street @@ -118,7 +118,7 @@ namespace ConsoleApp3.DataContracts /// the street in the address, equals the contacts street [DataMember(Name = "addressStreet", EmitDefaultValue = false)] [JsonProperty(PropertyName = "addressStreet")] - public string AddressStreet { get; set; } + public string AddressStreet { get; set; } = ""; /// /// the zip-code in the address, equals the contacts zip @@ -126,7 +126,7 @@ namespace ConsoleApp3.DataContracts /// the zip-code in the address, equals the contacts zip [DataMember(Name = "addressZip", EmitDefaultValue = false)] [JsonProperty(PropertyName = "addressZip")] - public string AddressZip { get; set; } + public string AddressZip { get; set; } = ""; /// /// the city in the address, equals the contacts city @@ -134,7 +134,7 @@ namespace ConsoleApp3.DataContracts /// the city in the address, equals the contacts city [DataMember(Name = "addressCity", EmitDefaultValue = false)] [JsonProperty(PropertyName = "addressCity")] - public string AddressCity { get; set; } + public string AddressCity { get; set; } = ""; /// /// the country in the address, equals the contacts country @@ -142,7 +142,7 @@ namespace ConsoleApp3.DataContracts /// the country in the address, equals the contacts country [DataMember(Name = "addressCountry", EmitDefaultValue = false)] [JsonProperty(PropertyName = "addressCountry")] - public ModelStaticCountry AddressCountry { get; set; } + public ModelStaticCountry? AddressCountry { get; set; } /// /// time left for paying the invoice, use format DD.MM.YYYY or number for number of days left @@ -158,7 +158,7 @@ namespace ConsoleApp3.DataContracts /// SevUser who created the invoice [DataMember(Name = "createUser", EmitDefaultValue = false)] [JsonProperty(PropertyName = "createUser")] - public ModelSevUser CreateUser { get; set; } + public ModelSevUser? CreateUser { get; set; } /// /// sevClient is the unique id every customer has and is used in nearly all operations @@ -166,7 +166,7 @@ namespace ConsoleApp3.DataContracts /// sevClient is the unique id every customer has and is used in nearly all operations [DataMember(Name = "sevClient", EmitDefaultValue = false)] [JsonProperty(PropertyName = "sevClient")] - public Object SevClient { get; set; } + public Object? SevClient { get; set; } /// /// delivery date of the goods from the invoice, please use dd.MM.yyyy @@ -182,7 +182,7 @@ namespace ConsoleApp3.DataContracts /// status of the invoice [DataMember(Name = "status", EmitDefaultValue = false)] [JsonProperty(PropertyName = "status")] - public EInvoiceStatus Status { get; set; } + public EInvoiceStatus? Status { get; set; } /// /// @@ -198,7 +198,7 @@ namespace ConsoleApp3.DataContracts /// SevUser who created the invoice and therefore is the contact person [DataMember(Name = "contactPerson", EmitDefaultValue = false)] [JsonProperty(PropertyName = "contactPerson")] - public ModelSevUser ContactPerson { get; set; } = new ModelSevUser() + public ModelSevUser? ContactPerson { get; set; } = new ModelSevUser() { }; @@ -217,7 +217,7 @@ namespace ConsoleApp3.DataContracts /// additional text when adding a value added tax regulation [DataMember(Name = "taxText", EmitDefaultValue = false)] [JsonProperty(PropertyName = "taxText")] - public string TaxText { get; set; } + public string TaxText { get; set; } = ""; /// /// dunning level of the invoice @@ -233,7 +233,7 @@ namespace ConsoleApp3.DataContracts /// name of the contacts address [DataMember(Name = "addressParentName", EmitDefaultValue = false)] [JsonProperty(PropertyName = "addressParentName")] - public string AddressParentName { get; set; } + public string AddressParentName { get; set; } = ""; /// /// a reference to the contacts address @@ -241,7 +241,7 @@ namespace ConsoleApp3.DataContracts /// a reference to the contacts address [DataMember(Name = "addressContactRef", EmitDefaultValue = false)] [JsonProperty(PropertyName = "addressContactRef")] - public ModelContactAddress AddressContactRef { get; set; } + public ModelContactAddress? AddressContactRef { get; set; } /// /// @@ -249,7 +249,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "taxType", EmitDefaultValue = false)] [JsonProperty(PropertyName = "taxType")] - public string TaxType { get; set; } + public string TaxType { get; set; } = ""; /// /// @@ -257,7 +257,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "paymentMethod", EmitDefaultValue = false)] [JsonProperty(PropertyName = "paymentMethod")] - public ModelPaymentMethod PaymentMethod { get; set; } + public ModelPaymentMethod? PaymentMethod { get; set; } /// /// @@ -265,7 +265,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "costCentre", EmitDefaultValue = false)] [JsonProperty(PropertyName = "costCentre")] - public ModelCostCentre CostCentre { get; set; } + public ModelCostCentre? CostCentre { get; set; } /// /// @@ -281,7 +281,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "origin", EmitDefaultValue = false)] [JsonProperty(PropertyName = "origin")] - public Object Origin { get; set; } + public Object? Origin { get; set; } /// /// type of the invoice @@ -289,7 +289,7 @@ namespace ConsoleApp3.DataContracts /// type of the invoice [DataMember(Name = "invoiceType", EmitDefaultValue = false)] [JsonProperty(PropertyName = "invoiceType")] - public string InvoiceType { get; set; } + public string InvoiceType { get; set; } = ""; /// /// @@ -353,7 +353,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "addressParentName2", EmitDefaultValue = false)] [JsonProperty(PropertyName = "addressParentName2")] - public string AddressParentName2 { get; set; } + public string AddressParentName2 { get; set; } = ""; /// /// @@ -361,7 +361,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "addressName2", EmitDefaultValue = false)] [JsonProperty(PropertyName = "addressName2")] - public string AddressName2 { get; set; } + public string AddressName2 { get; set; } = ""; /// /// @@ -369,7 +369,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "taxSet", EmitDefaultValue = false)] [JsonProperty(PropertyName = "taxSet")] - public ModelTaxSet TaxSet { get; set; } + public ModelTaxSet? TaxSet { get; set; } /// /// @@ -377,7 +377,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "addressGender", EmitDefaultValue = false)] [JsonProperty(PropertyName = "addressGender")] - public string AddressGender { get; set; } + public string AddressGender { get; set; } = ""; /// /// @@ -393,7 +393,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "address", EmitDefaultValue = false)] [JsonProperty(PropertyName = "address")] - public string Address { get; set; } + public string Address { get; set; } = ""; /// /// @@ -497,7 +497,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "entryType", EmitDefaultValue = false)] [JsonProperty(PropertyName = "entryType")] - public ModelEntryType EntryType { get; set; } + public ModelEntryType? EntryType { get; set; } /// /// @@ -505,7 +505,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "costumerInternalNote", EmitDefaultValue = false)] [JsonProperty(PropertyName = "costumerInternalNote")] - public string CostumerInternalNote { get; set; } + public string CostumerInternalNote { get; set; } = ""; /// /// @@ -530,7 +530,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "sendType", EmitDefaultValue = false)] [JsonProperty(PropertyName = "sendType")] - public string SendType { get; set; } + public string SendType { get; set; } = ""; /// /// diff --git a/ConsoleApp3/DataContracts/Invoices.cs b/ConsoleApp3/DataContracts/Invoices.cs index c8ab436..757a874 100644 --- a/ConsoleApp3/DataContracts/Invoices.cs +++ b/ConsoleApp3/DataContracts/Invoices.cs @@ -6,7 +6,7 @@ namespace ConsoleApp3.DataContracts { internal class Invoices { - [JsonProperty("objects")] public Invoice[] Invoice { get; set; } + [JsonProperty("objects")] public Invoice[]? Invoice { get; set; } } } \ No newline at end of file diff --git a/ConsoleApp3/DataContracts/ModelCategory.cs b/ConsoleApp3/DataContracts/ModelCategory.cs index a0f49f9..1407046 100644 --- a/ConsoleApp3/DataContracts/ModelCategory.cs +++ b/ConsoleApp3/DataContracts/ModelCategory.cs @@ -24,7 +24,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "parent", EmitDefaultValue = false)] [JsonProperty(PropertyName = "parent")] - public ModelCategory Parent { get; set; } + public ModelCategory? Parent { get; set; } /// /// @@ -32,7 +32,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "name", EmitDefaultValue = false)] [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + public string Name { get; set; } = ""; /// /// @@ -40,7 +40,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "objectType", EmitDefaultValue = false)] [JsonProperty(PropertyName = "objectType")] - public string ObjectType { get; set; } + public string ObjectType { get; set; } = ""; /// /// @@ -56,7 +56,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "code", EmitDefaultValue = false)] [JsonProperty(PropertyName = "code")] - public string Code { get; set; } + public string Code { get; set; } = ""; /// /// @@ -64,7 +64,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "color", EmitDefaultValue = false)] [JsonProperty(PropertyName = "color")] - public string Color { get; set; } + public string Color { get; set; } = ""; /// /// @@ -72,7 +72,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "sevClient", EmitDefaultValue = false)] [JsonProperty(PropertyName = "sevClient")] - public Object SevClient { get; set; } + public Object? SevClient { get; set; } /// /// @@ -80,7 +80,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "postingAccount", EmitDefaultValue = false)] [JsonProperty(PropertyName = "postingAccount")] - public string PostingAccount { get; set; } + public string PostingAccount { get; set; } = ""; /// /// @@ -88,7 +88,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "type", EmitDefaultValue = false)] [JsonProperty(PropertyName = "type")] - public string Type { get; set; } + public string Type { get; set; } = ""; /// /// @@ -96,7 +96,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "translationCode", EmitDefaultValue = false)] [JsonProperty(PropertyName = "translationCode")] - public string TranslationCode { get; set; } + public string TranslationCode { get; set; } = ""; /// /// @@ -104,7 +104,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "entryType", EmitDefaultValue = false)] [JsonProperty(PropertyName = "entryType")] - public ModelEntryType EntryType { get; set; } + public ModelEntryType? EntryType { get; set; } } } \ No newline at end of file diff --git a/ConsoleApp3/DataContracts/ModelContact.cs b/ConsoleApp3/DataContracts/ModelContact.cs index 8dbf856..5fc1319 100644 --- a/ConsoleApp3/DataContracts/ModelContact.cs +++ b/ConsoleApp3/DataContracts/ModelContact.cs @@ -19,7 +19,7 @@ namespace ConsoleApp3.DataContracts /// the contact address [DataMember(Name = "address", EmitDefaultValue = false)] [JsonProperty(PropertyName = "address")] - public ModelContactAddress Address { get; set; } + public ModelContactAddress? Address { get; set; } /// /// the creation date of the contact @@ -43,7 +43,7 @@ namespace ConsoleApp3.DataContracts /// name of the contact [DataMember(Name = "name", EmitDefaultValue = false)] [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + public string Name { get; set; } = ""; /// /// status of the contact @@ -67,7 +67,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "parent", EmitDefaultValue = false)] [JsonProperty(PropertyName = "parent")] - public ModelContact Parent { get; set; } + public ModelContact? Parent { get; set; } /// /// surname of the contact @@ -75,7 +75,7 @@ namespace ConsoleApp3.DataContracts /// surname of the contact [DataMember(Name = "surename", EmitDefaultValue = false)] [JsonProperty(PropertyName = "surename")] - public string Surename { get; set; } + public string Surename { get; set; } = ""; /// /// family name of the contact @@ -83,7 +83,7 @@ namespace ConsoleApp3.DataContracts /// family name of the contact [DataMember(Name = "familyname", EmitDefaultValue = false)] [JsonProperty(PropertyName = "familyname")] - public string Familyname { get; set; } + public string Familyname { get; set; } = ""; /// /// title of the contact @@ -91,7 +91,7 @@ namespace ConsoleApp3.DataContracts /// title of the contact [DataMember(Name = "titel", EmitDefaultValue = false)] [JsonProperty(PropertyName = "titel")] - public string Titel { get; set; } + public string Titel { get; set; } = ""; /// /// category of the contact @@ -99,7 +99,7 @@ namespace ConsoleApp3.DataContracts /// category of the contact [DataMember(Name = "category", EmitDefaultValue = false)] [JsonProperty(PropertyName = "category")] - public ModelCategory Category { get; set; } + public ModelCategory? Category { get; set; } /// /// description of the contact @@ -107,7 +107,7 @@ namespace ConsoleApp3.DataContracts /// description of the contact [DataMember(Name = "description", EmitDefaultValue = false)] [JsonProperty(PropertyName = "description")] - public string Description { get; set; } + public string Description { get; set; } = ""; /// /// any academic title of the contact @@ -115,7 +115,7 @@ namespace ConsoleApp3.DataContracts /// any academic title of the contact [DataMember(Name = "academicTitle", EmitDefaultValue = false)] [JsonProperty(PropertyName = "academicTitle")] - public string AcademicTitle { get; set; } + public string AcademicTitle { get; set; } = ""; /// /// gender of the contact @@ -123,7 +123,7 @@ namespace ConsoleApp3.DataContracts /// gender of the contact [DataMember(Name = "gender", EmitDefaultValue = false)] [JsonProperty(PropertyName = "gender")] - public string Gender { get; set; } + public string Gender { get; set; } = ""; /// /// sevClient is the unique id every customer has and is used in nearly all operations @@ -131,7 +131,7 @@ namespace ConsoleApp3.DataContracts /// sevClient is the unique id every customer has and is used in nearly all operations [DataMember(Name = "sevClient", EmitDefaultValue = false)] [JsonProperty(PropertyName = "sevClient")] - public Object SevClient { get; set; } + public Object? SevClient { get; set; } /// /// second name of the contact @@ -139,7 +139,7 @@ namespace ConsoleApp3.DataContracts /// second name of the contact [DataMember(Name = "name2", EmitDefaultValue = false)] [JsonProperty(PropertyName = "name2")] - public string Name2 { get; set; } + public string Name2 { get; set; } = ""; /// /// birthday of the contact @@ -155,7 +155,7 @@ namespace ConsoleApp3.DataContracts /// vat number of the contact [DataMember(Name = "vatNumber", EmitDefaultValue = false)] [JsonProperty(PropertyName = "vatNumber")] - public string VatNumber { get; set; } + public string VatNumber { get; set; } = ""; /// /// bank account of the contact @@ -163,7 +163,7 @@ namespace ConsoleApp3.DataContracts /// bank account of the contact [DataMember(Name = "bankAccount", EmitDefaultValue = false)] [JsonProperty(PropertyName = "bankAccount")] - public string BankAccount { get; set; } + public string BankAccount { get; set; } = ""; /// /// bank number of the contact @@ -171,7 +171,7 @@ namespace ConsoleApp3.DataContracts /// bank number of the contact [DataMember(Name = "bankNumber", EmitDefaultValue = false)] [JsonProperty(PropertyName = "bankNumber")] - public string BankNumber { get; set; } + public string BankNumber { get; set; } = ""; /// /// desired payment method of the customer @@ -179,7 +179,7 @@ namespace ConsoleApp3.DataContracts /// desired payment method of the customer [DataMember(Name = "paymentMethod", EmitDefaultValue = false)] [JsonProperty(PropertyName = "paymentMethod")] - public ModelPaymentMethod PaymentMethod { get; set; } + public ModelPaymentMethod? PaymentMethod { get; set; } /// /// @@ -187,7 +187,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "entryType", EmitDefaultValue = false)] [JsonProperty(PropertyName = "entryType")] - public ModelEntryType EntryType { get; set; } + public ModelEntryType? EntryType { get; set; } /// /// default cashback time of the contact @@ -219,7 +219,7 @@ namespace ConsoleApp3.DataContracts /// tax number of the contact [DataMember(Name = "taxNumber", EmitDefaultValue = false)] [JsonProperty(PropertyName = "taxNumber")] - public string TaxNumber { get; set; } + public string TaxNumber { get; set; } = ""; /// /// tax office of the contact @@ -227,6 +227,6 @@ namespace ConsoleApp3.DataContracts /// tax office of the contact [DataMember(Name = "taxOffice", EmitDefaultValue = false)] [JsonProperty(PropertyName = "taxOffice")] - public string TaxOffice { get; set; } + public string TaxOffice { get; set; } = ""; } } \ No newline at end of file diff --git a/ConsoleApp3/DataContracts/ModelContactAddress.cs b/ConsoleApp3/DataContracts/ModelContactAddress.cs index 58ad3b7..b4eebe4 100644 --- a/ConsoleApp3/DataContracts/ModelContactAddress.cs +++ b/ConsoleApp3/DataContracts/ModelContactAddress.cs @@ -28,7 +28,7 @@ namespace ConsoleApp3.DataContracts /// the contact the address belongs to [DataMember(Name = "contact", EmitDefaultValue = false)] [JsonProperty(PropertyName = "contact")] - public ModelContact Contact { get; set; } + public ModelContact? Contact { get; set; } /// /// @@ -36,7 +36,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "street", EmitDefaultValue = false)] [JsonProperty(PropertyName = "street")] - public string Street { get; set; } + public string Street { get; set; } = ""; /// /// zip of the city/village @@ -44,7 +44,7 @@ namespace ConsoleApp3.DataContracts /// zip of the city/village [DataMember(Name = "zip", EmitDefaultValue = false)] [JsonProperty(PropertyName = "zip")] - public string Zip { get; set; } + public string Zip { get; set; } = ""; /// /// @@ -52,7 +52,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "city", EmitDefaultValue = false)] [JsonProperty(PropertyName = "city")] - public string City { get; set; } + public string City { get; set; } = ""; /// /// @@ -60,7 +60,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "country", EmitDefaultValue = false)] [JsonProperty(PropertyName = "country")] - public ModelStaticCountry Country { get; set; } + public ModelStaticCountry? Country { get; set; } /// /// category of the address @@ -68,7 +68,7 @@ namespace ConsoleApp3.DataContracts /// category of the address [DataMember(Name = "category", EmitDefaultValue = false)] [JsonProperty(PropertyName = "category")] - public ModelCategory Category { get; set; } + public ModelCategory? Category { get; set; } /// /// @@ -76,7 +76,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "name", EmitDefaultValue = false)] [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + public string Name { get; set; } = ""; /// /// sevClient is the unique id every customer has and is used in nearly all operations @@ -84,7 +84,7 @@ namespace ConsoleApp3.DataContracts /// sevClient is the unique id every customer has and is used in nearly all operations [DataMember(Name = "sevClient", EmitDefaultValue = false)] [JsonProperty(PropertyName = "sevClient")] - public Object SevClient { get; set; } + public Object SevClient { get; set; } = new object(); /// /// @@ -92,7 +92,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "name2", EmitDefaultValue = false)] [JsonProperty(PropertyName = "name2")] - public string Name2 { get; set; } + public string Name2 { get; set; } = ""; /// /// @@ -100,7 +100,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "name3", EmitDefaultValue = false)] [JsonProperty(PropertyName = "name3")] - public string Name3 { get; set; } + public string Name3 { get; set; } = ""; /// /// @@ -108,7 +108,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "name4", EmitDefaultValue = false)] [JsonProperty(PropertyName = "name4")] - public string Name4 { get; set; } + public string Name4 { get; set; } = ""; } } \ No newline at end of file diff --git a/ConsoleApp3/DataContracts/ModelCostCentre.cs b/ConsoleApp3/DataContracts/ModelCostCentre.cs index b5877ac..45c7f55 100644 --- a/ConsoleApp3/DataContracts/ModelCostCentre.cs +++ b/ConsoleApp3/DataContracts/ModelCostCentre.cs @@ -25,7 +25,7 @@ namespace ConsoleApp3.DataContracts /// sevClient is the unique id every customer has and is used in nearly all operations [DataMember(Name = "sevClient", EmitDefaultValue = false)] [JsonProperty(PropertyName = "sevClient")] - public Object SevClient { get; set; } + public Object? SevClient { get; set; } /// /// @@ -33,7 +33,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "number", EmitDefaultValue = false)] [JsonProperty(PropertyName = "number")] - public string Number { get; set; } + public string Number { get; set; } = ""; /// /// @@ -41,7 +41,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "name", EmitDefaultValue = false)] [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + public string Name { get; set; } = ""; /// /// @@ -49,7 +49,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "color", EmitDefaultValue = false)] [JsonProperty(PropertyName = "color")] - public string Color { get; set; } + public string Color { get; set; } = ""; /// /// @@ -57,6 +57,6 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "postingAccount", EmitDefaultValue = false)] [JsonProperty(PropertyName = "postingAccount")] - public string PostingAccount { get; set; } + public string PostingAccount { get; set; } = ""; } } \ No newline at end of file diff --git a/ConsoleApp3/DataContracts/ModelEntryType.cs b/ConsoleApp3/DataContracts/ModelEntryType.cs index 544494d..c56728f 100644 --- a/ConsoleApp3/DataContracts/ModelEntryType.cs +++ b/ConsoleApp3/DataContracts/ModelEntryType.cs @@ -24,7 +24,7 @@ namespace ConsoleApp3.DataContracts /// sevClient is the unique id every customer has and is used in nearly all operations [DataMember(Name = "sevClient", EmitDefaultValue = false)] [JsonProperty(PropertyName = "sevClient")] - public Object SevClient { get; set; } + public Object? SevClient { get; set; } /// /// @@ -32,6 +32,6 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "name", EmitDefaultValue = false)] [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + public string Name { get; set; } = ""; } } \ No newline at end of file diff --git a/ConsoleApp3/DataContracts/ModelPaymentMethod.cs b/ConsoleApp3/DataContracts/ModelPaymentMethod.cs index 6d87dc0..5b00f12 100644 --- a/ConsoleApp3/DataContracts/ModelPaymentMethod.cs +++ b/ConsoleApp3/DataContracts/ModelPaymentMethod.cs @@ -28,7 +28,7 @@ namespace ConsoleApp3.DataContracts /// sevClient is the unique id every customer has and is used in nearly all operations [DataMember(Name = "sevClient", EmitDefaultValue = false)] [JsonProperty(PropertyName = "sevClient")] - public Object SevClient { get; set; } + public Object? SevClient { get; set; } /// /// @@ -36,7 +36,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "name", EmitDefaultValue = false)] [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + public string Name { get; set; } = ""; /// /// @@ -44,7 +44,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "text", EmitDefaultValue = false)] [JsonProperty(PropertyName = "text")] - public string Text { get; set; } + public string Text { get; set; } = ""; } } \ No newline at end of file diff --git a/ConsoleApp3/DataContracts/ModelRechnung.cs b/ConsoleApp3/DataContracts/ModelRechnung.cs index 72d7d35..f95dfc0 100644 --- a/ConsoleApp3/DataContracts/ModelRechnung.cs +++ b/ConsoleApp3/DataContracts/ModelRechnung.cs @@ -13,10 +13,10 @@ namespace ConsoleApp3.DataContracts { [DataMember(Name = "invoice", EmitDefaultValue = false)] [JsonProperty(PropertyName = "invoice")] - public Invoice Invoice { get; set; } + public Invoice? Invoice { get; set; } [DataMember(Name = "invoicePosSave", EmitDefaultValue = false)] [JsonProperty(PropertyName = "invoicePosSave")] - public InvoicePosSave[] InvoicePosSaves { get; set; } + public InvoicePosSave[]? InvoicePosSaves { get; set; } } } diff --git a/ConsoleApp3/DataContracts/ModelSevUser.cs b/ConsoleApp3/DataContracts/ModelSevUser.cs index 87c8bd1..5178edf 100644 --- a/ConsoleApp3/DataContracts/ModelSevUser.cs +++ b/ConsoleApp3/DataContracts/ModelSevUser.cs @@ -21,6 +21,6 @@ namespace ConsoleApp3.DataContracts /// This information is not visible for you [DataMember(Name = "hidden", EmitDefaultValue = false)] [JsonProperty(PropertyName = "hidden")] - public string Hidden { get; set; } + public string Hidden { get; set; } = ""; } } \ No newline at end of file diff --git a/ConsoleApp3/DataContracts/ModelStaticCountry.cs b/ConsoleApp3/DataContracts/ModelStaticCountry.cs index 8cb127c..337ca73 100644 --- a/ConsoleApp3/DataContracts/ModelStaticCountry.cs +++ b/ConsoleApp3/DataContracts/ModelStaticCountry.cs @@ -20,7 +20,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "code", EmitDefaultValue = false)] [JsonProperty(PropertyName = "code")] - public string Code { get; set; } + public string Code { get; set; } = ""; /// /// @@ -28,7 +28,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "name", EmitDefaultValue = false)] [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + public string Name { get; set; } = ""; /// /// @@ -36,7 +36,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "nameEn", EmitDefaultValue = false)] [JsonProperty(PropertyName = "nameEn")] - public string NameEn { get; set; } + public string NameEn { get; set; } = ""; /// /// @@ -44,7 +44,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "translationCode", EmitDefaultValue = false)] [JsonProperty(PropertyName = "translationCode")] - public string TranslationCode { get; set; } + public string TranslationCode { get; set; } = ""; /// /// @@ -52,7 +52,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "locale", EmitDefaultValue = false)] [JsonProperty(PropertyName = "locale")] - public string Locale { get; set; } + public string Locale { get; set; } = ""; /// /// diff --git a/ConsoleApp3/DataContracts/ModelTaxSet.cs b/ConsoleApp3/DataContracts/ModelTaxSet.cs index 30ddfb1..6debc33 100644 --- a/ConsoleApp3/DataContracts/ModelTaxSet.cs +++ b/ConsoleApp3/DataContracts/ModelTaxSet.cs @@ -29,7 +29,7 @@ namespace ConsoleApp3.DataContracts /// sevClient is the unique id every customer has and is used in nearly all operations [DataMember(Name = "sevClient", EmitDefaultValue = false)] [JsonProperty(PropertyName = "sevClient")] - public Object SevClient { get; set; } + public Object? SevClient { get; set; } /// /// @@ -37,7 +37,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "text", EmitDefaultValue = false)] [JsonProperty(PropertyName = "text")] - public string Text { get; set; } + public string Text { get; set; } = ""; /// /// @@ -61,7 +61,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "displayText", EmitDefaultValue = false)] [JsonProperty(PropertyName = "displayText")] - public string DisplayText { get; set; } + public string DisplayText { get; set; } = ""; /// /// @@ -69,7 +69,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "vatReportFieldNet", EmitDefaultValue = false)] [JsonProperty(PropertyName = "vatReportFieldNet")] - public string VatReportFieldNet { get; set; } + public string VatReportFieldNet { get; set; } = ""; /// /// @@ -77,7 +77,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "vatReportFieldTax", EmitDefaultValue = false)] [JsonProperty(PropertyName = "vatReportFieldTax")] - public string VatReportFieldTax { get; set; } + public string VatReportFieldTax { get; set; } = ""; /// /// @@ -85,7 +85,7 @@ namespace ConsoleApp3.DataContracts /// [DataMember(Name = "accountingExportVatField", EmitDefaultValue = false)] [JsonProperty(PropertyName = "accountingExportVatField")] - public string AccountingExportVatField { get; set; } + public string AccountingExportVatField { get; set; } = ""; /// /// diff --git a/ConsoleApp3/InvoiceParser.cs b/ConsoleApp3/InvoiceParser.cs index e3e2173..f06de07 100644 --- a/ConsoleApp3/InvoiceParser.cs +++ b/ConsoleApp3/InvoiceParser.cs @@ -54,6 +54,7 @@ namespace CardmarketBot // 3 => Österreich // 6 => Belgien // 11 => Frankreich + // 13 => Irland // 14 => Italien // 17 => Luxemburg @@ -65,6 +66,7 @@ namespace CardmarketBot { "Belgien",6 }, { "Dänemark", 8 }, { "Frankreich", 11 }, + { "Irland", 13 }, { "Italien", 14 }, { "Luxemburg", 17 } }; diff --git a/ConsoleApp3/Kunde.cs b/ConsoleApp3/Kunde.cs index fe56a1c..51554d3 100644 --- a/ConsoleApp3/Kunde.cs +++ b/ConsoleApp3/Kunde.cs @@ -29,6 +29,7 @@ class Kunde get => overrideVersandskosten; set { + if (value == null) return; string[] parts = value.Split(' '); if(parts.Length < 2) { diff --git a/ConsoleApp3/Program.cs b/ConsoleApp3/Program.cs index 84dbb41..cab7949 100644 --- a/ConsoleApp3/Program.cs +++ b/ConsoleApp3/Program.cs @@ -38,6 +38,7 @@ namespace CardmarketBot foreach (ModelRechnung item in rechnungen) { + if(item.Invoice == null) continue; var str_header = item.Invoice.Header; if (str_header != null) { diff --git a/ConsoleApp3/SevdeskService.cs b/ConsoleApp3/SevdeskService.cs index 86f16a5..81a0182 100644 --- a/ConsoleApp3/SevdeskService.cs +++ b/ConsoleApp3/SevdeskService.cs @@ -26,7 +26,7 @@ namespace CardmarketBot public async void Create(ModelRechnung rechnung) { - + if (rechnung.Invoice == null) return; rechnung.Invoice.InvoiceNumber = string.Format("RE-{0}", await GetNextInvoiceNumber()); await WriteInv(rechnung); } @@ -60,7 +60,9 @@ namespace CardmarketBot { MissingMemberHandling = MissingMemberHandling.Ignore }; +#pragma warning disable CS8603 // Mögliche Nullverweisrückgabe. return JsonConvert.DeserializeObject(contents, jsonSerializerSettings); +#pragma warning restore CS8603 // Mögliche Nullverweisrückgabe. } private async Task GetNextInvoiceNumber() @@ -76,6 +78,8 @@ namespace CardmarketBot }; var ob = JsonConvert.DeserializeObject(contents, jsonSerializerSettings); + if (ob == null) return ""; + if (ob.ConfigRechnungsnummer == null) return ""; return ob.ConfigRechnungsnummer.NextNumber; } @@ -84,7 +88,7 @@ namespace CardmarketBot [DataContract] class RNumbers { - [JsonProperty("objects")] public ConfigRechnungnummer ConfigRechnungsnummer { get; set; } + [JsonProperty("objects")] public ConfigRechnungnummer? ConfigRechnungsnummer { get; set; } } [DataContract] diff --git a/ConsoleApp3/test_BRIEF085.csv b/ConsoleApp3/test_BRIEF085.csv new file mode 100644 index 0000000..2f3b55f --- /dev/null +++ b/ConsoleApp3/test_BRIEF085.csv @@ -0,0 +1,6 @@ +NAME;ZUSATZ;STRASSE;NUMMER;PLZ;STADT;LAND;ADRESS_TYP;REFERENZ +W&W TECH UG;Lukas Winkelmann;Schwedenschanze;70;49808;LINGEN;DEU;HOUSE +Pierre KOch;;Zum Kuckeshof;22;47239;Duisburg;DEU;HOUSE;1122664505 +Yunus Elitok;;Heckteichstraße;13;40627;Düsseldorf;DEU;HOUSE;1122677794 +Dennis Wolf;;Edelherr-Ludolf-Ring;13;48432;Rheine;DEU;HOUSE;1122347599 +Corin Repina;;Richard-Wagner-Str.;47;78224;Singen;DEU;HOUSE;1122723098 diff --git a/ConsoleApp3/test_BRIEF100.csv b/ConsoleApp3/test_BRIEF100.csv new file mode 100644 index 0000000..14034e3 --- /dev/null +++ b/ConsoleApp3/test_BRIEF100.csv @@ -0,0 +1,3 @@ +NAME;ZUSATZ;STRASSE;NUMMER;PLZ;STADT;LAND;ADRESS_TYP;REFERENZ +W&W TECH UG;Lukas Winkelmann;Schwedenschanze;70;49808;LINGEN;DEU;HOUSE +Bastian Himmel;;Heinrich-Rau-Straße;17;16816;Neuruppin;DEU;HOUSE;1122659468 diff --git a/ConsoleApp3/test_FAILED.csv b/ConsoleApp3/test_FAILED.csv new file mode 100644 index 0000000..c975a6c --- /dev/null +++ b/ConsoleApp3/test_FAILED.csv @@ -0,0 +1,3 @@ +NAME;ZUSATZ;STRASSE;NUMMER;PLZ;STADT;LAND;ADRESS_TYP;REFERENZ +W&W TECH UG;Lukas Winkelmann;Schwedenschanze;70;49808;LINGEN;DEU;HOUSE +Alan Hoban;;9 Kings Hall Phibsboro;Road;D07KX07;Dublin,;DEU;HOUSE;1122708517 diff --git a/ConsoleApp3/test_PRIO210.csv b/ConsoleApp3/test_PRIO210.csv new file mode 100644 index 0000000..62ce19a --- /dev/null +++ b/ConsoleApp3/test_PRIO210.csv @@ -0,0 +1,3 @@ +NAME;ZUSATZ;STRASSE;NUMMER;PLZ;STADT;LAND;ADRESS_TYP;REFERENZ +W&W TECH UG;Lukas Winkelmann;Schwedenschanze;70;49808;LINGEN;DEU;HOUSE +Torben Clewinig;;Goslarer Straße;79;70499;Stuttgart;DEU;HOUSE;1122380365