/// <inheritdoc /> public Task <GetListResult <EccUserModel> > GetUsers(GetListSearchModel model) { var query = CltDbContext.Clients .AsNoTracking() .OrderBy(x => x.CreatedOn); return(EFCoreExtensions.GetAsync(model, query, SelectExpression)); }
/// <summary> /// Искать клиентов /// </summary> /// <param name="model"></param> /// <returns></returns> public Task <GetListResult <ClientModel> > GetClients(ClientSearch model) { var criterias = GetCriterias(model); var clientQuery = Query <Client>().BuildQuery(criterias) .OrderByDescending(x => x.CreatedOn); return(EFCoreExtensions.GetAsync(model, clientQuery, ClientSelectExpression)); }
/// <summary> /// Получить смс-сообщения отправленные клиенту /// </summary> /// <param name="model"></param> /// <returns></returns> public Task <GetListResult <SmsMessageModel> > GetClientSmsMessages(GetClientInteractions model) { var initQuery = Query <SmsMessageInteraction>(); if (!string.IsNullOrWhiteSpace(model.ClientId)) { initQuery = initQuery.Where(x => x.UserId == model.ClientId); } return(EFCoreExtensions.GetAsync(model, GetQueryWithStatus(initQuery).OrderByDescending(x => x.Interaction.CreatedOn), SelectExpression)); }
/// <summary> /// Получить сообщения /// </summary> /// <param name="model"></param> /// <param name="token"></param> /// <returns></returns> public Task <GetListResult <ChatMessageModel> > GetMessages(GetChatMessages model, CancellationToken token = default) { var query = Query <EccChatMessage>() .Where(x => x.ChatId == model.ChatId && x.SentOnUtcTicks <= model.LessThantUtcTicks) .OrderBy(x => x.SentOnUtcTicks); var searchModel = new GetListSearchModel { Count = model.Count, OffSet = 0 }; return(EFCoreExtensions.GetAsync(searchModel, query, x => new ChatMessageModel { Id = x.Id, SenderUserId = x.SenderUserId, SentOnUtcTicks = x.SentOnUtcTicks, LastUpdateUtcTicks = x.LastUpdateOnUtcTicks, Message = x.Message, TagString = x.TagString })); }
public void OnNext(KeyValuePair <string, object> value) { masterConnectionString = EFCoreExtensions.config.MasterConnetion; if (value.Key == RelationalEventId.CommandExecuting.Name) { var command = ((CommandEventData)value.Value).Command; var executeMethod = ((CommandEventData)value.Value).ExecuteMethod; Console.WriteLine(command.CommandText); if (executeMethod == DbCommandMethod.ExecuteNonQuery) { ResetConnection(command, masterConnectionString); } else if (executeMethod == DbCommandMethod.ExecuteScalar) { slaveConnectionString = EFCoreExtensions.GetConnectionString(); ResetConnection(command, slaveConnectionString); } else if (executeMethod == DbCommandMethod.ExecuteReader) { slaveConnectionString = EFCoreExtensions.GetConnectionString(); ResetConnection(command, slaveConnectionString); } } }
/// <summary> /// Получить группы адресов /// </summary> /// <param name="model"></param> /// <returns></returns> public Task <GetListResult <EmailGroupModel> > GetEmailGroups(GetListSearchModel model) { return(EFCoreExtensions.GetAsync(model, Query <EmailGroup>().OrderByDescending(x => x.CreatedOn), SelectExpression)); }
/// <summary> /// Получить электронные адреса в группе /// </summary> /// <param name="model"></param> /// <returns></returns> public Task <GetListResult <string> > GetEmailsInGroup(GetEmailsInGroup model) { return(EFCoreExtensions.GetAsync(model, Query <EmailInEmailGroupRelation>().Where(x => x.EmailGroupId == model.EmailGroupId).OrderByDescending(x => x.Email), x => x.Email)); }
/// <summary> /// Получить список уведомлений без пользователей /// </summary> /// <param name="model"></param> /// <returns></returns> public Task <GetListResult <NotificationModel> > GetUserNotificationsAsync(NotificationSearchQueryModel model) { return(EFCoreExtensions.GetAsync(model, GetFilteredQuery(model), NotificationModelSelectExpression)); }
/// <summary> /// Искать ловителей переходов /// </summary> /// <param name="model"></param> /// <returns></returns> public Task <GetListResult <EmailLinkCatchRedirectsCountModel> > Query(GetListSearchModel model) { return(EFCoreExtensions.GetAsync(model, Query <EmailLinkCatch>().OrderByDescending(x => x.CreatedOnUtc), SelectExpression)); }
/// <summary> /// Получить список отправленных адресов /// </summary> /// <param name="model"></param> /// <returns></returns> public Task <GetListResult <UserMailMessageModel> > GetMailsAsync(GetListSearchModel model) { var initQuery = Query <MailMessageInteraction>().OrderByDescending(x => x.CreatedOn); return(EFCoreExtensions.GetAsync(model, initQuery, UserMailMessageModel.SelectExpression)); }
/// <summary> /// Получить Email отправленные клиенту /// </summary> /// <param name="model"></param> /// <returns></returns> public Task <GetListResult <MailMessageModel> > GetClientMailMessages(GetClientInteractions model) { var queryWithStatus = GetQueryWithStatus(Query <MailMessageInteraction>().BuildQuery(model.GetCriterias())); return(EFCoreExtensions.GetAsync(model, queryWithStatus.OrderByDescending(x => x.Interaction.CreatedOn), MailMessageModelSelectExpression)); }