Compare commits

23 Commits

Author SHA1 Message Date
Damian Wessels
c78d734d14 Funktionierend 2024-12-10 19:14:29 +01:00
Damian Wessels
b566b0a201 Alte Quellcode bestand wiederhergestellt 2024-08-28 17:15:53 +02:00
6c216ca189 absturz mit X behoben 2023-09-09 09:47:48 +02:00
b6d36d7bf5 Cardmarket artikelparser umgeschrieben 2023-09-06 15:19:11 +02:00
839080392b Programm erweitert
über bestellnummer angabe prüft der Bot die Bestellung
2023-08-27 10:12:58 +02:00
b0e27caf9f fehlerhafte url war hinterlegtr. Diente zur Debug 2023-08-18 15:41:24 +02:00
81ed7ae8d1 Chrome driver geupdatet.
Vorbereitet für Tests um den Artikelparser zuverlässiger zu erstellen
2023-08-18 09:45:11 +02:00
ff8649b314 Slowenien hinzugefügt 2023-08-16 23:05:19 +02:00
744ce5a687 Kroatien hinzugefügt 2023-08-14 17:15:54 +02:00
dd7bd99595 Spanien hinzugefügt 2023-08-09 12:25:51 +02:00
Lukas Winkelmann
e6611f6c18 Batchdatei geht nicht mehr ins Projektornder 2023-08-08 19:54:16 +02:00
e48b6e9fae CSV Dateien ignoriert 2023-08-08 12:12:15 +02:00
34e5fb588d CSV Dateien sollen nicht ins Git 2023-08-08 12:09:21 +02:00
2de8b4adde Renaming
start.bat added
2023-08-08 12:05:06 +02:00
ee6eb210b7 Nullverweise warnings bereinigt 2023-08-08 11:58:09 +02:00
4af2bae8cd CSS selektor von login angepasst 2023-08-07 20:11:56 +02:00
966514148d Fehler in Ländercode behoben 2023-08-02 19:49:36 +02:00
1e115bddee public list fertig gestellt 2023-08-02 19:24:48 +02:00
2f2524a5c4 public list fertig gestellt 2023-08-01 14:20:27 +02:00
f4a0af33b0 WIP public list 2023-07-25 09:24:18 +02:00
e44385473f Adresse parser aktualisiert
Es werden nun alle Bestellungen CSV dateien erstellt
ledig nicht alle Rechnungen werden angelegt.
2023-07-23 13:52:37 +02:00
324f01df5e Funktionstüchtig 2023-07-22 20:32:47 +02:00
19e6a43847 Remove old dependency 2023-07-17 19:12:19 +02:00
39 changed files with 811 additions and 316 deletions

5
.gitignore vendored
View File

@@ -1,3 +1,4 @@
/.vs/ /.vs/
/ConsoleApp3/bin/ */bin/
/ConsoleApp3/obj/ */obj/
*.csv

View File

