本文整理汇总了C#中QueryResult类的典型用法代码示例。如果您正苦于以下问题:C# QueryResult类的具体用法?C# QueryResult怎么用?C# QueryResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QueryResult类属于命名空间,在下文中一共展示了QueryResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: QueryEmailAndSMSTemplates
/// <summary>
/// 查询邮件短信模板
/// </summary>
/// <param name="filter">查询条件</param>
/// <returns></returns>
public static QueryResult<EmailAndSMSTemplates> QueryEmailAndSMSTemplates(EmailAndSMSTemplatesQueryFilter filter)
{
QueryResult<EmailAndSMSTemplates> result = new QueryResult<EmailAndSMSTemplates>();
result.ServicePageIndex = filter.ServicePageIndex;
result.PageSize = filter.PageSize;
PagingInfoEntity page = DataAccessUtil.ToPagingInfo(filter);
CustomDataCommand cmd = DataCommandManager.CreateCustomDataCommandFromConfig("QueryEmailAndSMSTemplates");
using (var sqlBuilder = new DynamicQuerySqlBuilder(cmd.CommandText, cmd, page, "SysNo DESC"))
{
sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "Status", DbType.Int32,
"@Status1", QueryConditionOperatorType.NotEqual, CommonStatus.Deleted);
sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "SysNo", DbType.Int32,
"@SysNo", QueryConditionOperatorType.Equal, filter.SysNo);
sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "Category", DbType.String,
"@Category", QueryConditionOperatorType.Like, filter.Category);
sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "Templates", DbType.String,
"@Templates", QueryConditionOperatorType.Like, filter.Templates);
sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "Status", DbType.Int32,
"@Status", QueryConditionOperatorType.Equal, filter.Status);
cmd.CommandText = sqlBuilder.BuildQuerySql();
result.ResultList = cmd.ExecuteEntityList<EmailAndSMSTemplates>();
result.TotalCount = Convert.ToInt32(cmd.GetParameterValue("@TotalCount"));
return result;
}
}
示例2: QueryLogs
/// <summary>
/// 查询日志
/// </summary>
/// <param name="filter">查询条件</param>
/// <returns></returns>
public static QueryResult<Logs> QueryLogs(LogsQueryFilter filter)
{
QueryResult<Logs> result = new QueryResult<Logs>();
result.ServicePageIndex = filter.ServicePageIndex;
result.PageSize = filter.PageSize;
PagingInfoEntity page = DataAccessUtil.ToPagingInfo(filter);
CustomDataCommand cmd = DataCommandManager.CreateCustomDataCommandFromConfig("QueryLogs");
using (var sqlBuilder = new DynamicQuerySqlBuilder(cmd.CommandText, cmd, page, "SysNo DESC"))
{
sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "Classes", DbType.Int32,
"@Classes", QueryConditionOperatorType.Like, filter.Classes);
sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "Section", DbType.Int32,
"@Section", QueryConditionOperatorType.Like, filter.Section);
sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "Family", DbType.Int32,
"@Family", QueryConditionOperatorType.Like, filter.Family);
sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "RefenceSysNo", DbType.Int32,
"@RefenceSysNo", QueryConditionOperatorType.Like, filter.RefenceSysNo);
sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "Contents", DbType.String,
"@Contents", QueryConditionOperatorType.Like, filter.Contents);
cmd.CommandText = sqlBuilder.BuildQuerySql();
result.ResultList = cmd.ExecuteEntityList<Logs>();
result.TotalCount = Convert.ToInt32(cmd.GetParameterValue("@TotalCount"));
return result;
}
}
示例3: GetChannels
public Task<QueryResult<BaseItemDto>> GetChannels(ChannelQuery query, CancellationToken cancellationToken)
{
var user = string.IsNullOrWhiteSpace(query.UserId)
? null
: _userManager.GetUserById(new Guid(query.UserId));
var channels = _channelEntities.OrderBy(i => i.SortName).ToList();
if (user != null)
{
channels = channels.Where(i => GetChannelProvider(i).IsEnabledFor(user) && i.IsVisible(user))
.ToList();
}
// Get everything
var fields = Enum.GetNames(typeof(ItemFields))
.Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true))
.ToList();
var returnItems = channels.Select(i => _dtoService.GetBaseItemDto(i, fields, user))
.ToArray();
var result = new QueryResult<BaseItemDto>
{
Items = returnItems,
TotalRecordCount = returnItems.Length
};
return Task.FromResult(result);
}
示例4: CorrectlyInitialized
public void CorrectlyInitialized()
{
var qr = new QueryResult<User>(new User[] {new User() {FirstName = "Arne"}}, 100);
Assert.Equal("Arne", qr.Items.First().FirstName);
Assert.Equal(100, qr.TotalCount);
}
示例5: Add_Investment
public Add_Investment(ref Portfolio p, QueryResult qr)
{
InitializeComponent();
ThisPortfolio = p;
tbCompanyName.Text = qr.Company;
}
示例6: TestToString
public void TestToString(QueryResult result)
{
string queryResultToString = result.ToString();
if(result.ResultMessage == "Success")
{
if(result.RetrievedData != null)
{
string expectedString = "Success " + result.RetrievedData.ToString();
Assert.AreEqual(expectedString, queryResultToString);
}
}
else
{
if(result.ThrownException != null)
{
string expectedString = "Failed with Exception : " + result.ThrownException.ToString();
Assert.AreEqual(expectedString, queryResultToString);
}
else
{
string expectedString = "Failed ";
Assert.AreEqual(expectedString, queryResultToString);
}
}
}
示例7: FillSearchResultsDatatable
public static void FillSearchResultsDatatable(ref DataGridView dgv, QueryResult qr)
{
foreach(StockDay sd in qr.StockDays)
{
dgv.Rows.Add(sd.Date.ToShortDateString(), sd.OpeningValue, sd.High, sd.Low, sd.ClosingValue, sd.TradeVolume, sd.AdjustedClosingValue);
}
}
示例8: QueryNotices
/// <summary>
/// 查询公告
/// </summary>
/// <param name="filter">查询条件</param>
public static QueryResult<Notices> QueryNotices(NoticesQueryFilter filter)
{
QueryResult<Notices> result = new QueryResult<Notices>();
PagingInfoEntity page = new PagingInfoEntity();
page.SortField = (filter.SortList == null || filter.SortList.Count == 0) ? null : filter.SortListToString();
page.MaximumRows = filter.PageSize;
page.StartRowIndex = (filter.PageIndex - 1) * filter.PageSize;
CustomDataCommand cmd = DataCommandManager.CreateCustomDataCommandFromConfig("QueryNotices");
using (var sqlBuilder = new DynamicQuerySqlBuilder(cmd.CommandText, cmd, page, "SysNo DESC"))
{
sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "SysNo", DbType.Int32, "@SysNo",
QueryConditionOperatorType.Equal, filter.SysNo);
sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "Contents", DbType.String, "@Contents",
QueryConditionOperatorType.Like, filter.Contents);
sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "Status", DbType.Int32, "@Status",
QueryConditionOperatorType.Equal, filter.Status);
cmd.CommandText = sqlBuilder.BuildQuerySql();
result.ResultList = cmd.ExecuteEntityList<Notices>();
int totalCount = Convert.ToInt32(cmd.GetParameterValue("@TotalCount"));
result.PagingInfo = new PagingInfo() { PageIndex = filter.PageIndex, PageSize = filter.PageSize, TotalCount = totalCount };
return result;
}
}
示例9: Import
public override QueryResult Import(IEnumerable<String> myLines, IGraphDBSession myIGraphDBSession, DBContext myDBContext, UInt32 parallelTasks = 1, IEnumerable<String> comments = null, ulong? offset = null, ulong? limit = null, VerbosityTypes verbosityTypes = VerbosityTypes.Errors)
{
var gqlQuery = new GraphQLQuery(myDBContext.DBPluginManager);
#region Evaluate Limit and Offset
if (offset != null)
{
myLines = myLines.SkipULong(offset.Value);
}
if (limit != null)
{
myLines = myLines.TakeULong(limit.Value);
}
#endregion
var queryResult = new QueryResult();
#region Import queries
if (parallelTasks > 1)
{
queryResult = ExecuteAsParallel(myLines, myIGraphDBSession, gqlQuery, verbosityTypes, parallelTasks, comments);
}
else
{
queryResult = ExecuteAsSingleThread(myLines, myIGraphDBSession, gqlQuery, verbosityTypes, comments);
}
#endregion
return queryResult;
}
示例10: GetFiles
public async Task<QueryResult<FileSystemMetadata>> GetFiles(string[] pathParts, string rootFolderId, GoogleCredentials googleCredentials,
CancellationToken cancellationToken)
{
var fullDriveService = CreateDriveServiceAndCredentials(googleCredentials);
var driveService = fullDriveService.Item1;
var result = new QueryResult<FileSystemMetadata>();
if (pathParts != null && pathParts.Length > 0)
{
var name = pathParts.Last();
pathParts = pathParts.Take(pathParts.Length - 1).ToArray();
try
{
var parentId = await FindOrCreateParent(driveService, false, pathParts, rootFolderId, cancellationToken)
.ConfigureAwait(false);
var file = await FindFileId(name, parentId, driveService, cancellationToken).ConfigureAwait(false);
result.TotalRecordCount = 1;
result.Items = new[] { file }.Select(GetFileMetadata).ToArray();
}
catch (FileNotFoundException)
{
}
return result;
}
return result;
}
示例11: QueryGifts
/// <summary>
/// 查询奖品
/// </summary>
/// <param name="filter">查询条件</param>
/// <returns></returns>
public static QueryResult<Gift> QueryGifts(GiftQueryFilter filter)
{
QueryResult<Gift> result = new QueryResult<Gift>();
result.ServicePageIndex = filter.ServicePageIndex;
result.PageSize = filter.PageSize;
PagingInfoEntity page = DataAccessUtil.ToPagingInfo(filter);
CustomDataCommand cmd = DataCommandManager.CreateCustomDataCommandFromConfig("QueryGifts");
using (var sqlBuilder = new DynamicQuerySqlBuilder(cmd.CommandText, cmd, page, "SysNo DESC"))
{
sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "Status", DbType.Int32,
"@Status1", QueryConditionOperatorType.NotEqual, CommonStatus.Deleted);
sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "SysNo", DbType.Int32,
"@SysNo", QueryConditionOperatorType.Equal, filter.SysNo);
sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "GiftName", DbType.String,
"@GiftName", QueryConditionOperatorType.Like, filter.GiftName);
sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "GiftID", DbType.String,
"@GiftID", QueryConditionOperatorType.Like, filter.GiftID);
sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "Descriptions", DbType.String,
"@Descriptions", QueryConditionOperatorType.Like, filter.Descriptions);
sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "MarketPrice", DbType.Decimal,
"@MarketPrice", QueryConditionOperatorType.Like, filter.MarketPrice);
sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "Status", DbType.Int32,
"@Status", QueryConditionOperatorType.Equal, filter.Status);
cmd.CommandText = sqlBuilder.BuildQuerySql();
result.ResultList = cmd.ExecuteEntityList<Gift>();
result.TotalCount = Convert.ToInt32(cmd.GetParameterValue("@TotalCount"));
return result;
}
}
示例12: AnalyseQueryResults
public static string AnalyseQueryResults(QueryResult qr)
{
string output = string.Empty;
//Time span
output += string.Format(TimeTemplate, qr.StockDays.Count);
output += Environment.NewLine; output += Environment.NewLine;
//Average volume
output += string.Format(AverageTemplate, Math.Round(qr.AverageTradeVolume, 3));
output += Environment.NewLine; output += Environment.NewLine;
//Value Information
output += string.Format(PeaksTemplate, Math.Round(qr.AverageValue, 3),
Math.Round(qr.HighestValue, 3),
Math.Round(qr.LowestValue, 3),
Math.Round(qr.Divergence, 3),
Math.Round(qr.Divergence/ qr.AverageValue, 3)*100);
output += Environment.NewLine; output += Environment.NewLine;
return output;
}
示例13: AssignedCorrectly
public void AssignedCorrectly()
{
var items = new FakeAggregate[] {new FakeAggregate(), new FakeAggregate()};
var conditions = new QueryResult<FakeAggregate>(items, 10);
Assert.Same(items, conditions.Items);
Assert.Equal(10, conditions.TotalCount);
}
示例14: GetFiles
public async Task<QueryResult<FileMetadata>> GetFiles(FileQuery query, string rootFolderId, GoogleCredentials googleCredentials,
CancellationToken cancellationToken)
{
var fullDriveService = CreateDriveServiceAndCredentials(googleCredentials);
var driveService = fullDriveService.Item1;
var result = new QueryResult<FileMetadata>();
if (!string.IsNullOrWhiteSpace(query.Id))
{
try
{
var file = await GetFile(query.Id, driveService, cancellationToken).ConfigureAwait(false);
result.TotalRecordCount = 1;
result.Items = new[] { file }.Select(GetFileMetadata).ToArray();
}
catch (FileNotFoundException)
{
}
return result;
}
if (query.FullPath != null && query.FullPath.Length > 0)
{
var name = query.FullPath.Last();
var pathParts = query.FullPath.Take(query.FullPath.Length - 1).ToArray();
try
{
var parentId = await FindOrCreateParent(driveService, false, pathParts, rootFolderId, cancellationToken)
.ConfigureAwait(false);
var file = await FindFileId(name, parentId, driveService, cancellationToken).ConfigureAwait(false);
result.TotalRecordCount = 1;
result.Items = new[] { file }.Select(GetFileMetadata).ToArray();
}
catch (FileNotFoundException)
{
}
return result;
}
var queryResult = await GetFiles(null, driveService, cancellationToken).ConfigureAwait(false);
var files = queryResult
.Select(GetFileMetadata)
.ToArray();
result.Items = files;
result.TotalRecordCount = files.Length;
return result;
}
示例15: QueryResultPropertyTest
public void QueryResultPropertyTest()
{
List<Int32> list = new List<int>();
int totalCount = 20;
QueryResult<Int32> querResult = new QueryResult<Int32>(list, totalCount);
Assert.AreSame(list, querResult.ResultList);
Assert.AreEqual<int>(totalCount, querResult.Total);
}