コード例 #1
0
        public async Task <bool> UpdateLatestTrackerAsync(double newValue, double oldValue, DateTime lastModifyDate)
        {
            Message = string.Empty;
            if (string.IsNullOrEmpty(newValue.ToString()) && !double.TryParse(newValue.ToString(), out double nVal))
            {
                Message += "Invalid New Value";
            }

            if (string.IsNullOrEmpty(oldValue.ToString()) && !double.TryParse(oldValue.ToString(), out double oVal))
            {
                Message += "Invalid Old Value";
            }

            if (string.IsNullOrEmpty(lastModifyDate.ToString()) &&
                !DateTime.TryParse(lastModifyDate.ToString(), out DateTime dVal))
            {
                Message += "Invalid Last Modify date";
            }

            var trackerEditViewModel = new TrackerEditViewModel()
            {
                NewValue       = newValue,
                OldValue       = oldValue,
                LastModifyDate = lastModifyDate
            };
            var response = await ClientService.PostDataAsync(trackerEditViewModel, ControllerName, "posttrackeredit");

            if (response != null)
            {
                Task <string> jsonTask = response.Content.ReadAsStringAsync();
                if (jsonTask.Result.Contains(HttpConstants.SUCCESS))
                {
                    return(true);
                }
            }

            return(false);
        }
コード例 #2
0
 /// <summary>
 /// Tracker edit window constructor, taking ID of a tracker that gets edited or havinf default null if this is s new tracekr window mode.
 /// </summary>
 public TrackerEditWindow(int?trackerID = null)
 {
     DataContext = TrackerEditViewModel = new TrackerEditViewModel(trackerID);
     InitializeComponent();
     TrackerEditViewModel.FinishCommit += () => FinishCommit();
 }