//************************************************************************** // Function: updateStoppedPivots // // Description: If any of the pivots are past their stop time then update the database // // Parameters: None // // Returns: None //************************************************************************** public async Task updateStoppedPivots() { /* * YYYY MM DD hh:mm:ss * DateTime dt = new DateTime(2008, 3, 9, 16, 5, 7); * String.Format("{0:s}", dt); // "2008-03-09T16:05:07" SortableDateTime */ FieldTable updatedField = new FieldTable(); DateTime currentTime = DateTime.Now; DateTime stopTime; string format = "s"; foreach (FieldTable field in this.fieldEntries) { if (field.PivotRunning == true && field.UID == App.UserID) { stopTime = DateTime.ParseExact(field.StopTime, format, CultureInfo.InvariantCulture); if (DateTime.Compare(currentTime, stopTime) >= 0) { updatedField.assignTo(field); updatedField.PivotRunning = false; updatedField.StopTime = string.Empty; await this.UpdateField(updatedField); await this.fieldDataService.EditEntryAsync(updatedField); //await Application.Current.MainPage.Navigation.PopAsync (); } } } }