@@ -1,6 +1,6 @@
// See https://aka.ms/new-console-template for more information // See https://aka.ms/new-console-template for more information
internal class Artikel public class Artikel
{ {
public int Amount { get; set; } public int Amount { get; set; }
public string GERName { get; set; } = ""; public string GERName { get; set; } = "";

View File

@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Selenium.WebDriver" Version="4.22.0" />
<PackageReference Include="Selenium.WebDriver.GeckoDriver" Version="0.35.0" />
</ItemGroup>
</Project>

View File

@@ -1,10 +1,12 @@
// See https://aka.ms/new-console-template for more information // See https://aka.ms/new-console-template for more information
using OpenQA.Selenium.Chrome; using OpenQA.Selenium.Chrome;
//using SeleniumUndetectedChromeDriver;
using OpenQA.Selenium; using OpenQA.Selenium;
using System.Net; using System.Net;
using System.Diagnostics; using System.Diagnostics;
using ConsoleApp3.Contracts; using ConsoleApp3.Contracts;
using static System.Collections.Specialized.BitVector32;
namespace CardmarketBot namespace CardmarketBot
{ {
@@ -12,7 +14,6 @@ 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>()
{ {
@@ -24,31 +25,62 @@ namespace CardmarketBot
{"3,20 €", Helper.Porto.PRIO270 }, {"3,20 €", Helper.Porto.PRIO270 },
}; };
public CardMarketParser(string username, string password, IUsedRepository repository) public CardMarketParser(string username, string password)
{ {
this.username = username; this.username = username;
this.password = password; this.password = password;
_usedRepository = repository;
} }
public List<Kunde> ParseCardMarket() public List<Kunde> ParseCardMarket(string forceid = "")
{ {
//var driver = UndetectedChromeDriver.Create(driverExecutablePath: await new ChromeDriverInstaller().Auto());
ChromeOptions options = new ChromeOptions(); ChromeOptions options = new ChromeOptions();
options.AddArgument("start-maximized"); options.AddArgument("start-maximized");
//options.AddArgument("incognito");
options.AddArgument("disable-popup-blocking");
options.AddArgument("force-device-scale-factor=0.8");
//options.AddArgument("lang=en");
IWebDriver cd = new ChromeDriver(options); IWebDriver cd = new ChromeDriver(options);
//driver.GoToUrl("https://www.cardmarket.com/de/OnePiece");
cd.Url = @"https://www.cardmarket.com/de/OnePiece"; cd.Url = @"https://www.cardmarket.com/de/OnePiece";
cd.Navigate(); cd.Navigate();
cd.FindElement(By.CssSelector("#CookiesConsent > div > div > form > button")).Click(); Thread.Sleep(2000);
Thread.Sleep(10);
IWebElement? element;
/*
bool cloudfire = true;
if (cloudfire)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Scheint als würde Cloudfire aktiviert sein.");
Console.WriteLine("Bitte bestätige und komme zurück und klicke die buchstabe c und Enter");
Console.ReadLine();
}
*/
cd.FindElement(By.CssSelector("#CookiesConsent > div > div > form > div > button")).Click();
Thread.Sleep(2000);
cd.FindElement(By.Name("username")).Click(); cd.FindElement(By.Name("username")).Click();
cd.FindElement(By.Name("username")).SendKeys(username); cd.FindElement(By.Name("username")).SendKeys(username);
cd.FindElement(By.Name("userPassword")).Click(); cd.FindElement(By.Name("userPassword")).Click();
cd.FindElement(By.Name("userPassword")).SendKeys(password); cd.FindElement(By.Name("userPassword")).SendKeys(password);
cd.FindElement(By.CssSelector("#header-login > input.btn.AB-login-btn.btn-outline-primary.btn-sm")).Click(); cd.FindElement(By.CssSelector("#header-login > input.btn.btn-outline-primary.btn-sm")).Click();
Thread.Sleep(6000);
CookieContainer cookieContainer = new CookieContainer(); CookieContainer cookieContainer = new CookieContainer();
@@ -59,40 +91,77 @@ 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/Sent");
List<string> ids = new List<string>(); List<string> ids = new List<string>();
List<Kunde> kunden = new List<Kunde>(); List<Kunde> kunden = new List<Kunde>();
IWebElement element; //IWebElement? element;
/*cloudfire = true;
try try
{ {
element = cd.FindElement(By.XPath("/html/body/main/section/div[3]/div[3]/div[2]")); element = cd.FindElement(By.XPath("/html/body/div[1]/div/div[1]/div"));
string content = element.Text;
List<string> bereitsbearbeitet = _usedRepository.Query;
string[] datas = content.Split("\r\n");
for (int i = 0; i < datas.Length; i += 7)
{
if (bereitsbearbeitet.Find(x => x.Equals(datas[i])) != null) continue;
ids.Add(datas[i]);
}
// //[@id="challenge-body-text"]
} }
catch(OpenQA.Selenium.NotFoundException ex) catch (NoSuchElementException)
{ {
Console.WriteLine("Keine Verkäufe aktuell"); cloudfire = false;
return kunden; }
Console.WriteLine(cloudfire);
if(cloudfire )
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Scheint als würde Cloudfire aktiviert sein.");
Console.WriteLine("Bitte bestätige und komme zurück und klicke die buchstabe c und Enter");
Console.ReadLine();
}
*/
if (forceid != "")
{
string[] mid = forceid.Split(',');
if (mid.Length < 0)
{
ids.Add(forceid);
}
else
{
foreach(string kid in mid)
{
ids.Add(kid);
}
}
}
else
{
cd.Navigate().GoToUrl(@"https://www.cardmarket.com/de/OnePiece/Orders/Sales/Paid");
try
{
var verkaufstable = cd.FindElements(By.XPath("/html/body/main/section/div[3]/div[4]/div[2]/*"));
foreach(var karte in verkaufstable)
{
var content = karte.Text.Split("\r\n");
// 10 Stellen ist die ID
ids.Add(content[1]);
}
}
catch (OpenQA.Selenium.NotFoundException)
{
Console.WriteLine("Keine Verkäufe aktuell");
return kunden;
}
} }
foreach (string id in ids) foreach (string id in ids)
{ {
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"));
@@ -113,7 +182,7 @@ namespace CardmarketBot
else else
{ {
kunde.OverrideVersandskosten = element.Text; kunde.OverrideVersandskosten = element.Text;
Console.WriteLine(@"Achtung bei ID {id} wurde kein Richtige Porto berechnet. Liegt es im Ausland?"); Console.WriteLine($"Achtung bei ID {id} wurde kein Richtige Porto berechnet. Liegt es im Ausland?");
} }
//kunde.Versandskosten = portoberechnung[element.Text]; //kunde.Versandskosten = portoberechnung[element.Text];
kunde.BestellungID = id; kunde.BestellungID = id;
@@ -121,14 +190,19 @@ namespace CardmarketBot
// Artikeln // Artikeln
element = cd.FindElement(By.XPath("/html/body/main/section/div/div[1]/div/div[5]/table/tbody")); var k = cd.FindElements(By.XPath("/html/body/main/section/div/div[1]/div/*/table"));
//Debugger.Break();
element = k[0];
//element = cd.FindElement(By.XPath("/html/body/main/section/div/div[1]/div/div[6]/table/tbody"));
//element = cd.FindElement(By.XPath("/html/body/main/section/div/div[1]/div/div[5]/table/tbody"));
string artikeln = element.Text; string artikeln = element.Text;
kunde.Artikels = Helper.ParseArtikeln(element.Text); kunde.Artikels = Helper.ParseArtikeln(element.Text);
kunden.Add(kunde); kunden.Add(kunde);
Thread.Sleep(TimeSpan.FromSeconds(5)); Thread.Sleep(TimeSpan.FromSeconds(3));
} }
cd.Quit();
return kunden; return kunden;
} }
} }

View File

@@ -0,0 +1,38 @@
using ConsoleApp3.Contracts;
namespace CardmarketBot
{
internal class CheckSevDeskInternalList : ICheckSevDesk
{
private const string FILENAME = "usedList.csv";
private List<string> Query => (from l in File.ReadAllLines("usedList.csv")
select l.Split(',') into p
select new string(p[0])).ToList();
public CheckSevDeskInternalList()
{
if (!File.Exists("usedList.csv"))
{
File.Create("usedList.csv");
}
}
public bool AlreadyKnown(string verkaufsnummer)
{
if (Query.Find((string x) => x.Equals(verkaufsnummer)) != null)
{
return false;
}
return true;
}
public bool Write(string verkaufsnummer)
{
verkaufsnummer += Environment.NewLine;
File.AppendAllText("usedList.csv", verkaufsnummer);
return true;
}
}
}

View File

@@ -0,0 +1,118 @@
using ConsoleApp3.Contracts;
using OpenQA.Selenium.DevTools;
using OpenQA.Selenium.Support.UI;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace CardMarketBot
{
internal class CheckSevDeskPublicList : ICheckSevDesk
{
private static readonly object _lock = new object();
private static bool _closed;
enum EResult
{
FAILED,
AVAIBLE,
OK,
WRITTEN
}
private static void Write(TcpClient client, string str)
{
try
{
//SocketShutdown reason = SocketShutdown.Send;
lock (_lock)
{
BinaryWriter writer = new BinaryWriter(client.GetStream());
writer.Write(str);
if (_closed)
{
//reason = SocketShutdown.Both;
}
}
//client.Client.Shutdown(reason);
}
catch (IOException e)
{
Console.WriteLine($"IOException writing to socket: {e.Message}");
}
}
private static EResult Read(TcpClient client)
{
try
{
//while(true)
//{
try
{
if (!client.Connected)
{
lock (_lock)
{
_closed = true;
//break;
}
}
BinaryReader reader = new BinaryReader(client.GetStream());
string res = reader.ReadString();
if (res.Contains("OK"))
return EResult.OK;
return EResult.FAILED;
}
catch (EndOfStreamException)
{
lock (_lock)
{
_closed = true;
}
return EResult.FAILED;
}
//client.Client.Shutdown(SocketShutdown.Receive);
//}
}
catch (IOException e)
{
Console.WriteLine(e.Message);
return EResult.FAILED;
}
}
public bool AlreadyKnown(string verkaufsnummer)
{
try
{
TcpClient client = new TcpClient("huskyteufel.ddnss.de", 4000);
Write(client, string.Format("#TEST#{0}", verkaufsnummer));
EResult result = Read(client);
client.Client.Shutdown(SocketShutdown.Both);
client.Close();
return result == EResult.OK;
}
catch(SocketException ex)
{
throw new SocketException();
}
}
public bool Write(string verkaufsnummer)
{
TcpClient client = new TcpClient("huskyteufel.ddnss.de", 4000);
Write(client, string.Format("#WRITE#{0}", verkaufsnummer));
EResult result = Read(client);
client.Client.Shutdown(SocketShutdown.Both);
client.Close();
return result == EResult.OK;
}
}
}

View File

@@ -0,0 +1,8 @@
namespace ConsoleApp3.Contracts
{
internal interface ICheckSevDesk
{
bool AlreadyKnown(string verkaufsnummer);
bool Write(string verkaufsnummer);
}
}

View File

@@ -15,14 +15,14 @@ namespace ConsoleApp3.DataContracts
public int? Id { get; set; } public int? Id { get; set; }
[JsonProperty(PropertyName = "objectName")] [JsonProperty(PropertyName = "objectName")]
public string ObjectName { get; set; } public string ObjectName { get; set; } = "";
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <value></value> /// <value></value>
[DataMember(Name = "invoiceNumber", EmitDefaultValue = false)] [DataMember(Name = "invoiceNumber", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "invoiceNumber")] [JsonProperty(PropertyName = "invoiceNumber")]
public string InvoiceNumber { get; set; } public string InvoiceNumber { get; set; } = "";
/// <summary> /// <summary>
/// the contact the invoice belongs to /// the contact the invoice belongs to
@@ -30,7 +30,7 @@ namespace ConsoleApp3.DataContracts
/// <value>the contact the invoice belongs to</value> /// <value>the contact the invoice belongs to</value>
[DataMember(Name = "contact", EmitDefaultValue = false)] [DataMember(Name = "contact", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "contact")] [JsonProperty(PropertyName = "contact")]
public ModelContact Contact { get; set; } public ModelContact? Contact { get; set; }
/// <summary> /// <summary>
/// the date the invoice was created /// the date the invoice was created
@@ -62,7 +62,7 @@ namespace ConsoleApp3.DataContracts
/// <value>header/subject of the invoice</value> /// <value>header/subject of the invoice</value>
[DataMember(Name = "header", EmitDefaultValue = false)] [DataMember(Name = "header", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "header")] [JsonProperty(PropertyName = "header")]
public string Header { get; set; } public string Header { get; set; } = "";
/// <summary> /// <summary>
/// head text of the invoice /// head text of the invoice
@@ -70,7 +70,7 @@ namespace ConsoleApp3.DataContracts
/// <value>head text of the invoice</value> /// <value>head text of the invoice</value>
[DataMember(Name = "headText", EmitDefaultValue = false)] [DataMember(Name = "headText", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "headText")] [JsonProperty(PropertyName = "headText")]
public string HeadText { get; set; } public string HeadText { get; set; } = "";
/// <summary> /// <summary>
/// foot text of the invoice /// foot text of the invoice
@@ -78,7 +78,7 @@ namespace ConsoleApp3.DataContracts
/// <value>foot text of the invoice</value> /// <value>foot text of the invoice</value>
[DataMember(Name = "footText", EmitDefaultValue = false)] [DataMember(Name = "footText", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "footText")] [JsonProperty(PropertyName = "footText")]
public string FootText { get; set; } public string FootText { get; set; } = "";
/// <summary> /// <summary>
/// time left for paying the invoice, use format dd.MM.yyyy or number for number of days left /// time left for paying the invoice, use format dd.MM.yyyy or number for number of days left
@@ -86,7 +86,7 @@ namespace ConsoleApp3.DataContracts
/// <value>time left for paying the invoice, use format dd.MM.yyyy or number for number of days left</value> /// <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)] [DataMember(Name = "timeToPay", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "timeToPay")] [JsonProperty(PropertyName = "timeToPay")]
public DateTime? TimeToPay { get; set; } public int? TimeToPay { get; set; }
/// <summary> /// <summary>
/// ///
@@ -110,7 +110,7 @@ namespace ConsoleApp3.DataContracts
/// <value>the name in the address, equals the contacts name</value> /// <value>the name in the address, equals the contacts name</value>
[DataMember(Name = "addressName", EmitDefaultValue = false)] [DataMember(Name = "addressName", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "addressName")] [JsonProperty(PropertyName = "addressName")]
public string AddressName { get; set; } public string AddressName { get; set; } = "";
/// <summary> /// <summary>
/// the street in the address, equals the contacts street /// the street in the address, equals the contacts street
@@ -118,7 +118,7 @@ namespace ConsoleApp3.DataContracts
/// <value>the street in the address, equals the contacts street</value> /// <value>the street in the address, equals the contacts street</value>
[DataMember(Name = "addressStreet", EmitDefaultValue = false)] [DataMember(Name = "addressStreet", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "addressStreet")] [JsonProperty(PropertyName = "addressStreet")]
public string AddressStreet { get; set; } public string AddressStreet { get; set; } = "";
/// <summary> /// <summary>
/// the zip-code in the address, equals the contacts zip /// the zip-code in the address, equals the contacts zip
@@ -126,7 +126,7 @@ namespace ConsoleApp3.DataContracts
/// <value>the zip-code in the address, equals the contacts zip</value> /// <value>the zip-code in the address, equals the contacts zip</value>
[DataMember(Name = "addressZip", EmitDefaultValue = false)] [DataMember(Name = "addressZip", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "addressZip")] [JsonProperty(PropertyName = "addressZip")]
public string AddressZip { get; set; } public string AddressZip { get; set; } = "";
/// <summary> /// <summary>
/// the city in the address, equals the contacts city /// the city in the address, equals the contacts city
@@ -134,7 +134,7 @@ namespace ConsoleApp3.DataContracts
/// <value>the city in the address, equals the contacts city</value> /// <value>the city in the address, equals the contacts city</value>
[DataMember(Name = "addressCity", EmitDefaultValue = false)] [DataMember(Name = "addressCity", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "addressCity")] [JsonProperty(PropertyName = "addressCity")]
public string AddressCity { get; set; } public string AddressCity { get; set; } = "";
/// <summary> /// <summary>
/// the country in the address, equals the contacts country /// the country in the address, equals the contacts country
@@ -142,7 +142,7 @@ namespace ConsoleApp3.DataContracts
/// <value>the country in the address, equals the contacts country</value> /// <value>the country in the address, equals the contacts country</value>
[DataMember(Name = "addressCountry", EmitDefaultValue = false)] [DataMember(Name = "addressCountry", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "addressCountry")] [JsonProperty(PropertyName = "addressCountry")]
public ModelStaticCountry AddressCountry { get; set; } public ModelStaticCountry? AddressCountry { get; set; }
/// <summary> /// <summary>
/// time left for paying the invoice, use format DD.MM.YYYY or number for number of days left /// 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
/// <value>SevUser who created the invoice</value> /// <value>SevUser who created the invoice</value>
[DataMember(Name = "createUser", EmitDefaultValue = false)] [DataMember(Name = "createUser", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "createUser")] [JsonProperty(PropertyName = "createUser")]
public ModelSevUser CreateUser { get; set; } public ModelSevUser? CreateUser { get; set; }
/// <summary> /// <summary>
/// sevClient is the unique id every customer has and is used in nearly all operations /// sevClient is the unique id every customer has and is used in nearly all operations
@@ -166,7 +166,7 @@ namespace ConsoleApp3.DataContracts
/// <value>sevClient is the unique id every customer has and is used in nearly all operations</value> /// <value>sevClient is the unique id every customer has and is used in nearly all operations</value>
[DataMember(Name = "sevClient", EmitDefaultValue = false)] [DataMember(Name = "sevClient", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sevClient")] [JsonProperty(PropertyName = "sevClient")]
public Object SevClient { get; set; } public Object? SevClient { get; set; }
/// <summary> /// <summary>
/// delivery date of the goods from the invoice, please use dd.MM.yyyy /// delivery date of the goods from the invoice, please use dd.MM.yyyy
@@ -182,7 +182,7 @@ namespace ConsoleApp3.DataContracts
/// <value>status of the invoice</value> /// <value>status of the invoice</value>
[DataMember(Name = "status", EmitDefaultValue = false)] [DataMember(Name = "status", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "status")] [JsonProperty(PropertyName = "status")]
public EInvoiceStatus Status { get; set; } public EInvoiceStatus? Status { get; set; }
/// <summary> /// <summary>
/// ///
@@ -198,7 +198,7 @@ namespace ConsoleApp3.DataContracts
/// <value>SevUser who created the invoice and therefore is the contact person</value> /// <value>SevUser who created the invoice and therefore is the contact person</value>
[DataMember(Name = "contactPerson", EmitDefaultValue = false)] [DataMember(Name = "contactPerson", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "contactPerson")] [JsonProperty(PropertyName = "contactPerson")]
public ModelSevUser ContactPerson { get; set; } = new ModelSevUser() public ModelSevUser? ContactPerson { get; set; } = new ModelSevUser()
{ {
}; };
@@ -217,7 +217,7 @@ namespace ConsoleApp3.DataContracts
/// <value>additional text when adding a value added tax regulation</value> /// <value>additional text when adding a value added tax regulation</value>
[DataMember(Name = "taxText", EmitDefaultValue = false)] [DataMember(Name = "taxText", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "taxText")] [JsonProperty(PropertyName = "taxText")]
public string TaxText { get; set; } public string TaxText { get; set; } = "";
/// <summary> /// <summary>
/// dunning level of the invoice /// dunning level of the invoice
@@ -233,7 +233,7 @@ namespace ConsoleApp3.DataContracts
/// <value>name of the contacts address</value> /// <value>name of the contacts address</value>
[DataMember(Name = "addressParentName", EmitDefaultValue = false)] [DataMember(Name = "addressParentName", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "addressParentName")] [JsonProperty(PropertyName = "addressParentName")]
public string AddressParentName { get; set; } public string AddressParentName { get; set; } = "";
/// <summary> /// <summary>
/// a reference to the contacts address /// a reference to the contacts address
@@ -241,7 +241,7 @@ namespace ConsoleApp3.DataContracts
/// <value>a reference to the contacts address</value> /// <value>a reference to the contacts address</value>
[DataMember(Name = "addressContactRef", EmitDefaultValue = false)] [DataMember(Name = "addressContactRef", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "addressContactRef")] [JsonProperty(PropertyName = "addressContactRef")]
public ModelContactAddress AddressContactRef { get; set; } public ModelContactAddress? AddressContactRef { get; set; }
/// <summary> /// <summary>
/// ///
@@ -249,7 +249,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "taxType", EmitDefaultValue = false)] [DataMember(Name = "taxType", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "taxType")] [JsonProperty(PropertyName = "taxType")]
public string TaxType { get; set; } public string TaxType { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -257,7 +257,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "paymentMethod", EmitDefaultValue = false)] [DataMember(Name = "paymentMethod", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "paymentMethod")] [JsonProperty(PropertyName = "paymentMethod")]
public ModelPaymentMethod PaymentMethod { get; set; } public ModelPaymentMethod? PaymentMethod { get; set; }
/// <summary> /// <summary>
/// ///
@@ -265,7 +265,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "costCentre", EmitDefaultValue = false)] [DataMember(Name = "costCentre", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "costCentre")] [JsonProperty(PropertyName = "costCentre")]
public ModelCostCentre CostCentre { get; set; } public ModelCostCentre? CostCentre { get; set; }
/// <summary> /// <summary>
/// ///
@@ -281,7 +281,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "origin", EmitDefaultValue = false)] [DataMember(Name = "origin", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "origin")] [JsonProperty(PropertyName = "origin")]
public Object Origin { get; set; } public Object? Origin { get; set; }
/// <summary> /// <summary>
/// type of the invoice /// type of the invoice
@@ -289,7 +289,7 @@ namespace ConsoleApp3.DataContracts
/// <value>type of the invoice</value> /// <value>type of the invoice</value>
[DataMember(Name = "invoiceType", EmitDefaultValue = false)] [DataMember(Name = "invoiceType", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "invoiceType")] [JsonProperty(PropertyName = "invoiceType")]
public string InvoiceType { get; set; } public string InvoiceType { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -353,7 +353,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "addressParentName2", EmitDefaultValue = false)] [DataMember(Name = "addressParentName2", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "addressParentName2")] [JsonProperty(PropertyName = "addressParentName2")]
public string AddressParentName2 { get; set; } public string AddressParentName2 { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -361,7 +361,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "addressName2", EmitDefaultValue = false)] [DataMember(Name = "addressName2", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "addressName2")] [JsonProperty(PropertyName = "addressName2")]
public string AddressName2 { get; set; } public string AddressName2 { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -369,7 +369,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "taxSet", EmitDefaultValue = false)] [DataMember(Name = "taxSet", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "taxSet")] [JsonProperty(PropertyName = "taxSet")]
public ModelTaxSet TaxSet { get; set; } public ModelTaxSet? TaxSet { get; set; }
/// <summary> /// <summary>
/// ///
@@ -377,7 +377,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "addressGender", EmitDefaultValue = false)] [DataMember(Name = "addressGender", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "addressGender")] [JsonProperty(PropertyName = "addressGender")]
public string AddressGender { get; set; } public string AddressGender { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -393,7 +393,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "address", EmitDefaultValue = false)] [DataMember(Name = "address", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "address")] [JsonProperty(PropertyName = "address")]
public string Address { get; set; } public string Address { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -497,7 +497,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "entryType", EmitDefaultValue = false)] [DataMember(Name = "entryType", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "entryType")] [JsonProperty(PropertyName = "entryType")]
public ModelEntryType EntryType { get; set; } public ModelEntryType? EntryType { get; set; }
/// <summary> /// <summary>
/// ///
@@ -505,7 +505,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "costumerInternalNote", EmitDefaultValue = false)] [DataMember(Name = "costumerInternalNote", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "costumerInternalNote")] [JsonProperty(PropertyName = "costumerInternalNote")]
public string CostumerInternalNote { get; set; } public string CostumerInternalNote { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -530,7 +530,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "sendType", EmitDefaultValue = false)] [DataMember(Name = "sendType", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sendType")] [JsonProperty(PropertyName = "sendType")]
public string SendType { get; set; } public string SendType { get; set; } = "";
/// <summary> /// <summary>
/// ///

View File

@@ -1,11 +1,5 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using OpenQA.Selenium.DevTools.V112.DOM;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3.DataContracts namespace ConsoleApp3.DataContracts
{ {

View File

@@ -6,7 +6,7 @@ namespace ConsoleApp3.DataContracts
{ {
internal class Invoices internal class Invoices
{ {
[JsonProperty("objects")] public Invoice[] Invoice { get; set; } [JsonProperty("objects")] public Invoice[]? Invoice { get; set; }
} }
} }

View File

@@ -24,7 +24,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "parent", EmitDefaultValue = false)] [DataMember(Name = "parent", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "parent")] [JsonProperty(PropertyName = "parent")]
public ModelCategory Parent { get; set; } public ModelCategory? Parent { get; set; }
/// <summary> /// <summary>
/// ///
@@ -32,7 +32,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "name", EmitDefaultValue = false)] [DataMember(Name = "name", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name")] [JsonProperty(PropertyName = "name")]
public string Name { get; set; } public string Name { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -40,7 +40,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "objectType", EmitDefaultValue = false)] [DataMember(Name = "objectType", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "objectType")] [JsonProperty(PropertyName = "objectType")]
public string ObjectType { get; set; } public string ObjectType { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -56,7 +56,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "code", EmitDefaultValue = false)] [DataMember(Name = "code", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "code")] [JsonProperty(PropertyName = "code")]
public string Code { get; set; } public string Code { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -64,7 +64,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "color", EmitDefaultValue = false)] [DataMember(Name = "color", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "color")] [JsonProperty(PropertyName = "color")]
public string Color { get; set; } public string Color { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -72,7 +72,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "sevClient", EmitDefaultValue = false)] [DataMember(Name = "sevClient", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sevClient")] [JsonProperty(PropertyName = "sevClient")]
public Object SevClient { get; set; } public Object? SevClient { get; set; }
/// <summary> /// <summary>
/// ///
@@ -80,7 +80,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "postingAccount", EmitDefaultValue = false)] [DataMember(Name = "postingAccount", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "postingAccount")] [JsonProperty(PropertyName = "postingAccount")]
public string PostingAccount { get; set; } public string PostingAccount { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -88,7 +88,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "type", EmitDefaultValue = false)] [DataMember(Name = "type", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "type")] [JsonProperty(PropertyName = "type")]
public string Type { get; set; } public string Type { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -96,7 +96,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "translationCode", EmitDefaultValue = false)] [DataMember(Name = "translationCode", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "translationCode")] [JsonProperty(PropertyName = "translationCode")]
public string TranslationCode { get; set; } public string TranslationCode { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -104,7 +104,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "entryType", EmitDefaultValue = false)] [DataMember(Name = "entryType", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "entryType")] [JsonProperty(PropertyName = "entryType")]
public ModelEntryType EntryType { get; set; } public ModelEntryType? EntryType { get; set; }
} }
} }

