Umgeschrieben auf Sevdesk

This commit is contained in:
2023-07-17 19:10:11 +02:00
parent 47e39bc11f
commit 8c640c426c
32 changed files with 1795 additions and 369 deletions

View File

@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.6.33815.320 VisualStudioVersion = 17.6.33815.320
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp3", "ConsoleApp3\ConsoleApp3.csproj", "{4CB462A0-22BB-4E70-9C0B-203560329AFE}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CardMarketBot", "ConsoleApp3\CardMarketBot.csproj", "{4CB462A0-22BB-4E70-9C0B-203560329AFE}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@@ -8,7 +8,14 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="RestSharp" Version="110.2.0" />
<PackageReference Include="Selenium.WebDriver" Version="4.10.0" /> <PackageReference Include="Selenium.WebDriver" Version="4.10.0" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Update="usedList.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project> </Project>

View File

@@ -3,16 +3,8 @@
using OpenQA.Selenium.Chrome; using OpenQA.Selenium.Chrome;
using OpenQA.Selenium; using OpenQA.Selenium;
using System.Net; using System.Net;
using System.Diagnostics;
/* using ConsoleApp3.Contracts;
*
* referalPage: /de/OnePiece
username: Skywalkerex
userPassword: Magnatpower310!!
/de/OnePiece/PostGetAction/User_Login
curbpJUJmtup1t.Tq0awbHIhIRwhzMW7vrsWxLAJu.pI9X4r
*/
namespace CardmarketBot namespace CardmarketBot
{ {
@@ -20,6 +12,7 @@ namespace CardmarketBot
{ {
private readonly string username; private readonly string username;
private readonly string password; private readonly string password;
private readonly IUsedRepository _usedRepository;
Dictionary<string, Helper.Porto> portoberechnung = new Dictionary<string, Helper.Porto>() Dictionary<string, Helper.Porto> portoberechnung = new Dictionary<string, Helper.Porto>()
{ {
@@ -31,10 +24,11 @@ namespace CardmarketBot
{"3,20 €", Helper.Porto.PRIO270 }, {"3,20 €", Helper.Porto.PRIO270 },
}; };
public CardMarketParser(string username, string password) public CardMarketParser(string username, string password, IUsedRepository repository)
{ {
this.username = username; this.username = username;
this.password = password; this.password = password;
_usedRepository = repository;
} }
public List<Kunde> ParseCardMarket() public List<Kunde> ParseCardMarket()
@@ -65,27 +59,39 @@ namespace CardmarketBot
cookieContainer.Add(new System.Net.Cookie(name, value, c.Path, c.Domain)); cookieContainer.Add(new System.Net.Cookie(name, value, c.Path, c.Domain));
} }
//cd.Navigate().GoToUrl(@"https://www.cardmarket.com/de/OnePiece/Orders/Sales/Paid"); cd.Navigate().GoToUrl(@"https://www.cardmarket.com/de/OnePiece/Orders/Sales/Paid");
cd.Navigate().GoToUrl(@"https://www.cardmarket.com/de/OnePiece/Orders/Sales/Sent"); //cd.Navigate().GoToUrl(@"https://www.cardmarket.com/de/OnePiece/Orders/Sales/Sent");
IWebElement element = cd.FindElement(By.XPath("/html/body/main/section/div[3]/div[3]/div[2]"));
string content = element.Text;
string[] datas = content.Split("\r\n");
List<string> ids = new List<string>(); List<string> ids = new List<string>();
List<Kunde> kunden = new List<Kunde>();
IWebElement element;
try
{
element = cd.FindElement(By.XPath("/html/body/main/section/div[3]/div[3]/div[2]"));
string content = element.Text;
List<string> bereitsbearbeitet = _usedRepository.Query;
string[] datas = content.Split("\r\n");
for (int i = 0; i < datas.Length; i += 7) for (int i = 0; i < datas.Length; i += 7)
{ {
if (bereitsbearbeitet.Find(x => x.Equals(datas[i])) != null) continue;
ids.Add(datas[i]); ids.Add(datas[i]);
} }
List<Kunde> kunden = new List<Kunde>();
int maxCounter = 2;
int counter = 0; }
catch(OpenQA.Selenium.NotFoundException ex)
{
Console.WriteLine("Keine Verkäufe aktuell");
return kunden;
}
foreach (string id in ids) foreach (string id in ids)
{ {
if (counter > maxCounter) break;
Console.WriteLine(id); Console.WriteLine(id);
cd.Navigate().GoToUrl(string.Format(@"https://www.cardmarket.com/de/OnePiece/Orders/{0}", id)); cd.Navigate().GoToUrl(string.Format(@"https://www.cardmarket.com/de/OnePiece/Orders/{0}", id));
element = cd.FindElement(By.XPath("/html/body/main/section/div/div[1]/div/div[3]/div[2]/div[2]/div/div")); element = cd.FindElement(By.XPath("/html/body/main/section/div/div[1]/div/div[3]/div[2]/div[2]/div/div"));
@@ -94,12 +100,22 @@ namespace CardmarketBot
// Bezahldatum // Bezahldatum
element = cd.FindElement(By.XPath("/html/body/main/section/div/div[1]/div/div[2]/div/div[2]/div[2]")); element = cd.FindElement(By.XPath("/html/body/main/section/div/div[1]/div/div[2]/div/div[2]/div[2]"));
kunde.Bezahldatum = element.Text; kunde.Bezahldatum = Helper.ConvertBezahlDatum(element.Text);
//Debugger.Break();
// Versandkosten // Versandkosten
element = cd.FindElement(By.XPath("/html/body/main/section/div/div[1]/div/div[3]/div[1]/div[2]/div/div[3]/span[2]")); element = cd.FindElement(By.XPath("/html/body/main/section/div/div[1]/div/div[3]/div[1]/div[2]/div/div[3]/span[2]"));
kunde.Versandskosten = portoberechnung[element.Text]; Helper.Porto resul;
if(portoberechnung.TryGetValue(element.Text, out resul))
{
kunde.Versandskosten = resul;
}
else
{
kunde.OverrideVersandskosten = element.Text;
Console.WriteLine(@"Achtung bei ID {id} wurde kein Richtige Porto berechnet. Liegt es im Ausland?");
}
//kunde.Versandskosten = portoberechnung[element.Text];
kunde.BestellungID = id; kunde.BestellungID = id;
@@ -111,7 +127,6 @@ namespace CardmarketBot
kunden.Add(kunde); kunden.Add(kunde);
counter++;
Thread.Sleep(TimeSpan.FromSeconds(5)); Thread.Sleep(TimeSpan.FromSeconds(5));
} }
return kunden; return kunden;

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3.Contracts
{
internal interface IUsedRepository
{
List<string> Query { get; }
//void Insert(string key);
void Insert(List<Kunde> kunden);
}
}

View File

@@ -1,4 +0,0 @@
namespace ConsoleApp3.DataContracts
{
public record Employee(string Name, int Number);
}

View File

@@ -2,44 +2,558 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.Serialization;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xml.Linq;
namespace ConsoleApp3.DataContracts namespace ConsoleApp3.DataContracts
{ {
internal class Invoice internal class Invoice
{ {
[JsonProperty("id")] public string Id { get; set; } [JsonProperty(PropertyName ="id")]
//[JsonProperty("organizationId")] public string OrganizationId { get; set; } public int? Id { get; set; }
[JsonProperty("createdDate")] public string CreatedDate { get; set; }
[JsonProperty("updatedDate")] public string UpdatedDate { get; set; } [JsonProperty(PropertyName = "objectName")]
[JsonProperty("version")] public decimal Version { get; set; } public string ObjectName { get; set; }
[JsonProperty("language")] public string Language { get; set; } /// <summary>
[JsonProperty("archived")] public bool Archived { get; set; } ///
[JsonProperty("voucherStatus")] public string VoucherStatus { get; set; } /// </summary>
[JsonProperty("voucherNumber")] public string VoucherNumber { get; set; } /// <value></value>
[JsonProperty("voucherDate")] public string VoucherDate { get; set; } [DataMember(Name = "invoiceNumber", EmitDefaultValue = false)]
[JsonProperty("dueDate")] public string DueDate { get; set; } [JsonProperty(PropertyName = "invoiceNumber")]
[JsonProperty("address")] public InvoiceAddress Address { get; set; } public string InvoiceNumber { get; set; }
[JsonProperty("lineItems")] public List<InvoiceLineItem> LineItems { get; set; }
[JsonProperty("totalPrice")] public TotalPrice TotalPrice { get; set; } /// <summary>
[JsonProperty("taxConditions")] public TaxConditions TaxConditions { get; set; } /// the contact the invoice belongs to
[JsonProperty("shippingConditions")] public ShippingConditions ShippingConditions { get; set; } /// </summary>
/// <value>the contact the invoice belongs to</value>
[DataMember(Name = "contact", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "contact")]
public ModelContact Contact { get; set; }
/// <summary>
/// the date the invoice was created
/// </summary>
/// <value>the date the invoice was created</value>
[DataMember(Name = "create", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "create")]
public DateTime? Create { get; set; }
/// <summary>
/// the date the invoice was last updated
/// </summary>
/// <value>the date the invoice was last updated</value>
[DataMember(Name = "update", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "update")]
public DateTime? Update { get; set; }
/// <summary>
/// the date of the invoice
/// </summary>
/// <value>the date of the invoice</value>
[DataMember(Name = "invoiceDate", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "invoiceDate")]
public DateTime? InvoiceDate { get; set; }
/// <summary>
/// header/subject of the invoice
/// </summary>
/// <value>header/subject of the invoice</value>
[DataMember(Name = "header", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "header")]
public string Header { get; set; }
/// <summary>
/// head text of the invoice
/// </summary>
/// <value>head text of the invoice</value>
[DataMember(Name = "headText", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "headText")]
public string HeadText { get; set; }
/// <summary>
/// foot text of the invoice
/// </summary>
/// <value>foot text of the invoice</value>
[DataMember(Name = "footText", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "footText")]
public string FootText { get; set; }
/// <summary>
/// time left for paying the invoice, use format dd.MM.yyyy or number for number of days left
/// </summary>
/// <value>time left for paying the invoice, use format dd.MM.yyyy or number for number of days left</value>
[DataMember(Name = "timeToPay", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "timeToPay")]
public DateTime? TimeToPay { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
/*[DataMember(Name = "discountTime", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "discountTime")]
public DateTime? DiscountTime { get; set; }
*/
/// <summary>
/// the discount value in '%'
/// </summary>
/// <value>the discount value in '%'</value>
[DataMember(Name = "discount", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "discount")]
public float? Discount { get; set; }
/// <summary>
/// the name in the address, equals the contacts name
/// </summary>
/// <value>the name in the address, equals the contacts name</value>
[DataMember(Name = "addressName", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "addressName")]
public string AddressName { get; set; }
/// <summary>
/// the street in the address, equals the contacts street
/// </summary>
/// <value>the street in the address, equals the contacts street</value>
[DataMember(Name = "addressStreet", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "addressStreet")]
public string AddressStreet { get; set; }
/// <summary>
/// the zip-code in the address, equals the contacts zip
/// </summary>
/// <value>the zip-code in the address, equals the contacts zip</value>
[DataMember(Name = "addressZip", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "addressZip")]
public string AddressZip { get; set; }
/// <summary>
/// the city in the address, equals the contacts city
/// </summary>
/// <value>the city in the address, equals the contacts city</value>
[DataMember(Name = "addressCity", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "addressCity")]
public string AddressCity { get; set; }
/// <summary>
/// the country in the address, equals the contacts country
/// </summary>
/// <value>the country in the address, equals the contacts country</value>
[DataMember(Name = "addressCountry", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "addressCountry")]
public ModelStaticCountry AddressCountry { get; set; }
/// <summary>
/// time left for paying the invoice, use format DD.MM.YYYY or number for number of days left
/// </summary>
/// <value>time left for paying the invoice, use format DD.MM.YYYY or number for number of days left</value>
[DataMember(Name = "payDate", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "payDate")]
public DateTime? PayDate { get; set; }
/// <summary>
/// SevUser who created the invoice
/// </summary>
/// <value>SevUser who created the invoice</value>
[DataMember(Name = "createUser", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "createUser")]
public ModelSevUser CreateUser { get; set; }
/// <summary>
/// sevClient is the unique id every customer has and is used in nearly all operations
/// </summary>
/// <value>sevClient is the unique id every customer has and is used in nearly all operations</value>
[DataMember(Name = "sevClient", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sevClient")]
public Object SevClient { get; set; }
/// <summary>
/// delivery date of the goods from the invoice, please use dd.MM.yyyy
/// </summary>
/// <value>delivery date of the goods from the invoice, please use dd.MM.yyyy</value>
[DataMember(Name = "deliveryDate", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "deliveryDate")]
public DateTime? DeliveryDate { get; set; }
/// <summary>
/// status of the invoice
/// </summary>
/// <value>status of the invoice</value>
[DataMember(Name = "status", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "status")]
public EInvoiceStatus Status { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
/*[DataMember(Name = "smallSettlement", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "smallSettlement")]
public bool? SmallSettlement { get; set; }
*/
/// <summary>
/// SevUser who created the invoice and therefore is the contact person
/// </summary>
/// <value>SevUser who created the invoice and therefore is the contact person</value>
[DataMember(Name = "contactPerson", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "contactPerson")]
public ModelSevUser ContactPerson { get; set; } = new ModelSevUser()
{
};
/// <summary>
/// tax rate used when adding a value added tax regulation
/// </summary>
/// <value>tax rate used when adding a value added tax regulation</value>
[DataMember(Name = "taxRate", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "taxRate")]
public float? TaxRate { get; set; }
/// <summary>
/// additional text when adding a value added tax regulation
/// </summary>
/// <value>additional text when adding a value added tax regulation</value>
[DataMember(Name = "taxText", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "taxText")]
public string TaxText { get; set; }
/// <summary>
/// dunning level of the invoice
/// </summary>
/// <value>dunning level of the invoice</value>
[DataMember(Name = "dunningLevel", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "dunningLevel")]
public int? DunningLevel { get; set; }
/// <summary>
/// name of the contacts address
/// </summary>
/// <value>name of the contacts address</value>
[DataMember(Name = "addressParentName", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "addressParentName")]
public string AddressParentName { get; set; }
/// <summary>
/// a reference to the contacts address
/// </summary>
/// <value>a reference to the contacts address</value>
[DataMember(Name = "addressContactRef", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "addressContactRef")]
public ModelContactAddress AddressContactRef { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "taxType", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "taxType")]
public string TaxType { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "paymentMethod", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "paymentMethod")]
public ModelPaymentMethod PaymentMethod { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "costCentre", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "costCentre")]
public ModelCostCentre CostCentre { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "sendDate", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sendDate")]
public DateTime? SendDate { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "origin", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "origin")]
public Object Origin { get; set; }
/// <summary>
/// type of the invoice
/// </summary>
/// <value>type of the invoice</value>
[DataMember(Name = "invoiceType", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "invoiceType")]
public string InvoiceType { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "accountIntervall", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "accountIntervall")]
public int? AccountIntervall { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "accountLastInvoice", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "accountLastInvoice")]
public DateTime? AccountLastInvoice { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "accountNextInvoice", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "accountNextInvoice")]
public DateTime? AccountNextInvoice { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "reminderTotal", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "reminderTotal")]
public float? ReminderTotal { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "reminderDebit", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "reminderDebit")]
public float? ReminderDebit { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "reminderDeadline", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "reminderDeadline")]
public DateTime? ReminderDeadline { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "reminderCharge", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "reminderCharge")]
public float? ReminderCharge { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "addressParentName2", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "addressParentName2")]
public string AddressParentName2 { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "addressName2", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "addressName2")]
public string AddressName2 { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "taxSet", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "taxSet")]
public ModelTaxSet TaxSet { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "addressGender", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "addressGender")]
public string AddressGender { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "accountEndDate", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "accountEndDate")]
public DateTime? AccountEndDate { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "address", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "address")]
public string Address { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "currency", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "currency")]
public string Currency { get; set; } = "EUR";
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "sumNet", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sumNet")]
public float? SumNet { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "sumTax", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sumTax")]
public float? SumTax { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "sumGross", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sumGross")]
public float? SumGross { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "sumDiscounts", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sumDiscounts")]
public float? SumDiscounts { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "sumNetForeignCurrency", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sumNetForeignCurrency")]
public float? SumNetForeignCurrency { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "sumTaxForeignCurrency", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sumTaxForeignCurrency")]
public float? SumTaxForeignCurrency { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "sumGrossForeignCurrency", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sumGrossForeignCurrency")]
public float? SumGrossForeignCurrency { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "sumDiscountsForeignCurrency", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sumDiscountsForeignCurrency")]
public float? SumDiscountsForeignCurrency { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "sumNetAccounting", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sumNetAccounting")]
public float? SumNetAccounting { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "sumTaxAccounting", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sumTaxAccounting")]
public float? SumTaxAccounting { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "sumGrossAccounting", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sumGrossAccounting")]
public float? SumGrossAccounting { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "entryType", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "entryType")]
public ModelEntryType EntryType { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "costumerInternalNote", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "costumerInternalNote")]
public string CostumerInternalNote { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "showNet", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "showNet")]
public int ShowNet { get; set; } = 0;
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "enshrined", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "enshrined")]
public bool? Enshrined { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "sendType", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sendType")]
public string SendType { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "deliveryDateUntil", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "deliveryDateUntil")]
public DateTime? DeliveryDateUntil { get; set; }
[DataMember(Name = "mapAll", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "mapAll")]
public bool MapAll { get; set; } = true;
} }
public class ShippingConditions enum EInvoiceStatus
{ {
[JsonProperty("shippingDate")] public string shippingDate { get; set; } = "2023-04-22T00:00:00.000+02:00"; DEACTIVE = 50,
[JsonProperty("shippingType")] public string shippingType { get; set; } = "delivery"; DRAFT = 100,
OPEN = 200,
PAYED = 1000
} }
public class TaxConditions
{
[JsonProperty("taxType")] public string TaxType { get; set; } = "net";
}
public class TotalPrice
{
[JsonProperty("currency")] public string Currency { get; set; } = "EUR";
}
} }

View File

@@ -1,26 +0,0 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3.DataContracts
{
internal class InvoiceAddress
{
[JsonProperty("contactId")] public string ContactId { get; set; }
[JsonProperty("name")] public string Name { get; set; }
[JsonProperty("supplement")] public string Supplement { get; set; }
[JsonProperty("street")] public string Street { get; set; }
[JsonProperty("city")] public string City { get; set; }
[JsonProperty("zip")] public string Zip { get; set; }
[JsonProperty("countryCode")] public string CountryCode { get; set; }
}
}

View File

@@ -1,33 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3.DataContracts
{
public record InvoiceItem
{
internal InvoiceItem(string invoiceId, string customer, DateTime date, Employee employee, int account,
string description, decimal amountHours, decimal price)
{
InvoiceId = invoiceId;
Customer = customer;
Date = date;
Employee = employee;
Account = account;
Description = description;
AmountHours = amountHours;
Price = price;
}
public string InvoiceId { get; }
public string Customer { get; }
public DateTime Date { get; }
public Employee Employee { get; }
public int Account { get; }
public string Description { get; }
public decimal AmountHours { get; }
public decimal Price { get; }
}
}

View File

@@ -1,21 +0,0 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3.DataContracts
{
internal class InvoiceLineItem
{
[JsonProperty("type")] public string Type { get; set; }
[JsonProperty("name")] public string Name { get; set; }
[JsonProperty("description")] public string Description { get; set; }
[JsonProperty("quantity")] public decimal Quantity { get; set; }
[JsonProperty("unitName")] public string UnitName { get; set; }
[JsonProperty("unitPrice")] public InvoiceLineUnitPrice UnitPrice { get; set; }
[JsonProperty("discountPercentage")] public decimal DiscountPercentage { get; set; }
[JsonProperty("lineItemAmount")] public decimal LineItemAmount { get; set; }
}
}

View File

@@ -1,15 +0,0 @@
using Newtonsoft.Json;
namespace ConsoleApp3.DataContracts
{
public class InvoiceLineUnitPrice
{
[JsonProperty("currency")] public string Currency { get; set; }
[JsonProperty("netAmount")] public decimal NetAmount { get; set; }
[JsonProperty("grossAmount")] public decimal GrossAmount { get; set; }
[JsonProperty("taxRatePercentage")] public decimal TaxRatePercentage { get; set; }
}
}

View File

@@ -0,0 +1,67 @@
using Newtonsoft.Json;
using OpenQA.Selenium.DevTools.V112.DOM;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3.DataContracts
{
[DataContract]
internal class InvoicePosSave
{
[DataMember(Name = "id", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "id")]
public int? Id { get; set; }
[DataMember(Name = "objectName", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "objectName")]
public string ObjectName { get; set; } = "InvoicePos";
[DataMember(Name = "mapAll", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "mapAll")]
public bool MapAll { get; set; } = true;
[DataMember(Name = "quantity", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "quantity")]
public uint Quantity { get; set; }
[DataMember(Name = "price", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "price")]
public decimal Price { get; set; }
[DataMember(Name = "name", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name")]
public string Name { get; set; } = "";
[DataMember(Name = "unity", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "unity")]
public ModelUnity Unity { get; set; } = new ModelUnity();
[DataMember(Name = "positionNumber", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "positionNumber")]
public uint PositionNumber { get; set; }
[DataMember(Name = "text", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "text")]
public string? Text { get; set; }
[DataMember(Name = "discount", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "discount")]
public int Discount { get; set; } = 0;
[DataMember(Name = "taxRate", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "taxRate")]
public uint TaxRate { get; set; } = 19;
[DataMember(Name = "priceGross", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "priceGross")]
public decimal PriceGross { get; set; }
[DataMember(Name = "priceTax", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "priceTax")]
public int PriceTax { get; set; } = 19;
}
}

View File

@@ -0,0 +1,12 @@
// See https://aka.ms/new-console-template for more information
using Newtonsoft.Json;
namespace ConsoleApp3.DataContracts
{
internal class Invoices
{
[JsonProperty("objects")] public Invoice[] Invoice { get; set; }
}
}

View File

@@ -0,0 +1,110 @@
using Newtonsoft.Json;
using System.Runtime.Serialization;
namespace ConsoleApp3.DataContracts
{
[DataContract]
public class ModelCategory
{
[DataMember(Name = "create", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "create")]
public DateTime? Create { get; set; }
/// <summary>
/// date the category was last updated
/// </summary>
/// <value>date the category was last updated</value>
[DataMember(Name = "update", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "update")]
public DateTime? Update { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "parent", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "parent")]
public ModelCategory Parent { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "name", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "objectType", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "objectType")]
public string ObjectType { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "priority", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "priority")]
public int? Priority { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "code", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "code")]
public string Code { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "color", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "color")]
public string Color { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "sevClient", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sevClient")]
public Object SevClient { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "postingAccount", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "postingAccount")]
public string PostingAccount { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "type", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "type")]
public string Type { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "translationCode", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "translationCode")]
public string TranslationCode { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "entryType", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "entryType")]
public ModelEntryType EntryType { get; set; }
}
}

