/// <summary> /// Callback method for AddUserPreferenceBenchmark Service call - adds benchmark to selected group /// </summary> /// <param name="result">True/False</param> private void AddUserPreferenceBenchmarkCallBackMethod(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); if (_selectedMorningSnapshotRow.MorningSnapshotPreferenceInfo.BenchmarkName == null) { MorningSnapshotInfo.Remove(_selectedMorningSnapshotRow); } _dbInteractivity.RetrieveMorningSnapshotData(new List <UserBenchmarkPreference> { _selectedUserBenchmarkPreference }, RetrieveMorningSnapshotDataCallBackMethod); 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); }
/// <summary> /// Callback method for RemoveUserPreferenceBenchmarkGroup Service call - removes selected group /// </summary> /// <param name="result">True/False</param> private void RemoveUserPreferenceBenchmarkGroupCallBackMethod(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); MorningSnapshotInfo = new ObservableCollection <MorningSnapshotData> (MorningSnapshotInfo.Where(i => i.MorningSnapshotPreferenceInfo.GroupName != _selectedMorningSnapshotRow.MorningSnapshotPreferenceInfo.GroupName).ToList()); if (MorningSnapshotInfo.Count == 0) { MorningSnapshotInfo.Add(new MorningSnapshotData()); } 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); }
/// <summary> /// AddBenchmarkGroupCommand Execution method - adds new group to the morning snapshot grid /// </summary> /// <param name="param">Sender</param> private void AddBenchmarkGroupCommandMethod(object param) { string methodNamespace = String.Format("{0}.{1}", GetType().FullName, System.Reflection.MethodInfo.GetCurrentMethod().Name); Logging.LogBeginMethod(_logger, methodNamespace); try { //Get existing group names List <string> groupNames = MorningSnapshotInfo.Count == 1 ? (MorningSnapshotInfo[0].MorningSnapshotPreferenceInfo == null ? null : MorningSnapshotInfo.Select(i => i.MorningSnapshotPreferenceInfo.GroupName).Distinct().ToList()) : MorningSnapshotInfo.Select(i => i.MorningSnapshotPreferenceInfo.GroupName).Distinct().ToList(); ChildAddNewGroup childAddNewGroup = new ChildAddNewGroup("Add New Group", groupNames); childAddNewGroup.Show(); _benchmarkGroup = String.Empty; childAddNewGroup.Unloaded += (se, e) => { if (childAddNewGroup.DialogResult == true) { _benchmarkGroup = childAddNewGroup.GroupName; _dbInteractivity.AddUserPreferenceBenchmarkGroup(SessionManager.SESSION.UserName, _benchmarkGroup, AddUserPreferenceBenchmarkGroupCallBackMethod); } }; } catch (Exception ex) { MessageBox.Show("Message: " + ex.Message + "\nStackTrace: " + Logging.StackTraceToString(ex), "Exception", MessageBoxButton.OK); Logging.LogException(_logger, ex); } Logging.LogEndMethod(_logger, methodNamespace); }
/// <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> /// AddBenchmarkToGroupCommand Execution method - adds benchmark to group as Total(Gross), Net Return or Price Return /// </summary> /// <param name="param"></param> private void AddBenchmarkToGroupCommandMethod(object param) { List <string> morningSnapshotBenchmarkNames = MorningSnapshotInfo.Select(p => p.MorningSnapshotPreferenceInfo.BenchmarkName).Distinct().ToList(); ChildAddBenchmarks childAddBenchmarks = new ChildAddBenchmarks(BenchmarkSelectionInfo.Where(b => !(morningSnapshotBenchmarkNames.Contains(b.Name))).ToList()); childAddBenchmarks.Show(); childAddBenchmarks.Unloaded += (se, e) => { if (childAddBenchmarks.DialogResult == true) { if (childAddBenchmarks.SelectedUserBenchmarkPreference != null) { _selectedUserBenchmarkPreference = childAddBenchmarks.SelectedUserBenchmarkPreference; _selectedUserBenchmarkPreference.GroupName = SelectedMorningSnapshotRow.MorningSnapshotPreferenceInfo.GroupName; _dbInteractivity.AddUserPreferenceBenchmark (SessionManager.SESSION.UserName, _selectedUserBenchmarkPreference, AddUserPreferenceBenchmarkCallBackMethod); } } }; }
/// <summary> /// Callback method for AddUserPreferenceBenchmarkGroup Service call - creates a blank group /// </summary> /// <param name="result">True/False</param> private void AddUserPreferenceBenchmarkGroupCallBackMethod(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); if (_selectedMorningSnapshotRow.MorningSnapshotPreferenceInfo == null) { MorningSnapshotInfo.Clear(); } MorningSnapshotInfo.Add(new MorningSnapshotData() { MorningSnapshotPreferenceInfo = new UserBenchmarkPreference() { GroupName = _benchmarkGroup } }); 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); }