This commit is contained in:
Курнат Андрей
2026-04-01 19:33:59 +03:00
parent 339b9ab8aa
commit db15503315
8 changed files with 659 additions and 99 deletions

View File

@@ -88,7 +88,7 @@ ORDER BY fr.NMFRPD;";
return customers;
}
public Task<IReadOnlyList<CustomerReference>> LoadCustomersAsync(CancellationToken cancellationToken = default)
public async Task<IReadOnlyList<CustomerReference>> LoadCustomersAsync(CancellationToken cancellationToken = default)
{
const string sql = @"
SELECT
@@ -100,7 +100,7 @@ WHERE z.IDFRPDV IS NOT NULL
GROUP BY z.IDFRPDV, fr.NMFRPD
ORDER BY fr.NMFRPD;";
return SqlServerConnectionFactory.Current.QueryOpenConnectionAsync(
return await SqlServerConnectionFactory.Current.QueryOpenConnectionAsync(
sql,
delegate(SqlDataReader reader)
{
@@ -111,10 +111,7 @@ ORDER BY fr.NMFRPD;";
};
},
ConfigureCommandTimeout,
cancellationToken).ContinueWith<IReadOnlyList<CustomerReference>>(delegate(Task<List<CustomerReference>> task)
{
return task.Result;
}, cancellationToken, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
cancellationToken).ConfigureAwait(false);
}
public IReadOnlyList<PersonReference> LoadVerifiers()
@@ -151,7 +148,7 @@ ORDER BY p.PRFIO;";
return verifiers;
}
public Task<IReadOnlyList<PersonReference>> LoadVerifiersAsync(CancellationToken cancellationToken = default)
public async Task<IReadOnlyList<PersonReference>> LoadVerifiersAsync(CancellationToken cancellationToken = default)
{
const string sql = @"
SELECT
@@ -161,7 +158,7 @@ FROM dbo.PRSN p
WHERE NULLIF(LTRIM(RTRIM(p.PRFIO)), N'') IS NOT NULL
ORDER BY p.PRFIO;";
return SqlServerConnectionFactory.Current.QueryOpenConnectionAsync(
return await SqlServerConnectionFactory.Current.QueryOpenConnectionAsync(
sql,
delegate(SqlDataReader reader)
{
@@ -172,10 +169,7 @@ ORDER BY p.PRFIO;";
};
},
ConfigureCommandTimeout,
cancellationToken).ContinueWith<IReadOnlyList<PersonReference>>(delegate(Task<List<PersonReference>> task)
{
return task.Result;
}, cancellationToken, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
cancellationToken).ConfigureAwait(false);
}
public IReadOnlyList<DocumentFormReference> LoadVerificationDocumentForms(bool isPassed)
@@ -220,7 +214,7 @@ ORDER BY fr.NMFRD, v.IDVDODVDD;";
return forms;
}
public Task<IReadOnlyList<DocumentFormReference>> LoadVerificationDocumentFormsAsync(bool isPassed, CancellationToken cancellationToken = default)
public async Task<IReadOnlyList<DocumentFormReference>> LoadVerificationDocumentFormsAsync(bool isPassed, CancellationToken cancellationToken = default)
{
const string sql = @"
SELECT DISTINCT
@@ -235,7 +229,7 @@ WHERE v.IDSPVDOD = 2
AND fr.IDSPVDD = @DocumentTypeId
ORDER BY fr.NMFRD, v.IDVDODVDD;";
return SqlServerConnectionFactory.Current.QueryOpenConnectionAsync(
return await SqlServerConnectionFactory.Current.QueryOpenConnectionAsync(
sql,
delegate(SqlDataReader reader)
{
@@ -252,10 +246,7 @@ ORDER BY fr.NMFRD, v.IDVDODVDD;";
ConfigureCommandTimeout(command);
command.Parameters.Add("@DocumentTypeId", SqlDbType.Int).Value = isPassed ? 6 : 2;
},
cancellationToken).ContinueWith<IReadOnlyList<DocumentFormReference>>(delegate(Task<List<DocumentFormReference>> task)
{
return task.Result;
}, cancellationToken, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
cancellationToken).ConfigureAwait(false);
}
public IReadOnlyList<SpoiDirectoryItem> LoadSpoiItems()
@@ -293,7 +284,7 @@ ORDER BY s.NMOI, s.KDOI, s.IDSPOI;";
return items;
}
public Task<IReadOnlyList<SpoiDirectoryItem>> LoadSpoiItemsAsync(CancellationToken cancellationToken = default)
public async Task<IReadOnlyList<SpoiDirectoryItem>> LoadSpoiItemsAsync(CancellationToken cancellationToken = default)
{
const string sql = @"
SELECT
@@ -303,7 +294,7 @@ SELECT
FROM dbo.SPOI s
ORDER BY s.NMOI, s.KDOI, s.IDSPOI;";
return SqlServerConnectionFactory.Current.QueryOpenConnectionAsync(
return await SqlServerConnectionFactory.Current.QueryOpenConnectionAsync(
sql,
delegate(SqlDataReader reader)
{
@@ -315,10 +306,7 @@ ORDER BY s.NMOI, s.KDOI, s.IDSPOI;";
};
},
ConfigureCommandTimeout,
cancellationToken).ContinueWith<IReadOnlyList<SpoiDirectoryItem>>(delegate(Task<List<SpoiDirectoryItem>> task)
{
return task.Result;
}, cancellationToken, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
cancellationToken).ConfigureAwait(false);
}
public int AddSpoiItem(SpoiDirectoryItem item)
@@ -499,7 +487,7 @@ ORDER BY s.NMTP, s.IDSPNMTP;";
return items;
}
public Task<IReadOnlyList<SpnmtpDirectoryItem>> LoadSpnmtpItemsAsync(CancellationToken cancellationToken = default)
public async Task<IReadOnlyList<SpnmtpDirectoryItem>> LoadSpnmtpItemsAsync(CancellationToken cancellationToken = default)
{
const string sql = @"
SELECT
@@ -509,7 +497,7 @@ SELECT
FROM dbo.SPNMTP s
ORDER BY s.NMTP, s.IDSPNMTP;";
return SqlServerConnectionFactory.Current.QueryOpenConnectionAsync(
return await SqlServerConnectionFactory.Current.QueryOpenConnectionAsync(
sql,
delegate(SqlDataReader reader)
{
@@ -521,10 +509,7 @@ ORDER BY s.NMTP, s.IDSPNMTP;";
};
},
ConfigureCommandTimeout,
cancellationToken).ContinueWith<IReadOnlyList<SpnmtpDirectoryItem>>(delegate(Task<List<SpnmtpDirectoryItem>> task)
{
return task.Result;
}, cancellationToken, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
cancellationToken).ConfigureAwait(false);
}
public int AddSpnmtpItem(SpnmtpDirectoryItem item)
@@ -1267,7 +1252,7 @@ ORDER BY names.NMTP, tips.TP, sizeInfo.DPZN, z.NNZV;";
return instruments;
}
public Task<IReadOnlyList<AvailableInstrumentItem>> LoadCustomerInstrumentsAsync(int customerId, CancellationToken cancellationToken = default)
public async Task<IReadOnlyList<AvailableInstrumentItem>> LoadCustomerInstrumentsAsync(int customerId, CancellationToken cancellationToken = default)
{
const string sql = @"
SELECT
@@ -1343,7 +1328,7 @@ OUTER APPLY
WHERE z.IDFRPDV = @CustomerId
ORDER BY names.NMTP, tips.TP, sizeInfo.DPZN, z.NNZV;";
return SqlServerConnectionFactory.Current.QueryOpenConnectionAsync(
return await SqlServerConnectionFactory.Current.QueryOpenConnectionAsync(
sql,
delegate(SqlDataReader reader)
{
@@ -1371,10 +1356,7 @@ ORDER BY names.NMTP, tips.TP, sizeInfo.DPZN, z.NNZV;";
ConfigureCommandTimeout(command);
command.Parameters.Add("@CustomerId", SqlDbType.Int).Value = customerId;
},
cancellationToken).ContinueWith<IReadOnlyList<AvailableInstrumentItem>>(delegate(Task<List<AvailableInstrumentItem>> task)
{
return task.Result;
}, cancellationToken, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
cancellationToken).ConfigureAwait(false);
}
public IReadOnlyList<AvailableInstrumentItem> LoadInstrumentTypes()
@@ -1468,7 +1450,7 @@ ORDER BY names.NMTP, tips.TP, sizeInfo.DPZN, sizeInfo.NNGSRS;";
return instrumentTypes;
}
public Task<IReadOnlyList<AvailableInstrumentItem>> LoadInstrumentTypesAsync(CancellationToken cancellationToken = default)
public async Task<IReadOnlyList<AvailableInstrumentItem>> LoadInstrumentTypesAsync(CancellationToken cancellationToken = default)
{
const string sql = @"
SELECT
@@ -1522,7 +1504,7 @@ OUTER APPLY
) periodByType
ORDER BY names.NMTP, tips.TP, sizeInfo.DPZN, sizeInfo.NNGSRS;";
return SqlServerConnectionFactory.Current.QueryOpenConnectionAsync(
return await SqlServerConnectionFactory.Current.QueryOpenConnectionAsync(
sql,
delegate(SqlDataReader reader)
{
@@ -1546,10 +1528,7 @@ ORDER BY names.NMTP, tips.TP, sizeInfo.DPZN, sizeInfo.NNGSRS;";
};
},
ConfigureCommandTimeout,
cancellationToken).ContinueWith<IReadOnlyList<AvailableInstrumentItem>>(delegate(Task<List<AvailableInstrumentItem>> task)
{
return task.Result;
}, cancellationToken, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
cancellationToken).ConfigureAwait(false);
}
public IReadOnlyList<OpenDocumentConflictInfo> FindOpenDocumentConflicts(int customerId, string currentDocumentNumber, IEnumerable<PsvDocumentLine> candidateLines)