View File

@@ -0,0 +1,232 @@
using Newtonsoft.Json;
using System.Runtime.Serialization;
namespace ConsoleApp3.DataContracts
{
[DataContract]
public class ModelContact
{
[DataMember(Name = "id", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "id")]
public int Id { get; set; }
[DataMember(Name = "objectName", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "objectName")]
public string ObjectName { get; set; } = "";
/// <summary>
/// the contact address
/// </summary>
/// <value>the contact address</value>
[DataMember(Name = "address", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "address")]
public ModelContactAddress Address { get; set; }
/// <summary>
/// the creation date of the contact
/// </summary>
/// <value>the creation date of the contact</value>
[DataMember(Name = "create", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "create")]
public DateTime? Create { get; set; }
/// <summary>
/// date, the contact was last updated
/// </summary>
/// <value>date, the contact was last updated</value>
[DataMember(Name = "update", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "update")]
public DateTime? Update { get; set; }
/// <summary>
/// name of the contact
/// </summary>
/// <value>name of the contact</value>
[DataMember(Name = "name", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// status of the contact
/// </summary>
/// <value>status of the contact</value>
[DataMember(Name = "status", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "status")]
public int? Status { get; set; }
/// <summary>
/// customer number of the contact
/// </summary>
/// <value>customer number of the contact</value>
[DataMember(Name = "customerNumber", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "customerNumber")]
public int? CustomerNumber { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "parent", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "parent")]
public ModelContact Parent { get; set; }
/// <summary>
/// surname of the contact
/// </summary>
/// <value>surname of the contact</value>
[DataMember(Name = "surename", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "surename")]
public string Surename { get; set; }
/// <summary>
/// family name of the contact
/// </summary>
/// <value>family name of the contact</value>
[DataMember(Name = "familyname", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "familyname")]
public string Familyname { get; set; }
/// <summary>
/// title of the contact
/// </summary>
/// <value>title of the contact</value>
[DataMember(Name = "titel", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "titel")]
public string Titel { get; set; }
/// <summary>
/// category of the contact
/// </summary>
/// <value>category of the contact</value>
[DataMember(Name = "category", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "category")]
public ModelCategory Category { get; set; }
/// <summary>
/// description of the contact
/// </summary>
/// <value>description of the contact</value>
[DataMember(Name = "description", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "description")]
public string Description { get; set; }
/// <summary>
/// any academic title of the contact
/// </summary>
/// <value>any academic title of the contact</value>
[DataMember(Name = "academicTitle", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "academicTitle")]
public string AcademicTitle { get; set; }
/// <summary>
/// gender of the contact
/// </summary>
/// <value>gender of the contact</value>
[DataMember(Name = "gender", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "gender")]
public string Gender { get; set; }
/// <summary>
/// sevClient is the unique id every customer has and is used in nearly all operations
/// </summary>
/// <value>sevClient is the unique id every customer has and is used in nearly all operations</value>
[DataMember(Name = "sevClient", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sevClient")]
public Object SevClient { get; set; }
/// <summary>
/// second name of the contact
/// </summary>
/// <value>second name of the contact</value>
[DataMember(Name = "name2", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name2")]
public string Name2 { get; set; }
/// <summary>
/// birthday of the contact
/// </summary>
/// <value>birthday of the contact</value>
[DataMember(Name = "birthday", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "birthday")]
public DateTime? Birthday { get; set; }
/// <summary>
/// vat number of the contact
/// </summary>
/// <value>vat number of the contact</value>
[DataMember(Name = "vatNumber", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "vatNumber")]
public string VatNumber { get; set; }
/// <summary>
/// bank account of the contact
/// </summary>
/// <value>bank account of the contact</value>
[DataMember(Name = "bankAccount", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "bankAccount")]
public string BankAccount { get; set; }
/// <summary>
/// bank number of the contact
/// </summary>
/// <value>bank number of the contact</value>
[DataMember(Name = "bankNumber", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "bankNumber")]
public string BankNumber { get; set; }
/// <summary>
/// desired payment method of the customer
/// </summary>
/// <value>desired payment method of the customer</value>
[DataMember(Name = "paymentMethod", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "paymentMethod")]
public ModelPaymentMethod PaymentMethod { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "entryType", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "entryType")]
public ModelEntryType EntryType { get; set; }
/// <summary>
/// default cashback time of the contact
/// </summary>
/// <value>default cashback time of the contact</value>
[DataMember(Name = "defaultCashbackTime", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "defaultCashbackTime")]
public int? DefaultCashbackTime { get; set; }
/// <summary>
/// default cashback percentage of the contact
/// </summary>
/// <value>default cashback percentage of the contact</value>
[DataMember(Name = "defaultCashbackPercent", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "defaultCashbackPercent")]
public int? DefaultCashbackPercent { get; set; }
/// <summary>
/// default time to pay of the contact
/// </summary>
/// <value>default time to pay of the contact</value>
[DataMember(Name = "defaultTimeToPay", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "defaultTimeToPay")]
public int? DefaultTimeToPay { get; set; }
/// <summary>
/// tax number of the contact
/// </summary>
/// <value>tax number of the contact</value>
[DataMember(Name = "taxNumber", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "taxNumber")]
public string TaxNumber { get; set; }
/// <summary>
/// tax office of the contact
/// </summary>
/// <value>tax office of the contact</value>
[DataMember(Name = "taxOffice", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "taxOffice")]
public string TaxOffice { get; set; }
}
}

View File

@@ -0,0 +1,114 @@
using Newtonsoft.Json;
using System.Runtime.Serialization;
namespace ConsoleApp3.DataContracts
{
[DataContract]
public class ModelContactAddress
{
/// <summary>
/// the creation date of the contact
/// </summary>
/// <value>the creation date of the contact</value>
[DataMember(Name = "create", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "create")]
public DateTime? Create { get; set; }
/// <summary>
/// date, the contact was last updated
/// </summary>
/// <value>date, the contact was last updated</value>
[DataMember(Name = "update", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "update")]
public DateTime? Update { get; set; }
/// <summary>
/// the contact the address belongs to
/// </summary>
/// <value>the contact the address belongs to</value>
[DataMember(Name = "contact", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "contact")]
public ModelContact Contact { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "street", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "street")]
public string Street { get; set; }
/// <summary>
/// zip of the city/village
/// </summary>
/// <value>zip of the city/village</value>
[DataMember(Name = "zip", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "zip")]
public string Zip { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "city", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "city")]
public string City { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "country", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "country")]
public ModelStaticCountry Country { get; set; }
/// <summary>
/// category of the address
/// </summary>
/// <value>category of the address</value>
[DataMember(Name = "category", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "category")]
public ModelCategory Category { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "name", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// sevClient is the unique id every customer has and is used in nearly all operations
/// </summary>
/// <value>sevClient is the unique id every customer has and is used in nearly all operations</value>
[DataMember(Name = "sevClient", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sevClient")]
public Object SevClient { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "name2", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name2")]
public string Name2 { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "name3", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name3")]
public string Name3 { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "name4", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name4")]
public string Name4 { get; set; }
}
}

View File

@@ -0,0 +1,62 @@
using Newtonsoft.Json;
using System.Runtime.Serialization;
using System.Xml.Linq;
namespace ConsoleApp3.DataContracts
{
[DataContract]
public class ModelCostCentre
{
[DataMember(Name = "create", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "create")]
public DateTime? Create { get; set; }
/// <summary>
/// date the cost centre was last updated
/// </summary>
/// <value>date the cost centre was last updated</value>
[DataMember(Name = "update", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "update")]
public DateTime? Update { get; set; }
/// <summary>
/// sevClient is the unique id every customer has and is used in nearly all operations
/// </summary>
/// <value>sevClient is the unique id every customer has and is used in nearly all operations</value>
[DataMember(Name = "sevClient", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sevClient")]
public Object SevClient { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "number", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "number")]
public string Number { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "name", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "color", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "color")]
public string Color { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "postingAccount", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "postingAccount")]
public string PostingAccount { get; set; }
}
}

View File

@@ -0,0 +1,37 @@
using Newtonsoft.Json;
using System.Runtime.Serialization;
namespace ConsoleApp3.DataContracts
{
[DataContract]
public class ModelEntryType
{
[DataMember(Name = "create", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "create")]
public DateTime? Create { get; set; }
/// <summary>
/// date the entry type was last updated
/// </summary>
/// <value>date the entry type was last updated</value>
[DataMember(Name = "update", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "update")]
public DateTime? Update { get; set; }
/// <summary>
/// sevClient is the unique id every customer has and is used in nearly all operations
/// </summary>
/// <value>sevClient is the unique id every customer has and is used in nearly all operations</value>
[DataMember(Name = "sevClient", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sevClient")]
public Object SevClient { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "name", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,50 @@
using Newtonsoft.Json;
using System.Runtime.Serialization;
namespace ConsoleApp3.DataContracts
{
[DataContract]
public class ModelPaymentMethod
{
/// <summary>
/// date the payment method was created
/// </summary>
/// <value>date the payment method was created</value>
[DataMember(Name = "create", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "create")]
public DateTime? Create { get; set; }
/// <summary>
/// date the payment method was last updated
/// </summary>
/// <value>date the payment method was last updated</value>
[DataMember(Name = "update", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "update")]
public DateTime? Update { get; set; }
/// <summary>
/// sevClient is the unique id every customer has and is used in nearly all operations
/// </summary>
/// <value>sevClient is the unique id every customer has and is used in nearly all operations</value>
[DataMember(Name = "sevClient", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sevClient")]
public Object SevClient { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "name", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "text", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "text")]
public string Text { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3.DataContracts
{
[DataContract]
internal class ModelRechnung
{
[DataMember(Name = "invoice", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "invoice")]
public Invoice Invoice { get; set; }
[DataMember(Name = "invoicePosSave", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "invoicePosSave")]
public InvoicePosSave[] InvoicePosSaves { get; set; }
}
}

View File

@@ -0,0 +1,26 @@
using Newtonsoft.Json;
using System.Runtime.Serialization;
using System.Xml.Linq;
namespace ConsoleApp3.DataContracts
{
[DataContract]
public class ModelSevUser
{
[DataMember(Name = "id", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "id")]
public int Id { get; set; } = 995002;
[DataMember(Name = "objectName", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "objectName")]
public string objectName { get; set; } = "SevUser";
/// <summary>
/// This information is not visible for you
/// </summary>
/// <value>This information is not visible for you</value>
[DataMember(Name = "hidden", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "hidden")]
public string Hidden { get; set; }
}
}

View File

@@ -0,0 +1,66 @@
using Newtonsoft.Json;
using System.Runtime.Serialization;
namespace ConsoleApp3.DataContracts
{
[DataContract]
public class ModelStaticCountry
{
[DataMember(Name = "id", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "id")]
public int Id { get; set; }
[DataMember(Name = "objectName", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "objectName")]
public string ObjectName { get; set; } = "StaticCountry";
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "code", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "code")]
public string Code { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "name", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "nameEn", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "nameEn")]
public string NameEn { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "translationCode", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "translationCode")]
public string TranslationCode { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "locale", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "locale")]
public string Locale { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "priority", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "priority")]
public int? Priority { get; set; }
}
}

View File

@@ -0,0 +1,123 @@
using Newtonsoft.Json;
using System.Runtime.Serialization;
using System.Xml.Linq;
namespace ConsoleApp3.DataContracts
{
[DataContract]
public class ModelTaxSet
{
/// <summary>
/// date the tax set was created
/// </summary>
/// <value>date the tax set was created</value>
[DataMember(Name = "create", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "create")]
public DateTime? Create { get; set; }
/// <summary>
/// date the tax set was last updated
/// </summary>
/// <value>date the tax set was last updated</value>
[DataMember(Name = "update", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "update")]
public DateTime? Update { get; set; }
/// <summary>
/// sevClient is the unique id every customer has and is used in nearly all operations
/// </summary>
/// <value>sevClient is the unique id every customer has and is used in nearly all operations</value>
[DataMember(Name = "sevClient", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sevClient")]
public Object SevClient { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "text", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "text")]
public string Text { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "taxRate", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "taxRate")]
public float? TaxRate { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "code", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "code")]
public float? Code { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "displayText", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "displayText")]
public string DisplayText { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "vatReportFieldNet", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "vatReportFieldNet")]
public string VatReportFieldNet { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "vatReportFieldTax", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "vatReportFieldTax")]
public string VatReportFieldTax { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "accountingExportVatField", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "accountingExportVatField")]
public string AccountingExportVatField { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "showInvoice", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "showInvoice")]
public bool? ShowInvoice { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "showDebitVoucher", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "showDebitVoucher")]
public bool? ShowDebitVoucher { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "showCreditVoucher", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "showCreditVoucher")]
public bool? ShowCreditVoucher { get; set; }
/// <summary>
///
/// </summary>
/// <value></value>
[DataMember(Name = "onlyForVatDec", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "onlyForVatDec")]
public bool? OnlyForVatDec { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
using Newtonsoft.Json;
using System.Runtime.Serialization;
namespace ConsoleApp3.DataContracts
{
[DataContract]
public class ModelUnity
{
[DataMember(Name = "id", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "id")]
public int Id { get; set; } = 1;
[DataMember(Name = "objectName", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "objectName")]
public string ObjectName { get; set; } = "Unity";
}
}

View File

@@ -61,6 +61,16 @@ static class Helper
} }
return result; return result;
} }
internal static DateTime ConvertBezahlDatum(string text)
{
//21.06.202308:39
int uhrzeitsignature = text.IndexOf(':');
string datum = text.Substring(0, uhrzeitsignature - 2);
string uhrzeit = text.Substring(uhrzeitsignature-2,text.Length - uhrzeitsignature + 2);
return DateTime.Parse(string.Format("{0} {1}", datum, uhrzeit));
}
} }

