From 1a89c204c9350e6f074d2e98d111c10546fde701 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Wed, 21 Jan 2026 09:13:11 +0100 Subject: [PATCH] Fixed import to l10ports visited and last30 days and centralized this code at ExcelLocalImportHelper. In the future, I should refactor all the other places as well --- ...timeHealthDeclarationDetailControl.xaml.cs | 80 +----- .../SecurityDetailControl.xaml.cs | 80 +----- ENI2/ENI2.csproj | 5 +- ENI2/Excel/ExcelLocalImportHelper.cs | 246 ++++++++++++++++++ .../VoyageControl.xaml.cs | 162 ++---------- 5 files changed, 280 insertions(+), 293 deletions(-) create mode 100644 ENI2/Excel/ExcelLocalImportHelper.cs diff --git a/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml.cs b/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml.cs index 4ec5a4f7..818b9b67 100644 --- a/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml.cs @@ -281,79 +281,15 @@ namespace ENI2.DetailViewControls private void ButtonImportFromExcel_Click(object sender, RoutedEventArgs e) { - OpenFileDialog ofd = new OpenFileDialog + int cnt = Excel.ExcelLocalImportHelper.ImportLast30Days(this._mdh); + + if (cnt > 0) { - Filter = "Excel Files|*.xls;*.xlsx" - }; - if (ofd.ShowDialog() ?? false) - { - try - { - using (var workbook = new XLWorkbook(ofd.FileName)) - { - var worksheet = workbook.Worksheet(1); // Get first worksheet - var rows = worksheet.RangeUsed().RowsUsed(); // Get all rows with data - - List importPoC30 = new List(); - - foreach (var row in rows) - { - if (row.RowNumber() > worksheet.RangeUsed().RowCount()) break; - - if (worksheet.RangeUsed().ColumnCount() < 3) - { - throw new InvalidDataException("Sheet must have at least 3 Columns of data"); - } - - PortOfCallLast30Days poc30 = new PortOfCallLast30Days(); - - if (row.Cell(1).IsEmpty() && row.Cell(2).IsEmpty()) continue; - - if (!row.Cell(1).IsEmpty()) poc30.PortOfCallLast30DaysLocode = row.Cell(1).GetString(); - if (!row.Cell(2).IsEmpty()) poc30.PortOfCallLast30DaysDateOfDeparture = row.Cell(2).GetDateTime(); - - string boolString = ""; - if (!row.Cell(3).IsEmpty()) boolString = row.Cell(3).GetString(); - poc30.PortOfCallLast30DaysCrewMembersJoined = (boolString.Equals("y", StringComparison.OrdinalIgnoreCase) || - (boolString.Equals("yes", StringComparison.OrdinalIgnoreCase)) || - (boolString.Equals("j", StringComparison.OrdinalIgnoreCase))); - - if (worksheet.RangeUsed().ColumnCount() > 3) - { - string allNewCrew = row.Cell(4).IsEmpty() ? null : row.Cell(4).GetString()?.Trim(); - if (!allNewCrew.IsNullOrEmpty()) - { - string[] crewNames = allNewCrew.Split(',', ';'); - for (int i = 0; i < crewNames.Length; i++) - { - string crewName = crewNames[i].Trim(); - if (crewName.IsNullOrEmpty()) continue; - PortOfCallLast30DaysCrewJoinedShip poc30Crew = new PortOfCallLast30DaysCrewJoinedShip(); - poc30Crew.PortOfCallLast30DaysCrewJoinedShipName = crewName; - poc30Crew.PortOfCallLast30Days = poc30; - poc30.CrewJoinedShip.Add(poc30Crew); - } - } - } - - poc30.MDH = this._mdh; - this._mdh.PortOfCallLast30Days.Add(poc30); - importPoC30.Add(poc30); - } - - if (importPoC30.Count > 0) - { - this.dataGridPortOfCallLast30Days.Items.Refresh(); - this.SublistElementChanged(Message.NotificationClass.MDH); - MessageBox.Show(String.Format(Properties.Resources.textPoC30Imported, importPoC30.Count), Properties.Resources.textCaptionInformation, - MessageBoxButton.OK, MessageBoxImage.Information); - } - } - } - catch (Exception ex) - { - MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error); - } + this.dataGridPortOfCallLast30Days.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.MDH); + MessageBox.Show(String.Format(Properties.Resources.textPoC30Imported, cnt), + Properties.Resources.textCaptionInformation, + MessageBoxButton.OK, MessageBoxImage.Information); } } diff --git a/ENI2/DetailViewControls/SecurityDetailControl.xaml.cs b/ENI2/DetailViewControls/SecurityDetailControl.xaml.cs index aa86ade9..7bd57624 100644 --- a/ENI2/DetailViewControls/SecurityDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/SecurityDetailControl.xaml.cs @@ -337,80 +337,14 @@ namespace ENI2.DetailViewControls private void buttonImportExcel_Click(object sender, RoutedEventArgs e) { - OpenFileDialog ofd = new OpenFileDialog + int importedCount = Excel.ExcelLocalImportHelper.ImportLast10PortFacilities(this._sec); + + if (importedCount > 0) { - Filter = "Excel Files|*.xls;*.xlsx" - }; - - if (ofd.ShowDialog() ?? false) - { - try - { - using (var workbook = new XLWorkbook(ofd.FileName)) - { - var worksheet = workbook.Worksheet(1); // Get first worksheet - var rows = worksheet.RangeUsed().RowsUsed(); // Get all rows with data - - List importL10C = new List(); - - int cnt = 0; - foreach (var row in rows) - { - if (cnt >= 10) break; // Maximum 10 rows - - if (worksheet.RangeUsed().ColumnCount() < 8) - { - throw new InvalidDataException("Sheet must have 8 Columns of data"); - } - - LastTenPortFacilitiesCalled l10c = new LastTenPortFacilitiesCalled(); - - if (row.Cell(1).IsEmpty() && row.Cell(2).IsEmpty()) continue; - - if (!row.Cell(1).IsEmpty()) l10c.PortFacilityPortName = row.Cell(1).GetString(); - if (!row.Cell(3).IsEmpty()) l10c.PortFacilityPortCountry = row.Cell(3).GetString(); - if (!row.Cell(4).IsEmpty()) l10c.PortFacilityPortLoCode = row.Cell(4).GetString(); - - object o = null; - if (!row.Cell(5).IsEmpty()) o = row.Cell(5).Value; - if (o != null) l10c.PortFacilityDateOfArrival = Convert.ToDateTime(o); - - if (!row.Cell(6).IsEmpty()) o = row.Cell(6).Value; - if (o != null) l10c.PortFacilityDateOfDeparture = Convert.ToDateTime(o); - - if (!row.Cell(7).IsEmpty()) o = row.Cell(7).Value; - if (o != null) l10c.PortFacilityShipSecurityLevel = Convert.ToByte(o); - - if (!row.Cell(8).IsEmpty()) o = row.Cell(8).Value; - int gisis = Convert.ToInt32(o); - if (!row.Cell(8).IsEmpty()) l10c.PortFacilityGISISCode = gisis.ToString().PadLeft(4, '0'); - - if (!row.Cell(9).IsEmpty()) l10c.PortFacilitySecurityMattersToReport = row.Cell(9).GetString(); - if (l10c.PortFacilitySecurityMattersToReport?.Equals("nil", StringComparison.CurrentCultureIgnoreCase) == true) - l10c.PortFacilitySecurityMattersToReport = null; - - if (!row.Cell(10).IsEmpty()) l10c.PortFacilityGISISCodeLocode = row.Cell(10).GetString(); - - l10c.SEC = this._sec; - l10c.IsDirty = true; - l10c.Identifier = LastTenPortFacilitiesCalled.GetNewIdentifier(this._sec.LastTenPortFacilitesCalled); - this._sec.LastTenPortFacilitesCalled.Add(l10c); - importL10C.Add(l10c); - cnt++; - } - - if (importL10C.Count > 0) - { - this.dataGridLast10PortFacilities.Items.Refresh(); - this.SublistElementChanged(Message.NotificationClass.SEC); - MessageBox.Show(String.Format(Properties.Resources.textL10PImported, importL10C.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information); - } - } - } - catch (Exception ex) - { - MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error); - } + this.dataGridLast10PortFacilities.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.SEC); + MessageBox.Show(String.Format(Properties.Resources.textL10PImported, importedCount), + Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information); } } diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj index 3844de64..2beedc3b 100644 --- a/ENI2/ENI2.csproj +++ b/ENI2/ENI2.csproj @@ -36,8 +36,8 @@ 5.4.0.0 true publish.html - 1 - 7.2.13.1 + 2 + 7.2.13.2 false true true @@ -356,6 +356,7 @@ + diff --git a/ENI2/Excel/ExcelLocalImportHelper.cs b/ENI2/Excel/ExcelLocalImportHelper.cs new file mode 100644 index 00000000..84545948 --- /dev/null +++ b/ENI2/Excel/ExcelLocalImportHelper.cs @@ -0,0 +1,246 @@ +using bsmd.database; +using ClosedXML.Excel; +using Microsoft.Win32; +using System; +using System.Collections.Generic; +using System.IO; +using System.Windows; + +namespace ENI2.Excel +{ + internal static class ExcelLocalImportHelper + { + + #region Last 10 Port Facilities Called Import from Excel + + public static int ImportLast10PortFacilities(SEC sec) + { + int cnt = 0; + + OpenFileDialog ofd = new OpenFileDialog + { + Filter = "Excel Files|*.xls;*.xlsx" + }; + + if (ofd.ShowDialog() ?? false) + { + try + { + using (var workbook = new XLWorkbook(ofd.FileName)) + { + var worksheet = workbook.Worksheet(1); + var rows = worksheet.RangeUsed().RowsUsed(); + int columnCount = worksheet.RangeUsed().ColumnCount(); + + // Check minimum columns upfront + if (columnCount < 8) + { + throw new InvalidDataException("Sheet must have at least 8 Columns of data"); + } + + List importL10C = new List(); + + + foreach (var row in rows) + { + if (cnt >= 10) break; // Maximum 10 rows + + // Skip empty rows + if (row.Cell(1).IsEmpty() && row.Cell(2).IsEmpty()) continue; + + LastTenPortFacilitiesCalled l10c = new LastTenPortFacilitiesCalled(); + + try + { + // Column 1: Port Name + if (!row.Cell(1).IsEmpty()) + l10c.PortFacilityPortName = row.Cell(1).GetString(); + + // Column 3: Country + if (!row.Cell(3).IsEmpty()) + l10c.PortFacilityPortCountry = row.Cell(3).GetString(); + + // Column 4: Locode + if (!row.Cell(4).IsEmpty()) + l10c.PortFacilityPortLoCode = row.Cell(4).GetString(); + + // Column 5: Arrival Date + if (!row.Cell(5).IsEmpty()) + { + l10c.PortFacilityDateOfArrival = row.Cell(5).GetDateTime(); + } + + // Column 6: Departure Date + if (!row.Cell(6).IsEmpty()) + { + l10c.PortFacilityDateOfDeparture = row.Cell(6).GetDateTime(); + } + + // Column 7: Security Level (byte) + if (!row.Cell(7).IsEmpty()) + { + l10c.PortFacilityShipSecurityLevel = row.Cell(7).GetValue(); + } + + // Column 8: GISIS Code + if (!row.Cell(8).IsEmpty()) + { + int gisis = row.Cell(8).GetValue(); + l10c.PortFacilityGISISCode = gisis.ToString().PadLeft(4, '0'); + } + + // Column 9: Security Matters (optional, can be beyond minimum columns) + if (columnCount >= 9 && !row.Cell(9).IsEmpty()) + { + l10c.PortFacilitySecurityMattersToReport = row.Cell(9).GetString(); + if (l10c.PortFacilitySecurityMattersToReport?.Equals("nil", StringComparison.OrdinalIgnoreCase) == true) + l10c.PortFacilitySecurityMattersToReport = null; + } + + // Column 10: GISIS Code Locode (optional, can be beyond minimum columns) + if (columnCount >= 10 && !row.Cell(10).IsEmpty()) + { + l10c.PortFacilityGISISCodeLocode = row.Cell(10).GetString(); + } + + l10c.SEC = sec; + l10c.IsDirty = true; + l10c.Identifier = LastTenPortFacilitiesCalled.GetNewIdentifier(sec.LastTenPortFacilitesCalled); + sec.LastTenPortFacilitesCalled.Add(l10c); + importL10C.Add(l10c); + cnt++; + } + catch (Exception ex) + { + throw new InvalidDataException($"Error processing row {row.RowNumber()}: {ex.Message}", ex); + } + } + } + } + catch (Exception ex) + { + MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, + MessageBoxButton.OK, MessageBoxImage.Error); + } + } + + return cnt; + } + + #endregion + + #region Last 30 days Import from Excel + + public static int ImportLast30Days(MDH mdh) + { + int cnt = 0; + + OpenFileDialog ofd = new OpenFileDialog + { + Filter = "Excel Files|*.xls;*.xlsx" + }; + + if (ofd.ShowDialog() ?? false) + { + try + { + using (var workbook = new XLWorkbook(ofd.FileName)) + { + var worksheet = workbook.Worksheet(1); + var rows = worksheet.RangeUsed().RowsUsed(); + int columnCount = worksheet.RangeUsed().ColumnCount(); + + List importPoC30 = new List(); + + foreach (var row in rows) + { + if (row.RowNumber() > worksheet.RangeUsed().RowCount()) break; + + if (columnCount < 3) + { + throw new InvalidDataException("Sheet must have at least 3 Columns of data"); + } + + PortOfCallLast30Days poc30 = new PortOfCallLast30Days(); + + if (row.Cell(1).IsEmpty() && row.Cell(2).IsEmpty()) continue; + + // Safer locode extraction + if (!row.Cell(1).IsEmpty()) + { + try + { + poc30.PortOfCallLast30DaysLocode = row.Cell(1).GetString(); + } + catch (Exception ex) + { + throw new InvalidDataException($"Invalid locode in row {row.RowNumber()}: {ex.Message}"); + } + } + + // Safer date extraction + if (!row.Cell(2).IsEmpty()) + { + try + { + poc30.PortOfCallLast30DaysDateOfDeparture = row.Cell(2).GetDateTime(); + } + catch (Exception ex) + { + throw new InvalidDataException($"Invalid date in row {row.RowNumber()}: {ex.Message}"); + } + } + + // Safer boolean extraction + string boolString = ""; + if (!row.Cell(3).IsEmpty()) + { + boolString = row.Cell(3).GetString()?.Trim() ?? ""; + } + poc30.PortOfCallLast30DaysCrewMembersJoined = ( + boolString.Equals("y", StringComparison.OrdinalIgnoreCase) || + boolString.Equals("yes", StringComparison.OrdinalIgnoreCase) || + boolString.Equals("j", StringComparison.OrdinalIgnoreCase)); + + // FIX: Check column count before accessing column 4 + if (columnCount >= 4) + { + string allNewCrew = row.Cell(4).IsEmpty() ? null : row.Cell(4).GetString()?.Trim(); + if (!allNewCrew.IsNullOrEmpty()) + { + string[] crewNames = allNewCrew.Split(',', ';'); + foreach (string crewName in crewNames) + { + string trimmedName = crewName.Trim(); + if (trimmedName.IsNullOrEmpty()) continue; + + PortOfCallLast30DaysCrewJoinedShip poc30Crew = new PortOfCallLast30DaysCrewJoinedShip + { + PortOfCallLast30DaysCrewJoinedShipName = trimmedName, + PortOfCallLast30Days = poc30 + }; + poc30.CrewJoinedShip.Add(poc30Crew); + } + } + } + + poc30.MDH = mdh; + mdh.PortOfCallLast30Days.Add(poc30); + importPoC30.Add(poc30); + } + } + } + catch (Exception ex) + { + MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, + MessageBoxButton.OK, MessageBoxImage.Error); + } + } + + return cnt; + } + + #endregion + + } +} diff --git a/ENI2/SheetDisplayControls/VoyageControl.xaml.cs b/ENI2/SheetDisplayControls/VoyageControl.xaml.cs index 2c773019..de641837 100644 --- a/ENI2/SheetDisplayControls/VoyageControl.xaml.cs +++ b/ENI2/SheetDisplayControls/VoyageControl.xaml.cs @@ -300,80 +300,14 @@ namespace ENI2.SheetDisplayControls private void buttonImportExcelLast10PortFacilities_Click(object sender, RoutedEventArgs e) { - OpenFileDialog ofd = new OpenFileDialog + int importedCount = Excel.ExcelLocalImportHelper.ImportLast10PortFacilities(this._sec); + + if (importedCount > 0) { - Filter = "Excel Files|*.xls;*.xlsx" - }; - - if (ofd.ShowDialog() ?? false) - { - try - { - using (var workbook = new XLWorkbook(ofd.FileName)) - { - var worksheet = workbook.Worksheet(1); // Get first worksheet - var rows = worksheet.RangeUsed().RowsUsed(); // Get all rows with data - - List importL10C = new List(); - - int cnt = 0; - foreach (var row in rows) - { - if (cnt >= 10) break; // Maximum 10 rows - - if (worksheet.RangeUsed().ColumnCount() < 8) - { - throw new InvalidDataException("Sheet must have 8 Columns of data"); - } - - LastTenPortFacilitiesCalled l10c = new LastTenPortFacilitiesCalled(); - - if (row.Cell(1).IsEmpty() && row.Cell(2).IsEmpty()) continue; - - if (!row.Cell(1).IsEmpty()) l10c.PortFacilityPortName = row.Cell(1).GetString(); - if (!row.Cell(3).IsEmpty()) l10c.PortFacilityPortCountry = row.Cell(3).GetString(); - if (!row.Cell(4).IsEmpty()) l10c.PortFacilityPortLoCode = row.Cell(4).GetString(); - - object o = null; - if (!row.Cell(5).IsEmpty()) o = row.Cell(5).Value; - if (o != null) l10c.PortFacilityDateOfArrival = Convert.ToDateTime(o); - - if (!row.Cell(6).IsEmpty()) o = row.Cell(6).Value; - if (o != null) l10c.PortFacilityDateOfDeparture = Convert.ToDateTime(o); - - if (!row.Cell(7).IsEmpty()) o = row.Cell(7).Value; - if (o != null) l10c.PortFacilityShipSecurityLevel = Convert.ToByte(o); - - if (!row.Cell(8).IsEmpty()) o = row.Cell(8).Value; - int gisis = Convert.ToInt32(o); - if (!row.Cell(8).IsEmpty()) l10c.PortFacilityGISISCode = gisis.ToString().PadLeft(4, '0'); - - if (!row.Cell(9).IsEmpty()) l10c.PortFacilitySecurityMattersToReport = row.Cell(9).GetString(); - if (l10c.PortFacilitySecurityMattersToReport?.Equals("nil", StringComparison.CurrentCultureIgnoreCase) == true) - l10c.PortFacilitySecurityMattersToReport = null; - - if (!row.Cell(10).IsEmpty()) l10c.PortFacilityGISISCodeLocode = row.Cell(10).GetString(); - - l10c.SEC = this._sec; - l10c.IsDirty = true; - l10c.Identifier = LastTenPortFacilitiesCalled.GetNewIdentifier(this._sec.LastTenPortFacilitesCalled); - this._sec.LastTenPortFacilitesCalled.Add(l10c); - importL10C.Add(l10c); - cnt++; - } - - if (importL10C.Count > 0) - { - this.dataGridLast10PortFacilities.Items.Refresh(); - this.SublistElementChanged(Message.NotificationClass.SEC); - MessageBox.Show(String.Format(Properties.Resources.textL10PImported, importL10C.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information); - } - } - } - catch (Exception ex) - { - MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error); - } + this.dataGridLast10PortFacilities.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.SEC); + MessageBox.Show(String.Format(Properties.Resources.textL10PImported, importedCount), + Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information); } } @@ -443,80 +377,16 @@ namespace ENI2.SheetDisplayControls private void buttonImportLast30DaysFromExcel_Click(object sender, RoutedEventArgs e) { - OpenFileDialog ofd = new OpenFileDialog + int cnt = Excel.ExcelLocalImportHelper.ImportLast30Days(this._mdh); + + if (cnt > 0) { - Filter = "Excel Files|*.xls;*.xlsx" - }; - if (ofd.ShowDialog() ?? false) - { - try - { - using (var workbook = new XLWorkbook(ofd.FileName)) - { - var worksheet = workbook.Worksheet(1); // Get first worksheet - var rows = worksheet.RangeUsed().RowsUsed(); // Get all rows with data - - List importPoC30 = new List(); - - foreach (var row in rows) - { - if (row.RowNumber() > worksheet.RangeUsed().RowCount()) break; - - if (worksheet.RangeUsed().ColumnCount() < 3) - { - throw new InvalidDataException("Sheet must have at least 3 Columns of data"); - } - - PortOfCallLast30Days poc30 = new PortOfCallLast30Days(); - - if (row.Cell(1).IsEmpty() && row.Cell(2).IsEmpty()) continue; - - if (!row.Cell(1).IsEmpty()) poc30.PortOfCallLast30DaysLocode = row.Cell(1).GetString(); - if (!row.Cell(2).IsEmpty()) poc30.PortOfCallLast30DaysDateOfDeparture = row.Cell(2).GetDateTime(); - - string boolString = ""; - if (!row.Cell(3).IsEmpty()) boolString = row.Cell(3).GetString(); - poc30.PortOfCallLast30DaysCrewMembersJoined = (boolString.Equals("y", StringComparison.OrdinalIgnoreCase) || - (boolString.Equals("yes", StringComparison.OrdinalIgnoreCase)) || - (boolString.Equals("j", StringComparison.OrdinalIgnoreCase))); - - if (worksheet.RangeUsed().ColumnCount() > 3) - { - string allNewCrew = row.Cell(4).IsEmpty() ? null : row.Cell(4).GetString()?.Trim(); - if (!allNewCrew.IsNullOrEmpty()) - { - string[] crewNames = allNewCrew.Split(',', ';'); - for (int i = 0; i < crewNames.Length; i++) - { - string crewName = crewNames[i].Trim(); - if (crewName.IsNullOrEmpty()) continue; - PortOfCallLast30DaysCrewJoinedShip poc30Crew = new PortOfCallLast30DaysCrewJoinedShip(); - poc30Crew.PortOfCallLast30DaysCrewJoinedShipName = crewName; - poc30Crew.PortOfCallLast30Days = poc30; - poc30.CrewJoinedShip.Add(poc30Crew); - } - } - } - - poc30.MDH = this._mdh; - this._mdh.PortOfCallLast30Days.Add(poc30); - importPoC30.Add(poc30); - } - - if (importPoC30.Count > 0) - { - this.dataGridPortOfCallLast30Days.Items.Refresh(); - this.SublistElementChanged(Message.NotificationClass.MDH); - MessageBox.Show(String.Format(Properties.Resources.textPoC30Imported, importPoC30.Count), Properties.Resources.textCaptionInformation, - MessageBoxButton.OK, MessageBoxImage.Information); - } - } - } - catch (Exception ex) - { - MessageBox.Show("Error reading Excel: " + ex.Message, Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error); - } - } + this.dataGridPortOfCallLast30Days.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.MDH); + MessageBox.Show(String.Format(Properties.Resources.textPoC30Imported, cnt), + Properties.Resources.textCaptionInformation, + MessageBoxButton.OK, MessageBoxImage.Information); + } } private void buttonImportPortOfItineraryFromSEC_Click(object sender, RoutedEventArgs e)