diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx index b9e07213..2926e12d 100644 Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ diff --git a/nsw/Deutschland/BSMD-Formblatt.xlsx b/nsw/Deutschland/BSMD-Formblatt.xlsx new file mode 100644 index 00000000..3a78d9ea Binary files /dev/null and b/nsw/Deutschland/BSMD-Formblatt.xlsx differ diff --git a/nsw/Deutschland/BSMD-Formblatt.xltx b/nsw/Deutschland/BSMD-Formblatt.xltx new file mode 100644 index 00000000..c4aeb4d3 Binary files /dev/null and b/nsw/Deutschland/BSMD-Formblatt.xltx differ diff --git a/nsw/Deutschland/Legende.xlsx b/nsw/Deutschland/Legende.xlsx new file mode 100644 index 00000000..3979e1c8 Binary files /dev/null and b/nsw/Deutschland/Legende.xlsx differ diff --git a/nsw/Dänemark/NSW-DK-Excel-Arrival.xlsx b/nsw/Dänemark/NSW-DK-Excel-Arrival.xlsx new file mode 100644 index 00000000..8ac3e0f2 Binary files /dev/null and b/nsw/Dänemark/NSW-DK-Excel-Arrival.xlsx differ diff --git a/nsw/Dänemark/NSW-DK-Excel-Arrival.xltx b/nsw/Dänemark/NSW-DK-Excel-Arrival.xltx new file mode 100644 index 00000000..fdbe2f6c Binary files /dev/null and b/nsw/Dänemark/NSW-DK-Excel-Arrival.xltx differ diff --git a/nsw/Dänemark/NSW-DK-Excel-Departure.xlsx b/nsw/Dänemark/NSW-DK-Excel-Departure.xlsx new file mode 100644 index 00000000..6a0dcfe6 Binary files /dev/null and b/nsw/Dänemark/NSW-DK-Excel-Departure.xlsx differ diff --git a/nsw/Dänemark/NSW-DK-Excel-Departure.xltx b/nsw/Dänemark/NSW-DK-Excel-Departure.xltx new file mode 100644 index 00000000..e6abfa3a Binary files /dev/null and b/nsw/Dänemark/NSW-DK-Excel-Departure.xltx differ diff --git a/nsw/Source/bsmd.ExcelReadService/App.config b/nsw/Source/bsmd.ExcelReadService/App.config index 34c5e3ad..2177f47e 100644 --- a/nsw/Source/bsmd.ExcelReadService/App.config +++ b/nsw/Source/bsmd.ExcelReadService/App.config @@ -37,6 +37,23 @@ False + + + + E:\svnlager\BSMD\nsw\Deutschland\BSMD-Formblatt.xlsx + + + + + + + E:\svnlager\BSMD\nsw\Dänemark\NSW-DK-Excel-Arrival.xlsx + E:\svnlager\BSMD\nsw\Dänemark\NSW-DK-Excel-Departure.xlsx + + + \ No newline at end of file diff --git a/nsw/Source/bsmd.ExcelReadService/Confirmation.cs b/nsw/Source/bsmd.ExcelReadService/Confirmation.cs new file mode 100644 index 00000000..13e629b3 --- /dev/null +++ b/nsw/Source/bsmd.ExcelReadService/Confirmation.cs @@ -0,0 +1,155 @@ +using log4net; +using Microsoft.Office.Interop.Excel; +using System.Runtime.InteropServices; +using System; +using System.Drawing; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace bsmd.ExcelReadService +{ + /// + /// Kapselt die Implementierung / Schreiben des Bestätigungs-Sheets. Bisher wurde das Highlighting direkt in das ursprüngl. Sheet + /// übernommen. Da die Bestätigung aber anders aussieht und aus mehreren Sheets bestehen kann ist das jetzt abgetrennt in einer + /// eignenen Klasse. Der Pfad zu den Templates ist in den Settings hinterlegt, die Klasse wird mit der entspr. Collection aufgerufen + /// Das wiederum ergibt sich aus dem Zielhafen in PoC. + /// + internal class Confirmation : IDisposable + { + private ILog _log = LogManager.GetLogger(typeof(Confirmation)); + + private int okColor = ColorTranslator.ToOle(Color.FromArgb(200, 255, 200)); // light green + private int warnColor = ColorTranslator.ToOle(Color.FromArgb(255, 255, 200)); // yellow + private int failColor = ColorTranslator.ToOle(Color.FromArgb(255, 150, 150)); // light red + private int whiteColor = ColorTranslator.ToOle(Color.White); + + private List workbooks = new List(); + private List> nameDicts = new List>(); + private List templateNames = new List(); + + #region Construction + + public Confirmation(System.Collections.Specialized.StringCollection sheetCollection, Application excelInstance) + { + foreach(string template in sheetCollection) + { + try + { + // die Templates sollten echte Excel Templates (.xlst) sein + Workbook aWorkbook = excelInstance.Workbooks.Open(template, 0, false, 5, "", "", false, XlPlatform.xlWindows, "", true, false, 0, false, false, false); + Dictionary nameDict = new Dictionary(); + foreach (Name name in aWorkbook.Names) + { + nameDict[name.Name] = name; + } + workbooks.Add(aWorkbook); + nameDicts.Add(nameDict); + templateNames.Add(Path.GetFileNameWithoutExtension(template)); + } + catch(Exception ex) + { + _log.ErrorFormat("Failure creating sheet from template {0}:{1}", template, ex.Message); + } + } + } + + #endregion + + #region public + + public void ConfirmText(string lookup, string value, ExcelReader.ReadState state) + { + this.ConfirmValue(lookup, value, state); + } + + public void ConfirmNumber(string lookup, double? value, ExcelReader.ReadState state) + { + this.ConfirmValue(lookup, value, state); + } + + public void ConfirmDate(string lookup, DateTime? value, ExcelReader.ReadState state) + { + this.ConfirmValue(lookup, value, state); + } + + public void ConfirmTime(string lookup, DateTime? value, ExcelReader.ReadState state) + { + this.ConfirmValue(lookup, value, state); + } + + public List SaveConfirmationSheets(string receivedFileName) + { + + List result = new List(); + + for(int i=0;i sendItems = new List(); - sendItems.Add(confirmationFileName); + List localConfirmationSheets = reader.SaveConfirmationSheets(attachmentLocalPath); - // get the ship's name - string shipname = DBManager.Instance.GetShipNameFromCore(messageCore); - if (shipname.IsNullOrEmpty()) shipname = messageCore.IMO; + // get the ship's name + string shipname = DBManager.Instance.GetShipNameFromCore(messageCore); + if (shipname.IsNullOrEmpty()) shipname = messageCore.IMO; - string subject = string.Format("{0}: {1}", Properties.Settings.Default.SendEMailSubject, shipname); + string subject = string.Format("{0}: {1}", Properties.Settings.Default.SendEMailSubject, shipname); + + // send reply sheet back to sender + BSMDMail.SendNSWReportWithAttachments(subject, localConfirmationSheets, mailSender); - // send reply sheet back to sender - BSMDMail.SendNSWReportWithAttachments(subject, sendItems, mailSender); - } } } } diff --git a/nsw/Source/bsmd.ExcelReadService/ExcelReader.cs b/nsw/Source/bsmd.ExcelReadService/ExcelReader.cs index 3e84d75c..1a5dfa9a 100644 --- a/nsw/Source/bsmd.ExcelReadService/ExcelReader.cs +++ b/nsw/Source/bsmd.ExcelReadService/ExcelReader.cs @@ -12,7 +12,8 @@ using Microsoft.Office.Interop.Excel; using System; using System.Collections.Generic; using System.Data; -using System.Drawing; +using System.IO; + using System.Globalization; using System.Linq; using System.Runtime.InteropServices; @@ -28,24 +29,28 @@ namespace bsmd.ExcelReadService private Application _excelApp; private Dictionary _nameDict; - private int okColor = ColorTranslator.ToOle(Color.FromArgb(200, 255, 200)); // light green - private int warnColor = ColorTranslator.ToOle(Color.FromArgb(255, 255, 200)); // yellow - private int failColor = ColorTranslator.ToOle(Color.FromArgb(255, 150, 150)); // light red - internal enum ReadState { NONE, OK, WARN, FAIL }; - - public ExcelReader(string filePath) { this._excelApp = new Application(); + this._excelApp.DisplayAlerts = false; this._excelWorkbooks = _excelApp.Workbooks; + this._portcall = _excelWorkbooks.Open(filePath, 0, true, 5, "", "", false, XlPlatform.xlWindows, "", false, false, 0, false, false, false); _nameDict = new Dictionary(); foreach(Name name in _portcall.Names) { _nameDict[name.Name] = name; - } + } + + } + + internal Confirmation Conf { get; set; } + + internal void SetConfirmation(System.Collections.Specialized.StringCollection templatePaths) + { + this.Conf = new Confirmation(templatePaths, _excelApp); } internal bool Save(string filePath) @@ -81,27 +86,11 @@ namespace bsmd.ExcelReadService return result; } - internal void HighlightLookup(string lookup, ReadState state) + internal List SaveConfirmationSheets(string attachmentLocalPath) { - if (!_nameDict.ContainsKey(lookup)) return; - Range range = _nameDict[lookup].RefersToRange; - if(range != null) - { - switch(state) - { - case ReadState.FAIL: - range.Interior.Color = this.failColor; break; - case ReadState.WARN: - range.Interior.Color = this.warnColor; break; - case ReadState.OK: - range.Interior.Color = this.okColor; break; - case ReadState.NONE: - default: - break; - } - } - Marshal.ReleaseComObject(range); + return this.Conf.SaveConfirmationSheets(attachmentLocalPath); } + internal string ReadText(string lookup) { @@ -137,16 +126,16 @@ namespace bsmd.ExcelReadService string portName = LocodeDB.PortNameFromLocode(val); if(portName == null) { - this.HighlightLookup(lookup, ReadState.WARN); + this.Conf.ConfirmText(lookup, null, ReadState.WARN); } else { - this.HighlightLookup(lookup, ReadState.OK); + this.Conf.ConfirmText(lookup, portName, ReadState.OK); } } else { - this.HighlightLookup(lookup, ReadState.FAIL); + this.Conf.ConfirmText(lookup, null, ReadState.FAIL); } return val; } @@ -158,23 +147,23 @@ namespace bsmd.ExcelReadService if (val != null) { if (val.Equals("m", StringComparison.CurrentCultureIgnoreCase) || val.Equals("male", StringComparison.CurrentCultureIgnoreCase)) { - this.HighlightLookup(lookup, ReadState.OK); + this.Conf.ConfirmText(lookup, val, ReadState.OK); result = 0; } else if (val.Equals("f", StringComparison.CurrentCultureIgnoreCase) || val.Equals("female", StringComparison.CurrentCultureIgnoreCase)) { - this.HighlightLookup(lookup, ReadState.OK); + this.Conf.ConfirmText(lookup, val, ReadState.OK); result = 1; } else { result = 2; - this.HighlightLookup(lookup, ReadState.WARN); + this.Conf.ConfirmText(lookup, val, ReadState.WARN); } } if(result == null) { - this.HighlightLookup(lookup, ReadState.FAIL); + this.Conf.ConfirmText(lookup, null, ReadState.FAIL); } return result; } @@ -194,13 +183,13 @@ namespace bsmd.ExcelReadService if (val.Equals("ic", StringComparison.CurrentCultureIgnoreCase)) result = 0; if (result == null) - this.HighlightLookup(lookup, ReadState.WARN); + this.Conf.ConfirmText(lookup, val, ReadState.WARN); else - this.HighlightLookup(lookup, ReadState.OK); + this.Conf.ConfirmText(lookup, val, ReadState.OK); } else { - this.HighlightLookup(lookup, ReadState.FAIL); + this.Conf.ConfirmText(lookup, null, ReadState.FAIL); } return result; @@ -216,13 +205,13 @@ namespace bsmd.ExcelReadService if (val.IndexOf("europe", StringComparison.OrdinalIgnoreCase) >= 0) result = 1; if (val.IndexOf("overseas", StringComparison.OrdinalIgnoreCase) >= 0) result = 2; if (result == null) - this.HighlightLookup(lookup, ReadState.WARN); + this.Conf.ConfirmText(lookup, val, ReadState.WARN); else - this.HighlightLookup(lookup, ReadState.OK); + this.Conf.ConfirmText(lookup, val, ReadState.OK); } else { - this.HighlightLookup(lookup, ReadState.FAIL); + this.Conf.ConfirmText(lookup, null, ReadState.FAIL); } return result; } @@ -237,13 +226,13 @@ namespace bsmd.ExcelReadService if (val.IndexOf("single", StringComparison.OrdinalIgnoreCase) >= 0) result = 0; if (val.IndexOf("double", StringComparison.OrdinalIgnoreCase) >= 0) result = 2; if (result == null) - this.HighlightLookup(lookup, ReadState.WARN); + this.Conf.ConfirmText(lookup, val, ReadState.WARN); else - this.HighlightLookup(lookup, ReadState.OK); + this.Conf.ConfirmText(lookup, val, ReadState.OK); } else { - this.HighlightLookup(lookup, ReadState.FAIL); + this.Conf.ConfirmText(lookup, null, ReadState.FAIL); } return result; } @@ -258,13 +247,13 @@ namespace bsmd.ExcelReadService if (val.IndexOf("empty", StringComparison.OrdinalIgnoreCase) >= 0) result = 1; if (val.IndexOf("inerted", StringComparison.OrdinalIgnoreCase) >= 0) result = 2; if (result == null) - this.HighlightLookup(lookup, ReadState.WARN); + this.Conf.ConfirmText(lookup, val, ReadState.WARN); else - this.HighlightLookup(lookup, ReadState.OK); + this.Conf.ConfirmText(lookup, val, ReadState.OK); } else { - this.HighlightLookup(lookup, ReadState.FAIL); + this.Conf.ConfirmText(lookup, null, ReadState.FAIL); } return result; } @@ -280,13 +269,13 @@ namespace bsmd.ExcelReadService if (val.IndexOf("some", StringComparison.OrdinalIgnoreCase) >= 0) result = 1; if (val.IndexOf("none", StringComparison.OrdinalIgnoreCase) >= 0) result = 2; if (result == null) - this.HighlightLookup(lookup, ReadState.WARN); + this.Conf.ConfirmText(lookup, val, ReadState.WARN); else - this.HighlightLookup(lookup, ReadState.OK); + this.Conf.ConfirmText(lookup, val, ReadState.OK); } else { - this.HighlightLookup(lookup, ReadState.FAIL); + this.Conf.ConfirmText(lookup, val, ReadState.FAIL); } return result; } @@ -356,16 +345,16 @@ namespace bsmd.ExcelReadService if ((date.Value < new DateTime(1900, 1, 1)) || (date.Value > new DateTime(2030, 1, 1))) { date = null; - this.HighlightLookup(lookup, ReadState.WARN); + this.Conf.ConfirmDate(lookup, date, ReadState.WARN); } else { - this.HighlightLookup(lookup, ReadState.OK); + this.Conf.ConfirmDate(lookup, date, ReadState.OK); } } else { - this.HighlightLookup(lookup, ReadState.FAIL); + this.Conf.ConfirmDate(lookup, null, ReadState.FAIL); } } @@ -373,7 +362,7 @@ namespace bsmd.ExcelReadService } catch (Exception) { - this.HighlightLookup(lookup, ReadState.FAIL); + this.Conf.ConfirmDate(lookup, null, ReadState.FAIL); _log.WarnFormat("error parsing datetime for lookup {0}", lookup); return null; } @@ -458,18 +447,18 @@ namespace bsmd.ExcelReadService } if (result != null) - { - this.HighlightLookup(lookup, ReadState.OK); + { + this.Conf.ConfirmTime(lookup, result, ReadState.OK); } else { - this.HighlightLookup(lookup, ReadState.WARN); + this.Conf.ConfirmTime(lookup, result, ReadState.WARN); } } } catch (Exception) { - this.HighlightLookup(lookup, ReadState.FAIL); + this.Conf.ConfirmTime(lookup, null, ReadState.FAIL); _log.WarnFormat("error reading time for lookup {0}", lookup); } @@ -499,17 +488,17 @@ namespace bsmd.ExcelReadService } if (result != null) { - this.HighlightLookup(lookup, ReadState.OK); + this.Conf.ConfirmNumber(lookup, result, ReadState.OK); } else { - this.HighlightLookup(lookup, ReadState.FAIL); + this.Conf.ConfirmNumber(lookup, result, ReadState.FAIL); } } } catch (Exception) { - this.HighlightLookup(lookup, ReadState.FAIL); + this.Conf.ConfirmNumber(lookup, null, ReadState.FAIL); _log.WarnFormat("error reading number for lookup {0}", lookup); } return result; @@ -520,11 +509,11 @@ namespace bsmd.ExcelReadService string val = this.ReadText(lookup); if (val == null) { - this.HighlightLookup(lookup, ReadState.FAIL); + this.Conf.ConfirmText(lookup, val, ReadState.FAIL); return null; } - this.HighlightLookup(lookup, ReadState.OK); + this.Conf.ConfirmText(lookup, val, ReadState.OK); if ((val == "y") || (val == "Y") || val.Equals("yes", StringComparison.OrdinalIgnoreCase) || (val == "1") || (val == "x") || (val == "X")) return true; diff --git a/nsw/Source/bsmd.ExcelReadService/ProjectInstaller.Designer.cs b/nsw/Source/bsmd.ExcelReadService/ProjectInstaller.Designer.cs index 366ba076..0d65dff8 100644 --- a/nsw/Source/bsmd.ExcelReadService/ProjectInstaller.Designer.cs +++ b/nsw/Source/bsmd.ExcelReadService/ProjectInstaller.Designer.cs @@ -28,31 +28,31 @@ /// private void InitializeComponent() { - this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller(); - this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller(); + this.serviceProcessInstallerTestExcel = new System.ServiceProcess.ServiceProcessInstaller(); + this.serviceInstallerTestExcel = new System.ServiceProcess.ServiceInstaller(); // - // serviceProcessInstaller1 + // serviceProcessInstallerTestExcel // - this.serviceProcessInstaller1.Password = null; - this.serviceProcessInstaller1.Username = null; + this.serviceProcessInstallerTestExcel.Password = null; + this.serviceProcessInstallerTestExcel.Username = null; // - // serviceInstaller1 + // serviceInstallerTestExcel // - this.serviceInstaller1.Description = "Receives and processes Excel reports send via e-mail"; - this.serviceInstaller1.DisplayName = "NSW Excel Report Service"; - this.serviceInstaller1.ServiceName = "ExcelReadService"; + this.serviceInstallerTestExcel.Description = "Test-Instance: Receives and processes Excel reports send via e-mail"; + this.serviceInstallerTestExcel.DisplayName = "NSW Excel Report Test-Service "; + this.serviceInstallerTestExcel.ServiceName = "ExcelReadTestService"; // // ProjectInstaller // this.Installers.AddRange(new System.Configuration.Install.Installer[] { - this.serviceProcessInstaller1, - this.serviceInstaller1}); + this.serviceInstallerTestExcel, + this.serviceProcessInstallerTestExcel}); } #endregion - private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1; - private System.ServiceProcess.ServiceInstaller serviceInstaller1; + private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstallerTestExcel; + private System.ServiceProcess.ServiceInstaller serviceInstallerTestExcel; } } \ No newline at end of file diff --git a/nsw/Source/bsmd.ExcelReadService/ProjectInstaller.resx b/nsw/Source/bsmd.ExcelReadService/ProjectInstaller.resx index a5c17521..557b3f22 100644 --- a/nsw/Source/bsmd.ExcelReadService/ProjectInstaller.resx +++ b/nsw/Source/bsmd.ExcelReadService/ProjectInstaller.resx @@ -117,10 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + 17, 56 - + 196, 17 diff --git a/nsw/Source/bsmd.ExcelReadService/Properties/Settings.Designer.cs b/nsw/Source/bsmd.ExcelReadService/Properties/Settings.Designer.cs index c81b1b4c..90689ca9 100644 --- a/nsw/Source/bsmd.ExcelReadService/Properties/Settings.Designer.cs +++ b/nsw/Source/bsmd.ExcelReadService/Properties/Settings.Designer.cs @@ -83,5 +83,30 @@ namespace bsmd.ExcelReadService.Properties { return ((bool)(this["SendConfirmationSheet"])); } } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("\r\n\r\n E:\\svnlager\\BSMD\\nsw\\Deutschland\\BSMD-Formblatt.xlsx\r\n")] + public global::System.Collections.Specialized.StringCollection ConfirmationDE { + get { + return ((global::System.Collections.Specialized.StringCollection)(this["ConfirmationDE"])); + } + } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute(@" + + E:\svnlager\BSMD\nsw\Dänemark\NSW-DK-Excel-Arrival.xlsx + E:\svnlager\BSMD\nsw\Dänemark\NSW-DK-Excel-Departure.xlsx +")] + public global::System.Collections.Specialized.StringCollection ConfirmationDK { + get { + return ((global::System.Collections.Specialized.StringCollection)(this["ConfirmationDK"])); + } + } } } diff --git a/nsw/Source/bsmd.ExcelReadService/Properties/Settings.settings b/nsw/Source/bsmd.ExcelReadService/Properties/Settings.settings index 30bd5dbe..3e0f92fb 100644 --- a/nsw/Source/bsmd.ExcelReadService/Properties/Settings.settings +++ b/nsw/Source/bsmd.ExcelReadService/Properties/Settings.settings @@ -27,5 +27,18 @@ False + + <?xml version="1.0" encoding="utf-16"?> +<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <string>E:\svnlager\BSMD\nsw\Deutschland\BSMD-Formblatt.xlsx</string> +</ArrayOfString> + + + <?xml version="1.0" encoding="utf-16"?> +<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <string>E:\svnlager\BSMD\nsw\Dänemark\NSW-DK-Excel-Arrival.xlsx</string> + <string>E:\svnlager\BSMD\nsw\Dänemark\NSW-DK-Excel-Departure.xlsx</string> +</ArrayOfString> + \ No newline at end of file diff --git a/nsw/Source/bsmd.ExcelReadService/Util.cs b/nsw/Source/bsmd.ExcelReadService/Util.cs index 8e431a44..4412198e 100644 --- a/nsw/Source/bsmd.ExcelReadService/Util.cs +++ b/nsw/Source/bsmd.ExcelReadService/Util.cs @@ -26,7 +26,7 @@ namespace bsmd.ExcelReadService messageCore = Util.LookupMessageCore(reader, out readMessage); - if (messageCore == null) return false; // cannot work with this sheet or create one + if (messageCore == null) return false; // cannot work with this sheet or create one // load messages if already present List messages = DBManager.Instance.GetMessagesForCore(messageCore, DBManager.MessageLoad.EXCEL); @@ -285,7 +285,7 @@ namespace bsmd.ExcelReadService poi.PortOfItineraryLocode = reader.ReadLoCode(bpolLocode); if (!poi.PortOfItineraryLocode.IsNullOrEmpty() && (poi.PortOfItineraryLocode.Length > 5)) { - reader.HighlightLookup(bpolLocode, ExcelReader.ReadState.WARN); + reader.Conf.ConfirmText(bpolLocode, poi.PortOfItineraryLocode, ExcelReader.ReadState.WARN); } poi.PortOfItineraryETA = reader.ReadDate(bpolETA); @@ -388,7 +388,7 @@ namespace bsmd.ExcelReadService } if (!stat.Flag.IsNullOrEmpty() && (stat.Flag.Length > 2)) - reader.HighlightLookup("STAT.Flag", ExcelReader.ReadState.FAIL); + reader.Conf.ConfirmText("STAT.Flag", stat.Flag, ExcelReader.ReadState.FAIL); string transportMode = reader.ReadText("STAT.TransportMode"); if(transportMode != null) @@ -1098,7 +1098,7 @@ namespace bsmd.ExcelReadService crew.CrewMemberDuty = reader.ReadText(crewDuty); crew.CrewMemberNationality = reader.ReadText(crewNationality); if (!crew.CrewMemberNationality.IsNullOrEmpty() && (crew.CrewMemberNationality.Length > 2)) - reader.HighlightLookup(crewNationality, ExcelReader.ReadState.FAIL); + reader.Conf.ConfirmText(crewNationality, crew.CrewMemberNationality, ExcelReader.ReadState.FAIL); crew.CrewMemberPlaceOfBirth = reader.ReadText(crewPlaceOfBirth); crew.CrewMemberDateOfBirth = reader.ReadDate(crewDateOfBirth); crew.CrewMemberIdentityDocumentType = reader.ReadIdentityDocumentType(crewIdentDocType); @@ -1148,7 +1148,7 @@ namespace bsmd.ExcelReadService pas.PassengerGender = reader.ReadGender(pasGender); pas.PassengerNationality = reader.ReadText(pasNationality); if (!pas.PassengerNationality.IsNullOrEmpty() && pas.PassengerNationality.Length > 2) - reader.HighlightLookup(pasNationality, ExcelReader.ReadState.FAIL); + reader.Conf.ConfirmText(pasNationality, pas.PassengerNationality, ExcelReader.ReadState.FAIL); // TODO: Nicht klar ob hier LOCODEs kommen oder nicht pas.PassengerPortOfEmbarkation = reader.ReadTextNoWhitespace(pasEmbarkation); pas.PassengerPortOfDisembarkation = reader.ReadTextNoWhitespace(pasDebarkation); @@ -1255,8 +1255,16 @@ namespace bsmd.ExcelReadService } } - if(result == null) + if (result != null) { + // setup returning confirmation sheets according to PoC + if (result.PoC.Substring(0, 2) == "DK") + reader.SetConfirmation(Properties.Settings.Default.ConfirmationDK); + else + reader.SetConfirmation(Properties.Settings.Default.ConfirmationDE); + } + else + { // lookup poc, imo, eta poc = reader.ReadText("Visit.PortOfCall"); @@ -1265,6 +1273,7 @@ namespace bsmd.ExcelReadService // Prüfen auf Transit if (poc.ToUpper().Contains("CANAL") || poc.ToUpper().Equals("ZZNOK")) { + reader.SetConfirmation(Properties.Settings.Default.ConfirmationDE); poc = "ZZNOK"; isTransit = true; } @@ -1281,19 +1290,32 @@ namespace bsmd.ExcelReadService } if (RuleEngine.IsGermanLocode(aGermanPortName)) + { poc = aGermanPortName; + } else { // somehow lookup LOCODE from the port's name! - poc = LocodeDB.LocodeGERFromCity(aGermanPortName); + poc = LocodeDB.LocodeGERFromCity(aGermanPortName); } } + + if (poc != null) + { + // setup returning confirmation sheets according to PoC + if (poc.Substring(0, 2) == "DK") + reader.SetConfirmation(Properties.Settings.Default.ConfirmationDK); + else + reader.SetConfirmation(Properties.Settings.Default.ConfirmationDE); + } } imo = reader.ReadText("Visit.IMONumber"); + // ETA - eta = reader.ReadDateTime("NOA_NOD.ETADateToPortOfCall", "NOA_NOD.ETATimeToPortOfCall"); + if(poc != null) + eta = reader.ReadDateTime("NOA_NOD.ETADateToPortOfCall", "NOA_NOD.ETATimeToPortOfCall"); if ((imo != null) && (eta.HasValue) && (poc != null)) { diff --git a/nsw/Source/bsmd.ExcelReadService/bsmd.ExcelReadService.csproj b/nsw/Source/bsmd.ExcelReadService/bsmd.ExcelReadService.csproj index 7607c7a3..c2168ac2 100644 --- a/nsw/Source/bsmd.ExcelReadService/bsmd.ExcelReadService.csproj +++ b/nsw/Source/bsmd.ExcelReadService/bsmd.ExcelReadService.csproj @@ -71,6 +71,7 @@ Properties\AssemblyProjectKeyInfo.cs + Component diff --git a/nsw/Source/bsmd.database/Message.cs b/nsw/Source/bsmd.database/Message.cs index fb170caf..982ee144 100644 --- a/nsw/Source/bsmd.database/Message.cs +++ b/nsw/Source/bsmd.database/Message.cs @@ -2,9 +2,6 @@ using System.Data; using System.Data.SqlClient; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Collections.ObjectModel; namespace bsmd.database diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs index 390c837c..4a2be253 100644 --- a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs +++ b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs @@ -2,6 +2,6 @@ [assembly: AssemblyCompany("Informatikbüro Daniel Schick")] [assembly: AssemblyProduct("BSMD NSW interface")] -[assembly: AssemblyInformationalVersion("3.2.27")] +[assembly: AssemblyInformationalVersion("3.3.0")] [assembly: AssemblyCopyright("Copyright © 2014-2016 Informatikbüro Daniel Schick. All rights reserved.")] [assembly: AssemblyTrademark("")] \ No newline at end of file diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs index ef02b7e0..72cc0f52 100644 --- a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs +++ b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs @@ -1,4 +1,4 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.27.*")] +[assembly: AssemblyVersion("3.3.0.*")] diff --git a/nsw/Source/misc/info_service_installation.txt b/nsw/Source/misc/info_service_installation.txt new file mode 100644 index 00000000..7fe79e69 --- /dev/null +++ b/nsw/Source/misc/info_service_installation.txt @@ -0,0 +1,9 @@ +Ich hatte Weihnachten 16 größere Probleme den TestService installiert zu bekommen. +So hat es dann geklappt: +- ein Batch-File braucht man nicht +- Eingabeaufforderung als Admin starten +- C:\work\Services\ExcelReadService_Test>C:\Windows\Microsoft.NET\Framework\v4.0.3 +0319\installutil.exe /ShowCallStack bsmd.ExcelReadService.Test.exe +- Dann erscheint ein Dialog, in dem man Username + Passwort für den Service angeben muss. Das hat nicht +funktioniert für den Admin, auch nicht für meinen User ohne die Domäne vorne dran. +mit BSMD\daniel.schick# hat es dann geklappt.