View File

@@ -19,7 +19,7 @@ namespace ConsoleApp3.DataContracts
/// <value>the contact address</value> /// <value>the contact address</value>
[DataMember(Name = "address", EmitDefaultValue = false)] [DataMember(Name = "address", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "address")] [JsonProperty(PropertyName = "address")]
public ModelContactAddress Address { get; set; } public ModelContactAddress? Address { get; set; }
/// <summary> /// <summary>
/// the creation date of the contact /// the creation date of the contact
@@ -43,7 +43,7 @@ namespace ConsoleApp3.DataContracts
/// <value>name of the contact</value> /// <value>name of the contact</value>
[DataMember(Name = "name", EmitDefaultValue = false)] [DataMember(Name = "name", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name")] [JsonProperty(PropertyName = "name")]
public string Name { get; set; } public string Name { get; set; } = "";
/// <summary> /// <summary>
/// status of the contact /// status of the contact
@@ -67,7 +67,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "parent", EmitDefaultValue = false)] [DataMember(Name = "parent", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "parent")] [JsonProperty(PropertyName = "parent")]
public ModelContact Parent { get; set; } public ModelContact? Parent { get; set; }
/// <summary> /// <summary>
/// surname of the contact /// surname of the contact
@@ -75,7 +75,7 @@ namespace ConsoleApp3.DataContracts
/// <value>surname of the contact</value> /// <value>surname of the contact</value>
[DataMember(Name = "surename", EmitDefaultValue = false)] [DataMember(Name = "surename", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "surename")] [JsonProperty(PropertyName = "surename")]
public string Surename { get; set; } public string Surename { get; set; } = "";
/// <summary> /// <summary>
/// family name of the contact /// family name of the contact
@@ -83,7 +83,7 @@ namespace ConsoleApp3.DataContracts
/// <value>family name of the contact</value> /// <value>family name of the contact</value>
[DataMember(Name = "familyname", EmitDefaultValue = false)] [DataMember(Name = "familyname", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "familyname")] [JsonProperty(PropertyName = "familyname")]
public string Familyname { get; set; } public string Familyname { get; set; } = "";
/// <summary> /// <summary>
/// title of the contact /// title of the contact
@@ -91,7 +91,7 @@ namespace ConsoleApp3.DataContracts
/// <value>title of the contact</value> /// <value>title of the contact</value>
[DataMember(Name = "titel", EmitDefaultValue = false)] [DataMember(Name = "titel", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "titel")] [JsonProperty(PropertyName = "titel")]
public string Titel { get; set; } public string Titel { get; set; } = "";
/// <summary> /// <summary>
/// category of the contact /// category of the contact
@@ -99,7 +99,7 @@ namespace ConsoleApp3.DataContracts
/// <value>category of the contact</value> /// <value>category of the contact</value>
[DataMember(Name = "category", EmitDefaultValue = false)] [DataMember(Name = "category", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "category")] [JsonProperty(PropertyName = "category")]
public ModelCategory Category { get; set; } public ModelCategory? Category { get; set; }
/// <summary> /// <summary>
/// description of the contact /// description of the contact
@@ -107,7 +107,7 @@ namespace ConsoleApp3.DataContracts
/// <value>description of the contact</value> /// <value>description of the contact</value>
[DataMember(Name = "description", EmitDefaultValue = false)] [DataMember(Name = "description", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "description")] [JsonProperty(PropertyName = "description")]
public string Description { get; set; } public string Description { get; set; } = "";
/// <summary> /// <summary>
/// any academic title of the contact /// any academic title of the contact
@@ -115,7 +115,7 @@ namespace ConsoleApp3.DataContracts
/// <value>any academic title of the contact</value> /// <value>any academic title of the contact</value>
[DataMember(Name = "academicTitle", EmitDefaultValue = false)] [DataMember(Name = "academicTitle", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "academicTitle")] [JsonProperty(PropertyName = "academicTitle")]
public string AcademicTitle { get; set; } public string AcademicTitle { get; set; } = "";
/// <summary> /// <summary>
/// gender of the contact /// gender of the contact
@@ -123,7 +123,7 @@ namespace ConsoleApp3.DataContracts
/// <value>gender of the contact</value> /// <value>gender of the contact</value>
[DataMember(Name = "gender", EmitDefaultValue = false)] [DataMember(Name = "gender", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "gender")] [JsonProperty(PropertyName = "gender")]
public string Gender { get; set; } public string Gender { get; set; } = "";
/// <summary> /// <summary>
/// sevClient is the unique id every customer has and is used in nearly all operations /// sevClient is the unique id every customer has and is used in nearly all operations
@@ -131,7 +131,7 @@ namespace ConsoleApp3.DataContracts
/// <value>sevClient is the unique id every customer has and is used in nearly all operations</value> /// <value>sevClient is the unique id every customer has and is used in nearly all operations</value>
[DataMember(Name = "sevClient", EmitDefaultValue = false)] [DataMember(Name = "sevClient", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sevClient")] [JsonProperty(PropertyName = "sevClient")]
public Object SevClient { get; set; } public Object? SevClient { get; set; }
/// <summary> /// <summary>
/// second name of the contact /// second name of the contact
@@ -139,7 +139,7 @@ namespace ConsoleApp3.DataContracts
/// <value>second name of the contact</value> /// <value>second name of the contact</value>
[DataMember(Name = "name2", EmitDefaultValue = false)] [DataMember(Name = "name2", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name2")] [JsonProperty(PropertyName = "name2")]
public string Name2 { get; set; } public string Name2 { get; set; } = "";
/// <summary> /// <summary>
/// birthday of the contact /// birthday of the contact
@@ -155,7 +155,7 @@ namespace ConsoleApp3.DataContracts
/// <value>vat number of the contact</value> /// <value>vat number of the contact</value>
[DataMember(Name = "vatNumber", EmitDefaultValue = false)] [DataMember(Name = "vatNumber", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "vatNumber")] [JsonProperty(PropertyName = "vatNumber")]
public string VatNumber { get; set; } public string VatNumber { get; set; } = "";
/// <summary> /// <summary>
/// bank account of the contact /// bank account of the contact
@@ -163,7 +163,7 @@ namespace ConsoleApp3.DataContracts
/// <value>bank account of the contact</value> /// <value>bank account of the contact</value>
[DataMember(Name = "bankAccount", EmitDefaultValue = false)] [DataMember(Name = "bankAccount", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "bankAccount")] [JsonProperty(PropertyName = "bankAccount")]
public string BankAccount { get; set; } public string BankAccount { get; set; } = "";
/// <summary> /// <summary>
/// bank number of the contact /// bank number of the contact
@@ -171,7 +171,7 @@ namespace ConsoleApp3.DataContracts
/// <value>bank number of the contact</value> /// <value>bank number of the contact</value>
[DataMember(Name = "bankNumber", EmitDefaultValue = false)] [DataMember(Name = "bankNumber", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "bankNumber")] [JsonProperty(PropertyName = "bankNumber")]
public string BankNumber { get; set; } public string BankNumber { get; set; } = "";
/// <summary> /// <summary>
/// desired payment method of the customer /// desired payment method of the customer
@@ -179,7 +179,7 @@ namespace ConsoleApp3.DataContracts
/// <value>desired payment method of the customer</value> /// <value>desired payment method of the customer</value>
[DataMember(Name = "paymentMethod", EmitDefaultValue = false)] [DataMember(Name = "paymentMethod", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "paymentMethod")] [JsonProperty(PropertyName = "paymentMethod")]
public ModelPaymentMethod PaymentMethod { get; set; } public ModelPaymentMethod? PaymentMethod { get; set; }
/// <summary> /// <summary>
/// ///
@@ -187,7 +187,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "entryType", EmitDefaultValue = false)] [DataMember(Name = "entryType", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "entryType")] [JsonProperty(PropertyName = "entryType")]
public ModelEntryType EntryType { get; set; } public ModelEntryType? EntryType { get; set; }
/// <summary> /// <summary>
/// default cashback time of the contact /// default cashback time of the contact
@@ -219,7 +219,7 @@ namespace ConsoleApp3.DataContracts
/// <value>tax number of the contact</value> /// <value>tax number of the contact</value>
[DataMember(Name = "taxNumber", EmitDefaultValue = false)] [DataMember(Name = "taxNumber", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "taxNumber")] [JsonProperty(PropertyName = "taxNumber")]
public string TaxNumber { get; set; } public string TaxNumber { get; set; } = "";
/// <summary> /// <summary>
/// tax office of the contact /// tax office of the contact
@@ -227,6 +227,6 @@ namespace ConsoleApp3.DataContracts
/// <value>tax office of the contact</value> /// <value>tax office of the contact</value>
[DataMember(Name = "taxOffice", EmitDefaultValue = false)] [DataMember(Name = "taxOffice", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "taxOffice")] [JsonProperty(PropertyName = "taxOffice")]
public string TaxOffice { get; set; } public string TaxOffice { get; set; } = "";
} }
} }

