From 410735232817918457d400624829bc73622196a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santiago=20Ace=C3=B1olaza?= Date: Tue, 19 May 2015 11:52:01 -0300 Subject: [PATCH] Fixed defect on priority mappings not being saved when values in config file are incorrect --- .../UI/Controls/JiraPageControl.cs | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/VersionOne.ServiceHost.ConfigurationTool/UI/Controls/JiraPageControl.cs b/VersionOne.ServiceHost.ConfigurationTool/UI/Controls/JiraPageControl.cs index 6a4ca1c..dd679c4 100644 --- a/VersionOne.ServiceHost.ConfigurationTool/UI/Controls/JiraPageControl.cs +++ b/VersionOne.ServiceHost.ConfigurationTool/UI/Controls/JiraPageControl.cs @@ -238,17 +238,19 @@ private void grdProjectMappings_DataError(object sender, DataGridViewDataErrorEv private void grdPriorityMappings_DataError(object sender, DataGridViewDataErrorEventArgs e) { - var column = grdPriorityMappings.Columns[e.ColumnIndex]; - - if (column == colVersionOnePriority) - { - SetDefaultValue(VersionOnePriorities, e.RowIndex, e.ColumnIndex); - } - else if (column == colJiraPriority) + if (e.ColumnIndex >= 0) { - SetDefaultValue(JiraPriorities, e.RowIndex, e.ColumnIndex); + var column = grdPriorityMappings.Columns[e.ColumnIndex]; + + if (column == colVersionOnePriority) + { + SetDefaultValue(VersionOnePriorities, e.RowIndex, e.ColumnIndex); + } + else if (column == colJiraPriority) + { + SetDefaultValue(JiraPriorities, e.RowIndex, e.ColumnIndex); + } } - e.ThrowException = false; } @@ -300,6 +302,14 @@ public void UpdateJiraPriorities(IList priorities) { JiraPriorities = priorities; BindJiraPriorityColumn(); + + if (Model.PriorityMappings.Any(priorityMapping => !priorities.Any( + p => + p.Name.Equals(priorityMapping.JiraPriority.Name) && + p.Value.Equals(priorityMapping.JiraPriority.Id)))) + { + bsPriorityMappings.Clear(); + } } } } \ No newline at end of file