31 lines
805 B
C#
31 lines
805 B
C#
using ExcelDna.Integration;
|
|
using System;
|
|
|
|
namespace RhSolutions
|
|
{
|
|
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;
|
|
}
|
|
}
|
|
} |