View File

@@ -44,63 +44,85 @@ namespace CardmarketBot
this.kunden = kunden; this.kunden = kunden;
} }
public List<Invoice> GetInvoices() public List<ModelRechnung> GetInvoices()
{ {
List<Invoice> result = new List<Invoice>(); List<ModelRechnung> result = new List<ModelRechnung>();
foreach (Kunde kunde in kunden) foreach (Kunde kunde in kunden)
{ {
Invoice invoice = new Invoice(); ModelRechnung temp = new ModelRechnung();
invoice.Language = "de"; Invoice rechnung = new Invoice();
invoice.VoucherDate = DateTimeConverter(kunde.Bezahldatum); // "2023-02-22T00:00:00.000+01:00"; // rechnung.Id = null;
invoice.Address = new InvoiceAddress() rechnung.ObjectName = "Invoice";
//rechnung.InvoiceNumber = string.Format("RE-{0}", await GetNextInvoiceNumber()); => Should be done by services.
rechnung.InvoiceDate = kunde.Bezahldatum;
rechnung.Header = string.Format("Verkauf #{0}",kunde.BestellungID);
rechnung.HeadText = "Sehr geehrte Damen und Herren," +
"Wir stellen Ihnen für Ihre bestellung folgende Rechnung." +
"Bitte Beachte, dass der Lieferdatum die Bestelldatum entspricht.";
rechnung.FootText = "Ihre Rechnung ist bereits über Cardmarket beglichen worden.";
rechnung.TimeToPay = new DateTime(0);
rechnung.Discount = 0;
rechnung.Address = string.Format("{0}\n{1} {2}\n{3} {4}", kunde.Name, kunde.Strasse, kunde.Hausnummer, kunde.Plz, kunde.Ort); //"Damian Wessels\nDät Haartje 27A\n26683 Saterland";
rechnung.AddressCountry = new ModelStaticCountry()
{ {
Name = kunde.Name, Id = 1
Street = kunde.Strasse + " " + kunde.Hausnummer,
City = kunde.Ort,
Zip = kunde.Plz,
CountryCode = "DE"
}; };
invoice.LineItems = new List<InvoiceLineItem>(); //rechnung.PayDate = new DateTime(2019, 08, 24, 14, 15, 22);
foreach (var artikel in kunde.Artikels) rechnung.DeliveryDate = kunde.Bezahldatum;
{ rechnung.Status = EInvoiceStatus.OPEN;
invoice.LineItems.Add(new InvoiceLineItem() rechnung.TaxRate = 19;
{ rechnung.TaxText = "Umsatzsteuer 19%";
Type = "custom", rechnung.TaxType = "default";
Name = artikel.ENGName + "(" + artikel.Source + ")", rechnung.SendDate = kunde.Bezahldatum;
Quantity = artikel.Amount, rechnung.InvoiceType = "RE";
UnitName = "Stück",
UnitPrice = new InvoiceLineUnitPrice()
{
Currency = "EUR",
GrossAmount = Convert.ToDecimal(artikel.Preis),
TaxRatePercentage = 19
}
});
}
invoice.LineItems.Add(new InvoiceLineItem()
{
Type = "custom",
Name = "Versandkosten",
Quantity = 1,
UnitName = "Stück",
UnitPrice = new InvoiceLineUnitPrice()
{
Currency = "EUR",
GrossAmount = PortoPreis[kunde.Versandskosten],
TaxRatePercentage = 19
}
});
invoice.TotalPrice = new TotalPrice() { Currency = "EUR" }; rechnung.Contact = new ModelContact()
invoice.TaxConditions = new TaxConditions() { TaxType = "gross" };
invoice.ShippingConditions = new ShippingConditions()
{ {
shippingDate = "2023-04-22T00:00:00.000+02:00", Id = 64055231,
shippingType = "delivery" ObjectName = "Contact"
}; };
result.Add(invoice);
temp.Invoice = rechnung;
temp.InvoicePosSaves = new InvoicePosSave[kunde.Artikels.Count + 1];
for(int i = 0; i < kunde.Artikels.Count; i++)
{
temp.InvoicePosSaves[i] = new InvoicePosSave()
{
Id = null,
MapAll = true,
Quantity = (uint)kunde.Artikels[i].Amount,
Name = string.Format("{0} ({1})", kunde.Artikels[i].ENGName, kunde.Artikels[i].Source),
PositionNumber = 0,
TaxRate = 19,
Price = Convert.ToDecimal(kunde.Artikels[i].Preis),
Discount = 0,
PriceGross = Convert.ToDecimal(kunde.Artikels[i].Preis),
PriceTax = 19
};
}
// Versandskosten
temp.InvoicePosSaves[temp.InvoicePosSaves.Length - 1] = new InvoicePosSave()
{
Id = null,
MapAll = true,
Quantity = 1,
Price = PortoPreis[kunde.Versandskosten],
Name = "Versandskosten",
PositionNumber = 0,
Discount = 0,
TaxRate = 19,
PriceGross = PortoPreis[kunde.Versandskosten],
PriceTax = 19
};
result.Add(temp);
} }
return result; return result;
} }
} }
} }