View File

@@ -28,7 +28,7 @@ namespace ConsoleApp3.DataContracts
/// <value>the contact the address belongs to</value> /// <value>the contact the address belongs to</value>
[DataMember(Name = "contact", EmitDefaultValue = false)] [DataMember(Name = "contact", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "contact")] [JsonProperty(PropertyName = "contact")]
public ModelContact Contact { get; set; } public ModelContact? Contact { get; set; }
/// <summary> /// <summary>
/// ///
@@ -36,7 +36,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "street", EmitDefaultValue = false)] [DataMember(Name = "street", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "street")] [JsonProperty(PropertyName = "street")]
public string Street { get; set; } public string Street { get; set; } = "";
/// <summary> /// <summary>
/// zip of the city/village /// zip of the city/village
@@ -44,7 +44,7 @@ namespace ConsoleApp3.DataContracts
/// <value>zip of the city/village</value> /// <value>zip of the city/village</value>
[DataMember(Name = "zip", EmitDefaultValue = false)] [DataMember(Name = "zip", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "zip")] [JsonProperty(PropertyName = "zip")]
public string Zip { get; set; } public string Zip { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -52,7 +52,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "city", EmitDefaultValue = false)] [DataMember(Name = "city", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "city")] [JsonProperty(PropertyName = "city")]
public string City { get; set; } public string City { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -60,7 +60,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "country", EmitDefaultValue = false)] [DataMember(Name = "country", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "country")] [JsonProperty(PropertyName = "country")]
public ModelStaticCountry Country { get; set; } public ModelStaticCountry? Country { get; set; }
/// <summary> /// <summary>
/// category of the address /// category of the address
@@ -68,7 +68,7 @@ namespace ConsoleApp3.DataContracts
/// <value>category of the address</value> /// <value>category of the address</value>
[DataMember(Name = "category", EmitDefaultValue = false)] [DataMember(Name = "category", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "category")] [JsonProperty(PropertyName = "category")]
public ModelCategory Category { get; set; } public ModelCategory? Category { get; set; }
/// <summary> /// <summary>
/// ///
@@ -76,7 +76,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "name", EmitDefaultValue = false)] [DataMember(Name = "name", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name")] [JsonProperty(PropertyName = "name")]
public string Name { get; set; } public string Name { get; set; } = "";
/// <summary> /// <summary>
/// sevClient is the unique id every customer has and is used in nearly all operations /// sevClient is the unique id every customer has and is used in nearly all operations
@@ -84,7 +84,7 @@ namespace ConsoleApp3.DataContracts
/// <value>sevClient is the unique id every customer has and is used in nearly all operations</value> /// <value>sevClient is the unique id every customer has and is used in nearly all operations</value>
[DataMember(Name = "sevClient", EmitDefaultValue = false)] [DataMember(Name = "sevClient", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sevClient")] [JsonProperty(PropertyName = "sevClient")]
public Object SevClient { get; set; } public Object SevClient { get; set; } = new object();
/// <summary> /// <summary>
/// ///
@@ -92,7 +92,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "name2", EmitDefaultValue = false)] [DataMember(Name = "name2", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name2")] [JsonProperty(PropertyName = "name2")]
public string Name2 { get; set; } public string Name2 { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -100,7 +100,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "name3", EmitDefaultValue = false)] [DataMember(Name = "name3", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name3")] [JsonProperty(PropertyName = "name3")]
public string Name3 { get; set; } public string Name3 { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -108,7 +108,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "name4", EmitDefaultValue = false)] [DataMember(Name = "name4", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name4")] [JsonProperty(PropertyName = "name4")]
public string Name4 { get; set; } public string Name4 { get; set; } = "";
} }
} }

View File

@@ -25,7 +25,7 @@ namespace ConsoleApp3.DataContracts
/// <value>sevClient is the unique id every customer has and is used in nearly all operations</value> /// <value>sevClient is the unique id every customer has and is used in nearly all operations</value>
[DataMember(Name = "sevClient", EmitDefaultValue = false)] [DataMember(Name = "sevClient", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sevClient")] [JsonProperty(PropertyName = "sevClient")]
public Object SevClient { get; set; } public Object? SevClient { get; set; }
/// <summary> /// <summary>
/// ///
@@ -33,7 +33,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "number", EmitDefaultValue = false)] [DataMember(Name = "number", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "number")] [JsonProperty(PropertyName = "number")]
public string Number { get; set; } public string Number { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -41,7 +41,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "name", EmitDefaultValue = false)] [DataMember(Name = "name", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name")] [JsonProperty(PropertyName = "name")]
public string Name { get; set; } public string Name { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -49,7 +49,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "color", EmitDefaultValue = false)] [DataMember(Name = "color", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "color")] [JsonProperty(PropertyName = "color")]
public string Color { get; set; } public string Color { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -57,6 +57,6 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "postingAccount", EmitDefaultValue = false)] [DataMember(Name = "postingAccount", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "postingAccount")] [JsonProperty(PropertyName = "postingAccount")]
public string PostingAccount { get; set; } public string PostingAccount { get; set; } = "";
} }
} }

