|
|
|
@ -1,5 +1,3 @@
|
|
|
|
// using DocumentFormat.OpenXml.Packaging;
|
|
|
|
|
|
|
|
// using DocumentFormat.OpenXml.Wordprocessing;
|
|
|
|
|
|
|
|
using Gremlin_BlazorServer.Data.EntityClasses;
|
|
|
|
using Gremlin_BlazorServer.Data.EntityClasses;
|
|
|
|
using Gremlin_BlazorServer.Services;
|
|
|
|
using Gremlin_BlazorServer.Services;
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
@ -26,7 +24,7 @@ namespace Gremlin_BlazorServer.Data.DBClasses
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mySqlConnection = new MySqlConnection(connectionString);
|
|
|
|
mySqlConnection = new(connectionString);
|
|
|
|
mySqlConnection.Open();
|
|
|
|
mySqlConnection.Open();
|
|
|
|
isConnected = true;
|
|
|
|
isConnected = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -172,11 +170,11 @@ namespace Gremlin_BlazorServer.Data.DBClasses
|
|
|
|
EMail = "CustomerCare_Germany@agilent.com",
|
|
|
|
EMail = "CustomerCare_Germany@agilent.com",
|
|
|
|
PhoneNumber = "+49 800 6031000",
|
|
|
|
PhoneNumber = "+49 800 6031000",
|
|
|
|
DataStatus = Status.Active.ToString(),
|
|
|
|
DataStatus = Status.Active.ToString(),
|
|
|
|
AccountType = new AccountType()
|
|
|
|
AccountType = new()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AccountTypeCode = "SUP"
|
|
|
|
AccountTypeCode = "SUP"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
SubMarket = new SubMarket()
|
|
|
|
SubMarket = new()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SubMarketCode = "VEN"
|
|
|
|
SubMarketCode = "VEN"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -194,11 +192,11 @@ namespace Gremlin_BlazorServer.Data.DBClasses
|
|
|
|
EMail = "",
|
|
|
|
EMail = "",
|
|
|
|
PhoneNumber = "+44 1354 694377",
|
|
|
|
PhoneNumber = "+44 1354 694377",
|
|
|
|
DataStatus = Status.Active.ToString(),
|
|
|
|
DataStatus = Status.Active.ToString(),
|
|
|
|
AccountType = new AccountType()
|
|
|
|
AccountType = new()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AccountTypeCode = "SUP"
|
|
|
|
AccountTypeCode = "SUP"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
SubMarket = new SubMarket()
|
|
|
|
SubMarket = new()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SubMarketCode = "VAR"
|
|
|
|
SubMarketCode = "VAR"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -216,11 +214,11 @@ namespace Gremlin_BlazorServer.Data.DBClasses
|
|
|
|
EMail = "sales@huber-online.com",
|
|
|
|
EMail = "sales@huber-online.com",
|
|
|
|
PhoneNumber = "0781 96030",
|
|
|
|
PhoneNumber = "0781 96030",
|
|
|
|
DataStatus = Status.Active.ToString(),
|
|
|
|
DataStatus = Status.Active.ToString(),
|
|
|
|
AccountType = new AccountType()
|
|
|
|
AccountType = new()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AccountTypeCode = "SUP"
|
|
|
|
AccountTypeCode = "SUP"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
SubMarket = new SubMarket()
|
|
|
|
SubMarket = new()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SubMarketCode = "SUP"
|
|
|
|
SubMarketCode = "SUP"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -238,11 +236,11 @@ namespace Gremlin_BlazorServer.Data.DBClasses
|
|
|
|
EMail = "info@vdh-online.com",
|
|
|
|
EMail = "info@vdh-online.com",
|
|
|
|
PhoneNumber = "05265 945520",
|
|
|
|
PhoneNumber = "05265 945520",
|
|
|
|
DataStatus = Status.Active.ToString(),
|
|
|
|
DataStatus = Status.Active.ToString(),
|
|
|
|
AccountType = new AccountType()
|
|
|
|
AccountType = new()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AccountTypeCode = "SUP"
|
|
|
|
AccountTypeCode = "SUP"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
SubMarket = new SubMarket()
|
|
|
|
SubMarket = new()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SubMarketCode = "SUP"
|
|
|
|
SubMarketCode = "SUP"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -260,11 +258,11 @@ namespace Gremlin_BlazorServer.Data.DBClasses
|
|
|
|
EMail = "",
|
|
|
|
EMail = "",
|
|
|
|
PhoneNumber = "+45 36 78 41 85",
|
|
|
|
PhoneNumber = "+45 36 78 41 85",
|
|
|
|
DataStatus = Status.Active.ToString(),
|
|
|
|
DataStatus = Status.Active.ToString(),
|
|
|
|
AccountType = new AccountType()
|
|
|
|
AccountType = new()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AccountTypeCode = "SUP"
|
|
|
|
AccountTypeCode = "SUP"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
SubMarket = new SubMarket()
|
|
|
|
SubMarket = new()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SubMarketCode = "SUP"
|
|
|
|
SubMarketCode = "SUP"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -283,11 +281,11 @@ namespace Gremlin_BlazorServer.Data.DBClasses
|
|
|
|
PhoneNumber = "07551 932696",
|
|
|
|
PhoneNumber = "07551 932696",
|
|
|
|
FaxNumber = "07551-932699",
|
|
|
|
FaxNumber = "07551-932699",
|
|
|
|
DataStatus = Status.Active.ToString(),
|
|
|
|
DataStatus = Status.Active.ToString(),
|
|
|
|
AccountType = new AccountType()
|
|
|
|
AccountType = new()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AccountTypeCode = "SUP"
|
|
|
|
AccountTypeCode = "SUP"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
SubMarket = new SubMarket()
|
|
|
|
SubMarket = new()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SubMarketCode = "SUP"
|
|
|
|
SubMarketCode = "SUP"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -305,11 +303,11 @@ namespace Gremlin_BlazorServer.Data.DBClasses
|
|
|
|
EMail = "info.de@hellma.com",
|
|
|
|
EMail = "info.de@hellma.com",
|
|
|
|
PhoneNumber = "07631 1820",
|
|
|
|
PhoneNumber = "07631 1820",
|
|
|
|
DataStatus = Status.Active.ToString(),
|
|
|
|
DataStatus = Status.Active.ToString(),
|
|
|
|
AccountType = new AccountType()
|
|
|
|
AccountType = new()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AccountTypeCode = "SUP"
|
|
|
|
AccountTypeCode = "SUP"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
SubMarket = new SubMarket()
|
|
|
|
SubMarket = new()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SubMarketCode = "SUP"
|
|
|
|
SubMarketCode = "SUP"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -327,11 +325,11 @@ namespace Gremlin_BlazorServer.Data.DBClasses
|
|
|
|
EMail = "",
|
|
|
|
EMail = "",
|
|
|
|
PhoneNumber = "-/-",
|
|
|
|
PhoneNumber = "-/-",
|
|
|
|
DataStatus = Status.Active.ToString(),
|
|
|
|
DataStatus = Status.Active.ToString(),
|
|
|
|
AccountType = new AccountType()
|
|
|
|
AccountType = new()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AccountTypeCode = "SUP"
|
|
|
|
AccountTypeCode = "SUP"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
SubMarket = new SubMarket()
|
|
|
|
SubMarket = new()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SubMarketCode = "SUP"
|
|
|
|
SubMarketCode = "SUP"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -350,11 +348,11 @@ namespace Gremlin_BlazorServer.Data.DBClasses
|
|
|
|
PhoneNumber = "+1 608 274 2721",
|
|
|
|
PhoneNumber = "+1 608 274 2721",
|
|
|
|
FaxNumber = "+1 608 274 0103",
|
|
|
|
FaxNumber = "+1 608 274 0103",
|
|
|
|
DataStatus = Status.Active.ToString(),
|
|
|
|
DataStatus = Status.Active.ToString(),
|
|
|
|
AccountType = new AccountType()
|
|
|
|
AccountType = new()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AccountTypeCode = "SUP"
|
|
|
|
AccountTypeCode = "SUP"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
SubMarket = new SubMarket()
|
|
|
|
SubMarket = new()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SubMarketCode = "SUP"
|
|
|
|
SubMarketCode = "SUP"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -614,7 +612,7 @@ namespace Gremlin_BlazorServer.Data.DBClasses
|
|
|
|
int year = Convert.ToInt32(fields[12].Substring(0, 4), CultureInfo.CurrentCulture);
|
|
|
|
int year = Convert.ToInt32(fields[12].Substring(0, 4), CultureInfo.CurrentCulture);
|
|
|
|
int month = Convert.ToInt32(fields[12].Substring(4, 2), CultureInfo.CurrentCulture);
|
|
|
|
int month = Convert.ToInt32(fields[12].Substring(4, 2), CultureInfo.CurrentCulture);
|
|
|
|
int day = Convert.ToInt32(fields[12].Substring(6, 2), CultureInfo.CurrentCulture);
|
|
|
|
int day = Convert.ToInt32(fields[12].Substring(6, 2), CultureInfo.CurrentCulture);
|
|
|
|
importedContact.SapContactCreationDate = new DateTime(year, month, day);
|
|
|
|
importedContact.SapContactCreationDate = new(year, month, day);
|
|
|
|
|
|
|
|
|
|
|
|
//Convert "No Phone Calls"
|
|
|
|
//Convert "No Phone Calls"
|
|
|
|
if (fields[26] == "1")
|
|
|
|
if (fields[26] == "1")
|
|
|
|
@ -766,7 +764,7 @@ namespace Gremlin_BlazorServer.Data.DBClasses
|
|
|
|
int year = Convert.ToInt32(fields[8].Substring(0, 4));
|
|
|
|
int year = Convert.ToInt32(fields[8].Substring(0, 4));
|
|
|
|
int month = Convert.ToInt32(fields[8].Substring(4, 2));
|
|
|
|
int month = Convert.ToInt32(fields[8].Substring(4, 2));
|
|
|
|
int day = Convert.ToInt32(fields[8].Substring(6, 2));
|
|
|
|
int day = Convert.ToInt32(fields[8].Substring(6, 2));
|
|
|
|
importedAccount.AccountCreatedInSapOn = new DateTime(year, month, day);
|
|
|
|
importedAccount.AccountCreatedInSapOn = new(year, month, day);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//keine Konvertierung nötig:
|
|
|
|
//keine Konvertierung nötig:
|
|
|
|
@ -939,7 +937,7 @@ namespace Gremlin_BlazorServer.Data.DBClasses
|
|
|
|
int year = Convert.ToInt32(fields[columnNumberOf["AccountCreatedInSAPOn"]].Substring(0, 4));
|
|
|
|
int year = Convert.ToInt32(fields[columnNumberOf["AccountCreatedInSAPOn"]].Substring(0, 4));
|
|
|
|
int month = Convert.ToInt32(fields[columnNumberOf["AccountCreatedInSAPOn"]].Substring(4, 2));
|
|
|
|
int month = Convert.ToInt32(fields[columnNumberOf["AccountCreatedInSAPOn"]].Substring(4, 2));
|
|
|
|
int day = Convert.ToInt32(fields[columnNumberOf["AccountCreatedInSAPOn"]].Substring(6, 2));
|
|
|
|
int day = Convert.ToInt32(fields[columnNumberOf["AccountCreatedInSAPOn"]].Substring(6, 2));
|
|
|
|
importedAccount.AccountCreatedInSapOn = new DateTime(year, month, day);
|
|
|
|
importedAccount.AccountCreatedInSapOn = new(year, month, day);
|
|
|
|
|
|
|
|
|
|
|
|
//Convert City von Großschreibung zu Normalschreibung
|
|
|
|
//Convert City von Großschreibung zu Normalschreibung
|
|
|
|
importedAccount.City = fields[columnNumberOf["City"]].First().ToString() + fields[columnNumberOf["City"]].Substring(1).ToLower();
|
|
|
|
importedAccount.City = fields[columnNumberOf["City"]].First().ToString() + fields[columnNumberOf["City"]].Substring(1).ToLower();
|
|
|
|
@ -1029,7 +1027,7 @@ namespace Gremlin_BlazorServer.Data.DBClasses
|
|
|
|
year = Convert.ToInt32(fields[columnNumberOf["AccountCreatedInSAPOn"]].Substring(0, 4));
|
|
|
|
year = Convert.ToInt32(fields[columnNumberOf["AccountCreatedInSAPOn"]].Substring(0, 4));
|
|
|
|
month = Convert.ToInt32(fields[columnNumberOf["AccountCreatedInSAPOn"]].Substring(4, 2));
|
|
|
|
month = Convert.ToInt32(fields[columnNumberOf["AccountCreatedInSAPOn"]].Substring(4, 2));
|
|
|
|
day = Convert.ToInt32(fields[columnNumberOf["AccountCreatedInSAPOn"]].Substring(6, 2));
|
|
|
|
day = Convert.ToInt32(fields[columnNumberOf["AccountCreatedInSAPOn"]].Substring(6, 2));
|
|
|
|
importedContact.SapContactCreationDate = new DateTime(year, month, day);
|
|
|
|
importedContact.SapContactCreationDate = new(year, month, day);
|
|
|
|
|
|
|
|
|
|
|
|
//Convert "No Phone Calls"
|
|
|
|
//Convert "No Phone Calls"
|
|
|
|
if (fields[columnNumberOf["NoPhoneCalls"]] == "1")
|
|
|
|
if (fields[columnNumberOf["NoPhoneCalls"]] == "1")
|
|
|
|
@ -1899,72 +1897,72 @@ namespace Gremlin_BlazorServer.Data.DBClasses
|
|
|
|
public static Account ResolveAccountByName(GremlinContext context, string accountName)
|
|
|
|
public static Account ResolveAccountByName(GremlinContext context, string accountName)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try { return context.Accounts.Include(account => account.AccountType).Include(account => account.SubMarket).First(account => account.AccountName == accountName); }
|
|
|
|
try { return context.Accounts.Include(account => account.AccountType).Include(account => account.SubMarket).First(account => account.AccountName == accountName); }
|
|
|
|
catch { return new Account(); }
|
|
|
|
catch { return new(); }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static Account ResolveAccountById(GremlinContext context, uint accountId)
|
|
|
|
public static Account ResolveAccountById(GremlinContext context, uint accountId)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try { return context.Accounts.First(account => account.SapAccountNumber == accountId); }
|
|
|
|
try { return context.Accounts.First(account => account.SapAccountNumber == accountId); }
|
|
|
|
catch { return new Account(); }
|
|
|
|
catch { return new(); }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static Account ResolveAccountById(GremlinContext context, string accountId)
|
|
|
|
public static Account ResolveAccountById(GremlinContext context, string accountId)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try { return context.Accounts.First(account => account.SapAccountNumber == Convert.ToUInt32(accountId)); }
|
|
|
|
try { return context.Accounts.First(account => account.SapAccountNumber == Convert.ToUInt32(accountId)); }
|
|
|
|
catch { return new Account(); }
|
|
|
|
catch { return new(); }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static AccountType ResolveAccountType(GremlinContext context, string accountTypeCode)
|
|
|
|
public static AccountType ResolveAccountType(GremlinContext context, string accountTypeCode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try { return context.AccountTypes.First(account => account.AccountTypeCode == accountTypeCode); }
|
|
|
|
try { return context.AccountTypes.First(account => account.AccountTypeCode == accountTypeCode); }
|
|
|
|
catch { return new AccountType(); }
|
|
|
|
catch { return new(); }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static SubMarket ResolveSubmarket(GremlinContext context, string subMarketCode)
|
|
|
|
public static SubMarket ResolveSubmarket(GremlinContext context, string subMarketCode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try { return context.SubMarkets.First(submarket => submarket.SubMarketCode == subMarketCode); }
|
|
|
|
try { return context.SubMarkets.First(submarket => submarket.SubMarketCode == subMarketCode); }
|
|
|
|
catch { return new SubMarket(); }
|
|
|
|
catch { return new(); }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public static Product GetProduct(GremlinContext context, string productNumber, string optionNumber)
|
|
|
|
public static Product GetProduct(GremlinContext context, string productNumber, string optionNumber)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try { return context.Products.Include(product => product.ProductLine).Include(product => product.CustomDescription).First(product => product.ProductNumber == productNumber && product.OptionNumber == optionNumber); }
|
|
|
|
try { return context.Products.Include(product => product.ProductLine).Include(product => product.CustomDescription).First(product => product.ProductNumber == productNumber && product.OptionNumber == optionNumber); }
|
|
|
|
catch { return new Product(); }
|
|
|
|
catch { return new(); }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static Product ResolveProduct(GremlinContext context, string productNumber, string option)
|
|
|
|
public static Product ResolveProduct(GremlinContext context, string productNumber, string option)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try { return context.Products.First(product => product.ProductNumber == productNumber && product.OptionNumber == option); }
|
|
|
|
try { return context.Products.First(product => product.ProductNumber == productNumber && product.OptionNumber == option); }
|
|
|
|
catch { return new Product(); }
|
|
|
|
catch { return new(); }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static ProductLine ResolveProductLine(GremlinContext context, string productLineCode)
|
|
|
|
public static ProductLine ResolveProductLine(GremlinContext context, string productLineCode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try { return context.ProductLines.First(productline => productline.ProductLineCode == productLineCode); }
|
|
|
|
try { return context.ProductLines.First(productline => productline.ProductLineCode == productLineCode); }
|
|
|
|
catch { return new ProductLine(); }
|
|
|
|
catch { return new(); }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static string RandomString(int length)
|
|
|
|
private static string RandomString(int length)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
|
|
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
|
|
return new string(Enumerable.Repeat(chars, length).Select(s => s[random.Next(s.Length)]).ToArray());
|
|
|
|
return new(Enumerable.Repeat(chars, length).Select(s => s[random.Next(s.Length)]).ToArray());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static Contact GetContact(GremlinContext context, string lastName)
|
|
|
|
public static Contact GetContact(GremlinContext context, string lastName)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try { return context.Contacts.First(contact => contact.LastName == lastName); }
|
|
|
|
try { return context.Contacts.First(contact => contact.LastName == lastName); }
|
|
|
|
catch { return new Contact(); }
|
|
|
|
catch { return new(); }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static Contact GetContact(GremlinContext context, uint contactId)
|
|
|
|
public static Contact GetContact(GremlinContext context, uint contactId)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try { return context.Contacts.First(contact => contact.ContactId == contactId); }
|
|
|
|
try { return context.Contacts.First(contact => contact.ContactId == contactId); }
|
|
|
|
catch { return new Contact(); }
|
|
|
|
catch { return new(); }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
internal static List<Contact> GetAllContacts(GremlinContext context)
|
|
|
|
internal static List<Contact> GetAllContacts(GremlinContext context)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try { return context.Contacts.Where(contact => contact.LastName != "").ToList(); }
|
|
|
|
try { return context.Contacts.Where(contact => contact.LastName != "").ToList(); }
|
|
|
|
catch { return new List<Contact>(); }
|
|
|
|
catch { return new(); }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|