View File

@@ -1,46 +0,0 @@
// See https://aka.ms/new-console-template for more information
using System.Net;
using System.Text;
using ConsoleApp3.DataContracts;
using Newtonsoft.Json;
/*
*
* referalPage: /de/OnePiece
username: Skywalkerex
userPassword: Magnatpower310!!
/de/OnePiece/PostGetAction/User_Login
curbpJUJmtup1t.Tq0awbHIhIRwhzMW7vrsWxLAJu.pI9X4r
*/
namespace CardmarketBot
{
class InvoiceService
{
private readonly WebRequest request;
public InvoiceService(string apiKey)
{
request = WebRequest.Create("https://api.lexoffice.io/v1/invoices");
request.Method = "POST";
request.Headers.Add("Authorization", string.Format("Bearer {0}",apiKey));
request.Headers.Add("Accept", "application/json");
}
public void InsertInvoice(Invoice invoice)
{
var json = JsonConvert.SerializeObject(invoice);
byte[] bytearray = Encoding.UTF8.GetBytes(json);
request.ContentType = "application/json";
using var reqStream = request.GetRequestStream();
reqStream.Write(bytearray, 0, bytearray.Length);
using var response = request.GetResponse();
Console.WriteLine(((HttpWebResponse)response).StatusDescription);
reqStream.Close();
}
}
}

