private void OnLoadData() { //download data from hub ArrayOfProfitAccountingCheckpoints checkpointsObject = WsdlRepository.GetProfitAccountingCheckpoint(StationRepository.GetUid(ChangeTracker.CurrentUser).location_id.Value, StationRepository.StationNumber, currentPosition, itemsAmountPerPage); _Checkpoints = new ObservableCollection <CheckpointModel>(); if (checkpointsObject != null) { if (checkpointsObject.total != null) { itemsTotal = checkpointsObject.total.Value; } if (checkpointsObject.profitAccounting != null) { foreach (var profitAccountingCheckpoint in checkpointsObject.profitAccounting) { _Checkpoints.Add(new CheckpointModel { ProfitAccountingCheckpoint = profitAccountingCheckpoint }); } } } AddReportFromLastCheckpoint(); if (Checkpoints.Count > 0) { SelectedCheckpoint = Checkpoints.ElementAt(0); //LoadProperties(Checkpoints.ElementAt(0)); } OnPropertyChanged("Checkpoints"); }
private void AddReportFromLastCheckpoint() { ProfitAccountingCheckpoint testCP = WsdlRepository.GetProfitAccountingReport(Int32.Parse(StationRepository.GetUid(ChangeTracker.CurrentUser).location_id.ToString()), StationRepository.StationNumber, null, null); if (testCP != null) { testCP.general.endDate = DateTime.Now; Checkpoints.Insert(0, new CheckpointModel { ProfitAccountingCheckpoint = testCP, IsLastCheckpoint = true }); AccountingModel = testCP.location.model; } if (Checkpoints.Count > 0) { SelectedCheckpoint = Checkpoints.ElementAt(0); } }