public List <Schedule> FindByBreakIds(IEnumerable <Guid> breakIds)
        {
            var schedules = new List <Schedule>();
            var groups    = RavenRepositoryHelper.GroupElementsForInClause(breakIds);

            foreach (var itemGroup in groups)
            {
                schedules.AddRange(_session.GetAll <Schedule>(x => x.Breaks.Any(b => b.Id.In(itemGroup.ToList())),
                                                              indexName: Schedules_ByIdAndBreakIdAndSalesAreaAndDate.DefaultIndexName, isMapReduce: false));
            }

            return(schedules.Distinct(new ScheduleByIdComparer()).ToList());
        }
Beispiel #2
0
        public void Delete(IEnumerable <Guid> ids)
        {
            lock (_session)
            {
                var spots  = new List <Spot>();
                var groups = RavenRepositoryHelper.GroupElementsForInClause(ids.Distinct());

                foreach (var group in groups)
                {
                    spots.AddRange(_session.GetAll <Spot>(s => s.Uid.In(group.ToList())));
                }

                foreach (var spot in spots)
                {
                    _session.Delete(spot);
                }
            }
        }
Beispiel #3
0
        public IEnumerable <Spot> FindByExternalBreakNumbers(IEnumerable <string> externalBreakNumbers)
        {
            var spots  = new List <Spot>();
            var groups = RavenRepositoryHelper.GroupElementsForInClause(externalBreakNumbers);

            foreach (var itemGroup in groups)
            {
                spots.AddRange(
                    _session.GetAll <Spot>(s =>
                                           s.ExternalBreakNo.In(itemGroup.ToList()
                                                                ),
                                           Spots_ByManyFields.DefaultIndexName,
                                           isMapReduce: false
                                           )
                    );
            }

            return(spots);
        }