public static MapSpecification<IQuery, IEnumerable<long>> ByContacts(FindSpecification<Contact> specification) { return new MapSpecification<IQuery, IEnumerable<long>>( q => from client in q.For<Client>() join contact in q.For(specification) on client.Id equals contact.ClientId select client.Id); }
public static MapSpecification<IQuery, IEnumerable<long>> ByFirm(FindSpecification<Firm> specification) { return new MapSpecification<IQuery, IEnumerable<long>>( q => from firm in q.For(specification) where firm.ClientId != null select firm.ClientId.Value); }
/// <summary> /// Version of FindLocation that searches using a LatLong object /// </summary> /// <param name="aLatLong">a LatLong</param> /// <returns></returns> public Location FindLocation(LatLong aLatLong) { Location[] location = null; try { if (aLatLong == null) { throw new System.ArgumentNullException("LatLong cannot be null"); } //OK find something FindSpecification fs = new FindSpecification(); fs.DataSourceName = "MapPoint.NA"; LatLong locationLatLong = aLatLong; GetInfoOptions infoOptions = new GetInfoOptions(); location = theMapPointFindService.GetLocationInfo(locationLatLong, MAPPOINT_NA, infoOptions); } catch (ArgumentNullException e) { throw e; // rethrow for app to handle } catch (Exception e) { throw e; // rethrow for app to handle } return(location[0]); // zero position should be the best match }
public static FindSpecification <Period> Periods(IEnumerable <DateTime> aggregateIds) { var result = new FindSpecification <Period>(x => false); return(aggregateIds.Select(PeriodSpecificationForSingleKey) .Aggregate(result, (current, spec) => current | spec)); }
public void CommonFilteringTests <T>(T entity, FindSpecification <T> specification, bool expected) where T : class, IErmObject { SourceDb.Has(entity); Reader.Create(Query) .Verify(x => x.For(specification).Any(), expected); }
public static MapSpecification<IQuery, IEnumerable<long>> ByFirmAddress(FindSpecification<FirmAddress> specification) { return new MapSpecification<IQuery, IEnumerable<long>>( q => from firmAddress in q.For(specification) join firm in q.For<Firm>() on firmAddress.FirmId equals firm.Id where firm.ClientId.HasValue select firm.ClientId.Value); }
public MergeResult <T> DetectChanges(FindSpecification <T> specification) { var sourceObjects = new EnumerableDecorator(() => _sourceProvider.Invoke(specification)); var targetObjects = _targetProvider.Invoke(specification); var result = MergeTool.Merge(sourceObjects, targetObjects, _comparer); return(result); }
public static MapSpecification<IQuery, IEnumerable<long>> ByCategoryOrganizationUnit(FindSpecification<CategoryOrganizationUnit> specification) { return new MapSpecification<IQuery, IEnumerable<long>>( q => from categoryOrganizationUnit in q.For(specification) join categoryFirmAddress in q.For<CategoryFirmAddress>() on categoryOrganizationUnit.CategoryId equals categoryFirmAddress.CategoryId join firmAddress in q.For<FirmAddress>() on categoryFirmAddress.FirmAddressId equals firmAddress.Id join firm in q.For<Firm>() on new { categoryOrganizationUnit.OrganizationUnitId, firmAddress.FirmId } equals new { firm.OrganizationUnitId, FirmId = firm.Id } where firm.ClientId.HasValue select firm.ClientId.Value); }
public static MapSpecification<IQuery, IEnumerable<long>> ByAccount(FindSpecification<Account> specification) { return new MapSpecification<IQuery, IEnumerable<long>>( q => from account in q.For(specification) join legalPerson in q.For<LegalPerson>() on account.LegalPersonId equals legalPerson.Id join client in q.For<Client>() on legalPerson.ClientId equals client.Id join branchOfficeOrganizationUnit in q.For<BranchOfficeOrganizationUnit>() on account.BranchOfficeOrganizationUnitId equals branchOfficeOrganizationUnit.Id join firm in q.For<Firm>() on branchOfficeOrganizationUnit.OrganizationUnitId equals firm.OrganizationUnitId where firm.ClientId == client.Id select firm.Id); }
public MergeResult <T> DetectChanges(FindSpecification <T> specification) { using (var scope = new TransactionScope(TransactionScopeOption.Suppress)) { var sourceObjects = _sourceProvider.Invoke(specification); var targetObjects = _targetProvider.Invoke(specification); var result = MergeTool.Merge(sourceObjects, targetObjects, _comparer); scope.Complete(); return(result); } }
/// <summary> /// Find a location like an address (1500 Central rd., Chicago, IL) or landmark (Sears tower or Navy Pier) /// </summary> /// <param name="locationString">address or landmark</param> /// <returns>Location</returns> public Location FindLocation(string locationString) { Location[] location = null; try { if (locationString == "") { throw new System.ArgumentNullException("Location cannot be empty"); } FindSpecification myFindSpec = new FindSpecification(); myFindSpec.InputPlace = locationString; myFindSpec.DataSourceName = "MapPoint.NA"; FindResults results = theMapPointFindService.Find(myFindSpec); // if there is no result found try it as an address instead if (results.NumberFound == 0) { // if you want to use addresses instead you can use the code below Address address = theMapPointFindService.ParseAddress(locationString, "USA"); FindAddressSpecification myFindASpec = new FindAddressSpecification(); myFindASpec.DataSourceName = "MapPoint.NA"; myFindASpec.InputAddress = address; results = theMapPointFindService.FindAddress(myFindASpec); } // at this point a place (e.g. Sears Tower) or an address was not found so // return an error if (results.NumberFound == 0) { throw new System.ArgumentNullException("Location cannot be found"); } return(results.Results[0].FoundLocation); } catch (ArgumentNullException e) { throw e; // rethrow for app to handle } catch (Exception e) { throw e; // rethrow for app to handle } }
public static MapSpecification<IQuery, IEnumerable<Tuple<long, long?>>> ByProject(FindSpecification<Project> specification) { return new MapSpecification<IQuery, IEnumerable<Tuple<long, long?>>>( q => from project in q.For(specification) select new Tuple<long, long?>(project.Id, null)); }
public static MapSpecification<IQuery, IEnumerable<long>> ByCategoryOrganizationUnit(FindSpecification<CategoryOrganizationUnit> specification) { return new MapSpecification<IQuery, IEnumerable<long>>( q => (from categoryOrganizationUnit in q.For(specification) join project in q.For<Project>() on categoryOrganizationUnit.OrganizationUnitId equals project.OrganizationUnitId select project.Id).Distinct()); }
public static MapSpecification<IQuery, IEnumerable<long>> ByProject(FindSpecification<Project> specification) { return new MapSpecification<IQuery, IEnumerable<long>>( q => from project in q.For(specification) join territory in q.For<Territory>() on project.OrganizationUnitId equals territory.OrganizationUnitId select territory.Id); }
public static MapSpecification<IQuery, IEnumerable<long>> ByOrder(FindSpecification<Order> specification) { return new MapSpecification<IQuery, IEnumerable<long>>( q => from order in q.For(specification) select order.FirmId); }
public static MapSpecification<IQuery, IEnumerable<long>> ByActivity(FindSpecification<Activity> specification) { return new MapSpecification<IQuery, IEnumerable<long>>( q => from activity in q.For(specification) where activity.FirmId.HasValue select activity.FirmId.Value); }
public static MapSpecification <IQuery, IEnumerable <long> > BySalesModelCategoryRestriction(FindSpecification <SalesModelCategoryRestriction> specification) { return(new MapSpecification <IQuery, IEnumerable <long> >( q => (from restriction in q.For(specification) select restriction.ProjectId).Distinct())); }
public static MapSpecification<IQuery, IEnumerable<long>> ByFirmContacts(FindSpecification<FirmContact> specification) { return new MapSpecification<IQuery, IEnumerable<long>>( q => from firmAddress in q.For<FirmAddress>() join firmContact in q.For(specification) on firmAddress.Id equals firmContact.FirmAddressId select firmAddress.FirmId); }
public static MapSpecification <IQuery, IEnumerable <long> > ByAccount(FindSpecification <Account> specification) { return(new MapSpecification <IQuery, IEnumerable <long> >( q => from account in q.For(specification) join legalPerson in q.For <LegalPerson>() on account.LegalPersonId equals legalPerson.Id join client in q.For <Client>() on legalPerson.ClientId equals client.Id join branchOfficeOrganizationUnit in q.For <BranchOfficeOrganizationUnit>() on account.BranchOfficeOrganizationUnitId equals branchOfficeOrganizationUnit.Id join firm in q.For <Firm>() on branchOfficeOrganizationUnit.OrganizationUnitId equals firm.OrganizationUnitId where firm.ClientId == client.Id select firm.Id)); }
public static MapSpecification <IQuery, IEnumerable <long> > ByBranchOfficeOrganizationUnit(FindSpecification <BranchOfficeOrganizationUnit> specification) { return(new MapSpecification <IQuery, IEnumerable <long> >( q => from branchOfficeOrganizationUnit in q.For(specification) join firm in q.For <Firm>() on branchOfficeOrganizationUnit.OrganizationUnitId equals firm.OrganizationUnitId select firm.Id)); }
public static MapSpecification <IQuery, IEnumerable <long> > ByCategoryOrganizationUnit(FindSpecification <CategoryOrganizationUnit> specification) { return(new MapSpecification <IQuery, IEnumerable <long> >( q => from categoryOrganizationUnit in q.For(specification) join categoryFirmAddress in q.For <CategoryFirmAddress>() on categoryOrganizationUnit.CategoryId equals categoryFirmAddress.CategoryId join firmAddress in q.For <FirmAddress>() on categoryFirmAddress.FirmAddressId equals firmAddress.Id join firm in q.For <Firm>() on new { categoryOrganizationUnit.OrganizationUnitId, firmAddress.FirmId } equals new { firm.OrganizationUnitId, FirmId = firm.Id } where firm.ClientId.HasValue select firm.ClientId.Value)); }
public static MapSpecification <IQuery, IEnumerable <long> > ByFirmAddress(FindSpecification <FirmAddress> specification) { return(new MapSpecification <IQuery, IEnumerable <long> >( q => from firmAddress in q.For(specification) join firm in q.For <Firm>() on firmAddress.FirmId equals firm.Id where firm.ClientId.HasValue select firm.ClientId.Value)); }
public static MapSpecification <IQuery, IEnumerable <Tuple <long, long?> > > ByProject(FindSpecification <Project> specification) { return(new MapSpecification <IQuery, IEnumerable <Tuple <long, long?> > >( q => from project in q.For(specification) select new Tuple <long, long?>(project.Id, null))); }
public static MapSpecification <IQuery, IEnumerable <Tuple <long, long?> > > ByFirmAddressCategory(FindSpecification <CategoryFirmAddress> specification) { return(new MapSpecification <IQuery, IEnumerable <Tuple <long, long?> > >( q => from firm in q.For <Firm>() join project in q.For <Project>() on firm.OrganizationUnitId equals project.OrganizationUnitId join firmAddress in q.For <FirmAddress>() on firm.Id equals firmAddress.FirmId join firmAddressCategory in q.For(specification) on firmAddress.Id equals firmAddressCategory.FirmAddressId select new Tuple <long, long?>(project.Id, firmAddressCategory.CategoryId))); }
public static MapSpecification <IQuery, IEnumerable <long> > ByProject(FindSpecification <Project> specification) { return(new MapSpecification <IQuery, IEnumerable <long> >( q => from project in q.For(specification) join territory in q.For <Territory>() on project.OrganizationUnitId equals territory.OrganizationUnitId select territory.Id)); }
public static MapSpecification <IQuery, IEnumerable <long> > ByProject(FindSpecification <Project> specification) { return(new MapSpecification <IQuery, IEnumerable <long> >( q => from project in q.For(specification) join firm in q.For <Firm>() on project.OrganizationUnitId equals firm.OrganizationUnitId select firm.Id)); }
IQueryable <T> IQuery.For <T>(FindSpecification <T> findSpecification) => _connection.GetTable <T>().Where(findSpecification);
public static MapSpecification<IQuery, IEnumerable<long>> ByBranchOfficeOrganizationUnit(FindSpecification<BranchOfficeOrganizationUnit> specification) { return new MapSpecification<IQuery, IEnumerable<long>>( q => from branchOfficeOrganizationUnit in q.For(specification) join firm in q.For<Firm>() on branchOfficeOrganizationUnit.OrganizationUnitId equals firm.OrganizationUnitId select firm.Id); }
IQueryable <T> IQuery.For <T>(FindSpecification <T> findSpecification) { return(_connection.GetTable <T>().Where(findSpecification)); }
public static MapSpecification<IQuery, IEnumerable<long>> ByFirmAddressForStatistics(FindSpecification<FirmAddress> specification) { return new MapSpecification<IQuery, IEnumerable<long>>( q => { var changeKeys = from firm in q.For<Firm>() join firmAddress in q.For(specification) on firm.Id equals firmAddress.FirmId join firmAddressCategory in q.For<CategoryFirmAddress>() on firmAddress.Id equals firmAddressCategory.FirmAddressId select new { firm.OrganizationUnitId, firmAddressCategory.CategoryId }; var query = from firm in q.For<Firm>() join firmAddress in q.For<FirmAddress>() on firm.Id equals firmAddress.FirmId join firmAddressCategory in q.For<CategoryFirmAddress>() on firmAddress.Id equals firmAddressCategory.FirmAddressId join key in changeKeys on new { firm.OrganizationUnitId, firmAddressCategory.CategoryId } equals new { key.OrganizationUnitId, key.CategoryId } select firm.Id; return query.Distinct(); }); }
public IQueryable <T> For <T>(FindSpecification <T> findSpecification) where T : class { return(_data.OfType <T>().AsQueryable().Where(findSpecification)); }
/* ********************************************************************************************************* * GetGPSFromAdress() * * Description : Cette fonction converti une adresse en coordonnées GPS * * Argument(s) : strOrigAddress L'adresse de départ * * Note : Le format du string à passer en argument à la fonction est celui-ci: * "ADRESSE;VILLE;PROVINCE;CODE POSTAL;PAYS" * ex: strOrigAddress = "1408 RUE DE L'EGLISE;SAINT-LAURENT;QC;H4L2H3;CA"; ********************************************************************************************************* */ public static string[] GetGPSFromAdress(string strOrigAddress) { FindServiceSoap findService = new FindServiceSoap(); findService.Credentials = new System.Net.NetworkCredential("124624", "PDALE_projets5"); FindSpecification findSpec = new FindSpecification(); FindResults startResults = null; FindResults endResults = null; //Output the formatted address string[] strTemp = new String[5]; strTemp = strOrigAddress.Split(';'); Address myOrigAddress = new Address(); myOrigAddress.AddressLine = strTemp[0]; myOrigAddress.PrimaryCity = strTemp[1]; myOrigAddress.Subdivision = strTemp[2]; myOrigAddress.PostalCode = strTemp[3]; myOrigAddress.CountryRegion = strTemp[4]; FindAddressSpecification findOrigAddressSpec = new FindAddressSpecification(); findOrigAddressSpec.InputAddress = myOrigAddress; findOrigAddressSpec.DataSourceName = "MapPoint.NA"; //Retrieve the values of startResults try { startResults = findService.FindAddress(findOrigAddressSpec); } catch (Exception e2) //The request failed with HTTP status 401: Unauthorized. { Console.WriteLine("Problem connecting with service"); } // Make sure findResults isn't null if (startResults == null) { Console.WriteLine("Originating Address not found."); } else { // If no results were found, display error and return if (startResults.NumberFound == 0) { Console.WriteLine("Originating Address not found."); } } string[] strLongLat = new string[2]; strLongLat[0] = startResults.Results[0].FoundLocation.LatLong.Longitude.ToString(); strLongLat[1] = startResults.Results[0].FoundLocation.LatLong.Latitude.ToString(); return strLongLat; }
public static MapSpecification <IQuery, IEnumerable <long> > ByClientActivity(FindSpecification <Activity> specification) { return(new MapSpecification <IQuery, IEnumerable <long> >( q => from activity in q.For(specification) join firm in q.For <Firm>() on activity.ClientId equals firm.ClientId where activity.ClientId.HasValue select firm.Id)); }
public static MapSpecification<IQuery, IEnumerable<long>> ByProject(FindSpecification<Project> specification) { return new MapSpecification<IQuery, IEnumerable<long>>( q => from project in q.For(specification) join firm in q.For<Firm>() on project.OrganizationUnitId equals firm.OrganizationUnitId select firm.Id); }
public static MapSpecification<IQuery, IEnumerable<long>> ByCategory(FindSpecification<Category> specification) { return new MapSpecification<IQuery, IEnumerable<long>>( q => { var categories1 = q.For(new FindSpecification<Category>(x => x.Level == 1)); var categories2 = q.For(new FindSpecification<Category>(x => x.Level == 2)); var categories3 = q.For(new FindSpecification<Category>(x => x.Level == 3)); var level3 = from firmAddress in q.For<FirmAddress>() join categoryFirmAddress in q.For<CategoryFirmAddress>() on firmAddress.Id equals categoryFirmAddress.FirmAddressId join category3 in categories3.Where(specification) on categoryFirmAddress.CategoryId equals category3.Id select firmAddress.FirmId; var level2 = from firmAddress in q.For<FirmAddress>() join categoryFirmAddress in q.For<CategoryFirmAddress>() on firmAddress.Id equals categoryFirmAddress.FirmAddressId join category3 in categories3 on categoryFirmAddress.CategoryId equals category3.Id join category2 in categories2.Where(specification) on category3.ParentId equals category2.Id select firmAddress.FirmId; var level1 = from firmAddress in q.For<FirmAddress>() join categoryFirmAddress in q.For<CategoryFirmAddress>() on firmAddress.Id equals categoryFirmAddress.FirmAddressId join category3 in categories3 on categoryFirmAddress.CategoryId equals category3.Id join category2 in categories2 on category3.ParentId equals category2.Id join category1 in categories1.Where(specification) on category2.ParentId equals category1.Id select firmAddress.FirmId; return level3.Union(level2).Union(level1); }); }
public static MapSpecification<IQuery, IEnumerable<long>> ByClientActivity(FindSpecification<Activity> specification) { return new MapSpecification<IQuery, IEnumerable<long>>( q => from activity in q.For(specification) join firm in q.For<Firm>() on activity.ClientId equals firm.ClientId where activity.ClientId.HasValue select firm.Id); }
public IQueryable <T> For <T>(FindSpecification <T> findSpecification) where T : class => _dataContext.GetTable <T>().Where(findSpecification);
public static MapSpecification<IQuery, IEnumerable<long>> BySalesModelCategoryRestriction(FindSpecification<SalesModelCategoryRestriction> specification) { return new MapSpecification<IQuery, IEnumerable<long>>( q => (from restriction in q.For(specification) select restriction.ProjectId).Distinct()); }
public MergeResult <TCompared> DetectChanges <TCompared>(MapSpecification <IEnumerable <TOutput>, IEnumerable <TCompared> > mapSpec, FindSpecification <TFilter> specification, IEqualityComparer <TCompared> comparer) { using (var scope = new TransactionScope(TransactionScopeOption.Suppress)) { var sourceObjects = _sourceProvider.Invoke(specification).Map(_query); var targetObjects = _targetProvider.Invoke(specification).Map(_query); var result = MergeTool.Merge( mapSpec.Map(sourceObjects).ToArray(), mapSpec.Map(targetObjects).ToArray(), comparer); scope.Complete(); return(result); } }
public static MapSpecification<IQuery, IEnumerable<Tuple<long, long?>>> ByFirmAddressCategory(FindSpecification<CategoryFirmAddress> specification) { return new MapSpecification<IQuery, IEnumerable<Tuple<long, long?>>>( q => from firm in q.For<Firm>() join project in q.For<Project>() on firm.OrganizationUnitId equals project.OrganizationUnitId join firmAddress in q.For<FirmAddress>() on firm.Id equals firmAddress.FirmId join firmAddressCategory in q.For(specification) on firmAddress.Id equals firmAddressCategory.FirmAddressId select new Tuple<long, long?>(project.Id, firmAddressCategory.CategoryId)); }
public TestCaseDataBuilder SetSpecification <T>(FindSpecification <T> specification) { _specification = specification; return(this); }
public static MapSpecification <IQuery, IEnumerable <long> > ByActivity(FindSpecification <Activity> specification) { return(new MapSpecification <IQuery, IEnumerable <long> >( q => from activity in q.For(specification) where activity.FirmId.HasValue select activity.FirmId.Value)); }
public static MapSpecification <IQuery, IEnumerable <long> > ByContacts(FindSpecification <Contact> specification) { return(new MapSpecification <IQuery, IEnumerable <long> >( q => from client in q.For <Client>() join contact in q.For(specification) on client.Id equals contact.ClientId select client.Id)); }
public static MapSpecification <IQuery, IEnumerable <long> > ByOrder(FindSpecification <Order> specification) { return(new MapSpecification <IQuery, IEnumerable <long> >( q => from order in q.For(specification) select order.FirmId)); }
public static MapSpecification<IQuery, IEnumerable<long>> ByFirmAddress(FindSpecification<FirmAddress> specification) { return new MapSpecification<IQuery, IEnumerable<long>>( q => from firmAddress in q.For(specification) select firmAddress.FirmId); }
public static MapSpecification <IQuery, IEnumerable <long> > ByFirmAddressForStatistics(FindSpecification <FirmAddress> specification) { return(new MapSpecification <IQuery, IEnumerable <long> >( q => { var changeKeys = from firm in q.For <Firm>() join firmAddress in q.For(specification) on firm.Id equals firmAddress.FirmId join firmAddressCategory in q.For <CategoryFirmAddress>() on firmAddress.Id equals firmAddressCategory.FirmAddressId select new { firm.OrganizationUnitId, firmAddressCategory.CategoryId }; var query = from firm in q.For <Firm>() join firmAddress in q.For <FirmAddress>() on firm.Id equals firmAddress.FirmId join firmAddressCategory in q.For <CategoryFirmAddress>() on firmAddress.Id equals firmAddressCategory.FirmAddressId join key in changeKeys on new { firm.OrganizationUnitId, firmAddressCategory.CategoryId } equals new { key.OrganizationUnitId, key.CategoryId } select firm.Id; return query.Distinct(); })); }
public static MapSpecification <IQuery, IEnumerable <long> > ByCategoryOrganizationUnit(FindSpecification <CategoryOrganizationUnit> specification) { return(new MapSpecification <IQuery, IEnumerable <long> >( q => (from categoryOrganizationUnit in q.For(specification) join project in q.For <Project>() on categoryOrganizationUnit.OrganizationUnitId equals project.OrganizationUnitId select project.Id).Distinct())); }
private static TestCaseDataBuilder For <T>(FindSpecification <T> specification) { return(new TestCaseDataBuilder().SetSpecification(specification)); }
public static MapSpecification<IQuery, IEnumerable<long>> ByCategoryGroup(FindSpecification<CategoryGroup> specification) { return new MapSpecification<IQuery, IEnumerable<long>>( q => (from categoryGroup in q.For(specification) join categoryOrganizationUnit in q.For<CategoryOrganizationUnit>() on categoryGroup.Id equals categoryOrganizationUnit.CategoryId join categoryFirmAddress in q.For<CategoryFirmAddress>() on categoryOrganizationUnit.CategoryId equals categoryFirmAddress.CategoryId join firmAddress in q.For<FirmAddress>() on categoryFirmAddress.FirmAddressId equals firmAddress.Id select firmAddress.FirmId).Distinct()); }
public static MapSpecification<IQuery, IEnumerable<long>> ByCategoryFirmAddress(FindSpecification<CategoryFirmAddress> specification) { return new MapSpecification<IQuery, IEnumerable<long>>( q => from categoryFirmAddress in q.For(specification) join firmAddress in q.For<FirmAddress>() on categoryFirmAddress.FirmAddressId equals firmAddress.Id select firmAddress.FirmId); }
public static MapSpecification <IQuery, IEnumerable <long> > ByFirmContacts(FindSpecification <FirmContact> specification) { return(new MapSpecification <IQuery, IEnumerable <long> >( q => from firmAddress in q.For <FirmAddress>() join firmContact in q.For(specification) on firmAddress.Id equals firmContact.FirmAddressId select firmAddress.FirmId)); }
IQueryable <T> IQuery.For <T>(FindSpecification <T> findSpecification) { return(_data.OfType <T>().AsQueryable().Where(findSpecification)); }
public static MapSpecification<IQuery, IEnumerable<long>> ByClient(FindSpecification<Client> specification) { return new MapSpecification<IQuery, IEnumerable<long>>( q => from firm in q.For<Firm>() join client in q.For(specification) on firm.ClientId equals client.Id select firm.Id); }