aboutsummaryrefslogtreecommitdiff
path: root/src/Services/Functions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Services/Functions.cs')
-rw-r--r--src/Services/Functions.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/Services/Functions.cs b/src/Services/Functions.cs
new file mode 100644
index 0000000..22b67e0
--- /dev/null
+++ b/src/Services/Functions.cs
@@ -0,0 +1,31 @@
+using ExcelDna.Integration;
+using System;
+
+namespace RhSolutions.Services
+{
+ 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