Compare commits
23 Commits
convert_to
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c78d734d14 | ||
|
|
b566b0a201 | ||
| 6c216ca189 | |||
| b6d36d7bf5 | |||
| 839080392b | |||
| b0e27caf9f | |||
| 81ed7ae8d1 | |||
| ff8649b314 | |||
| 744ce5a687 | |||
| dd7bd99595 | |||
|
|
e6611f6c18 | ||
| e48b6e9fae | |||
| 34e5fb588d | |||
| 2de8b4adde | |||
| ee6eb210b7 | |||
| 4af2bae8cd | |||
| 966514148d | |||
| 1e115bddee | |||
| 2f2524a5c4 | |||
| f4a0af33b0 | |||
| e44385473f | |||
| 324f01df5e | |||
| 19e6a43847 |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
/.vs/
|
||||
/ConsoleApp3/bin/
|
||||
/ConsoleApp3/obj/
|
||||
*/bin/
|
||||
*/obj/
|
||||
*.csv
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
internal class Artikel
|
||||
public class Artikel
|
||||
{
|
||||
public int Amount { get; set; }
|
||||
public string GERName { get; set; } = "";
|
||||
15
CardMarketBot/CardMarketBot.csproj
Normal file
15
CardMarketBot/CardMarketBot.csproj
Normal 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>
|
||||
@@ -1,10 +1,12 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
using OpenQA.Selenium.Chrome;
|
||||
//using SeleniumUndetectedChromeDriver;
|
||||
using OpenQA.Selenium;
|
||||
using System.Net;
|
||||
using System.Diagnostics;
|
||||
using ConsoleApp3.Contracts;
|
||||
using static System.Collections.Specialized.BitVector32;
|
||||
|
||||
namespace CardmarketBot
|
||||
{
|
||||
@@ -12,7 +14,6 @@ namespace CardmarketBot
|
||||
{
|
||||
private readonly string username;
|
||||
private readonly string password;
|
||||
private readonly IUsedRepository _usedRepository;
|
||||
|
||||
Dictionary<string, Helper.Porto> portoberechnung = new Dictionary<string, Helper.Porto>()
|
||||
{
|
||||
@@ -24,31 +25,62 @@ namespace CardmarketBot
|
||||
{"3,20 €", Helper.Porto.PRIO270 },
|
||||
};
|
||||
|
||||
public CardMarketParser(string username, string password, IUsedRepository repository)
|
||||
public CardMarketParser(string username, string password)
|
||||
{
|
||||
this.username = username;
|
||||
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();
|
||||
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);
|
||||
|
||||
//driver.GoToUrl("https://www.cardmarket.com/de/OnePiece");
|
||||
|
||||
|
||||
cd.Url = @"https://www.cardmarket.com/de/OnePiece";
|
||||
|
||||
cd.Navigate();
|
||||
|
||||
cd.FindElement(By.CssSelector("#CookiesConsent > div > div > form > button")).Click();
|
||||
Thread.Sleep(10);
|
||||
Thread.Sleep(2000);
|
||||
|
||||
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")).SendKeys(username);
|
||||
|
||||
cd.FindElement(By.Name("userPassword")).Click();
|
||||
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();
|
||||
@@ -59,40 +91,77 @@ namespace CardmarketBot
|
||||
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<Kunde> kunden = new List<Kunde>();
|
||||
IWebElement element;
|
||||
//IWebElement? element;
|
||||
|
||||
/*cloudfire = true;
|
||||
|
||||
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)
|
||||
{
|
||||
if (bereitsbearbeitet.Find(x => x.Equals(datas[i])) != null) continue;
|
||||
ids.Add(datas[i]);
|
||||
}
|
||||
|
||||
|
||||
element = cd.FindElement(By.XPath("/html/body/div[1]/div/div[1]/div"));
|
||||
|
||||
// //[@id="challenge-body-text"]
|
||||
}
|
||||
catch(OpenQA.Selenium.NotFoundException ex)
|
||||
catch (NoSuchElementException)
|
||||
{
|
||||
Console.WriteLine("Keine Verkäufe aktuell");
|
||||
return kunden;
|
||||
cloudfire = false;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
Console.WriteLine(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"));
|
||||
|
||||
@@ -113,7 +182,7 @@ namespace CardmarketBot
|
||||
else
|
||||
{
|
||||
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.BestellungID = id;
|
||||
@@ -121,14 +190,19 @@ namespace CardmarketBot
|
||||
|
||||
|
||||
// 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;
|
||||
kunde.Artikels = Helper.ParseArtikeln(element.Text);
|
||||
|
||||
|
||||
kunden.Add(kunde);
|
||||
Thread.Sleep(TimeSpan.FromSeconds(5));
|
||||
Thread.Sleep(TimeSpan.FromSeconds(3));
|
||||
}
|
||||
cd.Quit();
|
||||
return kunden;
|
||||
}
|
||||
}
|
||||
38
CardMarketBot/CheckSevDeskInternalList.cs
Normal file
38
CardMarketBot/CheckSevDeskInternalList.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
118
CardMarketBot/CheckSevDeskPublicList.cs
Normal file
118
CardMarketBot/CheckSevDeskPublicList.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
8
CardMarketBot/Contracts/ICheckSevDesk.cs
Normal file
8
CardMarketBot/Contracts/ICheckSevDesk.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace ConsoleApp3.Contracts
|
||||
{
|
||||
internal interface ICheckSevDesk
|
||||
{
|
||||
bool AlreadyKnown(string verkaufsnummer);
|
||||
bool Write(string verkaufsnummer);
|
||||
}
|
||||
}
|
||||
@@ -15,14 +15,14 @@ namespace ConsoleApp3.DataContracts
|
||||
public int? Id { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "objectName")]
|
||||
public string ObjectName { get; set; }
|
||||
public string ObjectName { get; set; } = "";
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[DataMember(Name = "invoiceNumber", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "invoiceNumber")]
|
||||
public string InvoiceNumber { get; set; }
|
||||
public string InvoiceNumber { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// the contact the invoice belongs to
|
||||
@@ -30,7 +30,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>the contact the invoice belongs to</value>
|
||||
[DataMember(Name = "contact", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "contact")]
|
||||
public ModelContact Contact { get; set; }
|
||||
public ModelContact? Contact { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// the date the invoice was created
|
||||
@@ -62,7 +62,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>header/subject of the invoice</value>
|
||||
[DataMember(Name = "header", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "header")]
|
||||
public string Header { get; set; }
|
||||
public string Header { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// head text of the invoice
|
||||
@@ -70,7 +70,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>head text of the invoice</value>
|
||||
[DataMember(Name = "headText", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "headText")]
|
||||
public string HeadText { get; set; }
|
||||
public string HeadText { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// foot text of the invoice
|
||||
@@ -78,7 +78,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>foot text of the invoice</value>
|
||||
[DataMember(Name = "footText", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "footText")]
|
||||
public string FootText { get; set; }
|
||||
public string FootText { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
[DataMember(Name = "timeToPay", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "timeToPay")]
|
||||
public DateTime? TimeToPay { get; set; }
|
||||
public int? TimeToPay { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -110,7 +110,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>the name in the address, equals the contacts name</value>
|
||||
[DataMember(Name = "addressName", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "addressName")]
|
||||
public string AddressName { get; set; }
|
||||
public string AddressName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
[DataMember(Name = "addressStreet", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "addressStreet")]
|
||||
public string AddressStreet { get; set; }
|
||||
public string AddressStreet { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
[DataMember(Name = "addressZip", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "addressZip")]
|
||||
public string AddressZip { get; set; }
|
||||
public string AddressZip { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
[DataMember(Name = "addressCity", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "addressCity")]
|
||||
public string AddressCity { get; set; }
|
||||
public string AddressCity { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
[DataMember(Name = "addressCountry", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "addressCountry")]
|
||||
public ModelStaticCountry AddressCountry { get; set; }
|
||||
public ModelStaticCountry? AddressCountry { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
[DataMember(Name = "createUser", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "createUser")]
|
||||
public ModelSevUser CreateUser { get; set; }
|
||||
public ModelSevUser? CreateUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
[DataMember(Name = "sevClient", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sevClient")]
|
||||
public Object SevClient { get; set; }
|
||||
public Object? SevClient { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
[DataMember(Name = "status", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "status")]
|
||||
public EInvoiceStatus Status { get; set; }
|
||||
public EInvoiceStatus? Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -198,7 +198,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <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()
|
||||
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>
|
||||
[DataMember(Name = "taxText", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "taxText")]
|
||||
public string TaxText { get; set; }
|
||||
public string TaxText { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// dunning level of the invoice
|
||||
@@ -233,7 +233,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>name of the contacts address</value>
|
||||
[DataMember(Name = "addressParentName", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "addressParentName")]
|
||||
public string AddressParentName { get; set; }
|
||||
public string AddressParentName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// a reference to the contacts address
|
||||
@@ -241,7 +241,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>a reference to the contacts address</value>
|
||||
[DataMember(Name = "addressContactRef", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "addressContactRef")]
|
||||
public ModelContactAddress AddressContactRef { get; set; }
|
||||
public ModelContactAddress? AddressContactRef { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -249,7 +249,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "taxType", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "taxType")]
|
||||
public string TaxType { get; set; }
|
||||
public string TaxType { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -257,7 +257,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "paymentMethod", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "paymentMethod")]
|
||||
public ModelPaymentMethod PaymentMethod { get; set; }
|
||||
public ModelPaymentMethod? PaymentMethod { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -265,7 +265,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "costCentre", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "costCentre")]
|
||||
public ModelCostCentre CostCentre { get; set; }
|
||||
public ModelCostCentre? CostCentre { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -281,7 +281,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "origin", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "origin")]
|
||||
public Object Origin { get; set; }
|
||||
public Object? Origin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// type of the invoice
|
||||
@@ -289,7 +289,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>type of the invoice</value>
|
||||
[DataMember(Name = "invoiceType", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "invoiceType")]
|
||||
public string InvoiceType { get; set; }
|
||||
public string InvoiceType { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -353,7 +353,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "addressParentName2", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "addressParentName2")]
|
||||
public string AddressParentName2 { get; set; }
|
||||
public string AddressParentName2 { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -361,7 +361,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "addressName2", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "addressName2")]
|
||||
public string AddressName2 { get; set; }
|
||||
public string AddressName2 { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -369,7 +369,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "taxSet", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "taxSet")]
|
||||
public ModelTaxSet TaxSet { get; set; }
|
||||
public ModelTaxSet? TaxSet { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -377,7 +377,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "addressGender", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "addressGender")]
|
||||
public string AddressGender { get; set; }
|
||||
public string AddressGender { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -393,7 +393,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "address", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "address")]
|
||||
public string Address { get; set; }
|
||||
public string Address { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -497,7 +497,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "entryType", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "entryType")]
|
||||
public ModelEntryType EntryType { get; set; }
|
||||
public ModelEntryType? EntryType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -505,7 +505,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "costumerInternalNote", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "costumerInternalNote")]
|
||||
public string CostumerInternalNote { get; set; }
|
||||
public string CostumerInternalNote { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -530,7 +530,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "sendType", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sendType")]
|
||||
public string SendType { get; set; }
|
||||
public string SendType { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -1,11 +1,5 @@
|
||||
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
|
||||
{
|
||||
@@ -6,7 +6,7 @@ namespace ConsoleApp3.DataContracts
|
||||
{
|
||||
internal class Invoices
|
||||
{
|
||||
[JsonProperty("objects")] public Invoice[] Invoice { get; set; }
|
||||
[JsonProperty("objects")] public Invoice[]? Invoice { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "parent", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "parent")]
|
||||
public ModelCategory Parent { get; set; }
|
||||
public ModelCategory? Parent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -32,7 +32,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "name", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name")]
|
||||
public string Name { get; set; }
|
||||
public string Name { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -40,7 +40,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "objectType", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "objectType")]
|
||||
public string ObjectType { get; set; }
|
||||
public string ObjectType { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -56,7 +56,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "code", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "code")]
|
||||
public string Code { get; set; }
|
||||
public string Code { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -64,7 +64,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "color", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "color")]
|
||||
public string Color { get; set; }
|
||||
public string Color { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -72,7 +72,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "sevClient", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sevClient")]
|
||||
public Object SevClient { get; set; }
|
||||
public Object? SevClient { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -80,7 +80,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "postingAccount", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "postingAccount")]
|
||||
public string PostingAccount { get; set; }
|
||||
public string PostingAccount { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -88,7 +88,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "type", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "type")]
|
||||
public string Type { get; set; }
|
||||
public string Type { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -96,7 +96,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "translationCode", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "translationCode")]
|
||||
public string TranslationCode { get; set; }
|
||||
public string TranslationCode { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -104,7 +104,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "entryType", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "entryType")]
|
||||
public ModelEntryType EntryType { get; set; }
|
||||
public ModelEntryType? EntryType { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>the contact address</value>
|
||||
[DataMember(Name = "address", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "address")]
|
||||
public ModelContactAddress Address { get; set; }
|
||||
public ModelContactAddress? Address { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// the creation date of the contact
|
||||
@@ -43,7 +43,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>name of the contact</value>
|
||||
[DataMember(Name = "name", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name")]
|
||||
public string Name { get; set; }
|
||||
public string Name { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// status of the contact
|
||||
@@ -67,7 +67,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "parent", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "parent")]
|
||||
public ModelContact Parent { get; set; }
|
||||
public ModelContact? Parent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// surname of the contact
|
||||
@@ -75,7 +75,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>surname of the contact</value>
|
||||
[DataMember(Name = "surename", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "surename")]
|
||||
public string Surename { get; set; }
|
||||
public string Surename { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// family name of the contact
|
||||
@@ -83,7 +83,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>family name of the contact</value>
|
||||
[DataMember(Name = "familyname", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "familyname")]
|
||||
public string Familyname { get; set; }
|
||||
public string Familyname { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// title of the contact
|
||||
@@ -91,7 +91,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>title of the contact</value>
|
||||
[DataMember(Name = "titel", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "titel")]
|
||||
public string Titel { get; set; }
|
||||
public string Titel { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// category of the contact
|
||||
@@ -99,7 +99,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>category of the contact</value>
|
||||
[DataMember(Name = "category", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "category")]
|
||||
public ModelCategory Category { get; set; }
|
||||
public ModelCategory? Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// description of the contact
|
||||
@@ -107,7 +107,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>description of the contact</value>
|
||||
[DataMember(Name = "description", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "description")]
|
||||
public string Description { get; set; }
|
||||
public string Description { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// any academic title of the contact
|
||||
@@ -115,7 +115,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>any academic title of the contact</value>
|
||||
[DataMember(Name = "academicTitle", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "academicTitle")]
|
||||
public string AcademicTitle { get; set; }
|
||||
public string AcademicTitle { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// gender of the contact
|
||||
@@ -123,7 +123,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>gender of the contact</value>
|
||||
[DataMember(Name = "gender", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "gender")]
|
||||
public string Gender { get; set; }
|
||||
public string Gender { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
[DataMember(Name = "sevClient", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sevClient")]
|
||||
public Object SevClient { get; set; }
|
||||
public Object? SevClient { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// second name of the contact
|
||||
@@ -139,7 +139,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>second name of the contact</value>
|
||||
[DataMember(Name = "name2", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name2")]
|
||||
public string Name2 { get; set; }
|
||||
public string Name2 { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// birthday of the contact
|
||||
@@ -155,7 +155,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>vat number of the contact</value>
|
||||
[DataMember(Name = "vatNumber", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "vatNumber")]
|
||||
public string VatNumber { get; set; }
|
||||
public string VatNumber { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// bank account of the contact
|
||||
@@ -163,7 +163,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>bank account of the contact</value>
|
||||
[DataMember(Name = "bankAccount", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "bankAccount")]
|
||||
public string BankAccount { get; set; }
|
||||
public string BankAccount { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// bank number of the contact
|
||||
@@ -171,7 +171,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>bank number of the contact</value>
|
||||
[DataMember(Name = "bankNumber", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "bankNumber")]
|
||||
public string BankNumber { get; set; }
|
||||
public string BankNumber { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// desired payment method of the customer
|
||||
@@ -179,7 +179,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>desired payment method of the customer</value>
|
||||
[DataMember(Name = "paymentMethod", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "paymentMethod")]
|
||||
public ModelPaymentMethod PaymentMethod { get; set; }
|
||||
public ModelPaymentMethod? PaymentMethod { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -187,7 +187,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "entryType", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "entryType")]
|
||||
public ModelEntryType EntryType { get; set; }
|
||||
public ModelEntryType? EntryType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// default cashback time of the contact
|
||||
@@ -219,7 +219,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>tax number of the contact</value>
|
||||
[DataMember(Name = "taxNumber", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "taxNumber")]
|
||||
public string TaxNumber { get; set; }
|
||||
public string TaxNumber { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// tax office of the contact
|
||||
@@ -227,6 +227,6 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>tax office of the contact</value>
|
||||
[DataMember(Name = "taxOffice", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "taxOffice")]
|
||||
public string TaxOffice { get; set; }
|
||||
public string TaxOffice { get; set; } = "";
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>the contact the address belongs to</value>
|
||||
[DataMember(Name = "contact", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "contact")]
|
||||
public ModelContact Contact { get; set; }
|
||||
public ModelContact? Contact { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -36,7 +36,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "street", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "street")]
|
||||
public string Street { get; set; }
|
||||
public string Street { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// zip of the city/village
|
||||
@@ -44,7 +44,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>zip of the city/village</value>
|
||||
[DataMember(Name = "zip", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "zip")]
|
||||
public string Zip { get; set; }
|
||||
public string Zip { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -52,7 +52,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "city", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "city")]
|
||||
public string City { get; set; }
|
||||
public string City { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -60,7 +60,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "country", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "country")]
|
||||
public ModelStaticCountry Country { get; set; }
|
||||
public ModelStaticCountry? Country { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// category of the address
|
||||
@@ -68,7 +68,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>category of the address</value>
|
||||
[DataMember(Name = "category", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "category")]
|
||||
public ModelCategory Category { get; set; }
|
||||
public ModelCategory? Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -76,7 +76,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "name", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name")]
|
||||
public string Name { get; set; }
|
||||
public string Name { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
[DataMember(Name = "sevClient", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "sevClient")]
|
||||
public Object SevClient { get; set; }
|
||||
public Object SevClient { get; set; } = new object();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -92,7 +92,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "name2", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name2")]
|
||||
public string Name2 { get; set; }
|
||||
public string Name2 { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -100,7 +100,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "name3", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name3")]
|
||||
public string Name3 { get; set; }
|
||||
public string Name3 { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -108,7 +108,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "name4", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name4")]
|
||||
public string Name4 { get; set; }
|
||||
public string Name4 { get; set; } = "";
|
||||
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <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; }
|
||||
public Object? SevClient { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -33,7 +33,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "number", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "number")]
|
||||
public string Number { get; set; }
|
||||
public string Number { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -41,7 +41,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "name", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name")]
|
||||
public string Name { get; set; }
|
||||
public string Name { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -49,7 +49,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "color", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "color")]
|
||||
public string Color { get; set; }
|
||||
public string Color { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -57,6 +57,6 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "postingAccount", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "postingAccount")]
|
||||
public string PostingAccount { get; set; }
|
||||
public string PostingAccount { get; set; } = "";
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <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; }
|
||||
public Object? SevClient { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -32,6 +32,6 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "name", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name")]
|
||||
public string Name { get; set; }
|
||||
public string Name { get; set; } = "";
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <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; }
|
||||
public Object? SevClient { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -36,7 +36,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "name", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name")]
|
||||
public string Name { get; set; }
|
||||
public string Name { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -44,7 +44,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "text", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "text")]
|
||||
public string Text { get; set; }
|
||||
public string Text { get; set; } = "";
|
||||
|
||||
}
|
||||
}
|
||||
@@ -13,10 +13,10 @@ namespace ConsoleApp3.DataContracts
|
||||
{
|
||||
[DataMember(Name = "invoice", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "invoice")]
|
||||
public Invoice Invoice { get; set; }
|
||||
public Invoice? Invoice { get; set; }
|
||||
|
||||
[DataMember(Name = "invoicePosSave", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "invoicePosSave")]
|
||||
public InvoicePosSave[] InvoicePosSaves { get; set; }
|
||||
public InvoicePosSave[]? InvoicePosSaves { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,6 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value>This information is not visible for you</value>
|
||||
[DataMember(Name = "hidden", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "hidden")]
|
||||
public string Hidden { get; set; }
|
||||
public string Hidden { get; set; } = "";
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "code", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "code")]
|
||||
public string Code { get; set; }
|
||||
public string Code { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -28,7 +28,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "name", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "name")]
|
||||
public string Name { get; set; }
|
||||
public string Name { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -36,7 +36,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "nameEn", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "nameEn")]
|
||||
public string NameEn { get; set; }
|
||||
public string NameEn { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -44,7 +44,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "translationCode", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "translationCode")]
|
||||
public string TranslationCode { get; set; }
|
||||
public string TranslationCode { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -52,7 +52,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "locale", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "locale")]
|
||||
public string Locale { get; set; }
|
||||
public string Locale { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -29,7 +29,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <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; }
|
||||
public Object? SevClient { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -37,7 +37,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "text", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "text")]
|
||||
public string Text { get; set; }
|
||||
public string Text { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -61,7 +61,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "displayText", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "displayText")]
|
||||
public string DisplayText { get; set; }
|
||||
public string DisplayText { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -69,7 +69,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "vatReportFieldNet", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "vatReportFieldNet")]
|
||||
public string VatReportFieldNet { get; set; }
|
||||
public string VatReportFieldNet { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -77,7 +77,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "vatReportFieldTax", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "vatReportFieldTax")]
|
||||
public string VatReportFieldTax { get; set; }
|
||||
public string VatReportFieldTax { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -85,7 +85,7 @@ namespace ConsoleApp3.DataContracts
|
||||
/// <value></value>
|
||||
[DataMember(Name = "accountingExportVatField", EmitDefaultValue = false)]
|
||||
[JsonProperty(PropertyName = "accountingExportVatField")]
|
||||
public string AccountingExportVatField { get; set; }
|
||||
public string AccountingExportVatField { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
130
CardMarketBot/Helper.cs
Normal file
130
CardMarketBot/Helper.cs
Normal 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));
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
using ConsoleApp3.DataContracts;
|
||||
using System.Diagnostics;
|
||||
|
||||
/*
|
||||
*
|
||||
@@ -48,6 +49,36 @@ namespace CardmarketBot
|
||||
{
|
||||
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)
|
||||
{
|
||||
ModelRechnung temp = new ModelRechnung();
|
||||
@@ -57,17 +88,27 @@ namespace CardmarketBot
|
||||
//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.HeadText = "Sehr geehrte Damen und Herren, " +
|
||||
"wir stellen Ihnen für ihre Bestellung folgende Rechnung. " +
|
||||
"Bitte Beachte, dass das Lieferdatum dem Bestelldatum entspricht.";
|
||||
rechnung.FootText = "Ihre Rechnung ist bereits über Cardmarket beglichen worden.";
|
||||
rechnung.TimeToPay = new DateTime(0);
|
||||
rechnung.TimeToPay = 14;
|
||||
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()
|
||||
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.DeliveryDate = kunde.Bezahldatum;
|
||||
rechnung.Status = EInvoiceStatus.OPEN;
|
||||
@@ -110,14 +151,22 @@ namespace CardmarketBot
|
||||
Id = null,
|
||||
MapAll = true,
|
||||
Quantity = 1,
|
||||
Price = PortoPreis[kunde.Versandskosten],
|
||||
Name = "Versandskosten",
|
||||
PositionNumber = 0,
|
||||
Discount = 0,
|
||||
TaxRate = 19,
|
||||
PriceGross = PortoPreis[kunde.Versandskosten],
|
||||
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);
|
||||
|
||||
}
|
||||
@@ -11,6 +11,7 @@ class Kunde
|
||||
string plz;
|
||||
string ort;
|
||||
string land;
|
||||
|
||||
List<Artikel> artikels = new List<Artikel>();
|
||||
public DateTime Bezahldatum { get; set; }
|
||||
|
||||
@@ -28,6 +29,7 @@ class Kunde
|
||||
get => overrideVersandskosten;
|
||||
set
|
||||
{
|
||||
if (value == null) return;
|
||||
string[] parts = value.Split(' ');
|
||||
if(parts.Length < 2)
|
||||
{
|
||||
@@ -48,5 +50,6 @@ class Kunde
|
||||
plz = PLZ;
|
||||
ort = Ort;
|
||||
land = Land;
|
||||
Versandskosten = Helper.Porto.FAILED;
|
||||
}
|
||||
}
|
||||
149
CardMarketBot/Program.cs
Normal file
149
CardMarketBot/Program.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ namespace CardmarketBot
|
||||
|
||||
public async void Create(ModelRechnung rechnung)
|
||||
{
|
||||
|
||||
if (rechnung.Invoice == null) return;
|
||||
rechnung.Invoice.InvoiceNumber = string.Format("RE-{0}", await GetNextInvoiceNumber());
|
||||
await WriteInv(rechnung);
|
||||
}
|
||||
@@ -60,7 +60,9 @@ namespace CardmarketBot
|
||||
{
|
||||
MissingMemberHandling = MissingMemberHandling.Ignore
|
||||
};
|
||||
#pragma warning disable CS8603 // Mögliche Nullverweisrückgabe.
|
||||
return JsonConvert.DeserializeObject<Invoices>(contents, jsonSerializerSettings);
|
||||
#pragma warning restore CS8603 // Mögliche Nullverweisrückgabe.
|
||||
}
|
||||
|
||||
private async Task<string> GetNextInvoiceNumber()
|
||||
@@ -76,6 +78,8 @@ namespace CardmarketBot
|
||||
};
|
||||
var ob = JsonConvert.DeserializeObject<RNumbers>(contents, jsonSerializerSettings);
|
||||
|
||||
if (ob == null) return "";
|
||||
if (ob.ConfigRechnungsnummer == null) return "";
|
||||
return ob.ConfigRechnungsnummer.NextNumber;
|
||||
|
||||
}
|
||||
@@ -84,7 +88,7 @@ namespace CardmarketBot
|
||||
[DataContract]
|
||||
class RNumbers
|
||||
{
|
||||
[JsonProperty("objects")] public ConfigRechnungnummer ConfigRechnungsnummer { get; set; }
|
||||
[JsonProperty("objects")] public ConfigRechnungnummer? ConfigRechnungsnummer { get; set; }
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
12
CardMarketBot/SocketClient.cs
Normal file
12
CardMarketBot/SocketClient.cs
Normal 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
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.6.33815.320
|
||||
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
|
||||
Global
|
||||
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}.Release|Any CPU.ActiveCfg = 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
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
23
CardMarketBotTests/CardMarketBotTests.csproj
Normal file
23
CardMarketBotTests/CardMarketBotTests.csproj
Normal 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>
|
||||
32
CardMarketBotTests/HelperTests.cs
Normal file
32
CardMarketBotTests/HelperTests.cs
Normal file
File diff suppressed because one or more lines are too long
@@ -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>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
*/
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
|
|
4
StartDenHugo.bat
Normal file
4
StartDenHugo.bat
Normal file
@@ -0,0 +1,4 @@
|
||||
@echo off
|
||||
|
||||
git pull
|
||||
dotnet run --project CardMarketBot
|
||||
Reference in New Issue
Block a user