diff --git a/Gremlin_BlazorServer/Data/DBClasses/DbHelper.cs b/Gremlin_BlazorServer/Data/DBClasses/DbHelper.cs index 4806fbc..4035656 100644 --- a/Gremlin_BlazorServer/Data/DBClasses/DbHelper.cs +++ b/Gremlin_BlazorServer/Data/DBClasses/DbHelper.cs @@ -553,7 +553,7 @@ namespace Gremlin_BlazorServer.Data.DBClasses List ContactsReadFromFile = new(8000); // ENCODING CHANGED TO UNICODE. TO BE TESTED! - using (TextFieldParser csvParser = new(filepath, FileIO.GetEncoding(filepath))) + using (TextFieldParser csvParser = new(filepath, FileService.GetEncoding(filepath))) { //Parser configuration: csvParser.Delimiters = new string[] { separator }; @@ -712,7 +712,7 @@ namespace Gremlin_BlazorServer.Data.DBClasses //ENCODING CHANGED TO ISO-8859-1 AS EQUIVALENT (?) TO "LATIN1" (unavailable). TO BE TESTED! //ich würde mir ja UTF8 als universelles Encoding wünschen - using (TextFieldParser csvParser = new(filepath, FileIO.GetEncoding(filepath))) + using (TextFieldParser csvParser = new(filepath, FileService.GetEncoding(filepath))) { //Parser configuration: csvParser.Delimiters = new string[] { separator }; @@ -892,7 +892,7 @@ namespace Gremlin_BlazorServer.Data.DBClasses List ContactsReadFromFile = new(8000); List AccountsReadFromFile = new(1000); - using (TextFieldParser csvParser = new(filepath, FileIO.GetEncoding(filepath))) //ISO-8859-1 entspricht Latin1 + using (TextFieldParser csvParser = new(filepath, FileService.GetEncoding(filepath))) //ISO-8859-1 entspricht Latin1 { //Parser configuration: csvParser.Delimiters = new string[] { separator }; @@ -1755,7 +1755,7 @@ namespace Gremlin_BlazorServer.Data.DBClasses { List results = new(100000); //ENCODING CHANGED TO ISO-8859-1 AS EQUIVALENT (?) TO "LATIN1" (unavailable). TO BE TESTED! - using (TextFieldParser csvParser = new(filepath, FileIO.GetEncoding(filepath))) + using (TextFieldParser csvParser = new(filepath, FileService.GetEncoding(filepath))) { //Parser configuration: csvParser.Delimiters = new string[] { separator }; diff --git a/Gremlin_BlazorServer/Data/DBClasses/GenericImporter.cs b/Gremlin_BlazorServer/Data/DBClasses/GenericImporter.cs index c6d8ebc..644ca8b 100644 --- a/Gremlin_BlazorServer/Data/DBClasses/GenericImporter.cs +++ b/Gremlin_BlazorServer/Data/DBClasses/GenericImporter.cs @@ -126,7 +126,7 @@ namespace Gremlin_BlazorServer.Data.DBClasses } catch (Exception) { - Encoding = FileIO.GetEncoding(GenericImporter.filepath); + Encoding = FileService.GetEncoding(GenericImporter.filepath); } Separators = new string[] { separator }; @@ -147,7 +147,7 @@ namespace Gremlin_BlazorServer.Data.DBClasses } catch (Exception) { - Encoding = FileIO.GetEncoding(GenericImporter.filepath); + Encoding = FileService.GetEncoding(GenericImporter.filepath); } Separators = new string[] { separator }; @@ -1003,7 +1003,7 @@ namespace Gremlin_BlazorServer.Data.DBClasses public static Dictionary ReadMappingDictionaryFromFile() { Dictionary result = new(); - string fileInput = FileIO.ReadResource("MappingDictionary.txt"); + string fileInput = FileService.ReadResource("MappingDictionary.txt"); string[] lines = fileInput.Split(Environment.NewLine); foreach (string line in lines) { diff --git a/Gremlin_BlazorServer/Gremlin_BlazorServer.csproj b/Gremlin_BlazorServer/Gremlin_BlazorServer.csproj index f34f85b..e6fdda3 100644 --- a/Gremlin_BlazorServer/Gremlin_BlazorServer.csproj +++ b/Gremlin_BlazorServer/Gremlin_BlazorServer.csproj @@ -9,18 +9,18 @@ - - - - + + + + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + @@ -35,4 +35,8 @@ + + + + diff --git a/Gremlin_BlazorServer/Pages/Quotes/Add.razor b/Gremlin_BlazorServer/Pages/Quotes/Add.razor index caadcda..f0187a8 100644 --- a/Gremlin_BlazorServer/Pages/Quotes/Add.razor +++ b/Gremlin_BlazorServer/Pages/Quotes/Add.razor @@ -124,7 +124,7 @@ Contact selectedRecipient = new(); Account correspondingAccount = new(); CultureInfo cultureInfo = new("de-DE"); - + protected override async Task OnInitializedAsync() { contacts = await contactService.GetAllContactsAsync(); @@ -146,7 +146,12 @@ { await file.WriteToStreamAsync(stream); stream.Seek(0, SeekOrigin.Begin); - using (StreamReader reader = new(stream)) { quoteService.ReadLineItems(quote, await reader.ReadToEndAsync()); } + using (StreamReader reader = new(stream)) + { + string fileContent = await reader.ReadToEndAsync(); + quote = quoteService.ReadLineItems(quote, fileContent); + FileService.WriteClipboardToTSV(fileContent, quote); + } } } } @@ -178,24 +183,7 @@ { StringBuilder texStringBuilder = await quoteService.CreateTex(quote); quote.Tex = texStringBuilder.ToString(); - Byte[] texBytes = Encoding.UTF8.GetBytes(quote.Tex); - DownloadTexFile(quote.Tex, $"{quote.QuotationNumber}.tex"); - } - - async void DownloadTexFile(string texString, string datei) - { - try - { - //using (Stream stream = new MemoryStream(texBytes)) - //{ - // using DotNetStreamReference streamRef = new(stream: stream); - await JSRuntime.InvokeVoidAsync("alert", texString); - //} - } - catch - { - Debug.WriteLine("Download of TexFile failed!"); - } + FileService.WriteTexFile(quote); } private Task OnTexChanged(string value) diff --git a/Gremlin_BlazorServer/Quotes/474/55556/DE-83PE89-1222-154420.tsv b/Gremlin_BlazorServer/Quotes/474/55556/DE-83PE89-1222-154420.tsv new file mode 100644 index 0000000..aeaa9d5 --- /dev/null +++ b/Gremlin_BlazorServer/Quotes/474/55556/DE-83PE89-1222-154420.tsv @@ -0,0 +1,17 @@ +# Part Number Opt PL Description Qty Price EUR Breaks EUR Uplift % Total Discount % Net EUR Total EUR Sales Discount YA9% Contractual Discount Y99% Promotion Discount Y07% Demo Discount Y04% PH Code PH Description YMax +1 G7104C 29 1260 Infinity II Flexible Pumpe 1 33344 0 0 40 20006.4 20006.4 40 0 0 0 ISL100P1 Pumps +2 G7104C 001 29 HPLC System Tool-Kit 1260 Infinity II 1 377 0 0 40 226.2 226.2 40 0 0 0 +3 G7104C 004 29 Agilent Lab Advisor Advanced Software 1 1574 0 0 40 944.4 944.4 40 0 0 0 +4 G7104C 034 29 InfinityLab Stay Safe Verschl., St.-Kit 1 664 0 0 40 398.4 398.4 40 0 0 0 +5 G7104C 097 29 Poroshell 120 EC-C18 3,0x150mm, 2,7um 1 1 0 0 40 0.6 0.6 40 0 0 0 +6 G7167A 29 1260 Infinity II Mehrfachprobengeber 1 27195 0 0 40 16317 16317 40 0 0 0 ISL100A1 Autosamplers +7 G7167A 060 29 Nutzung vorhandene Lizenz 1 -1733 0 0 40 -1039.8 -1039.8 40 0 0 0 +8 G7167A 101 29 Agilent InfinityLab Proben-Thermostat 1 5871 0 0 40 3522.6 3522.6 40 0 0 0 +9 G7116A 29 1260 Infinity II Therm. f. mehr. Saeulen 1 6275 0 0 40 3765 3765 40 0 0 0 ISL100LC1 LC Hardware +10 G7162A 29 1260 Infinity II Brechungsindexdetektor 1 13516 0 0 40 8109.6 8109.6 40 0 0 0 ISL100D1 Detectors +11 M8414AA LI OpenLab CDS Workstation PC-Paket 1 16854 0 0 40 10112.4 10112.4 40 0 0 0 ISF300F110 OpenLAB CDS w/Hardware +12 M8414AA 001 LI LC Geraeteverbindung 1 0 0 0 40 0 0 40 0 0 0 +13 SYS-LC-1260II 74 LC 1260 Infinity II System 1 0 0 0 20 0 0 20 0 0 0 TSSYS0SYLC Service Systems - Liquid Chromatography +14 SYS-LC-1260II 2A9 74 Standard-Einweisung 1 999 0 0 20 799.2 799.2 20 0 0 0 TSSTRN Training Services +15 SYS-LC-1260II 8R2 74 CrossLab Silver - 2J, kompl. 1 10403 0 0 35 6761.95 6761.95 30 0 5 0 TSSYS2 Serviced As Systems - 2 YR > 29 + diff --git a/Gremlin_BlazorServer/Quotes/474/55556/DE-83PE89-1222-324791.tsv b/Gremlin_BlazorServer/Quotes/474/55556/DE-83PE89-1222-324791.tsv new file mode 100644 index 0000000..aeaa9d5 --- /dev/null +++ b/Gremlin_BlazorServer/Quotes/474/55556/DE-83PE89-1222-324791.tsv @@ -0,0 +1,17 @@ +# Part Number Opt PL Description Qty Price EUR Breaks EUR Uplift % Total Discount % Net EUR Total EUR Sales Discount YA9% Contractual Discount Y99% Promotion Discount Y07% Demo Discount Y04% PH Code PH Description YMax +1 G7104C 29 1260 Infinity II Flexible Pumpe 1 33344 0 0 40 20006.4 20006.4 40 0 0 0 ISL100P1 Pumps +2 G7104C 001 29 HPLC System Tool-Kit 1260 Infinity II 1 377 0 0 40 226.2 226.2 40 0 0 0 +3 G7104C 004 29 Agilent Lab Advisor Advanced Software 1 1574 0 0 40 944.4 944.4 40 0 0 0 +4 G7104C 034 29 InfinityLab Stay Safe Verschl., St.-Kit 1 664 0 0 40 398.4 398.4 40 0 0 0 +5 G7104C 097 29 Poroshell 120 EC-C18 3,0x150mm, 2,7um 1 1 0 0 40 0.6 0.6 40 0 0 0 +6 G7167A 29 1260 Infinity II Mehrfachprobengeber 1 27195 0 0 40 16317 16317 40 0 0 0 ISL100A1 Autosamplers +7 G7167A 060 29 Nutzung vorhandene Lizenz 1 -1733 0 0 40 -1039.8 -1039.8 40 0 0 0 +8 G7167A 101 29 Agilent InfinityLab Proben-Thermostat 1 5871 0 0 40 3522.6 3522.6 40 0 0 0 +9 G7116A 29 1260 Infinity II Therm. f. mehr. Saeulen 1 6275 0 0 40 3765 3765 40 0 0 0 ISL100LC1 LC Hardware +10 G7162A 29 1260 Infinity II Brechungsindexdetektor 1 13516 0 0 40 8109.6 8109.6 40 0 0 0 ISL100D1 Detectors +11 M8414AA LI OpenLab CDS Workstation PC-Paket 1 16854 0 0 40 10112.4 10112.4 40 0 0 0 ISF300F110 OpenLAB CDS w/Hardware +12 M8414AA 001 LI LC Geraeteverbindung 1 0 0 0 40 0 0 40 0 0 0 +13 SYS-LC-1260II 74 LC 1260 Infinity II System 1 0 0 0 20 0 0 20 0 0 0 TSSYS0SYLC Service Systems - Liquid Chromatography +14 SYS-LC-1260II 2A9 74 Standard-Einweisung 1 999 0 0 20 799.2 799.2 20 0 0 0 TSSTRN Training Services +15 SYS-LC-1260II 8R2 74 CrossLab Silver - 2J, kompl. 1 10403 0 0 35 6761.95 6761.95 30 0 5 0 TSSYS2 Serviced As Systems - 2 YR > 29 + diff --git a/Gremlin_BlazorServer/Quotes/474/55556/DE-83PE89-1222-684461.tsv b/Gremlin_BlazorServer/Quotes/474/55556/DE-83PE89-1222-684461.tsv new file mode 100644 index 0000000..aeaa9d5 --- /dev/null +++ b/Gremlin_BlazorServer/Quotes/474/55556/DE-83PE89-1222-684461.tsv @@ -0,0 +1,17 @@ +# Part Number Opt PL Description Qty Price EUR Breaks EUR Uplift % Total Discount % Net EUR Total EUR Sales Discount YA9% Contractual Discount Y99% Promotion Discount Y07% Demo Discount Y04% PH Code PH Description YMax +1 G7104C 29 1260 Infinity II Flexible Pumpe 1 33344 0 0 40 20006.4 20006.4 40 0 0 0 ISL100P1 Pumps +2 G7104C 001 29 HPLC System Tool-Kit 1260 Infinity II 1 377 0 0 40 226.2 226.2 40 0 0 0 +3 G7104C 004 29 Agilent Lab Advisor Advanced Software 1 1574 0 0 40 944.4 944.4 40 0 0 0 +4 G7104C 034 29 InfinityLab Stay Safe Verschl., St.-Kit 1 664 0 0 40 398.4 398.4 40 0 0 0 +5 G7104C 097 29 Poroshell 120 EC-C18 3,0x150mm, 2,7um 1 1 0 0 40 0.6 0.6 40 0 0 0 +6 G7167A 29 1260 Infinity II Mehrfachprobengeber 1 27195 0 0 40 16317 16317 40 0 0 0 ISL100A1 Autosamplers +7 G7167A 060 29 Nutzung vorhandene Lizenz 1 -1733 0 0 40 -1039.8 -1039.8 40 0 0 0 +8 G7167A 101 29 Agilent InfinityLab Proben-Thermostat 1 5871 0 0 40 3522.6 3522.6 40 0 0 0 +9 G7116A 29 1260 Infinity II Therm. f. mehr. Saeulen 1 6275 0 0 40 3765 3765 40 0 0 0 ISL100LC1 LC Hardware +10 G7162A 29 1260 Infinity II Brechungsindexdetektor 1 13516 0 0 40 8109.6 8109.6 40 0 0 0 ISL100D1 Detectors +11 M8414AA LI OpenLab CDS Workstation PC-Paket 1 16854 0 0 40 10112.4 10112.4 40 0 0 0 ISF300F110 OpenLAB CDS w/Hardware +12 M8414AA 001 LI LC Geraeteverbindung 1 0 0 0 40 0 0 40 0 0 0 +13 SYS-LC-1260II 74 LC 1260 Infinity II System 1 0 0 0 20 0 0 20 0 0 0 TSSYS0SYLC Service Systems - Liquid Chromatography +14 SYS-LC-1260II 2A9 74 Standard-Einweisung 1 999 0 0 20 799.2 799.2 20 0 0 0 TSSTRN Training Services +15 SYS-LC-1260II 8R2 74 CrossLab Silver - 2J, kompl. 1 10403 0 0 35 6761.95 6761.95 30 0 5 0 TSSYS2 Serviced As Systems - 2 YR > 29 + diff --git a/Gremlin_BlazorServer/Quotes/DE-83PE89-1222-650723.tsv b/Gremlin_BlazorServer/Quotes/DE-83PE89-1222-650723.tsv new file mode 100644 index 0000000..aeaa9d5 --- /dev/null +++ b/Gremlin_BlazorServer/Quotes/DE-83PE89-1222-650723.tsv @@ -0,0 +1,17 @@ +# Part Number Opt PL Description Qty Price EUR Breaks EUR Uplift % Total Discount % Net EUR Total EUR Sales Discount YA9% Contractual Discount Y99% Promotion Discount Y07% Demo Discount Y04% PH Code PH Description YMax +1 G7104C 29 1260 Infinity II Flexible Pumpe 1 33344 0 0 40 20006.4 20006.4 40 0 0 0 ISL100P1 Pumps +2 G7104C 001 29 HPLC System Tool-Kit 1260 Infinity II 1 377 0 0 40 226.2 226.2 40 0 0 0 +3 G7104C 004 29 Agilent Lab Advisor Advanced Software 1 1574 0 0 40 944.4 944.4 40 0 0 0 +4 G7104C 034 29 InfinityLab Stay Safe Verschl., St.-Kit 1 664 0 0 40 398.4 398.4 40 0 0 0 +5 G7104C 097 29 Poroshell 120 EC-C18 3,0x150mm, 2,7um 1 1 0 0 40 0.6 0.6 40 0 0 0 +6 G7167A 29 1260 Infinity II Mehrfachprobengeber 1 27195 0 0 40 16317 16317 40 0 0 0 ISL100A1 Autosamplers +7 G7167A 060 29 Nutzung vorhandene Lizenz 1 -1733 0 0 40 -1039.8 -1039.8 40 0 0 0 +8 G7167A 101 29 Agilent InfinityLab Proben-Thermostat 1 5871 0 0 40 3522.6 3522.6 40 0 0 0 +9 G7116A 29 1260 Infinity II Therm. f. mehr. Saeulen 1 6275 0 0 40 3765 3765 40 0 0 0 ISL100LC1 LC Hardware +10 G7162A 29 1260 Infinity II Brechungsindexdetektor 1 13516 0 0 40 8109.6 8109.6 40 0 0 0 ISL100D1 Detectors +11 M8414AA LI OpenLab CDS Workstation PC-Paket 1 16854 0 0 40 10112.4 10112.4 40 0 0 0 ISF300F110 OpenLAB CDS w/Hardware +12 M8414AA 001 LI LC Geraeteverbindung 1 0 0 0 40 0 0 40 0 0 0 +13 SYS-LC-1260II 74 LC 1260 Infinity II System 1 0 0 0 20 0 0 20 0 0 0 TSSYS0SYLC Service Systems - Liquid Chromatography +14 SYS-LC-1260II 2A9 74 Standard-Einweisung 1 999 0 0 20 799.2 799.2 20 0 0 0 TSSTRN Training Services +15 SYS-LC-1260II 8R2 74 CrossLab Silver - 2J, kompl. 1 10403 0 0 35 6761.95 6761.95 30 0 5 0 TSSYS2 Serviced As Systems - 2 YR > 29 + diff --git a/Gremlin_BlazorServer/Services/FileService.cs b/Gremlin_BlazorServer/Services/FileService.cs new file mode 100644 index 0000000..1e8c0e2 --- /dev/null +++ b/Gremlin_BlazorServer/Services/FileService.cs @@ -0,0 +1,119 @@ +using Gremlin_BlazorServer.Data.EntityClasses; +using System.Diagnostics; +using System.Reflection; +using System.Text; +//using Outlook = Microsoft.Office.Interop.Outlook; + +namespace Gremlin_BlazorServer.Services +{ + internal static class FileService + { + private static readonly Encoding defaultEncodingIfNoBom = Encoding.UTF8; + private static readonly string currentDirectory = Directory.GetCurrentDirectory(); + + public static string ReadResource(string name) + { + Assembly assembly = Assembly.GetExecutingAssembly(); + + // Format: "{Namespace}.{Folder}.{filename}.{Extension}" + string resourcePath = name.StartsWith(nameof(Gremlin_BlazorServer)) + ? name + : assembly.GetManifestResourceNames().Single(str => str.EndsWith(name)); + + using (Stream? stream = assembly.GetManifestResourceStream(resourcePath)) + { + if (stream == null) { return ""; } + using (StreamReader reader = new(stream)) + { + return reader.ReadToEnd(); + } + } + } + + // public static string GetFilepathFromUser(string filter = "Delimited Data File|*.csv; *.txt; *.tsv") + // { + // string _filepath = ""; + // OpenFileDialog dlg = new() + // { + // Multiselect = false, + // Filter = filter + // }; + + // if (dlg.ShowDialog() == true) + // { + // //Auswahl dlg.filenames an passende Objekte übergeben + // _filepath = dlg.FileName; + // } + // return _filepath; + // } + + internal static void OpenFile(string path, string file, string type) + { + try + { + _ = Process.Start(path == "" ? $"{file}.{type}" : $"{path}\\{file}.{type}"); + } + catch (Exception ex) + { + Debug.WriteLine(ex); + } + } + + public static Encoding GetEncoding(string fileName) + { + Stream fileStream = File.OpenRead(fileName); + using (StreamReader reader = new(fileStream, defaultEncodingIfNoBom, true)) + { + _ = reader.Peek(); + Encoding encoding = reader.CurrentEncoding; + return encoding; + } + } + + public static void WriteClipboardToTSV(string clipboard, Quote quote) + { + string datei = $"{currentDirectory}\\Quotes\\{quote.Recipient.Account.AccountId}\\{quote.Recipient.ContactId}\\{quote.QuotationNumber}.tsv"; + + FileInfo fileInfo = new(datei); + if (!fileInfo.Directory.Exists) { Directory.CreateDirectory(fileInfo.DirectoryName); } + + using StreamWriter writer = new(datei, false, Encoding.UTF8); + { + writer.WriteLine(clipboard); + } + } + + public static void WriteTexFile(Quote quote) + { + string datei = $"{currentDirectory}\\Quotes\\{quote.Recipient.Account.AccountId}\\{quote.Recipient.ContactId}\\{quote.QuotationNumber}.tex"; + + FileInfo fileInfo = new(datei); + if (!fileInfo.Directory.Exists) { Directory.CreateDirectory(fileInfo.DirectoryName); } + + using StreamWriter writer = new(datei, false, Encoding.UTF8); + { + writer.WriteLine(quote.Tex); + } + } + + //public static void SendQuoteViaMail(QuoteVM quoteVM) + //{ + // Outlook.Application application = new(); + + // Outlook.MailItem mail = application.CreateItem(Outlook.OlItemType.olMailItem) as Outlook.MailItem; + + // mail.Subject = quoteVM.QuoteNumber; + // Outlook.AddressEntry currentUser = application.Session.CurrentUser.AddressEntry; + + // if (currentUser.Type == "EX") + // { + // Outlook.ExchangeUser manager = currentUser.GetExchangeUser().GetExchangeUserManager(); + // // Add recipient using display name, alias, or smtp address + // mail.Recipients.Add(manager.PrimarySmtpAddress); + // mail.Recipients.ResolveAll(); + // mail.Attachments.Add($"{quoteVM.QuoteNumber}.pdf", Outlook.OlAttachmentType.olByValue, Type.Missing, Type.Missing); + // mail.Send(); + // } + //} + } +} \ No newline at end of file diff --git a/Gremlin_BlazorServer/Utilities/FileIO.cs b/Gremlin_BlazorServer/Utilities/FileIO.cs deleted file mode 100644 index 91606a2..0000000 --- a/Gremlin_BlazorServer/Utilities/FileIO.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System.Diagnostics; -using System.Reflection; -using System.Text; -//using Outlook = Microsoft.Office.Interop.Outlook; - -namespace Gremlin_BlazorServer.Services -{ - internal static class FileIO - { - public static string ReadResource(string name) - { - Assembly assembly = Assembly.GetExecutingAssembly(); - - // Format: "{Namespace}.{Folder}.{filename}.{Extension}" - string resourcePath = name.StartsWith(nameof(Gremlin_BlazorServer)) - ? name - : assembly.GetManifestResourceNames().Single(str => str.EndsWith(name)); - - using (Stream? stream = assembly.GetManifestResourceStream(resourcePath)) - { - if (stream == null) { return ""; } - using (StreamReader reader = new(stream)) - { - return reader.ReadToEnd(); - } - } - } - - private static readonly Encoding defaultEncodingIfNoBom = Encoding.UTF8; - - // public static string GetFilepathFromUser(string filter = "Delimited Data File|*.csv; *.txt; *.tsv") - // { - // string _filepath = ""; - // OpenFileDialog dlg = new() - // { - // Multiselect = false, - // Filter = filter - // }; - - // if (dlg.ShowDialog() == true) - // { - // //Auswahl dlg.filenames an passende Objekte übergeben - // _filepath = dlg.FileName; - // } - // return _filepath; - // } - - internal static void OpenFile(string path, string file, string type) - { - try - { - _ = Process.Start(path == "" ? $"{file}.{type}" : $"{path}\\{file}.{type}"); - } - catch (Exception ex) - { - Debug.WriteLine(ex); - } - } - - public static Encoding GetEncoding(string fileName) - { - Stream fileStream = File.OpenRead(fileName); - using (StreamReader reader = new(fileStream, defaultEncodingIfNoBom, true)) - { - _ = reader.Peek(); - Encoding encoding = reader.CurrentEncoding; - return encoding; - } - } - - // public static void WriteClipboardToTSV(string clipboard, QuoteViewModel quoteVM) - // { - // string datei = quoteVM.QuotePath + quoteVM.QuoteNumber + ".tsv"; - // using StreamWriter writer = new(datei, false, Encoding.UTF8); - // { - // writer.WriteLine(clipboard); - // } - // } - - //public static void SendQuoteViaMail(QuoteVM quoteVM) - //{ - // Outlook.Application application = new(); - - // Outlook.MailItem mail = application.CreateItem(Outlook.OlItemType.olMailItem) as Outlook.MailItem; - - // mail.Subject = quoteVM.QuoteNumber; - // Outlook.AddressEntry currentUser = application.Session.CurrentUser.AddressEntry; - - // if (currentUser.Type == "EX") - // { - // Outlook.ExchangeUser manager = currentUser.GetExchangeUser().GetExchangeUserManager(); - // // Add recipient using display name, alias, or smtp address - // mail.Recipients.Add(manager.PrimarySmtpAddress); - // mail.Recipients.ResolveAll(); - // mail.Attachments.Add($"{quoteVM.QuoteNumber}.pdf", Outlook.OlAttachmentType.olByValue, Type.Missing, Type.Missing); - // mail.Send(); - // } - //} - } -} \ No newline at end of file diff --git a/Gremlin_BlazorServer/Utilities/GUClasses/DataIdentificator.cs b/Gremlin_BlazorServer/Utilities/GUClasses/DataIdentificator.cs index bdd3855..56ba37c 100644 --- a/Gremlin_BlazorServer/Utilities/GUClasses/DataIdentificator.cs +++ b/Gremlin_BlazorServer/Utilities/GUClasses/DataIdentificator.cs @@ -154,7 +154,7 @@ namespace Gremlin_BlazorServer.Services.GUClasses public static List ReadDataIdentifierFromFile() { List result = new(50); - string fileInput = FileIO.ReadResource("DataIdentifier.txt"); + string fileInput = FileService.ReadResource("DataIdentifier.txt"); string[] lines = fileInput.Split(Environment.NewLine); foreach (string line in lines) {