aboutsummaryrefslogtreecommitdiff
path: root/src/AddIn
diff options
context:
space:
mode:
Diffstat (limited to 'src/AddIn')
-rw-r--r--src/AddIn/Functions.cs56
-rw-r--r--src/AddIn/RhSolutionsAddIn.cs35
2 files changed, 0 insertions, 91 deletions
diff --git a/src/AddIn/Functions.cs b/src/AddIn/Functions.cs
deleted file mode 100644
index 6a7fc54..0000000
--- a/src/AddIn/Functions.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using ExcelDna.Integration;
-using RhSolutions.Models;
-using RhSolutions.Services;
-using System.Linq;
-
-namespace RhSolutions.AddIn
-{
- public class Functions
- {
- [ExcelFunction(Description = "Распознать артикул и попробовать найти его в прайс-листе")]
- public static object RHSOLUTIONS([ExcelArgument(Name = "\"Строка с названием материала\"")] string line)
- {
- object result;
-
- result = ExcelAsyncUtil.Run("Database request", line, delegate
- {
- return RhDatabaseClient.GetProduct(line).GetAwaiter().GetResult();
- });
-
- string parsedSku = Sku.TryParse(line, out var skus)
- ? skus.First().ToString() : string.Empty;
-
- if (result == null)
- {
- if (string.IsNullOrEmpty(parsedSku))
- {
- return ExcelError.ExcelErrorNA;
- }
- else
- {
- return skus.First().ToString();
- }
- }
-
- if (result.Equals(ExcelError.ExcelErrorNA))
- {
- if (string.IsNullOrEmpty(parsedSku))
- {
- return "Загрузка...";
- }
- else
- {
- return skus.First().ToString();
- }
- }
-
- return result;
- }
-
- [ExcelFunction]
- public static void _ResetStatusBar()
- {
- RhSolutionsAddIn.Excel.StatusBar = false;
- }
- }
-} \ No newline at end of file
diff --git a/src/AddIn/RhSolutionsAddIn.cs b/src/AddIn/RhSolutionsAddIn.cs
deleted file mode 100644
index a4c6019..0000000
--- a/src/AddIn/RhSolutionsAddIn.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using ExcelDna.Integration;
-using ExcelDna.IntelliSense;
-using Microsoft.Office.Interop.Excel;
-using RhSolutions.Services;
-using System.Net;
-using System.Net.Http;
-
-namespace RhSolutions.AddIn
-{
- class RhSolutionsAddIn : IExcelAddIn
- {
- public static Application Excel { get; private set; }
- public static HttpClient HttpClient { get; private set; }
-
- public void AutoOpen()
- {
- Excel = (Application)ExcelDnaUtil.Application;
- HttpClient = new HttpClient();
- IntelliSenseServer.Install();
- RegistryUtil.Initialize();
- EventsUtil.Initialize();
-
- ServicePointManager.SecurityProtocol =
- SecurityProtocolType.Tls12;
- }
-
- public void AutoClose()
- {
- IntelliSenseServer.Uninstall();
- RegistryUtil.Uninitialize();
- EventsUtil.Uninitialize();
- HttpClient.Dispose();
- }
- }
-}