public IIterator Filter(FilterRequest.PhoneRequest phone, IdStorage idStorage) { if (phone.IsNull.HasValue) { if (phone.IsNull.Value) { return(phone.Code.HasValue ? ListHelper.EmptyInt : _null.GetIterator()); } } if (phone.Code.HasValue) { if (_code2ids.ContainsKey(phone.Code.Value)) { return(_code2ids[phone.Code.Value].GetIterator()); } else { return(ListHelper.EmptyInt); } } else { return(_ids.GetIterator()); } }
public EnvironmentFactory( IdStorage idStorage, SheepItDbContext dbContext) { _idStorage = idStorage; _dbContext = dbContext; }
public IIterator Filter( FilterRequest.CountryRequest country, IdStorage ids, CountryStorage countries) { if (country.IsNull.HasValue) { if (country.IsNull.Value) { return(country.Eq == null ? _null.GetIterator() : ListHelper.EmptyInt); } } if (country.Eq == null) { return(_ids.GetIterator()); } short countryId = countries.Get(country.Eq); if (_id2AccId[countryId] != null) { return(_id2AccId[countryId].GetIterator()); } else { return(ListHelper.EmptyInt); } }
public PackageFactory( IdStorage idStorage, IClock clock) { _idStorage = idStorage; _clock = clock; }
public DeploymentProcessFactory( IdStorage idStorage, ValidateZipFile validateZipFile) { _idStorage = idStorage; _validateZipFile = validateZipFile; }
public DeploymentFactory( IdStorage idStorage, IClock clock) { _idStorage = idStorage; _clock = clock; }
public void InitNull(IdStorage ids) { Cities.InitNull(ids); Countries.InitNull(ids); Interests.InitNull(ids); FirstNames.InitNull(ids); LastNames.InitNull(ids); Phones.InitNull(ids); Premiums.InitNull(ids); }
public IIterator Filter( FilterRequest.FnameRequest fname, IdStorage idStorage) { if (fname.IsNull != null) { if (fname.IsNull.Value) { if (fname.Eq == null && fname.Any.Count == 0) { return(_null.GetIterator()); } else { return(ListHelper.EmptyInt); } } } if (fname.Eq != null && fname.Any.Count > 0) { if (fname.Any.Contains(fname.Eq)) { int eqId = _storage.Get(fname.Eq); return(_byName[eqId]?.GetIterator() ?? ListHelper.EmptyInt); } else { return(ListHelper.EmptyInt); } } if (fname.Any.Count > 0) { List <IIterator> enumerators = new List <IIterator>(fname.Any.Count); for (int i = 0; i < fname.Any.Count; i++) { int nameId = _storage.Get(fname.Any[i]); if (_byName[nameId] != null) { enumerators.Add(_byName[nameId].GetIterator()); } } return(enumerators.MergeSort()); } else if (fname.Eq != null) { int eqId = _storage.Get(fname.Eq); return(_byName[eqId]?.GetIterator() ?? ListHelper.EmptyInt); } return(_ids.GetIterator()); }
public void InitNull(IdStorage ids) { _null.Clear(); foreach (var id in ids.AsEnumerable()) { if (_names[id] == 0) { _null.Load(id); } } _null.LoadEnded(); }
public void InitNull(IdStorage ids) { _null.Clear(); foreach (var id in ids.AsEnumerable()) { if (!_phones[id].IsNotEmpty()) { _null.Load(id); } } _null.LoadEnded(); }
public void InitNull(IdStorage ids) { _null.Clear(); foreach (var id in ids.AsEnumerable()) { if (!_ids.Contains(id)) { _null.Load(id); } } _null.LoadEnded(); }
private static async Task <List <int> > GenerateIds(IdStorage idStorage, int count, IdSequence sequence) { var ids = new List <int>(); for (var index = 0; index < count; index++) { var nextId = await idStorage.GetNext(sequence); ids.Add(nextId); } return(ids); }
public IIterator Filter(FilterRequest.SnameRequest sname, IdStorage idStorage) { if (sname.IsNull != null) { if (sname.IsNull.Value) { if (sname.Eq == null && sname.Starts == null) { return(_null.GetIterator()); } else { return(ListHelper.EmptyInt); } } } if (sname.Eq != null && sname.Starts != null) { if (sname.Eq.StartsWith(sname.Starts)) { return(_byName.GetValueOrDefault(_storage.Get(sname.Eq))?.GetIterator() ?? ListHelper.EmptyInt); } else { return(ListHelper.EmptyInt); } } if (sname.Starts != null) { List <IIterator> enumerators = new List <IIterator>(); foreach (var nameId in _storage.StartWith(sname.Starts)) { var list = _byName.GetValueOrDefault(nameId); if (list != null) { enumerators.Add(list.GetIterator()); } } return(enumerators.MergeSort()); } else if (sname.Eq != null) { return(_byName.GetValueOrDefault(_storage.Get(sname.Eq))?.GetIterator() ?? ListHelper.EmptyInt); } return(_ids.GetIterator()); }
public IIterator Filter( FilterRequest.CityRequest city, IdStorage ids, CityStorage cities) { if (city.IsNull.HasValue) { if (city.IsNull.Value) { return((city.Eq == null && city.Any.Count == 0) ? _null.GetIterator() : ListHelper.EmptyInt); } } if (city.Eq != null && city.Any.Count > 0) { if (city.Any.Contains(city.Eq)) { short cityId = cities.Get(city.Eq); return(_id2AccId[cityId]?.GetIterator() ?? ListHelper.EmptyInt); } else { return(ListHelper.EmptyInt); } } if (city.Eq != null) { short cityId = cities.Get(city.Eq); return(_id2AccId[cityId]?.GetIterator() ?? ListHelper.EmptyInt); } else if (city.Any.Count > 0) { return(ListHelper .MergeSort( city.Any .Select(x => cities.Get(x)) .Where(x => _id2AccId[x] != null) .Select(x => _id2AccId[x].GetIterator()) .ToList())); } else { return(_ids.GetIterator()); } }
public IIterator Filter( FilterRequest.EmailRequest email, DomainStorage domainStorage, IdStorage idStorage) { DelaySortedList <int> withDomain = null; if (email.Domain != null) { var domainId = domainStorage.Get(email.Domain); withDomain = _domain2ids.GetValueOrDefault(domainId); } IEnumerable <int> result = withDomain != null ? withDomain : idStorage.AsEnumerable(); if (email.Gt != null && email.Lt != null) { if (string.Compare(email.Gt, email.Lt) > 0) { return(ListHelper.EmptyInt); } return(result.Where(x => { string prefix = _emails[x].Prefix; return string.Compare(prefix, email.Gt) > 0 && string.Compare(prefix, email.Lt) < 0; }).GetIterator()); } if (email.Gt != null) { return(result .Where(x => string.Compare(_emails[x].Prefix, email.Gt) > 0) .GetIterator()); } else if (email.Lt != null) { return(result .Where(x => string.Compare(_emails[x].Prefix, email.Lt) < 0) .GetIterator()); } return(withDomain.GetIterator()); }
public IIterator Filter( FilterRequest.PremiumRequest premium, IdStorage ids) { if (premium.IsNull.HasValue) { if (premium.IsNull.Value) { return(premium.Now ? ListHelper.EmptyInt : _null.GetIterator()); } } if (premium.Now) { return(_now.GetIterator()); } else { return(_ids.GetIterator()); } }
public ComponentFactory(IdStorage idStorage) { _idStorage = idStorage; }
public IIterator Filter(FilterRequest.BirthRequest birth, IdStorage idStorage) { if (birth.Year.HasValue) { var list = _byYear.GetValueOrDefault(birth.Year.Value); if (list == null) { return(ListHelper.EmptyInt); } if (!birth.Gt.HasValue && birth.Lt.HasValue) { return(list.GetIterator()); } IEnumerable <int> result = list; if (birth.Gt.HasValue) { if (birth.Gt.Value.Year < birth.Year.Value) { return(ListHelper.EmptyInt); } result = result.Where(x => _id2time[x] > birth.Gt.Value); } if (birth.Lt.HasValue) { if (birth.Lt.Value.Year > birth.Year.Value) { return(ListHelper.EmptyInt); } result = result.Where(x => _id2time[x] < birth.Lt.Value); } return(result.GetIterator()); } else { List <IIterator> enumerators = new List <IIterator>(); if (birth.Lt.HasValue && birth.Gt.HasValue) { if (birth.Lt <= birth.Gt) { return(ListHelper.EmptyInt); } foreach (var pair in _byYear) { if (pair.Key > birth.Gt.Value.Year && pair.Key < birth.Lt.Value.Year) { enumerators.Add(pair.Value.GetIterator()); } else if (pair.Key == birth.Gt.Value.Year && pair.Key == birth.Lt.Value.Year) { enumerators.Add( pair.Value .Where(x => _id2time[x] > birth.Gt.Value && _id2time[x] < birth.Lt.Value) .GetIterator() ); } else if (pair.Key == birth.Gt.Value.Year) { enumerators.Add( pair.Value .Where(x => _id2time[x] > birth.Gt.Value) .GetIterator() ); } else if (pair.Key == birth.Lt.Value.Year) { enumerators.Add( pair.Value .Where(x => _id2time[x] < birth.Lt.Value) .GetIterator() ); } } } else if (birth.Lt.HasValue) { foreach (var pair in _byYear) { if (pair.Key < birth.Lt.Value.Year) { enumerators.Add(pair.Value.GetIterator()); } else if (pair.Key == birth.Lt.Value.Year) { enumerators.Add( pair.Value .Where(x => _id2time[x] < birth.Lt.Value) .GetIterator() ); } } } else { foreach (var pair in _byYear) { if (pair.Key > birth.Gt.Value.Year) { enumerators.Add(pair.Value.GetIterator()); } else if (pair.Key == birth.Gt.Value.Year) { enumerators.Add( pair.Value .Where(x => _id2time[x] > birth.Gt.Value) .GetIterator() ); } } } return(enumerators.MergeSort()); } }
internal int GetId <TEntity>(TEntity entity) where TEntity : class { return((int)IdStorage.GetValue <int>(entity)); }