View File

@@ -4,6 +4,7 @@ class Kunde
{ {
string bestellungID = ""; string bestellungID = "";
Helper.Porto versandskosten; Helper.Porto versandskosten;
string? overrideVersandskosten;
string name; string name;
string strasse; string strasse;
string hausnummer; string hausnummer;
@@ -11,7 +12,7 @@ class Kunde
string ort; string ort;
string land; string land;
List<Artikel> artikels = new List<Artikel>(); List<Artikel> artikels = new List<Artikel>();
public string Bezahldatum { get; set; } = ""; public DateTime Bezahldatum { get; set; }
public string Name { get => name; set => name = value; } public string Name { get => name; set => name = value; }
public string Strasse { get => strasse; set => strasse = value; } public string Strasse { get => strasse; set => strasse = value; }
@@ -20,8 +21,24 @@ class Kunde
public string Land { get => land; set => land = value; } public string Land { get => land; set => land = value; }
public string BestellungID { get => bestellungID; set => bestellungID = value; } public string BestellungID { get => bestellungID; set => bestellungID = value; }
public Helper.Porto Versandskosten { get => versandskosten; set => versandskosten = value; } public Helper.Porto Versandskosten { get => versandskosten; set => versandskosten = value; }
public string Hausnummer { get => hausnummer; set => hausnummer = value; } public string Hausnummer { get => hausnummer; set => hausnummer = value; }
internal List<Artikel> Artikels { get => artikels; set => artikels = value; } internal List<Artikel> Artikels { get => artikels; set => artikels = value; }
public string? OverrideVersandskosten {
get => overrideVersandskosten;
set
{
string[] parts = value.Split(' ');
if(parts.Length < 2)
{
overrideVersandskosten = value;
}
else
{
overrideVersandskosten = parts[0];
}
}
}
public Kunde(string Name, string Strasse, string Hausnummer, string PLZ, string Ort, string Land) public Kunde(string Name, string Strasse, string Hausnummer, string PLZ, string Ort, string Land)
{ {
@@ -33,25 +50,3 @@ class Kunde
land = Land; land = Land;
} }
} }
/*
HttpWebRequest hwr = (HttpWebRequest)HttpWebRequest.Create(@"https://www.cardmarket.com/de/OnePiece/Orders/Sales/Paid");
hwr.CookieContainer = cookieContainer;
hwr.Method = "GET";
hwr.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36";
WebResponse wr = hwr.GetResponse();
string s = new StreamReader(wr.GetResponseStream()).ReadToEnd();
Console.WriteLine(s);
string GetHashKey(string line)
{
var x = line.IndexOf("__cmtkn");
var d = line.Substring(x + 16);
var m = d.IndexOf("\"");
var a = d.Substring(0, m);
return a;
}
*/

