private List <MarketListDTO> GetBy(Queryable <R_Market> data) { List <MarketListDTO> list = new List <MarketListDTO>(); if (data != null && data.Any()) { var sourceList = data.ToList(); DateTime time = DateTime.Now; //注:前后分市前分市的结束时间与后分市的开始时间设置需相同 foreach (var item in sourceList) { MarketListDTO info = new MarketListDTO(); info.Id = item.Id; info.Name = item.Name; info.Description = item.Description; info.RestaurantId = item.R_Restaurant_Id; info.StartTime = item.StartTime; info.EndTime = item.EndTime; info.IsDefault = (DateTime.ParseExact(item.StartTime, "HH:mm", null) < time && time <= DateTime.ParseExact(item.EndTime, "HH:mm", null)); list.Add(info); } } return(list); }
protected override void Seed(AppContext context) { if (!context.Roles.Any(r => r.Name == "admins")) { var roleStore = new RoleStore <IdentityRole>(context); var roleManager = new RoleManager <IdentityRole>(roleStore); var role = new IdentityRole { Name = "admins" }; roleManager.Create(role); } //context.PackageSeries.AddOrUpdate(x => x.PackageSeriesId, //new PackageSeries() {PackageSeriesId = 1, PackageSeriesName = "Base"}); if (!Queryable.Any(context.Users, u => u.UserName == "*****@*****.**")) { var userStore = new UserStore <AppUser>(context); var userManager = new UserManager <AppUser>(userStore); var user = new AppUser { UserName = "******", Email = "*****@*****.**", FirstName = "ADMINFIRSTNAME", LastName = "ADMINLASTNAME", CompanyName = "admincompany", DeliveryAdress = "adminadr" }; userManager.Create(user, "P@ssw0rd"); userManager.AddToRole(user.Id, "admins"); } }
/// <summary> /// Kiểm tra bác sĩ đã tồn tại chưa? /// </summary> /// <param name="item"></param> /// <returns></returns> public override async Task <string> GetExistItemMessage(Doctors item) { List <string> messages = new List <string>(); string result = string.Empty; if (Queryable.Any(e => !e.Deleted && e.HospitalId == item.HospitalId && e.Id != item.Id && e.Code == item.Code)) { return("Mã bác sĩ đã tồn tại"); } if (item.DoctorDetails != null && item.DoctorDetails.Any()) { List <int> specialistTypeIds = new List <int>(); foreach (var doctorDetail in item.DoctorDetails) { if (doctorDetail.Deleted) { continue; } var specialistType = await this.unitOfWork.Repository <SpecialistTypes>().GetQueryable().Where(e => e.Id == doctorDetail.SpecialistTypeId).FirstOrDefaultAsync(); if (specialistTypeIds.Contains(doctorDetail.SpecialistTypeId)) { messages.Add(string.Format("Chuyên khoa {0} của bác sĩ đã tồn tại", specialistType.Name)); continue; } specialistTypeIds.Add(doctorDetail.SpecialistTypeId); } } if (messages.Any()) { result = string.Join("; ", messages); } return(result); }
public bool DinnerIsHostedBy(Guid dinnerId, string hostName) { return(Queryable.Any((from dinner in db.Dinners where dinner.HostedBy == hostName where dinner.DinnerId == dinnerId select dinner))); }
public void AnySingleTwoClausesSameTableSameMimeType() { Queryable.Any(c => c.FirstName == "Foo" && c.LastName == "Bar"); AssertSingularWithTwoClausesFromSameTableAndMimeType(); Assert.That(Translator.IsAny, Is.True); Assert.That(Translator.IsCount, Is.False); Assert.That(Translator.Take, Is.EqualTo(-1)); }
internal static Task <bool> AnyAsync <T>(this IQueryable <T> queryable, Expression <Func <T, bool> > filter) { if (queryable is IMongoQueryable <T> mongoQueryable) { return(MongoQueryable.AnyAsync(mongoQueryable, filter)); } return(Task.FromResult(Queryable.Any(queryable, filter))); }
public void AnySingleClause() { Queryable.Any(c => c.DisplayName == "Display Name"); AssertSingularWithSingleClause(); Assert.That(Translator.IsAny, Is.True); Assert.That(Translator.IsCount, Is.False); Assert.That(Translator.Take, Is.EqualTo(-1)); }
public void AnyTwoClausesSameTableDifferentMimeType() { Queryable.Any(c => c.FirstName == "Foo" && c.DisplayName == "Foo Bar"); AssertWhereWithTwoClausesFromSameTableDifferentMimeType(); Assert.That(Translator.IsAny, Is.True); Assert.That(Translator.IsCount, Is.False); Assert.That(Translator.Take, Is.EqualTo(-1), "Take was not -1"); Assert.That(Translator.Skip, Is.EqualTo(-1), "Skip was not -1"); }
private static bool Any <T>(this IQueryable <T> source, Expression <Func <T, bool> > predicate) { Expression expression = Expression.Call ( TypeUtils.GetMethod(() => Queryable.Any <T>(default(IQueryable <T>))), Expression.Call(MethodInfoFastRef.QueryableWhereMethod.MakeGenericMethod(typeof(T)), source.Expression, Expression.Quote(predicate)) ); return(((IQueryProvider)source.Provider).ExecuteEx <bool>(expression)); }
public AnyHqlGenerator() { SupportedMethods = new[] { ReflectHelper.GetMethodDefinition(() => Queryable.Any <object>(null)), ReflectHelper.GetMethodDefinition(() => Queryable.Any <object>(null, null)), ReflectHelper.GetMethodDefinition(() => Enumerable.Any <object>(null)), ReflectHelper.GetMethodDefinition(() => Enumerable.Any <object>(null, null)) }; }
private static bool Any <T>(this IQueryable <T> source) { Expression expression = Expression.Call ( TypeUtils.GetMethod(() => Queryable.Any <T>(default(IQueryable <T>))), source.Expression ); return(((IQueryProvider)source.Provider).ExecuteEx <bool>(expression)); }
public static bool IsUrlPagePublished(string url) { if (IsExternalLink(url)) { return(true); } using (DataConnection data = new DataConnection()) { return(Queryable.Any(data.Get <IPage>(), x => x.Id.ToString() == GetPageGuidFromUrl(url) && x.PublicationStatus == "published")); } }
public void GetSupportedMethods() { Assert.That( AnyExpressionNode.GetSupportedMethods(), Is.EquivalentTo( new[] { GetGenericMethodDefinition(() => Queryable.Any <object> (null)), GetGenericMethodDefinition(() => Queryable.Any <object> (null, null)), GetGenericMethodDefinition(() => Enumerable.Any <object> (null)), GetGenericMethodDefinition(() => Enumerable.Any <object> (null, null)) })); }
public void ApplyConfiguration(CloudOdsClaimSet configuration) { var claimSetExists = Queryable.Any(_securityContext.ClaimSets, cs => cs.ClaimSetName == configuration.ClaimSetName); if (claimSetExists) { return; } var resourceTypes = configuration.Claims.Select(c => c.EntityName); var actionNames = Enumerable.Distinct <string>(configuration.Claims.SelectMany(c => c.Actions).Select(x => x.ActionName)); var apiApplication = Queryable.Single(_securityContext.Applications, a => a.ApplicationName == configuration.ApplicationName); var resourceClaims = _securityContext.ResourceClaims.Where(rc => Enumerable.Contains(resourceTypes, rc.ResourceName)).ToList(); var actions = _securityContext.Actions.Where(a => actionNames.Contains(a.ActionName)).ToList(); var claimSet = new ClaimSet { Application = apiApplication, ClaimSetName = configuration.ClaimSetName }; _securityContext.ClaimSets.Add(claimSet); foreach (var requiredClaim in configuration.Claims) { var resourceClaim = resourceClaims.Single(rc => rc.ResourceName.Equals(requiredClaim.EntityName)); var authOverride = requiredClaim.AuthorizationStrategy != null ? Queryable.FirstOrDefault(_securityContext.AuthorizationStrategies, a => a.Application.ApplicationId == apiApplication.ApplicationId && a.AuthorizationStrategyName == requiredClaim.AuthorizationStrategy.StrategyName) : null; foreach (var claimSetResourceClaim in requiredClaim.Actions.Select(action => new ClaimSetResourceClaim { Action = actions.Single(a => a.ActionName == action.ActionName), AuthorizationStrategyOverride = authOverride, ClaimSet = claimSet, ResourceClaim = resourceClaim })) { _securityContext.ClaimSetResourceClaims.Add(claimSetResourceClaim); } } _securityContext.SaveChanges(); }
public void Any() { Queryable.Any(); Translator.Translate(Queryable.LastExpression); Assert.That(Translator.IsAny, Is.True); Assert.That(Translator.IsCount, Is.False); Assert.That(Translator.Take, Is.EqualTo(-1)); Assert.That(Translator.Skip, Is.EqualTo(-1)); Assert.That(Translator.QueryString, Is.Null); Assert.That(Translator.ClauseParameters, Is.Null.Or.Empty); Assert.That(Translator.Projections, Is.Null.Or.Empty); Assert.That(Translator.SortString, Is.Null.Or.Empty); Assert.That(Translator.Table, Is.EqualTo(ContactsContract.Contacts.ContentUri)); Assert.That(Translator.ReturnType, Is.Null); }
public IdentityResult RegisterUserWithContactAndLogin(UserE user, Contact contact, string password) { //using (var tran = Db.Database.BeginTransaction()) //{ try { var res = RegisterUser(user, password: password); if (res.Succeeded) { if (!Queryable.Any <Contact>(Db.Set <Contact>(), it => it.Id == contact.Id)) { Db.Set <Contact>().Add(contact); } else { Db.Entry(contact).State = EntityState.Modified; } if ( !Queryable.Any <UserContact>(Db.Set <UserContact>(), it => it.ContactId == contact.Id && it.UserId == user.Id)) { Db.Set <UserContact>().Add(new UserContact { UserId = user.Id, ContactId = contact.Id }); } Db.SaveChanges(); // tran.Commit(); LogIn(user, password); } //else // tran.Rollback(); return(res); } catch (Exception ex) { // tran.Rollback(); LogEventManager.Logger.Error(ex.Message, ex); throw; } // } }
public bool Exist(Expression <Func <T, bool> > predicate = null) { try { if (predicate == null) { return(Queryable.Any()); } else { return(Queryable.Any(predicate)); } } catch (Exception ex) { return(HandleException <bool>(string.Format("检查实体({0})存在出错", EType.Name), ex)); } }
public void GetLcsTestAny() { var testProvider = new TestLcsQueryProvider <Кошка>(); Queryable.Any(new Query <Кошка>(testProvider), o => o.Кличка.Contains("ош")); Expression queryExpression = testProvider.InnerExpression; var expected = new LoadingCustomizationStruct(null) { LimitFunction = this.ldef.GetFunction( this.ldef.funcLike, new VariableDef(this.ldef.StringType, "Кличка"), "%ош%"), ReturnType = LcsReturnType.Any }; LoadingCustomizationStruct actual = LinqToLcs.GetLcs(queryExpression, Utils.GetDefaultView(typeof(Кошка))); Assert.True(Equals(expected, actual)); }
public static async Task <bool> AnyAsync2 <T>(this IQueryable <T> source) { if (source is EnumerableQuery <T> ) { bool flag = await Task.Run <bool>((Func <bool>)(() => { if (source != null) { return(Queryable.Any <T>(source)); } return(false); })); return(flag); } bool flag1 = await source.AnyAsync <T>(); return(flag1); }
public static void SeedData(this IServiceScopeFactory scopeFactory) { using (var serviceScope = scopeFactory.CreateScope()) { var context = serviceScope.ServiceProvider.GetService <PortalDbContext>(); try { context.Database.Migrate(); context.Database.EnsureCreated(); if (!Queryable.Any <PortalLink>(context.PortalLinks)) { SeedData(context); } } catch (Exception e) { // N/A } } }
public static void SeedData(this IServiceScopeFactory scopeFactory) { using (var serviceScope = scopeFactory.CreateScope()) { var context = serviceScope.ServiceProvider.GetService <MyServerDbContext>(); try { context.Database.Migrate(); if (!Queryable.Any <User>(context.Users)) { SeedRoles(context); SeedAdmin(context); } } catch { // N/A } } }
public void ResultExport(DateTime fromDate, DateTime toDate, long accountId, string destinationPath, string corporateTag, string[] customTags = null, bool excludeCustomtagCusomers = false, bool useBlankValue = false, string resultExportFileName = "", bool considerEventDate = false, string[] showHiddenColumns = null, DateTime?eventStartDate = null, DateTime?eventEndDate = null, string[] showHiddenAdditionalFields = null, DateTime?stopSendingPdftoHealthPlanDate = null) { using (var adapter = PersistenceLayer.GetDataAccessAdapter()) { var linqMetaData = new LinqMetaData(adapter); _logger.Info("Fetching EventCustomerResults"); var eventCustomerResult = GetEventCustomerResult(linqMetaData, fromDate, toDate, accountId, corporateTag, customTags, excludeCustomtagCusomers, considerEventDate, eventStartDate, eventEndDate, stopSendingPdftoHealthPlanDate: stopSendingPdftoHealthPlanDate); if (eventCustomerResult == null || !Queryable.Any <EventCustomerResultEntity>(eventCustomerResult)) { _logger.Info("No Records Found"); return; } var customerIds = Queryable.Select <EventCustomerResultEntity, long>(eventCustomerResult, ecr => ecr.CustomerId); _logger.Info("Fetching UserIds"); var orgRoleUserIdUserIdPairs = GetOrgRoleUserIdUserIdPairs(linqMetaData, customerIds); _logger.Info("Fetching Users info"); var users = GetUsers(linqMetaData, Queryable.Select <OrderedPair <long, long>, long>(orgRoleUserIdUserIdPairs, oru => oru.SecondValue)); _logger.Info("Fetching Address info"); var addresses = GetAddress(linqMetaData, Queryable.Select <UserEntity, long>(users, u => u.HomeAddressId)); _logger.Info("Fetching Customer Profile info"); var customers = GetCustomers(linqMetaData, customerIds); _logger.Info("Fetching Event info"); var events = GetEvents(linqMetaData, Queryable.Select <EventCustomerResultEntity, long>(eventCustomerResult, ecr => ecr.EventId)); _logger.Info("Fetching Pod info"); var eventIdPodIdPairs = GetEventIdPodIdPairs(linqMetaData, Queryable.Select <EventCustomerResultEntity, long>(eventCustomerResult, ecr => ecr.EventId)); var pods = GetAllPods(linqMetaData); _logger.Info("Fetching Hospitalpartner info"); var eventIdHospitalPartnerIdPairs = GetEventIdHospitalPartnerIdPairs(linqMetaData, Queryable.Select <EventCustomerResultEntity, long>(eventCustomerResult, ecr => ecr.EventId)); var hospitalPartnerIdNamePairs = GetOrganizationIdNamePairs(linqMetaData, Queryable.Select <OrderedPair <long, long>, long>(eventIdHospitalPartnerIdPairs, eh => eh.SecondValue)); var hafTemplateIds = GetHafTemplateIds(linqMetaData, accountId, _cutOfDate); var hafQuestionIds = GetHafQuestionIds(linqMetaData, hafTemplateIds); _logger.Info("Fetching EventCustomer info"); var eventCustomers = GetEventCustomers(linqMetaData, Queryable.Select <EventCustomerResultEntity, long>(eventCustomerResult, ecr => ecr.EventCustomerResultId)); _logger.Info("Fetching Event Appoint info"); var eventAppointment = GetAppointmentDetails(linqMetaData, Queryable.Where <EventCustomersEntity>(eventCustomers, ec => ec.AppointmentId.HasValue).Select(ec => ec.AppointmentId.Value)); _logger.Info("Fetching Hospital Partner Customer info"); var hospitalPartnerCustomers = GetHospitalPartnerCustomers(linqMetaData, Queryable.Select <EventCustomerResultEntity, long>(eventCustomerResult, ecr => ecr.EventId)); var careCoordinatorIdNamePair = GetIdNamePairofUsers(linqMetaData, Queryable.Select <HospitalPartnerCustomerEntity, long>(hospitalPartnerCustomers, hpc => hpc.CareCoordinatorOrgRoleUserId)); _logger.Info("Fetching Primary care physician info"); var primaryCarePhysicians = GetPrimaryCarePhysicians(linqMetaData, customerIds); _logger.Info("Fetching Basic Biometric info"); var basicBiometric = GetEventCustomerBasicBiometric(linqMetaData, Queryable.Select <EventCustomerResultEntity, long>(eventCustomerResult, ecr => ecr.EventCustomerResultId)); _logger.Info("Fetching HAF info"); var customerHealthAnswers = GetCustomerHealthAnswers(linqMetaData, Queryable.Select <EventCustomerResultEntity, long>(eventCustomerResult, ecr => ecr.EventCustomerResultId)); IEnumerable <OrderedPair <string, string> > additionalFields = null; if (showHiddenAdditionalFields != null && showHiddenAdditionalFields.Any()) { _logger.Info("Fetching Additional Fields"); additionalFields = GetAdditionalFields(linqMetaData, accountId, showHiddenAdditionalFields); } _logger.Info("Creating CSV file"); _pcpResultExportFactory.Create(Enumerable.ToArray <EventCustomerResultEntity>(eventCustomerResult), Enumerable.ToArray <OrderedPair <long, long> >(orgRoleUserIdUserIdPairs), Enumerable.ToArray <UserEntity>(users), addresses, customers, events, customerHealthAnswers, Enumerable.ToArray <OrderedPair <long, long> >(eventIdPodIdPairs), pods, Enumerable.ToArray <OrderedPair <long, long> >(eventIdHospitalPartnerIdPairs), hospitalPartnerIdNamePairs, basicBiometric, Enumerable.ToArray <EventCustomersEntity>(eventCustomers), eventAppointment, hospitalPartnerCustomers, careCoordinatorIdNamePair, primaryCarePhysicians, destinationPath, hafQuestionIds, useBlankValue, resultExportFileName, showHiddenColumns, additionalFields); _logger.Info("Completed"); } }
public static bool exists <T>(IQueryable <T> list, Expression <Func <T, bool> > pred) => Queryable.Any(list, pred);
static Dictionary <MethodInfo, SoodaLinqMethod> Initialize() { Dictionary <MethodInfo, SoodaLinqMethod> method2id = new Dictionary <MethodInfo, SoodaLinqMethod>(); Expression <Func <object, bool> > predicate = o => true; Expression <Func <object, int> > selector = o => 0; Expression <Func <object, decimal> > selectorM = o => 0; Expression <Func <object, double> > selectorD = o => 0; Expression <Func <object, long> > selectorL = o => 0; Expression <Func <object, int?> > selectorN = o => 0; Expression <Func <object, decimal?> > selectorNM = o => 0; Expression <Func <object, double?> > selectorND = o => 0; Expression <Func <object, long?> > selectorNL = o => 0; method2id.Add(MethodOf(() => Queryable.Where(null, predicate)), SoodaLinqMethod.Queryable_Where); method2id.Add(MethodOf(() => Queryable.OrderBy(null, selector)), SoodaLinqMethod.Queryable_OrderBy); method2id.Add(MethodOf(() => Queryable.OrderByDescending(null, selector)), SoodaLinqMethod.Queryable_OrderByDescending); method2id.Add(MethodOf(() => Queryable.ThenBy(null, selector)), SoodaLinqMethod.Queryable_ThenBy); method2id.Add(MethodOf(() => Queryable.ThenByDescending(null, selector)), SoodaLinqMethod.Queryable_ThenByDescending); method2id.Add(MethodOf(() => Queryable.Skip <object>(null, 0)), SoodaLinqMethod.Queryable_Skip); method2id.Add(MethodOf(() => Queryable.Take <object>(null, 0)), SoodaLinqMethod.Queryable_Take); method2id.Add(MethodOf(() => Queryable.Select(null, selector)), SoodaLinqMethod.Queryable_Select); method2id.Add(MethodOf(() => Queryable.Select(null, (object o, int i) => i)), SoodaLinqMethod.Queryable_SelectIndexed); method2id.Add(MethodOf(() => Queryable.GroupBy(null, selector)), SoodaLinqMethod.Queryable_GroupBy); method2id.Add(MethodOf(() => Queryable.Reverse <object>(null)), SoodaLinqMethod.Queryable_Reverse); method2id.Add(MethodOf(() => Queryable.Distinct <object>(null)), SoodaLinqMethod.Queryable_Distinct); method2id.Add(MethodOf(() => Queryable.OfType <object>(null)), SoodaLinqMethod.Queryable_OfType); method2id.Add(MethodOf(() => Queryable.Except <object>(null, null)), SoodaLinqMethod.Queryable_Except); method2id.Add(MethodOf(() => Queryable.Intersect <object>(null, null)), SoodaLinqMethod.Queryable_Intersect); method2id.Add(MethodOf(() => Queryable.Union <object>(null, null)), SoodaLinqMethod.Queryable_Union); method2id.Add(MethodOf(() => Queryable.All(null, predicate)), SoodaLinqMethod.Enumerable_All); method2id.Add(MethodOf(() => Queryable.Any <object>(null)), SoodaLinqMethod.Enumerable_Any); method2id.Add(MethodOf(() => Queryable.Any(null, predicate)), SoodaLinqMethod.Enumerable_AnyFiltered); method2id.Add(MethodOf(() => Queryable.Contains <object>(null, null)), SoodaLinqMethod.Enumerable_Contains); method2id.Add(MethodOf(() => Queryable.Count <object>(null)), SoodaLinqMethod.Enumerable_Count); method2id.Add(MethodOf(() => Queryable.Count(null, predicate)), SoodaLinqMethod.Enumerable_CountFiltered); method2id.Add(MethodOf(() => Queryable.First <object>(null)), SoodaLinqMethod.Queryable_First); method2id.Add(MethodOf(() => Queryable.First(null, predicate)), SoodaLinqMethod.Queryable_FirstFiltered); method2id.Add(MethodOf(() => Queryable.FirstOrDefault <object>(null)), SoodaLinqMethod.Queryable_FirstOrDefault); method2id.Add(MethodOf(() => Queryable.FirstOrDefault(null, predicate)), SoodaLinqMethod.Queryable_FirstOrDefaultFiltered); method2id.Add(MethodOf(() => Queryable.Last <object>(null)), SoodaLinqMethod.Queryable_Last); method2id.Add(MethodOf(() => Queryable.Last(null, predicate)), SoodaLinqMethod.Queryable_LastFiltered); method2id.Add(MethodOf(() => Queryable.LastOrDefault <object>(null)), SoodaLinqMethod.Queryable_LastOrDefault); method2id.Add(MethodOf(() => Queryable.LastOrDefault(null, predicate)), SoodaLinqMethod.Queryable_LastOrDefaultFiltered); method2id.Add(MethodOf(() => Queryable.Single <object>(null)), SoodaLinqMethod.Queryable_Single); method2id.Add(MethodOf(() => Queryable.Single(null, predicate)), SoodaLinqMethod.Queryable_SingleFiltered); method2id.Add(MethodOf(() => Queryable.SingleOrDefault <object>(null)), SoodaLinqMethod.Queryable_SingleOrDefault); method2id.Add(MethodOf(() => Queryable.SingleOrDefault(null, predicate)), SoodaLinqMethod.Queryable_SingleOrDefaultFiltered); method2id.Add(MethodOf(() => Queryable.Average((IQueryable <decimal>)null)), SoodaLinqMethod.Enumerable_Average); method2id.Add(MethodOf(() => Queryable.Average((IQueryable <double>)null)), SoodaLinqMethod.Enumerable_Average); method2id.Add(MethodOf(() => Queryable.Average((IQueryable <int>)null)), SoodaLinqMethod.Enumerable_Average); method2id.Add(MethodOf(() => Queryable.Average((IQueryable <long>)null)), SoodaLinqMethod.Enumerable_Average); method2id.Add(MethodOf(() => Queryable.Average((IQueryable <decimal?>)null)), SoodaLinqMethod.Queryable_AverageNullable); method2id.Add(MethodOf(() => Queryable.Average((IQueryable <double?>)null)), SoodaLinqMethod.Queryable_AverageNullable); method2id.Add(MethodOf(() => Queryable.Average((IQueryable <int?>)null)), SoodaLinqMethod.Queryable_AverageNullable); method2id.Add(MethodOf(() => Queryable.Average((IQueryable <long?>)null)), SoodaLinqMethod.Queryable_AverageNullable); method2id.Add(MethodOf(() => Queryable.Max <int>(null)), SoodaLinqMethod.Enumerable_Max); method2id.Add(MethodOf(() => Queryable.Min <int>(null)), SoodaLinqMethod.Enumerable_Min); method2id.Add(MethodOf(() => Queryable.Sum((IQueryable <decimal>)null)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Queryable.Sum((IQueryable <double>)null)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Queryable.Sum((IQueryable <int>)null)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Queryable.Sum((IQueryable <long>)null)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Queryable.Sum((IQueryable <decimal?>)null)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Queryable.Sum((IQueryable <double?>)null)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Queryable.Sum((IQueryable <int?>)null)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Queryable.Sum((IQueryable <long?>)null)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Queryable.Average(null, selectorM)), SoodaLinqMethod.Enumerable_Average); method2id.Add(MethodOf(() => Queryable.Average(null, selectorD)), SoodaLinqMethod.Enumerable_Average); method2id.Add(MethodOf(() => Queryable.Average(null, selector)), SoodaLinqMethod.Enumerable_Average); method2id.Add(MethodOf(() => Queryable.Average(null, selectorL)), SoodaLinqMethod.Enumerable_Average); method2id.Add(MethodOf(() => Queryable.Average(null, selectorNM)), SoodaLinqMethod.Queryable_AverageNullable); method2id.Add(MethodOf(() => Queryable.Average(null, selectorND)), SoodaLinqMethod.Queryable_AverageNullable); method2id.Add(MethodOf(() => Queryable.Average(null, selectorN)), SoodaLinqMethod.Queryable_AverageNullable); method2id.Add(MethodOf(() => Queryable.Average(null, selectorNL)), SoodaLinqMethod.Queryable_AverageNullable); method2id.Add(MethodOf(() => Queryable.Max(null, selector)), SoodaLinqMethod.Enumerable_Max); method2id.Add(MethodOf(() => Queryable.Min(null, selector)), SoodaLinqMethod.Enumerable_Min); method2id.Add(MethodOf(() => Queryable.Sum(null, selectorM)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Queryable.Sum(null, selectorD)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Queryable.Sum(null, selector)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Queryable.Sum(null, selectorL)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Queryable.Sum(null, selectorNM)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Queryable.Sum(null, selectorND)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Queryable.Sum(null, selectorN)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Queryable.Sum(null, selectorNL)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Enumerable.All(null, (object o) => true)), SoodaLinqMethod.Enumerable_All); method2id.Add(MethodOf(() => Enumerable.Any <object>(null)), SoodaLinqMethod.Enumerable_Any); method2id.Add(MethodOf(() => Enumerable.Any(null, (object o) => true)), SoodaLinqMethod.Enumerable_AnyFiltered); method2id.Add(MethodOf(() => Enumerable.Contains <object>(null, null)), SoodaLinqMethod.Enumerable_Contains); method2id.Add(MethodOf(() => Enumerable.Count <object>(null)), SoodaLinqMethod.Enumerable_Count); method2id.Add(MethodOf(() => Enumerable.Count(null, (object o) => true)), SoodaLinqMethod.Enumerable_CountFiltered); method2id.Add(MethodOf(() => Enumerable.Average(null, (object o) => 0M)), SoodaLinqMethod.Enumerable_Average); method2id.Add(MethodOf(() => Enumerable.Average(null, (object o) => 0D)), SoodaLinqMethod.Enumerable_Average); method2id.Add(MethodOf(() => Enumerable.Average(null, (object o) => 0)), SoodaLinqMethod.Enumerable_Average); method2id.Add(MethodOf(() => Enumerable.Average(null, (object o) => 0L)), SoodaLinqMethod.Enumerable_Average); method2id.Add(MethodOf(() => Enumerable.Average(null, (object o) => (decimal?)0)), SoodaLinqMethod.Enumerable_Average); method2id.Add(MethodOf(() => Enumerable.Average(null, (object o) => (double?)0)), SoodaLinqMethod.Enumerable_Average); method2id.Add(MethodOf(() => Enumerable.Average(null, (object o) => (int?)0)), SoodaLinqMethod.Enumerable_Average); method2id.Add(MethodOf(() => Enumerable.Average(null, (object o) => (long?)0)), SoodaLinqMethod.Enumerable_Average); method2id.Add(MethodOf(() => Enumerable.Max(null, (object o) => 0M)), SoodaLinqMethod.Enumerable_Max); method2id.Add(MethodOf(() => Enumerable.Max(null, (object o) => 0D)), SoodaLinqMethod.Enumerable_Max); method2id.Add(MethodOf(() => Enumerable.Max(null, (object o) => 0)), SoodaLinqMethod.Enumerable_Max); method2id.Add(MethodOf(() => Enumerable.Max(null, (object o) => 0L)), SoodaLinqMethod.Enumerable_Max); method2id.Add(MethodOf(() => Enumerable.Max(null, (object o) => (decimal?)0)), SoodaLinqMethod.Enumerable_Max); method2id.Add(MethodOf(() => Enumerable.Max(null, (object o) => (double?)0)), SoodaLinqMethod.Enumerable_Max); method2id.Add(MethodOf(() => Enumerable.Max(null, (object o) => (int?)0)), SoodaLinqMethod.Enumerable_Max); method2id.Add(MethodOf(() => Enumerable.Max(null, (object o) => (long?)0)), SoodaLinqMethod.Enumerable_Max); method2id.Add(MethodOf(() => Enumerable.Max(null, (object o) => string.Empty)), SoodaLinqMethod.Enumerable_Max); method2id.Add(MethodOf(() => Enumerable.Min(null, (object o) => 0M)), SoodaLinqMethod.Enumerable_Min); method2id.Add(MethodOf(() => Enumerable.Min(null, (object o) => 0D)), SoodaLinqMethod.Enumerable_Min); method2id.Add(MethodOf(() => Enumerable.Min(null, (object o) => 0)), SoodaLinqMethod.Enumerable_Min); method2id.Add(MethodOf(() => Enumerable.Min(null, (object o) => 0L)), SoodaLinqMethod.Enumerable_Min); method2id.Add(MethodOf(() => Enumerable.Min(null, (object o) => (decimal?)0)), SoodaLinqMethod.Enumerable_Min); method2id.Add(MethodOf(() => Enumerable.Min(null, (object o) => (double?)0)), SoodaLinqMethod.Enumerable_Min); method2id.Add(MethodOf(() => Enumerable.Min(null, (object o) => (int?)0)), SoodaLinqMethod.Enumerable_Min); method2id.Add(MethodOf(() => Enumerable.Min(null, (object o) => (long?)0)), SoodaLinqMethod.Enumerable_Min); method2id.Add(MethodOf(() => Enumerable.Min(null, (object o) => string.Empty)), SoodaLinqMethod.Enumerable_Min); method2id.Add(MethodOf(() => Enumerable.Sum(null, (object o) => 0M)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Enumerable.Sum(null, (object o) => 0D)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Enumerable.Sum(null, (object o) => 0)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Enumerable.Sum(null, (object o) => 0L)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Enumerable.Sum(null, (object o) => (decimal?)0)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Enumerable.Sum(null, (object o) => (double?)0)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Enumerable.Sum(null, (object o) => (int?)0)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => Enumerable.Sum(null, (object o) => (long?)0)), SoodaLinqMethod.Enumerable_Sum); method2id.Add(MethodOf(() => ((ICollection <object>)null).Contains(null)), SoodaLinqMethod.ICollection_Contains); method2id.Add(MethodOf(() => ((List <object>)null).Contains(null)), SoodaLinqMethod.ICollection_Contains); method2id.Add(MethodOf(() => ((System.Collections.ArrayList)null).Contains(null)), SoodaLinqMethod.ICollection_Contains); method2id.Add(MethodOf(() => ((System.Collections.IList)null).Contains(null)), SoodaLinqMethod.ICollection_Contains); method2id.Add(MethodOf(() => ((Sooda.ObjectMapper.SoodaObjectCollectionWrapperGeneric <object>)null).Contains(null)), SoodaLinqMethod.ICollection_Contains); method2id.Add(MethodOf(() => string.Empty.GetType()), SoodaLinqMethod.Object_GetType); method2id.Add(MethodOf(() => ((object)null).Equals(null)), SoodaLinqMethod.Object_InstanceEquals); method2id.Add(MethodOf(() => false.Equals(false)), SoodaLinqMethod.Object_InstanceEquals); method2id.Add(MethodOf(() => 0M.Equals(0M)), SoodaLinqMethod.Object_InstanceEquals); method2id.Add(MethodOf(() => 0D.Equals(0D)), SoodaLinqMethod.Object_InstanceEquals); method2id.Add(MethodOf(() => 0.Equals(0)), SoodaLinqMethod.Object_InstanceEquals); method2id.Add(MethodOf(() => 0L.Equals(0L)), SoodaLinqMethod.Object_InstanceEquals); method2id.Add(MethodOf(() => string.Empty.Equals(string.Empty)), SoodaLinqMethod.Object_InstanceEquals); method2id.Add(MethodOf(() => DateTime.Now.Equals(DateTime.Now)), SoodaLinqMethod.Object_InstanceEquals); method2id.Add(MethodOf(() => object.Equals(null, null)), SoodaLinqMethod.Object_StaticEquals); method2id.Add(MethodOf(() => string.Equals(null, null)), SoodaLinqMethod.Object_StaticEquals); method2id.Add(MethodOf(() => DateTime.Equals(DateTime.Now, DateTime.Now)), SoodaLinqMethod.Object_StaticEquals); method2id.Add(MethodOf(() => SqlBoolean.Equals(SqlBoolean.Null, SqlBoolean.Null)), SoodaLinqMethod.Object_StaticEquals); method2id.Add(MethodOf(() => SqlDateTime.Equals(SqlDateTime.Null, SqlDateTime.Null)), SoodaLinqMethod.Object_StaticEquals); method2id.Add(MethodOf(() => SqlDecimal.Equals(SqlDecimal.Null, SqlDecimal.Null)), SoodaLinqMethod.Object_StaticEquals); method2id.Add(MethodOf(() => SqlDouble.Equals(SqlDouble.Null, SqlDouble.Null)), SoodaLinqMethod.Object_StaticEquals); method2id.Add(MethodOf(() => SqlGuid.Equals(SqlGuid.Null, SqlGuid.Null)), SoodaLinqMethod.Object_StaticEquals); method2id.Add(MethodOf(() => SqlInt32.Equals(SqlInt32.Null, SqlInt32.Null)), SoodaLinqMethod.Object_StaticEquals); method2id.Add(MethodOf(() => SqlInt64.Equals(SqlInt64.Null, SqlInt64.Null)), SoodaLinqMethod.Object_StaticEquals); method2id.Add(MethodOf(() => SqlSingle.Equals(SqlSingle.Null, SqlSingle.Null)), SoodaLinqMethod.Object_StaticEquals); method2id.Add(MethodOf(() => SqlString.Equals(SqlString.Null, SqlString.Null)), SoodaLinqMethod.Object_StaticEquals); method2id.Add(MethodOf(() => string.Concat(string.Empty, string.Empty)), SoodaLinqMethod.String_Concat); method2id.Add(MethodOf(() => LinqUtils.Like(string.Empty, string.Empty)), SoodaLinqMethod.String_Like); method2id.Add(MethodOf(() => string.Empty.Remove(0)), SoodaLinqMethod.String_Remove); method2id.Add(MethodOf(() => string.Empty.Substring(0, 0)), SoodaLinqMethod.String_Substring); method2id.Add(MethodOf(() => string.Empty.Replace(string.Empty, string.Empty)), SoodaLinqMethod.String_Replace); method2id.Add(MethodOf(() => string.Empty.ToLower()), SoodaLinqMethod.String_ToLower); method2id.Add(MethodOf(() => string.Empty.ToUpper()), SoodaLinqMethod.String_ToUpper); method2id.Add(MethodOf(() => string.Empty.StartsWith(string.Empty)), SoodaLinqMethod.String_StartsWith); method2id.Add(MethodOf(() => string.Empty.EndsWith(string.Empty)), SoodaLinqMethod.String_EndsWith); method2id.Add(MethodOf(() => string.Empty.Contains(string.Empty)), SoodaLinqMethod.String_Contains); method2id.Add(MethodOf(() => string.IsNullOrEmpty(null)), SoodaLinqMethod.String_IsNullOrEmpty); method2id.Add(MethodOf(() => 0.ToString()), SoodaLinqMethod.Int_ToString); method2id.Add(MethodOf(() => 0L.ToString()), SoodaLinqMethod.Long_ToString); method2id.Add(MethodOf(() => 0D.ToString()), SoodaLinqMethod.Double_ToString); method2id.Add(MethodOf(() => 0M.ToString()), SoodaLinqMethod.Decimal_ToString); method2id.Add(MethodOf(() => false.ToString()), SoodaLinqMethod.Bool_ToString); method2id.Add(MethodOf(() => Math.Abs(0M)), SoodaLinqMethod.Math_Abs); method2id.Add(MethodOf(() => Math.Abs(0D)), SoodaLinqMethod.Math_Abs); method2id.Add(MethodOf(() => Math.Abs((short)0)), SoodaLinqMethod.Math_Abs); method2id.Add(MethodOf(() => Math.Abs(0)), SoodaLinqMethod.Math_Abs); method2id.Add(MethodOf(() => Math.Abs(0L)), SoodaLinqMethod.Math_Abs); method2id.Add(MethodOf(() => Math.Abs((sbyte)0)), SoodaLinqMethod.Math_Abs); method2id.Add(MethodOf(() => Math.Abs(0F)), SoodaLinqMethod.Math_Abs); method2id.Add(MethodOf(() => Math.Acos(0)), SoodaLinqMethod.Math_Acos); method2id.Add(MethodOf(() => Math.Asin(0)), SoodaLinqMethod.Math_Asin); method2id.Add(MethodOf(() => Math.Atan(0)), SoodaLinqMethod.Math_Atan); method2id.Add(MethodOf(() => Math.Cos(0)), SoodaLinqMethod.Math_Cos); method2id.Add(MethodOf(() => Math.Exp(0)), SoodaLinqMethod.Math_Exp); method2id.Add(MethodOf(() => Math.Floor(0M)), SoodaLinqMethod.Math_Floor); method2id.Add(MethodOf(() => Math.Floor(0D)), SoodaLinqMethod.Math_Floor); method2id.Add(MethodOf(() => Math.Pow(1, 1)), SoodaLinqMethod.Math_Pow); method2id.Add(MethodOf(() => Math.Round(0M, 0)), SoodaLinqMethod.Math_Round); method2id.Add(MethodOf(() => Math.Round(0D, 0)), SoodaLinqMethod.Math_Round); method2id.Add(MethodOf(() => Math.Sign(0M)), SoodaLinqMethod.Math_Sign); method2id.Add(MethodOf(() => Math.Sign(0D)), SoodaLinqMethod.Math_Sign); method2id.Add(MethodOf(() => Math.Sign((short)0)), SoodaLinqMethod.Math_Sign); method2id.Add(MethodOf(() => Math.Sign(0)), SoodaLinqMethod.Math_Sign); method2id.Add(MethodOf(() => Math.Sign(0L)), SoodaLinqMethod.Math_Sign); method2id.Add(MethodOf(() => Math.Sign((sbyte)0)), SoodaLinqMethod.Math_Sign); method2id.Add(MethodOf(() => Math.Sign(0F)), SoodaLinqMethod.Math_Sign); method2id.Add(MethodOf(() => Math.Sin(0)), SoodaLinqMethod.Math_Sin); method2id.Add(MethodOf(() => Math.Sqrt(0)), SoodaLinqMethod.Math_Sqrt); method2id.Add(MethodOf(() => Math.Tan(0)), SoodaLinqMethod.Math_Tan); method2id.Add(MethodOf(() => ((SoodaObject)null).GetPrimaryKeyValue()), SoodaLinqMethod.SoodaObject_GetPrimaryKeyValue); method2id.Add(MethodOf(() => ((SoodaObject)null).GetLabel(false)), SoodaLinqMethod.SoodaObject_GetLabel); // doesn't compile: method2id.Add(MethodOf(() => ((SoodaObject) null)[string.Empty]), SoodaLinqMethod.SoodaObject_GetItem); method2id.Add(typeof(SoodaObject).GetMethod("get_Item"), SoodaLinqMethod.SoodaObject_GetItem); _method2id = method2id; return(method2id); }
public bool ExistUser(string loginName) { return(Queryable.Any(t => t.LoginName == loginName)); }
/// <summary> /// 全部监控的同步 /// </summary> public void Monitoring2() { //_dbContext1.Dispose(); //_dbContext1 = new HaikanHeQiaoContext(); cameraList = new List <HaikanSmartTownCockpit.WatchDog.Camera.List>(); GetCameras(1); for (int i = 0; i < cameraList.Count; i++) { var cid = cameraList[i].indexCode; if (Queryable.Any <XlProject>(_dbContext1.XlProject, x => x.XlShebeiId == cid && x.IsDeleted == 0)) { LogHelper.WriteLog(typeof(string), "监控信息修改:" + cid); //Console.WriteLine("监控信息修改:" + cid); var entity = Queryable.FirstOrDefault <XlProject>(_dbContext1.XlProject, x => x.XlShebeiId == cid && x.IsDeleted == 0); entity.ShebeiAddress = cameraList[i].name; entity.XlShebeiType = cameraList[i].regionName; //entity.Lat = cameraList[i].latitude; //entity.Lon = cameraList[i].longitude; entity.ShebeiType = GetOnlineState(cid); entity.UrlType = 1; } else { LogHelper.WriteLog(typeof(string), "监控信息添加:" + cid); //Console.WriteLine("监控信息添加:" + cid); XlProject project = new XlProject() { XlProjectUuid = Guid.NewGuid(), XlShebeiId = cid, XlShebeiType = cameraList[i].regionName, ShebeiAddress = cameraList[i].name, Lon = cameraList[i].longitude, Lat = cameraList[i].latitude, IsDeleted = 0, ShebeiType = GetOnlineState(cid), AddPeople = "狗", AddTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), UrlType = 1, }; _dbContext1.XlProject.Add(project); LogHelper.WriteLog(typeof(string), "添加" + JsonConvert.SerializeObject(project)); //Console.WriteLine("添加" + JsonConvert.SerializeObject(project)); } var num = _dbContext1.SaveChanges(); Console.WriteLine("改变:" + num); if (cameraList[i].regionName == "垃圾分类监控") { if (Queryable.Any <Ygiene>(_dbContext1.Ygiene, x => x.YgieneMonitorId == cid && x.IsDeleted == 0)) { LogHelper.WriteLog(typeof(string), "case9修改:" + cid); //Console.WriteLine("case9修改:" + cid); var entity = Queryable.FirstOrDefault <Ygiene>(_dbContext1.Ygiene, x => x.YgieneMonitorId == cid && x.IsDeleted == 0); entity.YgieneType = cameraList[i].regionName; entity.YgieneAddress = cameraList[i].name; //entity.Lat = cameraList[i].latitude; //entity.Lon = cameraList[i].longitude; entity.YgieneStaues = GetOnlineState(cid); entity.UrlType = 1; } else { LogHelper.WriteLog(typeof(string), "case9添加:" + cid); //Console.WriteLine("case9添加:" + cid); Ygiene ygiene = new Ygiene() { YgieneUuid = Guid.NewGuid(), YgieneMonitorId = cid, YgieneAddress = cameraList[i].name, Lon = cameraList[i].longitude, Lat = cameraList[i].latitude, AddPeople = "狗", AddTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), YgieneStaues = GetOnlineState(cid), YgieneType = cameraList[i].regionName, IsDeleted = 0, UrlType = 1, }; _dbContext1.Ygiene.Add(ygiene); LogHelper.WriteLog(typeof(string), "添加卫生点" + JsonConvert.SerializeObject(ygiene)); //Console.WriteLine("添加卫生点" + JsonConvert.SerializeObject(ygiene)); } _dbContext1.SaveChanges(); } } cameraList = new List <HaikanSmartTownCockpit.WatchDog.Camera.List>(); //GC.Collect(); }
public bool Any(Expression <Func <T, bool> > filter) => Queryable.Any(filter);
public bool Any() { return(Queryable.Any()); }
public bool Any(Expression <Func <T, bool> > where) { return(Queryable.Any(where)); }
public void AnyFallback() { Queryable.Any(c => c.Organizations.Any()); AssertFallback(); }