protected virtual void uploadGPSResult(GPSCoordinatesOperationResult res, SynchronizationItemViewModel item, bool firstTime)
        {
            if (res.GPSTrackerEntry != null)
            {
                var customerId = item.DayInfo.TrainingDay.CustomerId;
                var holder     = appState.GetTrainingDayHolder(customerId);

                item.DayInfo.GetGpsCoordinates(res.GPSTrackerEntry).IsSaved = true;

                item.State = MergeState.Finished;
                var dayInCache = holder.TrainingDays.Where(
                    x => x.Value.TrainingDay.Objects.Where(h => h.GlobalId == res.GPSTrackerEntry.GlobalId).Count() == 1)
                                 .SingleOrDefault();
                dayInCache.Value.Update(res.GPSTrackerEntry);
            }
            item.State = MergeState.Finished;
            Items.Remove(item);
        }
Example #2
0
        async protected override Task uploadGPSCoordinates(SynchronizationItemViewModel day, bool firstTime)
        {
            GPSUploadCount++;
            if (!IsInProgress)
            {
                IsInProgressGood = false;
            }

            if (UploadGPSError == null)
            {
                GPSCoordinatesOperationResult result = new GPSCoordinatesOperationResult(day.GPSEntry.Copy());
                uploadGPSResult(result, day, firstTime);
            }
            else if (UploadGPSError == ErrorCode.ObjectNotFound)
            {
                throw new ObjectNotFoundException();
            }
            else
            {
                throw new Exception();
            }
        }