View File

@@ -1,84 +0,0 @@
// See https://aka.ms/new-console-template for more information
using System.Text;
using ConsoleApp3.DataContracts;
using Newtonsoft.Json;
/*
*
* referalPage: /de/OnePiece
username: Skywalkerex
userPassword: Magnatpower310!!
/de/OnePiece/PostGetAction/User_Login
curbpJUJmtup1t.Tq0awbHIhIRwhzMW7vrsWxLAJu.pI9X4r
*/
namespace CardmarketBot
{
class LexofficeService
{
private readonly HttpClient _client;
private readonly Random _random = new();
public LexofficeService()
{
_client = new HttpClient
{
DefaultRequestHeaders =
{
{ "Authorization", "Bearer curbpJUJmtup1t.Tq0awbHIhIRwhzMW7vrsWxLAJu.pI9X4r" },
{ "Accept", "application/json" }
}
};
}
public void test()
{
var d = GetInvoiceAsync("d47936c1-71c6-4e22-b394-3630d7354ebf");
var m = d.Result;
Console.WriteLine(m);
}
public void m(Invoice invoice)
{
}
public async void WriteInvoice(Invoice invoice)
{
var jsonSerializerSettings = new JsonSerializerSettings
{
MissingMemberHandling = MissingMemberHandling.Ignore
};
var s = JsonConvert.SerializeObject(invoice, jsonSerializerSettings);
var content = new StringContent(invoice.ToString(), Encoding.UTF8, "application/json");
var uri = LexofficeApiAddressesBuilder.CreateInvoice();
var result = await _client.PostAsync(uri, content);
Console.WriteLine(result.Content);
}
private async Task<Invoice> GetInvoiceAsync(string id)
{
var uri = LexofficeApiAddressesBuilder.InvoiceUri(id);
var response = await _client.GetAsync(uri).ConfigureAwait(false);
response.EnsureSuccessStatusCode();
var contents = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
var jsonSerializerSettings = new JsonSerializerSettings
{
MissingMemberHandling = MissingMemberHandling.Ignore
};
return JsonConvert.DeserializeObject<Invoice>(contents, jsonSerializerSettings);
}
}
}

