/// <summary> /// Callback method for RetrieveMorningSnapshotData Service call - Gets morning snapshot data based on user preference /// </summary> /// <param name="result">MorningSnapshotData</param> private void RetrieveMorningSnapshotDataCallBackMethod(List <MorningSnapshotData> result) { string methodNamespace = String.Format("{0}.{1}", GetType().FullName, System.Reflection.MethodInfo.GetCurrentMethod().Name); Logging.LogBeginMethod(_logger, methodNamespace); try { if (result != null) { Logging.LogMethodParameter(_logger, methodNamespace, result, 1); if (MorningSnapshotInfo == null) { MorningSnapshotInfo = new ObservableCollection <MorningSnapshotData>(result); if (result.Count == 0) { MorningSnapshotInfo.Add(new MorningSnapshotData()); } } else { foreach (MorningSnapshotData record in result) { MorningSnapshotInfo.Add(record); } } RefreshContextMenu(); } else { Logging.LogMethodParameterNull(_logger, methodNamespace, 1); } } catch (Exception ex) { MessageBox.Show("Message: " + ex.Message + "\nStackTrace: " + Logging.StackTraceToString(ex), "Exception", MessageBoxButton.OK); Logging.LogException(_logger, ex); } Logging.LogEndMethod(_logger, methodNamespace); //if (BenchmarkGroupedData.Count == 0) //{ // BenchmarkGroupedData.Add(new MorningSnapshotData() // { // }); //} }
/// <summary> /// Callback method for AddUserPreferenceBenchmark Service call - adds benchmark to selected group /// </summary> /// <param name="result">True/False</param> private void RemoveUserPreferenceBenchmarkCallBackMethod(bool result) { string methodNamespace = String.Format("{0}.{1}", GetType().FullName, System.Reflection.MethodInfo.GetCurrentMethod().Name); Logging.LogBeginMethod(_logger, methodNamespace); try { if (result != false) { Logging.LogMethodParameter(_logger, methodNamespace, result, 1); int groupBenchmarkCount = MorningSnapshotInfo.Where(i => i.MorningSnapshotPreferenceInfo.GroupName == _selectedMorningSnapshotRow.MorningSnapshotPreferenceInfo.GroupName).Count(); if (groupBenchmarkCount == 1) { MorningSnapshotInfo.Add(new MorningSnapshotData() { MorningSnapshotPreferenceInfo = new UserBenchmarkPreference() { GroupName = _selectedMorningSnapshotRow.MorningSnapshotPreferenceInfo.GroupName } }); } MorningSnapshotInfo.Remove(_selectedMorningSnapshotRow); RefreshContextMenu(); } else { Logging.LogMethodParameterNull(_logger, methodNamespace, 1); } } catch (Exception ex) { MessageBox.Show("Message: " + ex.Message + "\nStackTrace: " + Logging.StackTraceToString(ex), "Exception", MessageBoxButton.OK); Logging.LogException(_logger, ex); } Logging.LogEndMethod(_logger, methodNamespace); }