diff options
author | Sergey Chebotar <s.chebotar@gmail.com> | 2023-03-22 08:36:13 +0300 |
---|---|---|
committer | Sergey Chebotar <s.chebotar@gmail.com> | 2023-03-22 08:36:13 +0300 |
commit | 4f448f203471a19a1444555a895f503515ad2fda (patch) | |
tree | 301b7df2561d650e4d300d24341342bd77ac7f3e /src/AddIn/Functions.cs | |
parent | 6484cac4f025bd84f7ffa2b2030d729dafe09d3d (diff) |
Add basic test
Diffstat (limited to 'src/AddIn/Functions.cs')
-rw-r--r-- | src/AddIn/Functions.cs | 56 |
1 files changed, 0 insertions, 56 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 |