View File

@@ -1,8 +1,6 @@
// See https://aka.ms/new-console-template for more information using ConsoleApp3.DataContracts;
using ConsoleApp3;
using System.Diagnostics; using ConsoleApp3.Contracts;
using static System.Collections.Specialized.BitVector32;
using ConsoleApp3.DataContracts;
namespace CardmarketBot namespace CardmarketBot
{ {
@@ -10,26 +8,38 @@ namespace CardmarketBot
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
IUsedRepository usedRepository = new UsedRepository();
// Kunden aus Cardmarket erstellen // Kunden aus Cardmarket erstellen
List<Kunde> kunden = new List<Kunde>(); List<Kunde> kunden = new List<Kunde>();
CardMarketParser cardMarketParser = new CardMarketParser("Skywalkerex", "Magnatpower310!!"); CardMarketParser cardMarketParser = new CardMarketParser("More-Tcg", "Magnatpower310!!", usedRepository);
kunden = cardMarketParser.ParseCardMarket(); kunden = cardMarketParser.ParseCardMarket();
// Rechnungen generieren // Rechnungen generieren
List<Invoice> rechnungen = new List<Invoice>(); List<ModelRechnung> rechnungen = new List<ModelRechnung>();
InvoiceParser invoiceParser = new InvoiceParser(kunden); InvoiceParser invoiceParser = new InvoiceParser(kunden);
rechnungen = invoiceParser.GetInvoices(); rechnungen = invoiceParser.GetInvoices();
foreach (var item in rechnungen) foreach (var item in rechnungen)
{ {
InvoiceService invoiceService = new InvoiceService("curbpJUJmtup1t.Tq0awbHIhIRwhzMW7vrsWxLAJu.pI9X4r"); SevdeskService sevdeskService = new SevdeskService("7251554968610b78ca865b2b774b4134");
invoiceService.InsertInvoice(item); sevdeskService.Create(item);
} }
// Post CSV Erstellen // Post CSV Erstellen
DeutschePost deutschePost = new DeutschePost(kunden); DeutschePost deutschePost = new DeutschePost(kunden);
deutschePost.GenerateCSV(); deutschePost.GenerateCSV();
usedRepository.Insert(kunden);
Console.WriteLine("Fertig"); Console.WriteLine("Fertig");
Console.ReadLine(); Console.ReadLine();
} }