View File

@@ -24,7 +24,7 @@ namespace ConsoleApp3.DataContracts
/// <value>sevClient is the unique id every customer has and is used in nearly all operations</value> /// <value>sevClient is the unique id every customer has and is used in nearly all operations</value>
[DataMember(Name = "sevClient", EmitDefaultValue = false)] [DataMember(Name = "sevClient", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sevClient")] [JsonProperty(PropertyName = "sevClient")]
public Object SevClient { get; set; } public Object? SevClient { get; set; }
/// <summary> /// <summary>
/// ///
@@ -32,6 +32,6 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "name", EmitDefaultValue = false)] [DataMember(Name = "name", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name")] [JsonProperty(PropertyName = "name")]
public string Name { get; set; } public string Name { get; set; } = "";
} }
} }

View File

@@ -28,7 +28,7 @@ namespace ConsoleApp3.DataContracts
/// <value>sevClient is the unique id every customer has and is used in nearly all operations</value> /// <value>sevClient is the unique id every customer has and is used in nearly all operations</value>
[DataMember(Name = "sevClient", EmitDefaultValue = false)] [DataMember(Name = "sevClient", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sevClient")] [JsonProperty(PropertyName = "sevClient")]
public Object SevClient { get; set; } public Object? SevClient { get; set; }
/// <summary> /// <summary>
/// ///
@@ -36,7 +36,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "name", EmitDefaultValue = false)] [DataMember(Name = "name", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name")] [JsonProperty(PropertyName = "name")]
public string Name { get; set; } public string Name { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -44,7 +44,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "text", EmitDefaultValue = false)] [DataMember(Name = "text", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "text")] [JsonProperty(PropertyName = "text")]
public string Text { get; set; } public string Text { get; set; } = "";
} }
} }

