2021-12-03 12:57:22 +03:00
|
|
|
|
using ExcelDna.Integration;
|
2022-12-20 12:41:46 +03:00
|
|
|
|
using RhSolutions.Services;
|
2021-11-11 16:33:40 +03:00
|
|
|
|
|
2022-12-20 12:41:46 +03:00
|
|
|
|
namespace RhSolutions.AddIn
|
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;
|
|
|
|
|
}
|
2022-12-23 21:10:43 +03:00
|
|
|
|
|
|
|
|
|
[ExcelFunction]
|
|
|
|
|
public static void ResetStatusBar()
|
|
|
|
|
{
|
|
|
|
|
RhSolutionsAddIn.Excel.StatusBar = false;
|
|
|
|
|
}
|
2022-12-19 09:13:14 +03:00
|
|
|
|
}
|
2021-11-11 16:33:40 +03:00
|
|
|
|
}
|