private void StatisticsInfoButton_Click(object sender, RoutedEventArgs e) { SearchingScope scope = (SearchingScope)System.Enum.Parse(typeof(SearchingScope), (sender as HyperlinkButton).Tag.ToString(), true); SummaryDetails details2 = new SummaryDetails(); AccountItem item = new AccountItem { Category = this.current }; details2.Tag = item; SummaryDetails details = details2; DetailsCondition condition2 = new DetailsCondition { ChartGroupMode = ChartGroupMode.ByCategoryName, SearchingScope = scope, GroupCategoryMode = this.current.IsParent ? CategorySortType.ByParentCategory : CategorySortType.ByChildCategory }; DetailsCondition searchingCondition = condition2; StatsticSummaryItemsViewer.Show(details, searchingCondition, this); }
/// <summary> /// Shows the specified item. /// </summary> /// <param name="item">The item.</param> /// <param name="SearchingCondition">The searching condition.</param> /// <param name="pageFrom">The page from.</param> public static void Show(SummaryDetails item, DetailsCondition SearchingCondition, PhoneApplicationPage pageFrom) { var queryForSeeMore = QueryDataBySearchingCondition(SearchingCondition); var summaryItem = item.Tag as AccountItem; Guid categoryID = summaryItem.CategoryId; Account account = summaryItem.Account; if (SearchingCondition.ChartGroupMode == ChartGroupMode.ByCategoryName) { if (SearchingCondition.GroupCategoryMode == CategorySortType.ByParentCategory) { IEnumerable<Guid> ids = null; if (summaryItem.Category.IsParent) { categoryID = summaryItem.Category.Id; ids = ViewModelLocator.CategoryViewModel.AccountBookDataContext.Categories.Where(p => p.ParentCategoryId == categoryID) .Select(p => p.Id).ToList(); } else { categoryID = summaryItem.Category.ParentCategoryId; ids = ViewModelLocator.CategoryViewModel.AccountBookDataContext.Categories.Where(p => p.ParentCategoryId == summaryItem.Category.ParentCategory.Id) .Select(p => p.Id).ToList(); } queryForSeeMore = queryForSeeMore.Where(p => ids.Contains(p.CategoryId)); } else { queryForSeeMore = queryForSeeMore.Where(i => i.CategoryId == categoryID); } } else { if (account != null) { queryForSeeMore = queryForSeeMore.Where(p => p.AccountId == account.Id); } } StatsticSummaryItemsViewer.NeedReloadData = true; Pages.DialogBox.StatsticSummaryItemsViewer.DataSourceGetter = () => queryForSeeMore; pageFrom.NavigateTo("/Pages/DialogBox/StatsticSummaryItemsViewer.xaml"); }