View File

@@ -13,10 +13,10 @@ namespace ConsoleApp3.DataContracts
{ {
[DataMember(Name = "invoice", EmitDefaultValue = false)] [DataMember(Name = "invoice", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "invoice")] [JsonProperty(PropertyName = "invoice")]
public Invoice Invoice { get; set; } public Invoice? Invoice { get; set; }
[DataMember(Name = "invoicePosSave", EmitDefaultValue = false)] [DataMember(Name = "invoicePosSave", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "invoicePosSave")] [JsonProperty(PropertyName = "invoicePosSave")]
public InvoicePosSave[] InvoicePosSaves { get; set; } public InvoicePosSave[]? InvoicePosSaves { get; set; }
} }
} }

View File

@@ -21,6 +21,6 @@ namespace ConsoleApp3.DataContracts
/// <value>This information is not visible for you</value> /// <value>This information is not visible for you</value>
[DataMember(Name = "hidden", EmitDefaultValue = false)] [DataMember(Name = "hidden", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "hidden")] [JsonProperty(PropertyName = "hidden")]
public string Hidden { get; set; } public string Hidden { get; set; } = "";
} }
} }

View File

@@ -20,7 +20,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "code", EmitDefaultValue = false)] [DataMember(Name = "code", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "code")] [JsonProperty(PropertyName = "code")]
public string Code { get; set; } public string Code { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -28,7 +28,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "name", EmitDefaultValue = false)] [DataMember(Name = "name", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "name")] [JsonProperty(PropertyName = "name")]
public string Name { get; set; } public string Name { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -36,7 +36,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "nameEn", EmitDefaultValue = false)] [DataMember(Name = "nameEn", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "nameEn")] [JsonProperty(PropertyName = "nameEn")]
public string NameEn { get; set; } public string NameEn { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -44,7 +44,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "translationCode", EmitDefaultValue = false)] [DataMember(Name = "translationCode", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "translationCode")] [JsonProperty(PropertyName = "translationCode")]
public string TranslationCode { get; set; } public string TranslationCode { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -52,7 +52,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "locale", EmitDefaultValue = false)] [DataMember(Name = "locale", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "locale")] [JsonProperty(PropertyName = "locale")]
public string Locale { get; set; } public string Locale { get; set; } = "";
/// <summary> /// <summary>
/// ///

View File

@@ -29,7 +29,7 @@ namespace ConsoleApp3.DataContracts
/// <value>sevClient is the unique id every customer has and is used in nearly all operations</value> /// <value>sevClient is the unique id every customer has and is used in nearly all operations</value>
[DataMember(Name = "sevClient", EmitDefaultValue = false)] [DataMember(Name = "sevClient", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "sevClient")] [JsonProperty(PropertyName = "sevClient")]
public Object SevClient { get; set; } public Object? SevClient { get; set; }
/// <summary> /// <summary>
/// ///
@@ -37,7 +37,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "text", EmitDefaultValue = false)] [DataMember(Name = "text", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "text")] [JsonProperty(PropertyName = "text")]
public string Text { get; set; } public string Text { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -61,7 +61,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "displayText", EmitDefaultValue = false)] [DataMember(Name = "displayText", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "displayText")] [JsonProperty(PropertyName = "displayText")]
public string DisplayText { get; set; } public string DisplayText { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -69,7 +69,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "vatReportFieldNet", EmitDefaultValue = false)] [DataMember(Name = "vatReportFieldNet", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "vatReportFieldNet")] [JsonProperty(PropertyName = "vatReportFieldNet")]
public string VatReportFieldNet { get; set; } public string VatReportFieldNet { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -77,7 +77,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "vatReportFieldTax", EmitDefaultValue = false)] [DataMember(Name = "vatReportFieldTax", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "vatReportFieldTax")] [JsonProperty(PropertyName = "vatReportFieldTax")]
public string VatReportFieldTax { get; set; } public string VatReportFieldTax { get; set; } = "";
/// <summary> /// <summary>
/// ///
@@ -85,7 +85,7 @@ namespace ConsoleApp3.DataContracts
/// <value></value> /// <value></value>
[DataMember(Name = "accountingExportVatField", EmitDefaultValue = false)] [DataMember(Name = "accountingExportVatField", EmitDefaultValue = false)]
[JsonProperty(PropertyName = "accountingExportVatField")] [JsonProperty(PropertyName = "accountingExportVatField")]
public string AccountingExportVatField { get; set; } public string AccountingExportVatField { get; set; } = "";
/// <summary> /// <summary>
/// ///

130
CardMarketBot/Helper.cs Normal file
View File

