diff --git a/ENI-2/ENI2/ENI2/Controls/ReportingPartyControl.xaml.cs b/ENI-2/ENI2/ENI2/Controls/ReportingPartyControl.xaml.cs index 197b7033..cdebb1dd 100644 --- a/ENI-2/ENI2/ENI2/Controls/ReportingPartyControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/Controls/ReportingPartyControl.xaml.cs @@ -9,6 +9,7 @@ using bsmd.database; using ENI2.EditControls; using System.Collections.ObjectModel; using System.Windows.Controls; +using System.Windows.Media.Imaging; namespace ENI2.Controls { @@ -29,11 +30,37 @@ namespace ENI2.Controls { this.dataGridReportingParties.Initialize(); this.dataGridReportingParties.ItemsSource = this.ReportingParties; + this.dataGridReportingParties.CreateRequested += DataGridReportingParties_CreateRequested; this.dataGridReportingParties.AddingNewItem += DataGridReportingParties_AddingNewItem; this.dataGridReportingParties.EditRequested += DataGridReportingParties_EditRequested; this.dataGridReportingParties.DeleteRequested += DataGridReportingParties_DeleteRequested; + MenuItem resetItem = new MenuItem(); + resetItem.Header = Properties.Resources.textResetPassword; + resetItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/recycle.png")) }; + resetItem.Click += ResetItem_Click; + this.dataGridReportingParties.ContextMenu.Items.Add(resetItem); + + } + + private void ResetItem_Click(object sender, RoutedEventArgs e) + { + if ((this.dataGridReportingParties.SelectedItems != null) && (this.dataGridReportingParties.SelectedItems.Count == 1) && !this.dataGridReportingParties.IsReadOnly) + { + ReportingParty selectedParty = this.dataGridReportingParties.SelectedItems[0] as ReportingParty; + if (selectedParty != null) + { + string confirmText = string.Format(Properties.Resources.textConfirmPasswordReset, selectedParty.Logon); + MessageBoxResult result = MessageBox.Show(confirmText, Properties.Resources.textCaptionDeleteConfirm, MessageBoxButton.YesNo, MessageBoxImage.Question); + if (result == MessageBoxResult.Yes) + { + selectedParty.PasswordHash = null; + selectedParty.Salt = null; + DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(selectedParty); + } + } + } } #region grid event handler diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/PSC72hDetailControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailViewControls/PSC72hDetailControl.xaml.cs index 23cdf0c2..1a21bfc0 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/PSC72hDetailControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailViewControls/PSC72hDetailControl.xaml.cs @@ -56,6 +56,7 @@ namespace ENI2.DetailViewControls { bool isTanker = this.checkBoxTanker.IsChecked ?? false; this.doubleUpDownVolumeOfCargo.IsEnabled = isTanker; + this.doubleUpDownVolumeOfCargo.IsReadOnly = !isTanker; this.comboBoxTankerHullConfig.IsEnabled = isTanker; this.comboBoxConditionCargoBallastTanks.IsEnabled = isTanker; this.textBoxNatureOfCargo.IsEnabled = isTanker; diff --git a/ENI-2/ENI2/ENI2/EditControls/EditBKRDialog.xaml.cs b/ENI-2/ENI2/ENI2/EditControls/EditBKRDialog.xaml.cs index 5d8d336f..1f2f68c2 100644 --- a/ENI-2/ENI2/ENI2/EditControls/EditBKRDialog.xaml.cs +++ b/ENI-2/ENI2/ENI2/EditControls/EditBKRDialog.xaml.cs @@ -42,6 +42,7 @@ namespace ENI2.EditControls this.doubleUpDownBunkerQuantity.Value = this.IsDeparture ? this.BRKD.BunkerFuelQuantity_TNE : this.BRKA.BunkerFuelQuantity_TNE; this.OKClicked += EditBKRDialog_OKClicked; this.AddVisible = true; + this.textBoxBunkerType.Focus(); } public void CopyValuesToEntity() diff --git a/ENI-2/ENI2/ENI2/EditControls/EditCallPurposeDialog.xaml.cs b/ENI-2/ENI2/ENI2/EditControls/EditCallPurposeDialog.xaml.cs index 2393d317..f90358ad 100644 --- a/ENI-2/ENI2/ENI2/EditControls/EditCallPurposeDialog.xaml.cs +++ b/ENI-2/ENI2/ENI2/EditControls/EditCallPurposeDialog.xaml.cs @@ -30,7 +30,8 @@ namespace ENI2.EditControls public void CopyValuesToEntity() { - this.CallPurpose.CallPurposeCode = (int) this.comboBoxCode.SelectedValue; + if(this.comboBoxCode.SelectedValue != null) + this.CallPurpose.CallPurposeCode = (int) this.comboBoxCode.SelectedValue; this.CallPurpose.CallPurposeDescription = this.textBoxDescription.Text; } diff --git a/ENI-2/ENI2/ENI2/MainWindow.xaml.cs b/ENI-2/ENI2/ENI2/MainWindow.xaml.cs index e3edcbb6..95a012b3 100644 --- a/ENI-2/ENI2/ENI2/MainWindow.xaml.cs +++ b/ENI-2/ENI2/ENI2/MainWindow.xaml.cs @@ -536,7 +536,10 @@ namespace ENI2 } if (failedLogonCount == 3) + { this.buttonLogin.IsEnabled = false; + MessageBox.Show(Properties.Resources.textWrongPasswordThreeTimes, Properties.Resources.textCaptionError); + } } private void buttonExit_Click(object sender, RoutedEventArgs e) diff --git a/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs b/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs index 9ffe1d5f..c6bbf6df 100644 --- a/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs +++ b/ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs @@ -1274,6 +1274,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Reset password for user {0}?. + /// + public static string textConfirmPasswordReset { + get { + return ResourceManager.GetString("textConfirmPasswordReset", resourceCulture); + } + } + /// /// Looks up a localized string similar to Reset messages?. /// @@ -3560,6 +3569,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to Reset password. + /// + public static string textResetPassword { + get { + return ResourceManager.GetString("textResetPassword", resourceCulture); + } + } + /// /// Looks up a localized string similar to ResidencePermit. /// @@ -4550,6 +4568,15 @@ namespace ENI2.Properties { } } + /// + /// Looks up a localized string similar to 3 logon attempts failed. Login denied. If you do not remember your password, please contact your administrator to reset it.. + /// + public static string textWrongPasswordThreeTimes { + get { + return ResourceManager.GetString("textWrongPasswordThreeTimes", resourceCulture); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/ENI-2/ENI2/ENI2/Properties/Resources.resx b/ENI-2/ENI2/ENI2/Properties/Resources.resx index 180e184b..b36794e9 100644 --- a/ENI-2/ENI2/ENI2/Properties/Resources.resx +++ b/ENI-2/ENI2/ENI2/Properties/Resources.resx @@ -1609,4 +1609,13 @@ Close + + Reset password + + + 3 logon attempts failed. Login denied. If you do not remember your password, please contact your administrator to reset it. + + + Reset password for user {0}? + \ No newline at end of file diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx index a5d32955..4311a608 100644 Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ diff --git a/nsw/Source/bsmd.ExcelReadService/ExcelReadService.cs b/nsw/Source/bsmd.ExcelReadService/ExcelReadService.cs index d0eaab25..b6ce4dc6 100644 --- a/nsw/Source/bsmd.ExcelReadService/ExcelReadService.cs +++ b/nsw/Source/bsmd.ExcelReadService/ExcelReadService.cs @@ -97,7 +97,6 @@ namespace bsmd.ExcelReadService string receiptText = ""; MessageCore messageCore = null; - if (attachmentLocalPath == null) { receiptText = "incoming E-Mail did not contain an Excel attachment!"; @@ -197,13 +196,7 @@ namespace bsmd.ExcelReadService } } } - } - - if (receiptText.Length > 0) - { - _log.Debug("sending system info email"); - BSMDMail.SendSystemInfo(receiptSubject, receiptText, mailSender); - } + } // remove attachment _log.InfoFormat("removing local file {0}", attachmentLocalPath); @@ -211,10 +204,15 @@ namespace bsmd.ExcelReadService if (!Properties.Settings.Default.TestMode) File.Delete(attachmentLocalPath); - attachmentLocalPath = null; - } + + if (receiptText.Length > 0) + { + _log.Debug("sending system info email"); + BSMDMail.SendSystemInfo(receiptSubject, receiptText, mailSender); + } + // remove e-Mail _log.InfoFormat("deleting mail with messageId {0}", messageId); _log.InfoFormat("mail delete {0}", bsmdPopClient.DeleteMessageByMessageId(messageId) ? "successful" : "failed"); diff --git a/nsw/Source/bsmd.dakosy/Request.cs b/nsw/Source/bsmd.dakosy/Request.cs index 6fb65013..5fe53229 100644 --- a/nsw/Source/bsmd.dakosy/Request.cs +++ b/nsw/Source/bsmd.dakosy/Request.cs @@ -414,7 +414,7 @@ namespace bsmd.dakosy for (int j = 0; j < vList.Visit[0].MDH.PortsOfCallLast30Days[i].CrewJoinedShipName.Length; j++) { vList.Visit[0].MDH.PortsOfCallLast30Days[i].CrewJoinedShipName[j] = new CrewJoinedShipName(); - vList.Visit[0].MDH.PortsOfCallLast30Days[i].CrewJoinedShipName[j].Name = poc30d.CrewJoinedShip[j].PortOfCallLast30DaysCrewJoinedShipName; + vList.Visit[0].MDH.PortsOfCallLast30Days[i].CrewJoinedShipName[j].Name = ((PortOfCallLast30DaysCrewJoinedShip) poc30d.CrewJoinedShip[j]).PortOfCallLast30DaysCrewJoinedShipName; } } } @@ -737,7 +737,7 @@ namespace bsmd.dakosy for (int i = 0; i < was.WasteDisposalServiceProvider.Count; i++) { vList.Visit[0].WAS.WasteDisposalServiceProviderName[i] = new WasteDisposalServiceProviderName(); - vList.Visit[0].WAS.WasteDisposalServiceProviderName[i].ServiceProviderName = was.WasteDisposalServiceProvider[i].WasteDisposalServiceProviderName; + vList.Visit[0].WAS.WasteDisposalServiceProviderName[i].ServiceProviderName = ((WasteDisposalServiceProvider) was.WasteDisposalServiceProvider[i]).WasteDisposalServiceProviderName; } } vList.Visit[0].WAS.WasteDisposalDeliverySpecified = was.WasteDisposalDelivery.HasValue; diff --git a/nsw/Source/bsmd.database/CallPurpose.cs b/nsw/Source/bsmd.database/CallPurpose.cs index 7ba6be5e..e5bf4918 100644 --- a/nsw/Source/bsmd.database/CallPurpose.cs +++ b/nsw/Source/bsmd.database/CallPurpose.cs @@ -31,8 +31,9 @@ namespace bsmd.database public int CallPurposeCode { get; set; } [ShowReport] - [MaxLength(100)] + [MaxLength(99)] [ENI2Validation] + [Validation(ValidationCode.STRING_MAXLEN, 99)] public string CallPurposeDescription { get; set; } public string Identifier { get; set; } diff --git a/nsw/Source/bsmd.database/INFO.cs b/nsw/Source/bsmd.database/INFO.cs index 5aa3377d..74c69b62 100644 --- a/nsw/Source/bsmd.database/INFO.cs +++ b/nsw/Source/bsmd.database/INFO.cs @@ -78,8 +78,8 @@ namespace bsmd.database [ShowReport] [LookupName("INFO.PortArea")] - [Validation(ValidationCode.NOT_NULL)] // ist bei NOK Transit leer - [MaxLength(50)] + [Validation(ValidationCode.PORTAREA)] // ist bei NOK Transit leer + [MaxLength(4)] [ENI2Validation] public string PortArea { get; set; } diff --git a/nsw/Source/bsmd.database/LastTenPortFacilitiesCalled.cs b/nsw/Source/bsmd.database/LastTenPortFacilitiesCalled.cs index 624c4c8b..88b11367 100644 --- a/nsw/Source/bsmd.database/LastTenPortFacilitiesCalled.cs +++ b/nsw/Source/bsmd.database/LastTenPortFacilitiesCalled.cs @@ -27,12 +27,12 @@ namespace bsmd.database public SEC SEC { get; set; } [ShowReport] - [MaxLength(100)] + [MaxLength(99)] [ENI2Validation] public string PortFacilityPortName { get; set; } [ShowReport] - [MaxLength(100)] + [MaxLength(99)] [ENI2Validation] public string PortFacilityPortCountry { get; set; } @@ -172,6 +172,13 @@ namespace bsmd.database this.PortFacilityPortCountry ?? ""); violations.Add(RuleEngine.CreateViolation(ValidationCode.V703, null, val, this.Title, this.Identifier, this.SEC.Tablename)); } + + if(!this.PortFacilityPortLoCode.IsNullOrEmpty() && (RuleEngine.LocodeChecker != null)) + { + if (!RuleEngine.LocodeChecker(this.PortFacilityPortLoCode, RuleEngine.LocodeMode.STANDARD)) + errors.Add(RuleEngine.CreateError(ValidationCode.LOCODE, null, this.PortFacilityPortLoCode, this.Title, this.Identifier, this.SEC.Tablename)); + } + } #endregion diff --git a/nsw/Source/bsmd.database/NOA_NOD.cs b/nsw/Source/bsmd.database/NOA_NOD.cs index 832d010b..90445592 100644 --- a/nsw/Source/bsmd.database/NOA_NOD.cs +++ b/nsw/Source/bsmd.database/NOA_NOD.cs @@ -222,11 +222,18 @@ namespace bsmd.database (this.ETDFromPortOfCall < this.ETAToPortOfCall)) errors.Add(RuleEngine.CreateError(ValidationCode.E121, "ETDFromPortOfCall", this.ETDFromPortOfCall.ToString(), this.Title, null, this.Tablename)); - if(this.CallPurposes.IsNullOrEmpty()) + if (this.CallPurposes.IsNullOrEmpty()) { errors.Add(RuleEngine.CreateError(ValidationCode.LIST_EMPTY, "CallPurposes", "CallPurpose", this.Title, null, this.Tablename)); } - + else + { + foreach (CallPurpose cp in this.CallPurposes) + { + if (cp.CallPurposeCode == 0) + errors.Add(RuleEngine.CreateError(ValidationCode.INT_GT_ZERO, "CallPurposeCode", "0", this.Title, cp.Identifier, this.Tablename)); + } + } } else { diff --git a/nsw/Source/bsmd.database/RuleEngine.cs b/nsw/Source/bsmd.database/RuleEngine.cs index 812f260d..703229d9 100644 --- a/nsw/Source/bsmd.database/RuleEngine.cs +++ b/nsw/Source/bsmd.database/RuleEngine.cs @@ -349,6 +349,12 @@ namespace bsmd.database if ((value.Length > maxlen) || (value.Length == 0)) errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename)); break; + case ValidationCode.PORTAREA: + { + if ((value.Length < 2) || (value.Length > 4)) + errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename)); + break; + } case ValidationCode.FRZ: { Regex rgx = new Regex(@"^[A-Z, a-z,0-9]{4,7}$"); @@ -447,6 +453,8 @@ namespace bsmd.database return (gerLocodeList.Contains(val.ToUpper())); } + public static LocodeValidHandler LocodeChecker { get { return _locodeChecker; } } + #endregion #region private helper diff --git a/nsw/Source/bsmd.dbh/Request.cs b/nsw/Source/bsmd.dbh/Request.cs index 56d74ead..778555a6 100644 --- a/nsw/Source/bsmd.dbh/Request.cs +++ b/nsw/Source/bsmd.dbh/Request.cs @@ -968,7 +968,7 @@ namespace bsmd.dbh l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysCrewJoinedShip.PortOfCallLast30DaysCrewJoinedShipName = new string[portOfCallLast30Days.CrewJoinedShip.Count]; for (int j = 0; j < portOfCallLast30Days.CrewJoinedShip.Count; j++) { - l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysCrewJoinedShip.PortOfCallLast30DaysCrewJoinedShipName[j] = portOfCallLast30Days.CrewJoinedShip[j].PortOfCallLast30DaysCrewJoinedShipName; + l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysCrewJoinedShip.PortOfCallLast30DaysCrewJoinedShipName[j] = ((PortOfCallLast30DaysCrewJoinedShip) portOfCallLast30Days.CrewJoinedShip[j]).PortOfCallLast30DaysCrewJoinedShipName; } } l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysCrewMembersJoined = portOfCallLast30Days.PortOfCallLast30DaysCrewMembersJoined ?? false ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N; @@ -1018,10 +1018,10 @@ namespace bsmd.dbh for (int i = 0; i < was.WasteDisposalServiceProvider.Count; i++) { - if (was.WasteDisposalServiceProvider[i].WasteDisposalServiceProviderName.Trim().IsNullOrEmpty()) continue; + if (((WasteDisposalServiceProvider) was.WasteDisposalServiceProvider[i]).WasteDisposalServiceProviderName.Trim().IsNullOrEmpty()) continue; choiceType3s.Add(ItemsChoiceType3.WasteDisposalServiceProviderName); - wasteItems.Add(was.WasteDisposalServiceProvider[i].WasteDisposalServiceProviderName); + wasteItems.Add(((WasteDisposalServiceProvider) was.WasteDisposalServiceProvider[i]).WasteDisposalServiceProviderName); } diff --git a/nsw/Source/bsmd.hisnord/Request.cs b/nsw/Source/bsmd.hisnord/Request.cs index 9b344e60..6e876dfd 100644 --- a/nsw/Source/bsmd.hisnord/Request.cs +++ b/nsw/Source/bsmd.hisnord/Request.cs @@ -861,8 +861,11 @@ namespace bsmd.hisnord } secItemNames.Add(ItemsChoiceType4.ValidISSCOnBoard); secItems.Add((sec.ValidISSCOnBoard ?? false) ? yorntype.Y : yorntype.N); - secItemNames.Add(ItemsChoiceType4.ReasonsForNoValidISSC); - secItems.Add(sec.ReasonsForNoValidISSC); + if ((!sec.ValidISSCOnBoard ?? false) && (!sec.ReasonsForNoValidISSC.IsNullOrEmpty())) { + secItemNames.Add(ItemsChoiceType4.ReasonsForNoValidISSC); + secItems.Add(sec.ReasonsForNoValidISSC); + } + if (sec.ISSCType.HasValue) { secItemNames.Add(ItemsChoiceType4.ISSCType); @@ -1123,8 +1126,8 @@ namespace bsmd.hisnord List crewJoinedShipList = new List(); for (int k = 0; k < portOfCallLast30Days.CrewJoinedShip.Count; k++) { - if (!portOfCallLast30Days.CrewJoinedShip[k].PortOfCallLast30DaysCrewJoinedShipName.IsNullOrEmpty()) - crewJoinedShipList.Add(portOfCallLast30Days.CrewJoinedShip[k].PortOfCallLast30DaysCrewJoinedShipName); + if (!((PortOfCallLast30DaysCrewJoinedShip)portOfCallLast30Days.CrewJoinedShip[k]).PortOfCallLast30DaysCrewJoinedShipName.IsNullOrEmpty()) + crewJoinedShipList.Add(((PortOfCallLast30DaysCrewJoinedShip)portOfCallLast30Days.CrewJoinedShip[k]).PortOfCallLast30DaysCrewJoinedShipName); } pocs.PortOfCallLast30Days[j].PortOfCallLast30DaysCrewJoinedShip = crewJoinedShipList.ToArray(); } @@ -1181,9 +1184,9 @@ namespace bsmd.hisnord for (int i = 0; i < was.WasteDisposalServiceProvider.Count; i++) { - if (!was.WasteDisposalServiceProvider[i].WasteDisposalServiceProviderName.IsNullOrEmpty()) + if (!((WasteDisposalServiceProvider) was.WasteDisposalServiceProvider[i]).WasteDisposalServiceProviderName.IsNullOrEmpty()) { - was_items.Add(was.WasteDisposalServiceProvider[i].WasteDisposalServiceProviderName); + was_items.Add(((WasteDisposalServiceProvider) was.WasteDisposalServiceProvider[i]).WasteDisposalServiceProviderName); was_item_names.Add(ItemsChoiceType6.WasteDisposalServiceProviderName); } }