public void Load() { var id = Guid.Parse("00000000-0000-0000-0000-000000000000"); var appDao = DataAccessManager.AppDao.Build <StatisticsDao>(); var statistics = appDao.FindBy(new Dictionary <string, object>() { { "ID", id } }).First(); NumberOfBoots.Value = statistics.NumberOfBoots; NumberOfBooks.Value = BookFacade.FindAll().Count(); TotalFileSize.Value = ImageFacade.SumTotalFileSize(); NumberOfPages.Value = PageFacade.CountAll(); NumberOfAuthors.Value = AuthorFacade.CountAll(); NumberOfTags.Value = TagFacade.CountAll(); NumberOfBookTags.Value = BookTagFacade.CountAll(); NumberOfImageTags.Value = ImageTagFacade.CountAll(); NumberOfBooks5.Value = StarFacade.FindBookByStar(5).Count(); NumberOfBooks4.Value = StarFacade.FindBookByStar(4).Count(); NumberOfBooks3.Value = StarFacade.FindBookByStar(3).Count(); NumberOfBooks2.Value = StarFacade.FindBookByStar(2).Count(); NumberOfBooks1.Value = StarFacade.FindBookByStar(1).Count(); NumberOfBooksN.Value = StarFacade.FindBookByStar(null).Count(); NumberOfDuplicateBooks.Value = BookFacade.FindDuplicateFingerPrint().Count(); TotalDuplicateBooksSize.Value = BookFacade.FindDuplicateFingerPrint().Where(x => x.ByteSize != null).Select(x => x.ByteSize.Value).Sum(); }
public ChangeStarViewModel() { Star1Command = EditTarget .Where(x => x != null) .Select(_ => true) .ToReactiveCommand(); Star1Command.Subscribe(_ => { EditTarget.Value.StarLevel = 1; StarFacade.InsertOrReplace(EditTarget.Value); RequestClose.Invoke(new DialogResult(ButtonResult.OK)); }); Star2Command = EditTarget .Where(x => x != null) .Select(_ => true) .ToReactiveCommand(); Star2Command.Subscribe(_ => { EditTarget.Value.StarLevel = 2; StarFacade.InsertOrReplace(EditTarget.Value); RequestClose.Invoke(new DialogResult(ButtonResult.OK)); }); Star3Command = EditTarget .Where(x => x != null) .Select(_ => true) .ToReactiveCommand(); Star3Command.Subscribe(_ => { EditTarget.Value.StarLevel = 3; StarFacade.InsertOrReplace(EditTarget.Value); RequestClose.Invoke(new DialogResult(ButtonResult.OK)); }); Star4Command = EditTarget .Where(x => x != null) .Select(_ => true) .ToReactiveCommand(); Star4Command.Subscribe(_ => { EditTarget.Value.StarLevel = 4; StarFacade.InsertOrReplace(EditTarget.Value); RequestClose.Invoke(new DialogResult(ButtonResult.OK)); }); Star5Command = EditTarget .Where(x => x != null) .Select(_ => true) .ToReactiveCommand(); Star5Command.Subscribe(_ => { EditTarget.Value.StarLevel = 5; StarFacade.InsertOrReplace(EditTarget.Value); RequestClose.Invoke(new DialogResult(ButtonResult.OK)); }); NotEvaluatedCommand = EditTarget .Where(x => x != null) .Select(_ => true) .ToReactiveCommand(); NotEvaluatedCommand.Subscribe(_ => { EditTarget.Value.StarLevel = null; StarFacade.InsertOrReplace(EditTarget.Value); RequestClose.Invoke(new DialogResult(ButtonResult.OK)); }); }