RhSolutions-AddIn/src/AddIn/Functions.cs

31 lines
805 B
C#
Raw Normal View History

using ExcelDna.Integration;
2022-12-19 09:13:14 +03:00
using System;
2021-11-11 16:33:40 +03:00
2022-12-19 20:25:35 +03:00
namespace RhSolutions
2021-11-11 16:33:40 +03:00
{
2021-11-29 15:50:24 +03:00
public class Functions
2021-11-11 16:33:40 +03:00
{
2022-12-19 09:13:14 +03:00
[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;
}
}
2021-11-11 16:33:40 +03:00
}