diff options
author | Sergey Chebotar <s.chebotar@gmail.com> | 2022-12-20 12:41:46 +0300 |
---|---|---|
committer | Sergey Chebotar <s.chebotar@gmail.com> | 2022-12-20 12:41:46 +0300 |
commit | 6137433aefde1257fa42e0823242e66f5bd57e22 (patch) | |
tree | b2f3e99c9144b8568894547f9546c323cee4b3a9 /src/AddIn/Functions.cs | |
parent | 73569a43644309d0342817580bcfd86c1face5b8 (diff) |
Refactoring
Diffstat (limited to 'src/AddIn/Functions.cs')
-rw-r--r-- | src/AddIn/Functions.cs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/AddIn/Functions.cs b/src/AddIn/Functions.cs new file mode 100644 index 0000000..2be19fa --- /dev/null +++ b/src/AddIn/Functions.cs @@ -0,0 +1,31 @@ +using ExcelDna.Integration; +using RhSolutions.Services; + +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(); + }); + + if (result == null) + { + return ExcelError.ExcelErrorNA; + } + + if (result.Equals(ExcelError.ExcelErrorNA)) + { + return "Загрузка..."; + } + + return result; + } + } +}
\ No newline at end of file |