View File

@@ -0,0 +1,101 @@
using System.Runtime.Serialization;
using System.Text;
using ConsoleApp3.DataContracts;
using Newtonsoft.Json;
namespace CardmarketBot
{
class SevdeskService
{
private readonly HttpClient _client;
private readonly Random _random = new();
public SevdeskService(string key)
{
_client = new HttpClient
{
DefaultRequestHeaders =
{
{ "Authorization", "7251554968610b78ca865b2b774b4134" },
{ "Accept", "application/json" }
}
};
}
public async void Create(ModelRechnung rechnung)
{
rechnung.Invoice.InvoiceNumber = string.Format("RE-{0}", await GetNextInvoiceNumber());
await WriteInv(rechnung);
}
private async Task<bool> WriteInv(ModelRechnung invoice)
{
var uri = "https://my.sevdesk.de/api/v1/Invoice/Factory/saveInvoice";
var t = JsonConvert.SerializeObject(invoice);
var content = new StringContent(JsonConvert.SerializeObject(invoice),Encoding.UTF8, "application/json");
var resp = await _client.PostAsync(uri, content);
//Console.WriteLine(resp.EnsureSuccessStatusCode());
var contents = await resp.Content.ReadAsStringAsync();
return true;
}
private async Task<Invoices> GetInvoiceAsync(string id)
{
//var uri = LexofficeApiAddressesBuilder.InvoiceUri(id);
var uri = "https://my.sevdesk.de/api/v1/Invoice/56501411/getPositions";
var response = await _client.GetAsync(uri).ConfigureAwait(false);
response.EnsureSuccessStatusCode();
var contents = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
var jsonSerializerSettings = new JsonSerializerSettings
{
MissingMemberHandling = MissingMemberHandling.Ignore
};
return JsonConvert.DeserializeObject<Invoices>(contents, jsonSerializerSettings);
}
private async Task<string> GetNextInvoiceNumber()
{
var uri = "https://my.sevdesk.de/api/v1/SevSequence/Factory/getByType?objectType=Invoice&type=RE";
var response = await _client.GetAsync(uri).ConfigureAwait(false);
response.EnsureSuccessStatusCode();
var contents = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
var jsonSerializerSettings = new JsonSerializerSettings
{
MissingMemberHandling = MissingMemberHandling.Ignore
};
var ob = JsonConvert.DeserializeObject<RNumbers>(contents, jsonSerializerSettings);
return ob.ConfigRechnungsnummer.NextNumber;
}
}
[DataContract]
class RNumbers
{
[JsonProperty("objects")] public ConfigRechnungnummer ConfigRechnungsnummer { get; set; }
}
[DataContract]
class ConfigRechnungnummer
{
[DataMember(Name = "format", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "format")]
public string Format { get; set; } = "";
[DataMember(Name = "nextSequence", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "nextSequence")]
public string NextNumber { get; set; } = "";
}
}

View File

@@ -0,0 +1,27 @@
using ConsoleApp3.Contracts;
namespace ConsoleApp3
{
internal class UsedRepository : IUsedRepository
{
public List<string> Query => File
.ReadLines("usedList.csv")
.Select(l => l.Split(','))
.Select(p => new String(p[0]))
.ToList();
public void insert(string key)
{
key += Environment.NewLine;
File.AppendAllText("usedList.csv", key);
}
public void Insert(List<Kunde> list)
{
foreach(var kunde in list)
{
insert(kunde.BestellungID);
}
}
}
}

1
ConsoleApp3/usedList.csv Normal file
View File

@@ -0,0 +1 @@