change byte Gender in ViewModels to Enum.Gender

pull/1/head
Sascha Woitschetzki 2021-07-16 12:36:25 +07:00
parent 612411ca34
commit c206b84b73
22 changed files with 114 additions and 125 deletions

@ -1119,7 +1119,7 @@ namespace Gremlin.GremlinData.DBClasses
ImportedCD.Supplier = new(); ImportedCD.Supplier = new();
ImportedCD.Supplier.AccountName = fields[2] is "" or "RB" ? "Agilent Technologies" : fields[2]; ImportedCD.Supplier.AccountName = fields[2] is "" or "RB" ? "Agilent Technologies" : fields[2];
MetaDataSetter.ForImport(ImportedCD, "Importer", "Initial Importer by CD-ImporterFomCsv"); MetaDataSetter.ForImport(ImportedCD, "Importer", "Initial Importer by CD-ImporterFomCsv");
CDsReadFromFile.Add(ImportedCD); CDsReadFromFile.Add(ImportedCD);
} }
@ -1361,7 +1361,7 @@ namespace Gremlin.GremlinData.DBClasses
.Where(p => p.DataStatus == Status.Active.ToString()) .Where(p => p.DataStatus == Status.Active.ToString())
.Include(p => p.ProductLine) .Include(p => p.ProductLine)
.ToList(); .ToList();
//Neue CPL einlesen... //Neue CPL einlesen...
List<Product> ProductsReadFromFile = new(ParseProductFile(filepath, separator, dataHasHeading)); List<Product> ProductsReadFromFile = new(ParseProductFile(filepath, separator, dataHasHeading));
@ -1915,7 +1915,7 @@ namespace Gremlin.GremlinData.DBClasses
public static Product ResolveProduct(GremlinContext context, string productNumber, string option) public static Product ResolveProduct(GremlinContext context, string productNumber, string option)
{ {
try {return context.Products.Where(product => product.ProductNumber == productNumber && product.OptionNumber == option).First(); } try { return context.Products.Where(product => product.ProductNumber == productNumber && product.OptionNumber == option).First(); }
catch { return null; } catch { return null; }
} }

