public void LoadData() { try { var AlphaList = Alpharepo.GetAlphasAsync().Result.ToList(); ObservableCollection <Alpha> POData = new ObservableCollection <Alpha>(); foreach (var item in AlphaList) { POData.Add(item); } Alphas = POData; var BetaList = Betarepo.GetBetasAsync().Result.ToList(); ObservableCollection <Beta> BetaData = new ObservableCollection <Beta>(); foreach (var item in BetaList) { BetaData.Add(item); } Betas = BetaData; var GammaList = Gammarepo.GetGammasAsync().Result.ToList(); ObservableCollection <Gamma> GammaData = new ObservableCollection <Gamma>(); foreach (var item in GammaList) { GammaData.Add(item); } Gammas = GammaData; var DeltaList = DeltaRepo.GetDeltasAsync().Result.ToList(); ObservableCollection <Delta> DeltaData = new ObservableCollection <Delta>(); foreach (var item in DeltaList) { DeltaData.Add(item); } Deltas = DeltaData; var ThetaList = ThetaRepo.GetThetasAsync().Result.ToList(); ObservableCollection <Theta> ThetaData = new ObservableCollection <Theta>(); foreach (var item in ThetaList) { ThetaData.Add(item); } Thetas = ThetaData; SelectedBeta = Betas.First(x => x.Id.Equals(1)); SelectedGamma = Gammas.First(x => x.Id.Equals(1)); SelectedAlpha = Alphas.First(x => x.Id.Equals(1)); SelectedDelta = Deltas.First(x => x.Id.Equals(1)); SelectedTheta = Thetas.First(x => x.Id.Equals(1)); SaveText = null; } catch (Exception e) { _logger.Error("Some error have AddRecordViewModel Load data , stacktarce =" + e.StackTrace); _logger.Error("AddRecordViewModel error message is " + e.Message + " inner error is " + e.InnerException.Message); } }
public void LoadData() { var data = repo.GetDeltasAsync().Result.ToList(); ObservableCollection <Delta> DeltaData = new ObservableCollection <Delta>(); foreach (var item in data) { if (item.Id != 1) { DeltaData.Add(item); } } Deltas = DeltaData; }
public void LoadData() { try { _logger.Info("Inside Records viewer view model Load data"); IsWorking = Visibility.Hidden; var AlphaList = Alpharepo.GetAlphasAsync().Result.ToList(); ObservableCollection <Alpha> AlphaData = new ObservableCollection <Alpha>(); AlphaFilter = new ObservableCollection <Alpha>(); foreach (var item in AlphaList) { AlphaData.Add(item); AlphaFilter.Add(item); } Alphas = AlphaData; AlphaFilter.Add(new Alpha() { Id = 1000, Name = "All" }); SelectedAlpha = AlphaFilter.First(x => x.Name.Equals("All")); var PSList = Betarepo.GetBetasAsync().Result.ToList(); ObservableCollection <Beta> BetaData = new ObservableCollection <Beta>(); BetaFilter = new ObservableCollection <Beta>(); foreach (var item in PSList) { BetaData.Add(item); BetaFilter.Add(item); } Betas = BetaData; BetaFilter.Add(new Beta() { Id = 1000, Name = "All" }); SelectedBeta = BetaFilter.First(x => x.Name.Equals("All")); var GammaList = Gammarepo.GetGammasAsync().Result.ToList(); ObservableCollection <Gamma> GammaData = new ObservableCollection <Gamma>(); GammaFilter = new ObservableCollection <Gamma>(); foreach (var item in GammaList) { GammaData.Add(item); GammaFilter.Add(item); } Gammas = GammaData; GammaFilter.Add(new Gamma() { Id = 1000, Name = "All" }); SelectedGamma = GammaFilter.First(x => x.Name.Equals("All")); var StatusList = StatusRepo.GetStatus(); ObservableCollection <Status> StatusData = new ObservableCollection <Status>(); StatusFilter = new ObservableCollection <Status>(); foreach (var item in StatusList) { StatusData.Add(item); StatusFilter.Add(item); } Statuses = StatusData; StatusFilter.Add(new Status() { Id = 1000, Name = "All" }); SelectedStatus = StatusFilter.First(x => x.Name.Equals("Open")); var DeltaList = DeltaRepo.GetDeltasAsync().Result.ToList(); ObservableCollection <Delta> DeltaData = new ObservableCollection <Delta>(); DeltaFilter = new ObservableCollection <Delta>(); foreach (var item in DeltaList) { DeltaData.Add(item); DeltaFilter.Add(item); } Deltas = DeltaData; DeltaFilter.Add(new Delta() { Id = 1000, Name = "All" }); SelectedDelta = DeltaFilter.First(x => x.Name.Equals("All")); var ThetaList = ThetaRepo.GetThetasAsync().Result.ToList(); ObservableCollection <Theta> ThetaData = new ObservableCollection <Theta>(); ThetaFilter = new ObservableCollection <Theta>(); foreach (var item in ThetaList) { ThetaData.Add(item); ThetaFilter.Add(item); } Thetas = ThetaData; ThetaFilter.Add(new Theta() { Id = 1000, Name = "All" }); SelectedTheta = ThetaFilter.First(x => x.Name.Equals("All")); } catch (Exception e) { _logger.Error("Some error have occured in Report.xaml" + e.StackTrace); _logger.Error("Report.xaml error message is " + e.Message + " inner error is " + e.InnerException.Message); } }