/// <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> /// 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); } } }; }