diff options
author | Serghei Cebotari <51533848+schebotar@users.noreply.github.com> | 2021-12-03 23:07:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-03 23:07:10 +0300 |
commit | f6f6678ccf54f0513726fbb61a99d437ed68bb81 (patch) | |
tree | c7a0b8ef9ea39a8c7c801b41ff37ff544c73d3bf /Source/ExcelDNA | |
parent | f5799a28eaef3f3ea24ba56dc16970d6203b73fd (diff) | |
parent | 4acde8a85b29ca968739bf1bf38d614a2830f6e7 (diff) |
Merge pull request #6 from schebotar/dev
Dev
Diffstat (limited to 'Source/ExcelDNA')
-rw-r--r-- | Source/ExcelDNA/AddIn.cs | 28 | ||||
-rw-r--r-- | Source/ExcelDNA/Functions.cs | 19 |
2 files changed, 47 insertions, 0 deletions
diff --git a/Source/ExcelDNA/AddIn.cs b/Source/ExcelDNA/AddIn.cs new file mode 100644 index 0000000..0505e5b --- /dev/null +++ b/Source/ExcelDNA/AddIn.cs @@ -0,0 +1,28 @@ +using ExcelDna.Integration; +using ExcelDna.Registration; +using System.Net.Http; + +namespace Rehau.Sku.Assist +{ + public class AddIn : IExcelAddIn + { + public static HttpClient httpClient; + + public void AutoOpen() + { + RegisterFunctions(); + httpClient = new HttpClient(); + } + + public void AutoClose() + { + } + + void RegisterFunctions() + { + ExcelRegistration.GetExcelFunctions() + .ProcessAsyncRegistrations(nativeAsyncIfAvailable: false) + .RegisterFunctions(); + } + } +} diff --git a/Source/ExcelDNA/Functions.cs b/Source/ExcelDNA/Functions.cs new file mode 100644 index 0000000..a9bdfca --- /dev/null +++ b/Source/ExcelDNA/Functions.cs @@ -0,0 +1,19 @@ +using ExcelDna.Integration; + +namespace Rehau.Sku.Assist +{ + public class Functions + { + [ExcelFunction] + public static object RAUNAME(string request) + => SkuAssist.GetProduct(request, ProductField.Name); + + [ExcelFunction] + public static object RAUSKU(string request) + => SkuAssist.GetProduct(request, ProductField.Id); + + [ExcelFunction] + public static object RAUPRICE(string request) + => SkuAssist.GetProduct(request, ProductField.Price); + } +}
\ No newline at end of file |