void RequestDataForPieAndBar() { var range = RangeViewModel.GetSelectedRange(); if (range == null) { return; } RequestData("Data", x => { if (ModuleType == Modules.Regions) { return(x.GetSalesByRegion(range.Value, GroupingPeriod.All)); } else if (ModuleType == Modules.Sectors) { return(x.GetSalesBySector(range.Value, GroupingPeriod.All)); } else if (ModuleType == Modules.Products) { return(x.GetSalesByProduct(range.Value, GroupingPeriod.All)); } else if (ModuleType == Modules.Channels) { return(x.GetSalesByChannel(range.Value, GroupingPeriod.All)); } throw new NotImplementedException(); }, x => { BarViewModel.LoadData(x); PieViewModel.LoadData(x); }); }
protected PieBarRangeViewModel(string moduleType) { ModuleType = moduleType; BarViewModel = BarViewModel.Create(); PieViewModel = PieViewModel.Create(); RangeViewModel = RangeViewModel.Create(); RangeViewModel.RangeChanged += OnRangeViewModelRangeChanged; RangeViewModel.SelectedRangeChanged += OnRangeViewModelSelectedRangeChanged; RequestDataForRange(); RequestDataForPieAndBar(); }