public List <Sungero.Domain.Shared.IEntity> GetChangedBankAccountsFromSyncDateRemote(List <Guid> entityTypeGuids, int processedEntitiesCount, int entitiesCountForProcessing, string extEntityType, string systemId) { using (var session = new Domain.Session()) { var entities = new List <Sungero.Domain.Shared.IEntity>().AsQueryable(); foreach (var entityTypeGuid in entityTypeGuids) { entities = entities.Union(this.GetChangedEntities(session, entityTypeGuid, extEntityType, systemId)); } entities = entities.Where(x => Counterparties.Is(x) && Counterparties.As(x).Status == Sungero.Parties.Counterparty.Status.Active && Counterparties.As(x).Bank != null && !string.IsNullOrEmpty(Counterparties.As(x).Account)); var entitiesBatch = entities .Skip(processedEntitiesCount) .Take(entitiesCountForProcessing) .ToList(); return(entitiesBatch); } }
public int GetChangedBankAccountsFromSyncDateRemoteCount(List <Guid> entityTypeGuids, string extEntityType, string systemId) { using (var session = new Domain.Session()) { var totalCount = 0; foreach (var entityTypeGuid in entityTypeGuids) { var entities = this.GetChangedEntities(session, entityTypeGuid, extEntityType, systemId).ToList(); totalCount += entities.Where(x => Counterparties.Is(x) && Counterparties.As(x).Status == Sungero.Parties.Counterparty.Status.Active && Counterparties.As(x).Bank != null && !string.IsNullOrEmpty(Counterparties.As(x).Account)) .Count(); } return(totalCount); } }
public override IQueryable <T> Filtering(IQueryable <T> query, Sungero.Domain.FilteringEventArgs e) { if (_filter != null) { if (_filter.Company || _filter.Person || _filter.Bank) { query = query.Where(x => (_filter.Company && Companies.Is(x)) || (_filter.Person && People.Is(x)) || (_filter.Bank && Banks.Is(x))); } if (_filter.Responsible != null) { query = query.Where(x => Counterparties.Is(x) && Equals(_filter.Responsible, Counterparties.As(x).Responsible)); } } // Исключение системного контрагента - "По списку рассылки". var distributionListCounterparty = Parties.PublicFunctions.Counterparty.Remote.GetDistributionListCounterparty(); return(query.Where(x => !Equals(x, distributionListCounterparty))); }