@ -14,11 +14,11 @@ namespace Gremlin.GremlinData.DBClasses
entity.HasOne(d => d.AccountType).WithMany(p => p.Accounts).IsRequired(true).OnDelete(DeleteBehavior.Restrict); entity.HasOne(d => d.AccountType).WithMany(p => p.Accounts).IsRequired(true).OnDelete(DeleteBehavior.Restrict);
entity.HasOne(d => d.SubMarket).WithMany(p => p.Accounts).IsRequired(true).OnDelete(DeleteBehavior.Restrict); entity.HasOne(d => d.SubMarket).WithMany(p => p.Accounts).IsRequired(true).OnDelete(DeleteBehavior.Restrict);
entity.HasAlternateKey(e => e.SAPAccountNumber); // =Unique entity.HasAlternateKey(e => e.SAPAccountNumber); // =Unique
entity.Property(e => e.AccountId).ValueGeneratedOnAdd(); entity.Property(e => e.AccountId).ValueGeneratedOnAdd();
entity.Property(e => e.ParentAccountId); entity.Property(e => e.ParentAccountId);
entity.Property(e => e.AccountName).IsRequired(true).HasMaxLength(250); entity.Property(e => e.AccountName).IsRequired(true).HasMaxLength(250);
//.HasColumnType("VARCHAR(250)") ist überflüssig, da .HasMaxLength(250) VARCHAR(250) impliziert. //.HasColumnType("VARCHAR(250)") ist überflüssig, da .HasMaxLength(250) VARCHAR(250) impliziert.
entity.Property(e => e.Notes); entity.Property(e => e.Notes);
entity.Property(e => e.Street).IsRequired(true).HasMaxLength(100); entity.Property(e => e.Street).IsRequired(true).HasMaxLength(100);
entity.Property(e => e.ZIP).IsRequired(true).HasColumnType("Char(5)"); entity.Property(e => e.ZIP).IsRequired(true).HasColumnType("Char(5)");
@ -32,16 +32,16 @@ namespace Gremlin.GremlinData.DBClasses
entity.Property(e => e.EMail).HasMaxLength(150); entity.Property(e => e.EMail).HasMaxLength(150);
entity.Property(e => e.SAPAccountNumber).IsRequired(true); entity.Property(e => e.SAPAccountNumber).IsRequired(true);
entity.Property(e => e.AccountCreatedInSAPOn).IsRequired(true); entity.Property(e => e.AccountCreatedInSAPOn).IsRequired(true);
entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd(); entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd(); entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd(); entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
entity.Property(e => e.DataVersionNumber).HasDefaultValue(1).IsRequired(true); entity.Property(e => e.DataVersionNumber).HasDefaultValue(1).IsRequired(true);
entity.Property(e => e.DataVersionComment).HasDefaultValue(""); entity.Property(e => e.DataVersionComment).HasDefaultValue("");
entity.Property(e => e.DataStatus).IsRequired(true); entity.Property(e => e.DataStatus).IsRequired(true);
//.HasDefaultValue("Active") //Default-Wert wird nicht gesetzt?!? Bug in EF Core? //.HasDefaultValue("Active") //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
entity.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true); entity.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
//.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true) //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
entity.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").IsRequired(true).HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()"); entity.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").IsRequired(true).HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
} }
} }
@ -53,7 +53,7 @@ namespace Gremlin.GremlinData.DBClasses
entity.HasKey(e => e.ContactId); entity.HasKey(e => e.ContactId);
entity.HasOne(p => p.Account).WithMany(d => d.Contacts).IsRequired(true); entity.HasOne(p => p.Account).WithMany(d => d.Contacts).IsRequired(true);
//entity.HasAlternateKey(e => e.SAPContactNumber); //entity.HasAlternateKey(e => e.SAPContactNumber);
entity.Property(e => e.ContactId); entity.Property(e => e.ContactId);
entity.Property(e => e.SAPContactNumber).IsRequired(true); entity.Property(e => e.SAPContactNumber).IsRequired(true);
entity.Property(e => e.AcademicTitle); entity.Property(e => e.AcademicTitle);
@ -65,7 +65,7 @@ namespace Gremlin.GremlinData.DBClasses
entity.Property(e => e.IsReference).HasDefaultValue(false); entity.Property(e => e.IsReference).HasDefaultValue(false);
entity.Property(e => e.Notes); entity.Property(e => e.Notes);
entity.Property(e => e.ValidatedContact).HasDefaultValue(false); entity.Property(e => e.ValidatedContact).HasDefaultValue(false);
entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd(); entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd(); entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd(); entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
@ -86,12 +86,12 @@ namespace Gremlin.GremlinData.DBClasses
{ {
entity.HasKey(e => e.QuoteId); entity.HasKey(e => e.QuoteId);
entity.HasMany(d => d.LineItems).WithOne(p => p.Quote).IsRequired(false).OnDelete(DeleteBehavior.Cascade); entity.HasMany(d => d.LineItems).WithOne(p => p.Quote).IsRequired(false).OnDelete(DeleteBehavior.Cascade);
entity.Property(e => e.QuotationNumber).HasColumnType("VARCHAR(255)").IsRequired(true).ValueGeneratedOnAdd(); entity.Property(e => e.QuotationNumber).HasColumnType("VARCHAR(255)").IsRequired(true).ValueGeneratedOnAdd();
entity.Property(e => e.QuotationDate).IsRequired(true).ValueGeneratedOnAdd(); entity.Property(e => e.QuotationDate).IsRequired(true).ValueGeneratedOnAdd();
entity.Property(e => e.ValidUntil); entity.Property(e => e.ValidUntil);
entity.Property(e => e.ValidFor).IsRequired(true); entity.Property(e => e.ValidFor).IsRequired(true);
entity.Ignore("SalesRep"); entity.Ignore("SalesRep");
entity.Property(e => e.TotalListprice); entity.Property(e => e.TotalListprice);
@ -102,7 +102,7 @@ namespace Gremlin.GremlinData.DBClasses
entity.Property(e => e.QuoteContains3PP).HasDefaultValue(false); entity.Property(e => e.QuoteContains3PP).HasDefaultValue(false);
entity.Property(e => e.QuoteContainsRB).HasDefaultValue(false); entity.Property(e => e.QuoteContainsRB).HasDefaultValue(false);
entity.Property(e => e.QuoteTemplate); entity.Property(e => e.QuoteTemplate);
entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd(); entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd(); entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd(); entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
@ -122,7 +122,7 @@ namespace Gremlin.GremlinData.DBClasses
{ {
entity.HasKey(e => e.LineItemId); entity.HasKey(e => e.LineItemId);
entity.HasOne(p => p.Quote).WithMany(d => d.LineItems).HasForeignKey(fk => fk.QuoteId).IsRequired(true).OnDelete(DeleteBehavior.Cascade); entity.HasOne(p => p.Quote).WithMany(d => d.LineItems).HasForeignKey(fk => fk.QuoteId).IsRequired(true).OnDelete(DeleteBehavior.Cascade);
entity.Property(e => e.Position).IsRequired(true); entity.Property(e => e.Position).IsRequired(true);
entity.Property(e => e.Amount).IsRequired(true); entity.Property(e => e.Amount).IsRequired(true);
entity.Property(e => e.ProductNumber).IsRequired(true); entity.Property(e => e.ProductNumber).IsRequired(true);
@ -139,7 +139,7 @@ namespace Gremlin.GremlinData.DBClasses
entity.Property(e => e.ExtendedListPrice).IsRequired(true); entity.Property(e => e.ExtendedListPrice).IsRequired(true);
entity.Property(e => e.NetPrice).IsRequired(true); entity.Property(e => e.NetPrice).IsRequired(true);
entity.Property(e => e.Total).IsRequired(true); entity.Property(e => e.Total).IsRequired(true);
entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd(); entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd(); entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd(); entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
@ -162,7 +162,7 @@ namespace Gremlin.GremlinData.DBClasses
entity.HasOne(p => p.ProductLine).WithMany(d => d.Products).HasForeignKey("ProductLineCode").IsRequired(true).OnDelete(DeleteBehavior.Restrict); entity.HasOne(p => p.ProductLine).WithMany(d => d.Products).HasForeignKey("ProductLineCode").IsRequired(true).OnDelete(DeleteBehavior.Restrict);
entity.Property(e => e.CustomDescriptionId).IsRequired(false); entity.Property(e => e.CustomDescriptionId).IsRequired(false);
entity.Property(e => e.ProductNumber).IsRequired(true); entity.Property(e => e.ProductNumber).IsRequired(true);
entity.Property(e => e.OptionNumber); entity.Property(e => e.OptionNumber);
entity.Property(e => e.SapShortDescription); entity.Property(e => e.SapShortDescription);
@ -171,7 +171,7 @@ namespace Gremlin.GremlinData.DBClasses
entity.Property(e => e.ProductStatus); entity.Property(e => e.ProductStatus);
entity.Property(e => e.IntroductionDate); entity.Property(e => e.IntroductionDate);
entity.Property(e => e.ListPrice).IsRequired(true); entity.Property(e => e.ListPrice).IsRequired(true);
entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd(); entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd(); entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd(); entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
@ -192,7 +192,7 @@ namespace Gremlin.GremlinData.DBClasses
entity.HasKey(e => e.CustomDescriptionId); entity.HasKey(e => e.CustomDescriptionId);
entity.HasMany(p => p.Products).WithOne(d => d.CustomDescription).IsRequired(false); entity.HasMany(p => p.Products).WithOne(d => d.CustomDescription).IsRequired(false);
entity.HasOne(p => p.Supplier).WithMany(d => d.CustomDescriptions).IsRequired(true); entity.HasOne(p => p.Supplier).WithMany(d => d.CustomDescriptions).IsRequired(true);
entity.Property(e => e.ProductNumber).IsRequired(true); entity.Property(e => e.ProductNumber).IsRequired(true);
entity.Property(e => e.OptionNumber); entity.Property(e => e.OptionNumber);
entity.Property(e => e.Heading).IsRequired(true); entity.Property(e => e.Heading).IsRequired(true);
@ -218,7 +218,7 @@ namespace Gremlin.GremlinData.DBClasses
public void Configure(EntityTypeBuilder<ProductLine> entity) public void Configure(EntityTypeBuilder<ProductLine> entity)
{ {
entity.HasMany(p => p.Products).WithOne(d => d.ProductLine).IsRequired(true).OnDelete(DeleteBehavior.Restrict); entity.HasMany(p => p.Products).WithOne(d => d.ProductLine).IsRequired(true).OnDelete(DeleteBehavior.Restrict);
entity.Property(e => e.ProductLineDescription).IsRequired(true); entity.Property(e => e.ProductLineDescription).IsRequired(true);
entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd(); entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
@ -242,7 +242,7 @@ namespace Gremlin.GremlinData.DBClasses
//entity.HasMany(p => p.Accounts).WithOne(d => d.AccountType); //already defined in class Account //entity.HasMany(p => p.Accounts).WithOne(d => d.AccountType); //already defined in class Account
entity.Property(e => e.AccountTypeCode).IsRequired(true).HasColumnType("Char(3)"); entity.Property(e => e.AccountTypeCode).IsRequired(true).HasColumnType("Char(3)");
entity.Property(e => e.AccountTypeDescription).HasColumnType("Varchar(1000)").IsRequired(true); entity.Property(e => e.AccountTypeDescription).HasColumnType("Varchar(1000)").IsRequired(true);
entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd(); entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd(); entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd(); entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
@ -264,7 +264,7 @@ namespace Gremlin.GremlinData.DBClasses
//entity.HasMany(p => p.Accounts).WithOne(d => d.SubMarket); //already defined in class Account //entity.HasMany(p => p.Accounts).WithOne(d => d.SubMarket); //already defined in class Account
entity.Property(e => e.SubMarketCode).HasColumnType("Char(3)"); entity.Property(e => e.SubMarketCode).HasColumnType("Char(3)");
entity.Property(e => e.SubMarketDescription).HasColumnType("Varchar(1000)").IsRequired(true); entity.Property(e => e.SubMarketDescription).HasColumnType("Varchar(1000)").IsRequired(true);
entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd(); entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd(); entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd(); entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();

@ -18,16 +18,16 @@ namespace Gremlin.GremlinData.DBClasses
{ {
//Private members //Private members
private static readonly DateTime FarInTheFuture = DateTime.Parse("2050-12-31t00:00:00.000000z", CultureInfo.CurrentCulture); private static readonly DateTime FarInTheFuture = DateTime.Parse("2050-12-31t00:00:00.000000z", CultureInfo.CurrentCulture);
private static TextFieldParser _csvParser; private static TextFieldParser _csvParser;
private static string _filepath; private static string _filepath;
private static bool _dataHasHeadings; private static bool _dataHasHeadings;
private static Encoding _encoding = default; private static Encoding _encoding;
internal static GremlinContext db = new(); internal static GremlinContext db = new();
//Public properties //Public properties
public static string Filepath public static string Filepath
{ {
get => _filepath; get => _filepath;
set set
{ {
@ -52,7 +52,7 @@ namespace Gremlin.GremlinData.DBClasses
} }
} }
} }
public static bool DataHasHeadings public static bool DataHasHeadings
{ {
get => _dataHasHeadings; get => _dataHasHeadings;
@ -139,7 +139,7 @@ namespace Gremlin.GremlinData.DBClasses
Encoding = FileIO.GetEncoding(_filepath); Encoding = FileIO.GetEncoding(_filepath);
} }
Separators = new string[] { separator }; Separators = new string[] { separator };
ImportFile(); ImportFile();
return true; return true;
} }
@ -195,7 +195,7 @@ namespace Gremlin.GremlinData.DBClasses
score[i, j] = line.Split(candidates[j]).Length; score[i, j] = line.Split(candidates[j]).Length;
} }
} }
} }
} }
List<(string, int, float)> scoreBoard = new(); //Item1 = Separator, Item2 = Score (Anzahl aufeinanderfolgender Zeilen mit gleicher Anzahl von Fields), Item3 = Count (durchschnittliche Anzahl von Fields in Zeile) List<(string, int, float)> scoreBoard = new(); //Item1 = Separator, Item2 = Score (Anzahl aufeinanderfolgender Zeilen mit gleicher Anzahl von Fields), Item3 = Count (durchschnittliche Anzahl von Fields in Zeile)
@ -207,7 +207,7 @@ namespace Gremlin.GremlinData.DBClasses
average = 0; average = 0;
for (int i = 0; i < numberOfLinesToEvaluate - 1; i++) for (int i = 0; i < numberOfLinesToEvaluate - 1; i++)
{ {
if (score[i,j] == score[i+1,j] && score[i,j] > 1) if (score[i, j] == score[i + 1, j] && score[i, j] > 1)
{ {
x++; x++;
} }
@ -217,11 +217,11 @@ namespace Gremlin.GremlinData.DBClasses
average /= numberOfLinesToEvaluate; average /= numberOfLinesToEvaluate;
scoreBoard.Add((candidates[j], x, average)); scoreBoard.Add((candidates[j], x, average));
} }
ResetParser(); ResetParser();
return scoreBoard.Find(f => f.Item2 == scoreBoard.Max(x => x.Item2) && f.Item3 == scoreBoard.Max(x => x.Item3)).Item1; return scoreBoard.Find(f => f.Item2 == scoreBoard.Max(x => x.Item2) && f.Item3 == scoreBoard.Max(x => x.Item3)).Item1;
} }
public static bool ImportFile() public static bool ImportFile()
//Ein (möglichst) generischer Importer //Ein (möglichst) generischer Importer
//1. Dateipfad erfassen //1. Dateipfad erfassen
@ -235,11 +235,11 @@ namespace Gremlin.GremlinData.DBClasses
using (_csvParser) using (_csvParser)
{ {
//für geneerischen Code: //für geneerischen Code:
//int numberOfLines = File.ReadAllLines(filepath).Length; //int numberOfLines = File.ReadAllLines(filepath).Length;
//Assembly Gremlin = Assembly.GetExecutingAssembly(); //Assembly Gremlin = Assembly.GetExecutingAssembly();
//dynamische Spaltenzuordnung in Dictonary speichern //dynamische Spaltenzuordnung in Dictonary speichern
string[] fields = _csvParser.ReadFields(); string[] fields = _csvParser.ReadFields();
Dictionary<string, string> MappingDictionary = ReadMappingDictionaryFromFile(); Dictionary<string, string> MappingDictionary = ReadMappingDictionaryFromFile();
@ -294,7 +294,7 @@ namespace Gremlin.GremlinData.DBClasses
_filepath = filepath; _filepath = filepath;
return ImportFile(); return ImportFile();
} }
private static bool ImportCustomDescriptions(Dictionary<string, int> mappingTable) private static bool ImportCustomDescriptions(Dictionary<string, int> mappingTable)
{ {
List<CustomDescription> CDsReadFromFile = new(2500); List<CustomDescription> CDsReadFromFile = new(2500);
@ -379,7 +379,7 @@ namespace Gremlin.GremlinData.DBClasses
{ {
//Skip Desciptions, if it has been already imported above (as part from 3PP) //Skip Desciptions, if it has been already imported above (as part from 3PP)
if (thirdPartyProductsFromImportedCDs.Intersect(CD.Products).Any()) continue; if (thirdPartyProductsFromImportedCDs.Intersect(CD.Products).Any()) continue;
//Establish EF Reference. If no PN/Opt found, then skip this custom description. //Establish EF Reference. If no PN/Opt found, then skip this custom description.
//CD.Product = GetProduct(db, CD.ProductNumber, CD.OptionNumber); //ResolveXY-functions return null, if no match is found in db. //CD.Product = GetProduct(db, CD.ProductNumber, CD.OptionNumber); //ResolveXY-functions return null, if no match is found in db.
CD.Products = productsInDb.Where(product => product.ProductNumber == CD.ProductNumber && product.OptionNumber == CD.OptionNumber).ToList(); CD.Products = productsInDb.Where(product => product.ProductNumber == CD.ProductNumber && product.OptionNumber == CD.OptionNumber).ToList();
@ -399,7 +399,7 @@ namespace Gremlin.GremlinData.DBClasses
//prepare properties //prepare properties
_ = MetaDataSetter.ForImport(CD, "GenericImporter-Method", "Initial import by CSV Importer (Function GenericImporter.ImportCustomDescriptions)"); _ = MetaDataSetter.ForImport(CD, "GenericImporter-Method", "Initial import by CSV Importer (Function GenericImporter.ImportCustomDescriptions)");
//add to final list of CDs, that will go into the db. //add to final list of CDs, that will go into the db.
importedCDsWithEFReferences.Add(CD); importedCDsWithEFReferences.Add(CD);
} }
@ -412,7 +412,7 @@ namespace Gremlin.GremlinData.DBClasses
return true; return true;
} }
} }
private static bool ImportProducts(Dictionary<string, int> mappingTable) private static bool ImportProducts(Dictionary<string, int> mappingTable)
{ {
List<Product> ProductsReadFromFile = new(ParseProductFile(mappingTable)); List<Product> ProductsReadFromFile = new(ParseProductFile(mappingTable));
@ -611,10 +611,10 @@ namespace Gremlin.GremlinData.DBClasses
ImportedContact.MobileNumber = fields[columnNumberOf["MobileNumber"]]; ImportedContact.MobileNumber = fields[columnNumberOf["MobileNumber"]];
//Convert Gender //Convert Gender
ImportedContact.Gender = fields[columnNumberOf["Gender"]] == "M" ImportedContact.Gender = fields[columnNumberOf["Gender"]] == "M"
? (byte)Gender.Male ? (byte)Gender.Male
: fields[columnNumberOf["Gender"]] == "F" : fields[columnNumberOf["Gender"]] == "F"
? (byte)Gender.Female ? (byte)Gender.Female
: (byte)Gender.Unknown; : (byte)Gender.Unknown;
//Convert OptIn Status //Convert OptIn Status
@ -811,7 +811,7 @@ namespace Gremlin.GremlinData.DBClasses
//Validierten Account der Liste hinzufügen: //Validierten Account der Liste hinzufügen:
if (DataHasError == false) ImportedAccount.AddIfUniqueTo(AccountsReadFromFile); if (DataHasError == false) ImportedAccount.AddIfUniqueTo(AccountsReadFromFile);
} }
//Eingelesenen Account in DB schreiben: //Eingelesenen Account in DB schreiben:
DateTime now = DateTime.Now; DateTime now = DateTime.Now;
@ -825,7 +825,7 @@ namespace Gremlin.GremlinData.DBClasses
account.AccountType = accountType; account.AccountType = accountType;
account.AccountType = DbHelper.ResolveAccountType(db, account.AccountType.AccountTypeCode); account.AccountType = DbHelper.ResolveAccountType(db, account.AccountType.AccountTypeCode);
SubMarket subMarket = db.SubMarkets SubMarket subMarket = db.SubMarkets
.Where(a => a.SubMarketCode == account.SubMarket.SubMarketCode) .Where(a => a.SubMarketCode == account.SubMarket.SubMarketCode)
.First(); .First();
@ -842,7 +842,7 @@ namespace Gremlin.GremlinData.DBClasses
//Bestätigung senden //Bestätigung senden
MessageBox.Show($"Es wurden {AccountsReadFromFile.Count} Accounts erfolgreich der Datenbank hinzugefügt."); MessageBox.Show($"Es wurden {AccountsReadFromFile.Count} Accounts erfolgreich der Datenbank hinzugefügt.");
return true; return true;
} }
@ -858,7 +858,7 @@ namespace Gremlin.GremlinData.DBClasses
List<ProductLine> productLinesReadFromFile = new(50); List<ProductLine> productLinesReadFromFile = new(50);
using (csvParser) using (csvParser)
{ {
while (!csvParser.EndOfData) while (!csvParser.EndOfData)
{ {
ProductLine importedProductLine = new(); ProductLine importedProductLine = new();
string[] fields = csvParser.ReadFields(); string[] fields = csvParser.ReadFields();
@ -871,7 +871,7 @@ namespace Gremlin.GremlinData.DBClasses
db.ProductLines.AddRange(productLinesReadFromFile); db.ProductLines.AddRange(productLinesReadFromFile);
db.SaveChanges(); db.SaveChanges();
return true; return true;
} }
@ -898,7 +898,7 @@ namespace Gremlin.GremlinData.DBClasses
db.AccountTypes.AddRange(accountTypesReadFromFile); db.AccountTypes.AddRange(accountTypesReadFromFile);
db.SaveChanges(); db.SaveChanges();
return true; return true;
} }
@ -912,7 +912,7 @@ namespace Gremlin.GremlinData.DBClasses
List<SubMarket> subMarketsReadFromFile = new(20); List<SubMarket> subMarketsReadFromFile = new(20);
using (csvParser) using (csvParser)
{ {
while (!csvParser.EndOfData) while (!csvParser.EndOfData)
{ {
SubMarket importedSubMarket = new(); SubMarket importedSubMarket = new();
string[] fields = csvParser.ReadFields(); string[] fields = csvParser.ReadFields();
@ -925,7 +925,7 @@ namespace Gremlin.GremlinData.DBClasses
db.SubMarkets.AddRange(subMarketsReadFromFile); db.SubMarkets.AddRange(subMarketsReadFromFile);
db.SaveChanges(); db.SaveChanges();
return true; return true;
} }
@ -999,8 +999,8 @@ namespace Gremlin.GremlinData.DBClasses
{ {
//Unfertiger, generischer Code aus der ImportFile() Methode. //Unfertiger, generischer Code aus der ImportFile() Methode.
//Aufbewahren für später, wenn Zeit ist, das ordentlich zu machen. //Aufbewahren für später, wenn Zeit ist, das ordentlich zu machen.
//while (!csvParser.EndOfData) //while (!csvParser.EndOfData)
//{ //{
// //read // //read

@ -9,12 +9,12 @@ namespace Gremlin.GremlinData.DBClasses
{ {
public static class MetaDataSetter public static class MetaDataSetter
{ {
private static readonly DateTime FarInTheFuture = DateTime.Parse("2050-12-31t00:00:00.000000z", CultureInfo.CurrentCulture); private static readonly DateTime FarInTheFuture = DateTime.Parse("2050-12-31t00:00:00.000000z", CultureInfo.CurrentCulture);
public static IMetadata ForImport( public static IMetadata ForImport(
IMetadata entity, IMetadata entity,
string datamodifiedby = "", string datamodifiedby = "",
string dataversioncomment = "", string dataversioncomment = "",
[CallerMemberName] string callername = "") [CallerMemberName] string callername = "")
{ {
SetMetaData(entity, datamodifiedby, dataversioncomment, callername); SetMetaData(entity, datamodifiedby, dataversioncomment, callername);

@ -15,7 +15,7 @@ namespace Gremlin.GremlinData.EntityClasses
public AccountType AccountType { get; set; } public AccountType AccountType { get; set; }
public SubMarket SubMarket { get; set; } public SubMarket SubMarket { get; set; }
public IList<CustomDescription> CustomDescriptions { get; set; } public IList<CustomDescription> CustomDescriptions { get; set; }
//class properties: //class properties:
public string AccountName { get; set; } public string AccountName { get; set; }
public string Notes { get; set; } public string Notes { get; set; }

@ -34,7 +34,7 @@ namespace Gremlin.GremlinData.EntityClasses
public bool EmailBounced { get; set; } public bool EmailBounced { get; set; }
public bool NoHardcopyMailing { get; set; } public bool NoHardcopyMailing { get; set; }
public bool ValidatedContact { get; set; } public bool ValidatedContact { get; set; }
//Agilent-specific Properties: //Agilent-specific Properties:
public int SAPContactNumber { get; set; } public int SAPContactNumber { get; set; }
public DateTime SAPContactCreationDate { get; set; } public DateTime SAPContactCreationDate { get; set; }
@ -44,7 +44,7 @@ namespace Gremlin.GremlinData.EntityClasses
public string SAPApplicationInterest { get; set; } public string SAPApplicationInterest { get; set; }
public string SAPJobLevel { get; set; } public string SAPJobLevel { get; set; }
public string SAPCompetitiveIBase { get; set; } public string SAPCompetitiveIBase { get; set; }
//metadata: //metadata:
public DateTime DataCreationDate { get; set; } public DateTime DataCreationDate { get; set; }
public DateTime DataModificationDate { get; set; } public DateTime DataModificationDate { get; set; }
@ -54,7 +54,7 @@ namespace Gremlin.GremlinData.EntityClasses
public uint DataVersionNumber { get; set; } public uint DataVersionNumber { get; set; }
public string DataVersionComment { get; set; } public string DataVersionComment { get; set; }
public string DataStatus { get; set; } public string DataStatus { get; set; }
public Contact() public Contact()
{ {
} }

@ -7,7 +7,7 @@ namespace Gremlin.GremlinData.EntityClasses
{ {
//primary key: //primary key:
public uint CustomDescriptionId { get; set; } public uint CustomDescriptionId { get; set; }
//foreign keys: //foreign keys:
//public uint ProductId { get; set; } //public uint ProductId { get; set; }
public uint AccountId { get; set; } public uint AccountId { get; set; }
@ -23,7 +23,7 @@ namespace Gremlin.GremlinData.EntityClasses
public string DescriptionText { get; set; } public string DescriptionText { get; set; }
public string CoverletterText { get; set; } public string CoverletterText { get; set; }
public string Notes { get; set; } //Hinweise, Tipps, Caveats, etc. für Konfiguration, Verwendung, Best Practice usw. public string Notes { get; set; } //Hinweise, Tipps, Caveats, etc. für Konfiguration, Verwendung, Best Practice usw.
//Agilent-Specific properties: //Agilent-Specific properties:
//NONE //NONE

@ -1,6 +1,6 @@
namespace Gremlin.GremlinData.EntityClasses namespace Gremlin.GremlinData.EntityClasses
{ {
internal class Enums public class Enums
{ {
public enum Status : byte public enum Status : byte
{ {

@ -30,7 +30,7 @@ namespace Gremlin.GremlinData.EntityClasses
public decimal ExtendedListPrice { get; set; } public decimal ExtendedListPrice { get; set; }
public decimal NetPrice { get; set; } public decimal NetPrice { get; set; }
public decimal Total { get; set; } public decimal Total { get; set; }
//metadata: //metadata:
public DateTime DataCreationDate { get; set; } public DateTime DataCreationDate { get; set; }
public string DataModificationByUser { get; set; } public string DataModificationByUser { get; set; }

@ -14,7 +14,7 @@ namespace Gremlin.GremlinData.EntityClasses
//foreign keys //foreign keys
public uint? CustomDescriptionId { get; set; } public uint? CustomDescriptionId { get; set; }
public string ProductLineCode { get; set; } public string ProductLineCode { get; set; }
//Agilent-specific properties: //Agilent-specific properties:
public string ProductNumber { get; set; } public string ProductNumber { get; set; }
public string OptionNumber { get; set; } public string OptionNumber { get; set; }

@ -10,11 +10,11 @@ namespace Gremlin.GremlinData.EntityClasses
//foreign keys: //foreign keys:
public uint? ContactId { get; set; } public uint? ContactId { get; set; }
//navigation properties: //navigation properties:
public Contact Recipient { get; set; } public Contact Recipient { get; set; }
public IList<LineItem> LineItems { get; set; } public IList<LineItem> LineItems { get; set; }
//class properties: //class properties:
public Contact SalesRep { get; set; } public Contact SalesRep { get; set; }
public string QuotationNumber { get; set; } public string QuotationNumber { get; set; }

@ -14,7 +14,7 @@ namespace Gremlin.GremlinData.EntityClasses
//class properties //class properties
public string UserName { get; set; } public string UserName { get; set; }
public string PasswordHash { get; set; } public string PasswordHash { get; set; }
//metadata (subset of IMetadata) //metadata (subset of IMetadata)
public DateTime DataCreationDate { get; set; } public DateTime DataCreationDate { get; set; }
public DateTime DataModificationDate { get; set; } public DateTime DataModificationDate { get; set; }

@ -77,7 +77,7 @@ namespace Gremlin.GremlinUtilities
// mail.Subject = quoteVM.QuoteNumber; // mail.Subject = quoteVM.QuoteNumber;
// Outlook.AddressEntry currentUser = application.Session.CurrentUser.AddressEntry; // Outlook.AddressEntry currentUser = application.Session.CurrentUser.AddressEntry;
// if (currentUser.Type == "EX") // if (currentUser.Type == "EX")
// { // {
// Outlook.ExchangeUser manager = currentUser.GetExchangeUser().GetExchangeUserManager(); // Outlook.ExchangeUser manager = currentUser.GetExchangeUser().GetExchangeUserManager();

@ -13,21 +13,21 @@ namespace Gremlin.GremlinUtilities.GUClasses
private int _score = 0; private int _score = 0;
private bool _allQualifierMatched = false; private bool _allQualifierMatched = false;
public string DataType public string DataType
{ {
get => _dataType; get => _dataType;
} }
public List<string> Qualifiers public List<string> Qualifiers
{ {
get => _qualifiers; get => _qualifiers;
} }
public int Score public int Score
{ {
get => _score; get => _score;
} }
public bool AllQualifierMatched public bool AllQualifierMatched
{ {
get => _allQualifierMatched; get => _allQualifierMatched;
@ -64,7 +64,7 @@ namespace Gremlin.GremlinUtilities.GUClasses
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
return obj is DataIdType type return obj is DataIdType type
&& _dataType == type._dataType; && _dataType == type._dataType;
} }

@ -10,7 +10,7 @@ namespace Gremlin.GremlinUtilities.GUClasses
//private readonly string _source; //Qualifier-Liste //private readonly string _source; //Qualifier-Liste
private readonly Dictionary<string, int> _mappingTable; //Mapping Spaltenzahl <-> Property/(übersetzte) Spaltenüberschrift private readonly Dictionary<string, int> _mappingTable; //Mapping Spaltenzahl <-> Property/(übersetzte) Spaltenüberschrift
public List<DataIdType> DataTypes { get; set; } public List<DataIdType> DataTypes { get; set; }
public DataIdentificator(Dictionary<string, int> MappingTable) public DataIdentificator(Dictionary<string, int> MappingTable)
{ {
@ -88,10 +88,10 @@ namespace Gremlin.GremlinUtilities.GUClasses
{ {
if (winners.Contains("ProductLine")) winners.Remove("ProductLine"); if (winners.Contains("ProductLine")) winners.Remove("ProductLine");
if (winners.Contains("AccountType")) winners.Remove("AccountType"); if (winners.Contains("AccountType")) winners.Remove("AccountType");
if (winners.Contains("SubMarket")) winners.Remove("SubMarket"); if (winners.Contains("SubMarket")) winners.Remove("SubMarket");
if (winners.Contains("Account")) winners.Remove("Account"); if (winners.Contains("Account")) winners.Remove("Account");
if (winners.Contains("Contact")) winners.Remove("Contact"); if (winners.Contains("Contact")) winners.Remove("Contact");
} }
if (MustMatchAllQualifer == true && winners.Contains("Account")) if (MustMatchAllQualifer == true && winners.Contains("Account"))

@ -12,7 +12,7 @@ namespace Gremlin.MVVM
{ {
private string _filepath; private string _filepath;
private string _encodingName; private string _encodingName;
public DataImport() public DataImport()
{ {
InitializeComponent(); InitializeComponent();

@ -1,7 +1,5 @@
using DocumentFormat.OpenXml.Office2010.ExcelAc; using Gremlin.MVVM;
using Gremlin.MVVM;
using System; using System;
using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
@ -58,34 +56,18 @@ namespace Gremlin.Operations
process.StartInfo.WorkingDirectory = quoteVM.QuotePath; process.StartInfo.WorkingDirectory = quoteVM.QuotePath;
process.StartInfo.FileName = "pdflatex"; process.StartInfo.FileName = "pdflatex";
process.StartInfo.Arguments = quoteVM.QuoteNumber; process.StartInfo.Arguments = quoteVM.QuoteNumber;
process.StartInfo.UseShellExecute = false; process.StartInfo.UseShellExecute = true;
try { _ = process.Start(); } try { process.Start(); }
catch (Exception ex) { ErrorHandler.ShowErrorInMessageBox(ex); } catch (Exception ex) { ErrorHandler.ShowErrorInMessageBox(ex); }
process.WaitForExit(); process.WaitForExit();
} }
} }
} }
//private static void RunningPDFLaTeX(string quotePath, string fileName, int runs) public static void OpenPDF(QuoteViewModel quoteVM)
//{ {
// for (int i = 0; i < runs; i++) string pdfFile = $"explorer {quoteVM.QuotePath}";
// { Process.Start(pdfFile);
// using (Process process = new()) }
// {
// process.StartInfo.FileName = "pdflatex";
// process.StartInfo.Arguments = quotePath == "" ? $"{fileName}.tex" : $"{quotePath}\\{fileName}.tex";
// process.StartInfo.UseShellExecute = false;
// try
// {
// _ = process.Start();
// }
// catch (Exception ex)
// {
// ErrorHandler.ShowErrorInMessageBox(ex);
// }
// process.WaitForExit();
// }
// }
//}
} }
} }

@ -52,7 +52,7 @@ namespace Gremlin.MVVM
_ = texFile.AppendLine("&\\\\\n&\\\\\n\\end{tabular}\n\\vspace{1cm}\\par "); _ = texFile.AppendLine("&\\\\\n&\\\\\n\\end{tabular}\n\\vspace{1cm}\\par ");
//Anrede //Anrede
_ = quoteVM.Recipient.Gender == (byte)Gender.Male _ = quoteVM.Recipient.Gender == Gender.Male
? texFile.AppendLine($"Sehr geehrter Herr {quoteVM.Recipient.LastName},\\par ") ? texFile.AppendLine($"Sehr geehrter Herr {quoteVM.Recipient.LastName},\\par ")
: texFile.AppendLine($"Sehr geehrte Frau {quoteVM.Recipient.LastName},\\par "); : texFile.AppendLine($"Sehr geehrte Frau {quoteVM.Recipient.LastName},\\par ");

@ -11,7 +11,7 @@ namespace Gremlin.MVVM
{ {
public class ContactViewModel : PropertyChangedBase public class ContactViewModel : PropertyChangedBase
{ {
private byte _gender = 1; private Enums.Gender _gender = Enums.Gender.Male;
private string _firstName = "firstName"; private string _firstName = "firstName";
private string _lastName = "lastName"; private string _lastName = "lastName";
private string _eMail = "email@email.de"; private string _eMail = "email@email.de";
@ -20,7 +20,7 @@ namespace Gremlin.MVVM
private uint _accountZIP; private uint _accountZIP;
private string _accountCity = "accountCity"; private string _accountCity = "accountCity";
public byte Gender { get => _gender; set { _gender = value; NotifyOfPropertyChange(() => Gender); } } public Enums.Gender Gender { get => _gender; set { _gender = value; NotifyOfPropertyChange(() => Gender); } }
public string FirstName { get => _firstName; set { _firstName = value; NotifyOfPropertyChange(() => FirstName); } } public string FirstName { get => _firstName; set { _firstName = value; NotifyOfPropertyChange(() => FirstName); } }
public string LastName { get => _lastName; set { _lastName = value; NotifyOfPropertyChange(() => LastName); } } public string LastName { get => _lastName; set { _lastName = value; NotifyOfPropertyChange(() => LastName); } }
public string EMail { get => _eMail; set { _eMail = value; NotifyOfPropertyChange(() => EMail); } } public string EMail { get => _eMail; set { _eMail = value; NotifyOfPropertyChange(() => EMail); } }
@ -31,7 +31,7 @@ namespace Gremlin.MVVM
public ContactViewModel() { } public ContactViewModel() { }
public ContactViewModel(byte gender, string firstName, string lastName, string eMail, string accountName, string accountStreet, uint accountZIP, string accountCity) public ContactViewModel(Enums.Gender gender, string firstName, string lastName, string eMail, string accountName, string accountStreet, uint accountZIP, string accountCity)
{ {
Gender = gender; Gender = gender;
FirstName = firstName ?? throw new ArgumentNullException(nameof(firstName)); FirstName = firstName ?? throw new ArgumentNullException(nameof(firstName));
@ -64,7 +64,7 @@ namespace Gremlin.MVVM
public override string ToString() public override string ToString()
{ {
return Gender == (byte)Enums.Gender.Male return Gender == Enums.Gender.Male
? $"Herr {FirstName} {LastName}; {AccountName}, {AccountStreet}, {AccountZIP} {AccountCity}" ? $"Herr {FirstName} {LastName}; {AccountName}, {AccountStreet}, {AccountZIP} {AccountCity}"
: $"Frau {FirstName} {LastName}; {AccountName}, {AccountStreet}, {AccountZIP} {AccountCity}"; : $"Frau {FirstName} {LastName}; {AccountName}, {AccountStreet}, {AccountZIP} {AccountCity}";
} }
@ -98,7 +98,7 @@ namespace Gremlin.MVVM
{ {
case 1: case 1:
{ {
ContactViewModel salesRepWoitschetzki = new((byte)Enums.Gender.Male, ContactViewModel salesRepWoitschetzki = new(Enums.Gender.Male,
"Sascha", "Sascha",
"Woitschetzki", "Woitschetzki",
"sascha.woitschetzki@non.agilent.com", "sascha.woitschetzki@non.agilent.com",
@ -111,7 +111,7 @@ namespace Gremlin.MVVM
case 2: case 2:
{ {
ContactViewModel salesRepWelsch = new((byte)Enums.Gender.Male, ContactViewModel salesRepWelsch = new(Enums.Gender.Male,
"Sebastian", "Sebastian",
"Welsch", "Welsch",
"sebastian.welsch@non.agilent.com", "sebastian.welsch@non.agilent.com",
@ -133,7 +133,7 @@ namespace Gremlin.MVVM
internal static ContactViewModel ConvertContactToVM(Contact contact) internal static ContactViewModel ConvertContactToVM(Contact contact)
{ {
ContactViewModel contactVM = new(); ContactViewModel contactVM = new();
contactVM.Gender = contact.Gender; contactVM.Gender = (Enums.Gender)contact.Gender;
contactVM.LastName = contact.LastName; contactVM.LastName = contact.LastName;
contactVM.FirstName = contact.FirstName; contactVM.FirstName = contact.FirstName;
contactVM.EMail = contact.EMail; contactVM.EMail = contact.EMail;
@ -151,7 +151,7 @@ namespace Gremlin.MVVM
{ {
StringBuilder briefkopf = new(); StringBuilder briefkopf = new();
_ = contactVM.Gender == (byte)Enums.Gender.Male _ = contactVM.Gender == Enums.Gender.Male
? briefkopf.AppendLine($"Herr {contactVM.FirstName} {contactVM.LastName}") ? briefkopf.AppendLine($"Herr {contactVM.FirstName} {contactVM.LastName}")
: briefkopf.AppendLine($"Frau {contactVM.FirstName} {contactVM.LastName}"); : briefkopf.AppendLine($"Frau {contactVM.FirstName} {contactVM.LastName}");
if (tex) _ = briefkopf.AppendLine($"\\\\"); if (tex) _ = briefkopf.AppendLine($"\\\\");

@ -22,15 +22,15 @@ namespace Gremlin.MVVM
public ushort Position { get => _position; set { _position = value; NotifyOfPropertyChange(() => Position); } } public ushort Position { get => _position; set { _position = value; NotifyOfPropertyChange(() => Position); } }
public ushort Amount { get => _amount; set { _amount = value; NotifyOfPropertyChange(() => Amount); } } public ushort Amount { get => _amount; set { _amount = value; NotifyOfPropertyChange(() => Amount); } }
public string ProductNumber { get => _productNumber; set { _productNumber = value; NotifyOfPropertyChange(() => ProductNumber); }} public string ProductNumber { get => _productNumber; set { _productNumber = value; NotifyOfPropertyChange(() => ProductNumber); } }
public string OptionNumber { get => _optionNumber; set { _optionNumber = value; NotifyOfPropertyChange(() => OptionNumber); }} public string OptionNumber { get => _optionNumber; set { _optionNumber = value; NotifyOfPropertyChange(() => OptionNumber); } }
public string SapShortDescription { get => _sapShortDescription; set { _sapShortDescription = value; NotifyOfPropertyChange(() => SapShortDescription); }} public string SapShortDescription { get => _sapShortDescription; set { _sapShortDescription = value; NotifyOfPropertyChange(() => SapShortDescription); } }
public CustomDescriptionViewModel CustomDescriptionVM { get => _customDescriptionVM; set { _customDescriptionVM = value; NotifyOfPropertyChange(() => CustomDescriptionVM); }} public CustomDescriptionViewModel CustomDescriptionVM { get => _customDescriptionVM; set { _customDescriptionVM = value; NotifyOfPropertyChange(() => CustomDescriptionVM); } }
public string ProductLine { get => _productLine; set { _productLine = value; NotifyOfPropertyChange(() => ProductLine); }} public string ProductLine { get => _productLine; set { _productLine = value; NotifyOfPropertyChange(() => ProductLine); } }
public decimal TotalDiscount { get => _totalDiscount; set { _totalDiscount = value; NotifyOfPropertyChange(() => TotalDiscount); }} public decimal TotalDiscount { get => _totalDiscount; set { _totalDiscount = value; NotifyOfPropertyChange(() => TotalDiscount); } }
public decimal CalcNetPrice { get => _calcNetPrice; set { _calcNetPrice = value; NotifyOfPropertyChange(() => CalcNetPrice); }} public decimal CalcNetPrice { get => _calcNetPrice; set { _calcNetPrice = value; NotifyOfPropertyChange(() => CalcNetPrice); } }
public decimal CalcTotalNet { get => _calcTotalNet; set { _calcTotalNet = value; NotifyOfPropertyChange(() => CalcTotalNet); }} public decimal CalcTotalNet { get => _calcTotalNet; set { _calcTotalNet = value; NotifyOfPropertyChange(() => CalcTotalNet); } }
public decimal ListPrice { get => _listPrice; set { _listPrice = value; NotifyOfPropertyChange(() => ListPrice); }} public decimal ListPrice { get => _listPrice; set { _listPrice = value; NotifyOfPropertyChange(() => ListPrice); } }
internal static ObservableCollection<LineItemViewModel> ReadLineItemsFromClipboard() internal static ObservableCollection<LineItemViewModel> ReadLineItemsFromClipboard()
{ {

@ -94,5 +94,10 @@ namespace Gremlin.MVVM
{ {
PDFHandler.CreatePDF(QuoteVM); PDFHandler.CreatePDF(QuoteVM);
} }
public void OpenPDF()
{
PDFHandler.OpenPDF(QuoteVM);
}
} }
} }

@ -7,6 +7,7 @@
<DataGrid <DataGrid
x:Name="Contacts" x:Name="Contacts"
AutoGenerateColumns="True" AutoGenerateColumns="True"
FrozenColumnCount="3"
SelectionMode="Single" SelectionMode="Single"
SelectedItem="SelectedContact" SelectedItem="SelectedContact"
AlternatingRowBackground="LightGray" AlternatingRowBackground="LightGray"
@ -18,6 +19,7 @@
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
<Button x:Name="CreateTex" Content="TexFile erzeugen" Margin="10,5,10,5"/> <Button x:Name="CreateTex" Content="TexFile erzeugen" Margin="10,5,10,5"/>
<Button x:Name="CreatePDF" Content="PDF erzeugen" Margin="10,5,10,5"/> <Button x:Name="CreatePDF" Content="PDF erzeugen" Margin="10,5,10,5"/>
<Button x:Name="OpenPDF" Content="PDF öffnen" Margin="10,5,10,5"/>
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
</UserControl> </UserControl>