@@ -0,0 +1,130 @@
// See https://aka.ms/new-console-template for more information
using System.Diagnostics;
using System.Text.RegularExpressions;
public static class Helper
{
public enum Porto
{
FAILED,
BRIEF085,
BRIEF100,
BRIEF160,
BRIEF275,
PRIO210,
PRIO270
}
internal static Kunde ConvertToKunde(string text)
{
string[] datas = text.Split("\r\n");
string name = datas[0];
string adresseUNDHausnummer = datas[datas.Length-3];
string plzUNDOrt = datas[datas.Length-2];
string land = datas[datas.Length-1];
datas = plzUNDOrt.Split(" ");
string plz = datas[0];
string ort = datas[1];
datas = adresseUNDHausnummer.Split(" ");
string strasse = "";
string hausnummer = "";
//Trace.WriteLine(datas.Length);
if (datas.Length <= 1)
{
Regex myRegex = new Regex("[0-9]*$");
var matched = myRegex.Match(adresseUNDHausnummer);
strasse = adresseUNDHausnummer.Substring(0, matched.Index);
hausnummer = adresseUNDHausnummer.Substring(matched.Index);
}
else
{
for (int i = 0; i < datas.Length - 1; i++)
{
strasse += datas[i] + " ";
}
strasse = strasse.Trim();
hausnummer = datas[datas.Length - 1];
}
return new Kunde(name, strasse, hausnummer, plz, ort, land);
}
public static List<Artikel> ParseArtikeln(string text)
{
List<Artikel> result = new List<Artikel>();
string[] datas = text.Split("\r\n");
for(int i = 0; i < datas.Length; i++)
{
Artikel temp = new Artikel();
int internalCounter = 0;
bool SourceFounded = false;
for(int j = i; j < datas.Length; j++)
{
var nFound = datas[j].IndexOf("€");
if(nFound == -1)
{
if (temp.Amount == 0)
{
var xFound = datas[j].IndexOf("x");
if (xFound >= 1 && xFound <= 2)
{
temp.Amount = Convert.ToInt32(datas[j].Substring(0, xFound));
temp.GERName = datas[j].Substring(xFound + 1).Trim();
}
}
if(internalCounter == 1)
{
temp.ENGName = datas[j];
}
if(internalCounter == 2)
{
if (datas[j].IndexOf("#") > -1)
{
temp.CardNumber = datas[j];
SourceFounded = false;
}
else
{
temp.Source = datas[j];
SourceFounded = true;
}
}
if(internalCounter == 3)
{
if(SourceFounded)
{
temp.Raritaet = datas[j];
}
else
{
temp.Source = datas[j];
}
}
//Trace.WriteLine(j + " " + datas[j]);
}
else
{
temp.Preis = datas[j].Split(' ')[0];
result.Add(temp);
i = j;
break;
}
internalCounter++;
}
}
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

@@ -1,6 +1,7 @@
// See https://aka.ms/new-console-template for more information // See https://aka.ms/new-console-template for more information
using ConsoleApp3.DataContracts; using ConsoleApp3.DataContracts;
using System.Diagnostics;
/* /*
* *
@@ -48,6 +49,36 @@ namespace CardmarketBot
{ {
List<ModelRechnung> result = new List<ModelRechnung>(); List<ModelRechnung> result = new List<ModelRechnung>();
// 1 => Deutschland
// 2 => Schweiz
// 3 => Österreich
// 6 => Belgien
// 11 => Frankreich
// 13 => Irland
// 14 => Italien
// 17 => Luxemburg
// 28 => Slowenien
// 29 => Spanien
// 48 => Kroatien
Dictionary<string, int> LaenderCodes = new Dictionary<string, int>()
{
{ "Deutschland", 1 },
{ "Schweiz", 2 },
{ "Österreich", 3 },
{ "Belgien",6 },
{ "Dänemark", 8 },
{ "Frankreich", 11 },
{ "Irland", 13 },
{ "Italien", 14 },
{ "Luxemburg", 17 },
{ "Slowenien", 28 },
{ "Spanien", 29 },
{ "Kroatien", 48 }
};
foreach (Kunde kunde in kunden) foreach (Kunde kunde in kunden)
{ {
ModelRechnung temp = new ModelRechnung(); ModelRechnung temp = new ModelRechnung();
@@ -57,17 +88,27 @@ namespace CardmarketBot
//rechnung.InvoiceNumber = string.Format("RE-{0}", await GetNextInvoiceNumber()); => Should be done by services. //rechnung.InvoiceNumber = string.Format("RE-{0}", await GetNextInvoiceNumber()); => Should be done by services.
rechnung.InvoiceDate = kunde.Bezahldatum; rechnung.InvoiceDate = kunde.Bezahldatum;
rechnung.Header = string.Format("Verkauf #{0}",kunde.BestellungID); rechnung.Header = string.Format("Verkauf #{0}",kunde.BestellungID);
rechnung.HeadText = "Sehr geehrte Damen und Herren," + rechnung.HeadText = "Sehr geehrte Damen und Herren, " +
"Wir stellen Ihnen für Ihre bestellung folgende Rechnung." + "wir stellen Ihnen für ihre Bestellung folgende Rechnung. " +
"Bitte Beachte, dass der Lieferdatum die Bestelldatum entspricht."; "Bitte Beachte, dass das Lieferdatum dem Bestelldatum entspricht.";
rechnung.FootText = "Ihre Rechnung ist bereits über Cardmarket beglichen worden."; rechnung.FootText = "Ihre Rechnung ist bereits über Cardmarket beglichen worden.";
rechnung.TimeToPay = new DateTime(0); rechnung.TimeToPay = 14;
rechnung.Discount = 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.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() rechnung.AddressCountry = new ModelStaticCountry();
if(LaenderCodes.ContainsKey(kunde.Land))
{ {
Id = 1 rechnung.AddressCountry.Id = LaenderCodes[kunde.Land];
}; }
else
{
rechnung.AddressCountry.Id = 1;
Console.WriteLine($"Fehler Land wurde nicht richtig gefunden {kunde.Land} Bitte in Sevdesk kontrollieren und Damian die\n" +
$"Fehlercode #LC01#{kunde.BestellungID} melden");
}
//rechnung.PayDate = new DateTime(2019, 08, 24, 14, 15, 22); //rechnung.PayDate = new DateTime(2019, 08, 24, 14, 15, 22);
rechnung.DeliveryDate = kunde.Bezahldatum; rechnung.DeliveryDate = kunde.Bezahldatum;
rechnung.Status = EInvoiceStatus.OPEN; rechnung.Status = EInvoiceStatus.OPEN;
@@ -110,14 +151,22 @@ namespace CardmarketBot
Id = null, Id = null,
MapAll = true, MapAll = true,
Quantity = 1, Quantity = 1,
Price = PortoPreis[kunde.Versandskosten],
Name = "Versandskosten", Name = "Versandskosten",
PositionNumber = 0, PositionNumber = 0,
Discount = 0, Discount = 0,
TaxRate = 19, TaxRate = 19,
PriceGross = PortoPreis[kunde.Versandskosten],
PriceTax = 19 PriceTax = 19
}; };
if(kunde.OverrideVersandskosten != null)
{
temp.InvoicePosSaves[temp.InvoicePosSaves.Length - 1].Price = Convert.ToDecimal(kunde.OverrideVersandskosten);
temp.InvoicePosSaves[temp.InvoicePosSaves.Length - 1].Price = Convert.ToDecimal(kunde.OverrideVersandskosten);
}
else
{
temp.InvoicePosSaves[temp.InvoicePosSaves.Length - 1].Price = PortoPreis[kunde.Versandskosten];
temp.InvoicePosSaves[temp.InvoicePosSaves.Length - 1].PriceGross = PortoPreis[kunde.Versandskosten];
}
result.Add(temp); result.Add(temp);
} }

View File

@@ -11,6 +11,7 @@ class Kunde
string plz; string plz;
string ort; string ort;
string land; string land;
List<Artikel> artikels = new List<Artikel>(); List<Artikel> artikels = new List<Artikel>();
public DateTime Bezahldatum { get; set; } public DateTime Bezahldatum { get; set; }
@@ -28,6 +29,7 @@ class Kunde
get => overrideVersandskosten; get => overrideVersandskosten;
set set
{ {
if (value == null) return;
string[] parts = value.Split(' '); string[] parts = value.Split(' ');
if(parts.Length < 2) if(parts.Length < 2)
{ {
@@ -48,5 +50,6 @@ class Kunde
plz = PLZ; plz = PLZ;
ort = Ort; ort = Ort;
land = Land; land = Land;
Versandskosten = Helper.Porto.FAILED;
} }
} }

149
CardMarketBot/Program.cs Normal file
View File

@@ -0,0 +1,149 @@
using ConsoleApp3.DataContracts;
using ConsoleApp3.Contracts;
using System.Text.RegularExpressions;
using CardMarketBot;
using System.Reflection.Metadata.Ecma335;
using System.Net.Sockets;
using System.Net;
namespace CardmarketBot
{
internal class Programm
{
private static bool CheckServerAvaible()
{
#if DEBUG
return false;
#endif
IPAddress[] hostAddresses = Dns.GetHostAddresses("huskyteufel.ddnss.de");
if (hostAddresses.Length == 0)
{
return false;
}
IPEndPoint iPEndPoint = new IPEndPoint(hostAddresses[0], 4000);
Socket socket = new Socket(iPEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
try
{
socket.Connect(iPEndPoint);
if (socket.Connected)
{
return true;
}
return false;
}
catch (Exception)
{
return false;
}
}
static void Main(string[] args)
{
Console.WriteLine("Hendrik prüft ob Server erreichbar ist");
bool flag = CheckServerAvaible();
Console.WriteLine("Das ergebnis von Hendrik seine erkundung lautet: " + flag);
ICheckSevDesk checkSevDesk = ((!flag) ? ((ICheckSevDesk)new CheckSevDeskInternalList()) : ((ICheckSevDesk)new CheckSevDeskPublicList()));
Console.WriteLine("Hallo Herzlich willkommen Augustin Karneval e.V.");
Console.WriteLine("Was kann ich für dich tun?");
bool programmexited = false;
List<Kunde> kunden = new List<Kunde>();
CardMarketParser cardMarketParser = new CardMarketParser("More-Tcg", "Magnatpower310!!");
while (!programmexited)
{
Console.WriteLine("1) Starte den Konstantin, der alle bezahlte Artikeln erfasst");
Console.WriteLine("2) Starte den Pöttker der Bestellnummern nachkontrolliert");
Console.WriteLine("3) Reset der Augen, gut wenn man Pöttkers Frau gesehen hat");
Console.WriteLine("4) Beende");
string? input = Console.ReadLine();
if (input == null)
{
continue;
}
switch (input)
{
case "1":
kunden = cardMarketParser.ParseCardMarket();
break;
case "2":
{
Console.Write("Verkaufsnummer: ");
string? verkaufsnummer = Console.ReadLine();
if (verkaufsnummer == null)
{
Console.WriteLine("Fehler");
continue;
}
kunden = cardMarketParser.ParseCardMarket(verkaufsnummer);
}
break;
case "3":
DoShit();
break;
case "4":
programmexited = true;
continue;
default: continue;
}
// Rechnungen generieren
List<ModelRechnung> rechnungen = new List<ModelRechnung>();
InvoiceParser invoiceParser = new InvoiceParser(kunden);
rechnungen = invoiceParser.GetInvoices();
foreach (ModelRechnung item in rechnungen)
{
if (item.Invoice == null) continue;
var str_header = item.Invoice.Header;
if (str_header != null)
{
Regex regex = new Regex("[0-9]*$");
Match matched = regex.Match(str_header);
string verkaufnummer = str_header.Substring(matched.Index);
Console.Write($"Teste {verkaufnummer} : ");
if (checkSevDesk.AlreadyKnown(verkaufnummer))
{
Console.Write("wurde noch nicht in Sevdesk erfasst ");
SevdeskService sevdeskService = new SevdeskService("7251554968610b78ca865b2b774b4134");
sevdeskService.Create(item);
Console.WriteLine("nun in Sevdesk eingetragen");
checkSevDesk.Write(verkaufnummer);
}
else
{
Console.WriteLine("wurde bereits in Sevdesk erfasst, wird somit übersprungen. Jedoch wird PostCSV erstellt");
}
}
}
// Post CSV Erstellen
//DeutschePost deutschePost = new DeutschePost(kunden);
//deutschePost.GenerateCSV();
Console.WriteLine("Fertig");
}
}
private static void DoShit()
{
for(int i = 0; i < 10; i++)
{
Console.Beep(38, 3);
Console.BackgroundColor = ConsoleColor.Green;
Console.Clear();
Thread.Sleep(100);
Console.BackgroundColor = ConsoleColor.Red;
Console.Clear();
}
Console.BackgroundColor = ConsoleColor.Black;
Console.Clear();
}
}
}

View File

@@ -26,7 +26,7 @@ namespace CardmarketBot
public async void Create(ModelRechnung rechnung) public async void Create(ModelRechnung rechnung)
{ {
if (rechnung.Invoice == null) return;
rechnung.Invoice.InvoiceNumber = string.Format("RE-{0}", await GetNextInvoiceNumber()); rechnung.Invoice.InvoiceNumber = string.Format("RE-{0}", await GetNextInvoiceNumber());
await WriteInv(rechnung); await WriteInv(rechnung);
} }
@@ -60,7 +60,9 @@ namespace CardmarketBot
{ {
MissingMemberHandling = MissingMemberHandling.Ignore MissingMemberHandling = MissingMemberHandling.Ignore
}; };
#pragma warning disable CS8603 // Mögliche Nullverweisrückgabe.
return JsonConvert.DeserializeObject<Invoices>(contents, jsonSerializerSettings); return JsonConvert.DeserializeObject<Invoices>(contents, jsonSerializerSettings);
#pragma warning restore CS8603 // Mögliche Nullverweisrückgabe.
} }
private async Task<string> GetNextInvoiceNumber() private async Task<string> GetNextInvoiceNumber()
@@ -76,6 +78,8 @@ namespace CardmarketBot
}; };
var ob = JsonConvert.DeserializeObject<RNumbers>(contents, jsonSerializerSettings); var ob = JsonConvert.DeserializeObject<RNumbers>(contents, jsonSerializerSettings);
if (ob == null) return "";
if (ob.ConfigRechnungsnummer == null) return "";
return ob.ConfigRechnungsnummer.NextNumber; return ob.ConfigRechnungsnummer.NextNumber;
} }
@@ -84,7 +88,7 @@ namespace CardmarketBot
[DataContract] [DataContract]
class RNumbers class RNumbers
{ {
[JsonProperty("objects")] public ConfigRechnungnummer ConfigRechnungsnummer { get; set; } [JsonProperty("objects")] public ConfigRechnungnummer? ConfigRechnungsnummer { get; set; }
} }
[DataContract] [DataContract]

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CardMarketBot
{
internal class SocketClient
{
}
}

View File

@@ -3,7 +3,9 @@ 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("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CardMarketBot", "ConsoleApp3\CardMarketBot.csproj", "{4CB462A0-22BB-4E70-9C0B-203560329AFE}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CardMarketBot", "CardMarketBot\CardMarketBot.csproj", "{4CB462A0-22BB-4E70-9C0B-203560329AFE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CardMarketBotTests", "CardMarketBotTests\CardMarketBotTests.csproj", "{778573E1-5691-44C2-A897-C84FCC73FAC0}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,6 +17,10 @@ Global
{4CB462A0-22BB-4E70-9C0B-203560329AFE}.Debug|Any CPU.Build.0 = Debug|Any CPU {4CB462A0-22BB-4E70-9C0B-203560329AFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4CB462A0-22BB-4E70-9C0B-203560329AFE}.Release|Any CPU.ActiveCfg = Release|Any CPU {4CB462A0-22BB-4E70-9C0B-203560329AFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4CB462A0-22BB-4E70-9C0B-203560329AFE}.Release|Any CPU.Build.0 = Release|Any CPU {4CB462A0-22BB-4E70-9C0B-203560329AFE}.Release|Any CPU.Build.0 = Release|Any CPU
{778573E1-5691-44C2-A897-C84FCC73FAC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{778573E1-5691-44C2-A897-C84FCC73FAC0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{778573E1-5691-44C2-A897-C84FCC73FAC0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{778573E1-5691-44C2-A897-C84FCC73FAC0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="coverlet.collector" Version="3.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CardMarketBot\CardMarketBot.csproj" />
</ItemGroup>
</Project>

File diff suppressed because one or more lines are too long

View File

@@ -1,21 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="RestSharp" Version="110.2.0" />
<PackageReference Include="Selenium.WebDriver" Version="4.10.0" />
</ItemGroup>
<ItemGroup>
<None Update="usedList.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -1,96 +0,0 @@
// See https://aka.ms/new-console-template for more information
static class Helper
{
public enum Porto
{
BRIEF085,
BRIEF100,
BRIEF160,
BRIEF275,
PRIO210,
PRIO270
}
internal static Kunde ConvertToKunde(string text)
{
string[] datas = text.Split("\r\n");
string name = datas[0];
string adresseUNDHausnummer = datas[1];
string plzUNDOrt = datas[2];
string land = datas[3];
datas = plzUNDOrt.Split(" ");
string plz = datas[0];
string ort = datas[1];
datas = adresseUNDHausnummer.Split(" ");
string strasse = "";
for (int i = 0; i < datas.Length - 1; i++)
{
strasse += datas[i] + " ";
}
strasse = strasse.Trim();
string hausnummer = datas[datas.Length - 1];
return new Kunde(name, strasse, hausnummer, plz, ort, land);
}
internal static List<Artikel> ParseArtikeln(string text)
{
List<Artikel> result = new List<Artikel>();
string[] datas = text.Split("\r\n");
int anzahl = datas.Length / 6;
for (int i = 0; i < datas.Length; i += 6)
{
Artikel temp = new Artikel();
var xFound = datas[i].IndexOf("x");
var am = datas[i].Substring(0, xFound);
temp.Amount = Convert.ToInt32(am);
temp.GERName = datas[i].Substring(xFound + 1);
temp.ENGName = datas[i + 1];
temp.CardNumber = datas[i + 2];
temp.Source = datas[i + 3];
temp.Raritaet = datas[i + 4];
temp.Preis = datas[i + 5].Split(' ')[0];
result.Add(temp);
}
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));
}
}
/*
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,47 +0,0 @@
using ConsoleApp3.DataContracts;
using ConsoleApp3;
using ConsoleApp3.Contracts;
namespace CardmarketBot
{
internal class Programm
{
static void Main(string[] args)
{
IUsedRepository usedRepository = new UsedRepository();
// Kunden aus Cardmarket erstellen
List<Kunde> kunden = new List<Kunde>();
CardMarketParser cardMarketParser = new CardMarketParser("More-Tcg", "Magnatpower310!!", usedRepository);
kunden = cardMarketParser.ParseCardMarket();
// Rechnungen generieren
List<ModelRechnung> rechnungen = new List<ModelRechnung>();
InvoiceParser invoiceParser = new InvoiceParser(kunden);
rechnungen = invoiceParser.GetInvoices();
foreach (var item in rechnungen)
{
SevdeskService sevdeskService = new SevdeskService("7251554968610b78ca865b2b774b4134");
sevdeskService.Create(item);
}
// Post CSV Erstellen
DeutschePost deutschePost = new DeutschePost(kunden);
deutschePost.GenerateCSV();
usedRepository.Insert(kunden);
Console.WriteLine("Fertig");
Console.ReadLine();
}
}
}

View File

@@ -1 +0,0 @@


4
StartDenHugo.bat Normal file
View File

@@ -0,0 +1,4 @@
@echo off
git pull
dotnet run --project CardMarketBot