public IList <Frame> GetFrames(Damany.Util.DateTimeRange range)
        {
            var dtos   = dataProvider.GetFrames(range);
            var frames = dtos.ToList().ConvertAll(dto => Mapper.Map <DAL.DTO.Frame, Frame>(dto));

            return(frames);
        }
        public IList <Portrait> GetPortraits(Damany.Util.DateTimeRange range)
        {
            var dtos      = dataProvider.GetPortraits(range);
            var portraits = dtos.ToList().ConvertAll(dto => Mapper.Map <DAL.DTO.Portrait, Portrait>(dto));

            return(portraits);
        }
        private static void DeleteOutdatedPortrait(Damany.Util.DateTimeRange range, UnitOfWork uow)
        {
            var cs        = string.Format("CaptureTime >= '{0}' And CaptureTime < '{1}'", range.From, range.To);
            var c         = DevExpress.Data.Filtering.CriteriaOperator.Parse(cs);
            var portraits = new XPCollection <Damany.PortraitCapturer.DAL.DTO.Portrait>(uow, c);

            uow.Delete(portraits);
        }
Beispiel #4
0
 public IList <DTO.Frame> GetFrames(Damany.Util.DateTimeRange range)
 {
     using (var container = OpenContainer())
     {
         return(container.Query <DTO.Frame>(frame => {
             return frame.CapturedAt >= range.From && frame.CapturedAt <= range.To;
         }));
     }
 }
Beispiel #5
0
 public IList <DTO.Portrait> GetPortraits(Damany.Util.DateTimeRange range)
 {
     using (var container = OpenContainer())
     {
         return(container.Query <DTO.Portrait>(portrait =>
         {
             return portrait.CapturedAt >= range.From && portrait.CapturedAt <= range.To;
         }));
     }
 }
Beispiel #6
0
        public IList <DTO.Portrait> GetPortraits(int cameraId, Damany.Util.DateTimeRange range)
        {
            var container = OpenContainer();

            var portraitQuery = from DTO.Portrait p in container
                                where p.CapturedAt >= range.From && p.CapturedAt <= range.To
                                select p;

            if (cameraId != -1)
            {
                portraitQuery = from p in portraitQuery
                                where p.SourceId == cameraId
                                select p;
            }

            return(portraitQuery.ToList());
        }
        private void DeleteData()
        {
            while (ShouldDoCleaning())
            {
                using (var uow = new UnitOfWork())
                {
                    var videoQuery  = new XPQuery <Damany.PortraitCapturer.DAL.DTO.Video>(uow);
                    var oldestVideo = (from v in videoQuery
                                       orderby v.CaptureTime ascending
                                       select v).FirstOrDefault();

                    var portraitQuery  = new XPQuery <Damany.PortraitCapturer.DAL.DTO.Portrait>(uow);
                    var oldestPortrait = (from p in portraitQuery
                                          orderby p.CaptureTime ascending
                                          select p).FirstOrDefault();

                    var oldest = DateTime.MaxValue;
                    if (oldestVideo != null)
                    {
                        if (oldestVideo.CaptureTime <= oldest)
                        {
                            oldest = oldestVideo.CaptureTime;
                        }
                    }

                    if (oldestPortrait != null)
                    {
                        if (oldestPortrait.CaptureTime <= oldest)
                        {
                            oldest = oldestPortrait.CaptureTime;
                        }
                    }

                    if (oldest != DateTime.MaxValue)
                    {
                        var range = new Damany.Util.DateTimeRange(oldest.Date, oldest.Date.AddDays(1));
                        DeleteOutdatedPortrait(range, uow);
                        DeleteOutdatedFrame(range, uow);
                        DeleteOutdatedVideos(range, uow);
                    }

                    uow.CommitChanges();
                    uow.PurgeDeletedObjects();
                }
            }
        }
Beispiel #8
0
        public IList <DTO.Frame> GetFrames(int cameraId, Damany.Util.DateTimeRange range)
        {
            var container = OpenContainer();
            var frames    = container.Query <DTO.Frame>(frame =>
            {
                bool flag = frame.CapturedAt >= range.From && frame.CapturedAt <= range.To;

                if (cameraId != -1)
                {
                    flag = flag && frame.SourceId == cameraId;
                }

                return(flag);
            });


            return(frames);
        }
        private void DeleteData()
        {
            while (ShouldDoCleaning())
            {
                using (var uow = new UnitOfWork())
                {
                    var videoQuery = new XPQuery<Damany.PortraitCapturer.DAL.DTO.Video>(uow);
                    var oldestVideo = (from v in videoQuery
                                       orderby v.CaptureTime ascending
                                       select v).FirstOrDefault();

                    var portraitQuery = new XPQuery<Damany.PortraitCapturer.DAL.DTO.Portrait>(uow);
                    var oldestPortrait = (from p in portraitQuery
                                          orderby p.CaptureTime ascending
                                          select p).FirstOrDefault();

                    var oldest = DateTime.MaxValue;
                    if (oldestVideo != null)
                    {
                        if (oldestVideo.CaptureTime <= oldest)
                        {
                            oldest = oldestVideo.CaptureTime;
                        }
                    }

                    if (oldestPortrait != null)
                    {
                        if (oldestPortrait.CaptureTime <= oldest)
                        {
                            oldest = oldestPortrait.CaptureTime;
                        }
                    }

                    if (oldest != DateTime.MaxValue)
                    {
                        var range = new Damany.Util.DateTimeRange(oldest.Date, oldest.Date.AddDays(1));
                        DeleteOutdatedPortrait(range, uow);
                        DeleteOutdatedFrame(range, uow);
                        DeleteOutdatedVideos(range, uow);
                    }

                    uow.CommitChanges();
                    uow.PurgeDeletedObjects();
                }
            }
        }
        public void Search()
        {
            this.range = this.screen.TimeRange;
            selectedCamera = screen.SelectedCamera;

            if (selectedCamera == null)
            {
                return;
            }

            Action disableUI = delegate
            {
                EnableScreen(false);
                this.screen.ShowStatus("开始搜索");
                this.screen.IsBusy = true;
            };

            Action enableUI = delegate
            {
                EnableScreen(true);
                this.screen.ShowStatus("搜索完毕");
                this.screen.IsBusy = false;
            };

            this.DoActionsAsync(disableUI, enableUI,
                (Action)SearchInternal,
                (Action)CalculatePaging,
                (Action)ShowCurrentPage);
        }