aboutsummaryrefslogtreecommitdiff
path: root/Source/ExcelDNA
diff options
context:
space:
mode:
Diffstat (limited to 'Source/ExcelDNA')
-rw-r--r--Source/ExcelDNA/AddIn.cs28
-rw-r--r--Source/ExcelDNA/Functions.cs19
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