Kleinigkeiten korrigiert auf dem Weg zur neuen Version

This commit is contained in:
Daniel Schick 2018-01-24 06:08:28 +00:00
parent 2a759e8325
commit 14d48d2b20
17 changed files with 122 additions and 29 deletions

View File

@ -9,6 +9,7 @@ using bsmd.database;
using ENI2.EditControls; using ENI2.EditControls;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Media.Imaging;
namespace ENI2.Controls namespace ENI2.Controls
{ {
@ -29,11 +30,37 @@ namespace ENI2.Controls
{ {
this.dataGridReportingParties.Initialize(); this.dataGridReportingParties.Initialize();
this.dataGridReportingParties.ItemsSource = this.ReportingParties; this.dataGridReportingParties.ItemsSource = this.ReportingParties;
this.dataGridReportingParties.CreateRequested += DataGridReportingParties_CreateRequested; this.dataGridReportingParties.CreateRequested += DataGridReportingParties_CreateRequested;
this.dataGridReportingParties.AddingNewItem += DataGridReportingParties_AddingNewItem; this.dataGridReportingParties.AddingNewItem += DataGridReportingParties_AddingNewItem;
this.dataGridReportingParties.EditRequested += DataGridReportingParties_EditRequested; this.dataGridReportingParties.EditRequested += DataGridReportingParties_EditRequested;
this.dataGridReportingParties.DeleteRequested += DataGridReportingParties_DeleteRequested; 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 #region grid event handler

View File

@ -56,6 +56,7 @@ namespace ENI2.DetailViewControls
{ {
bool isTanker = this.checkBoxTanker.IsChecked ?? false; bool isTanker = this.checkBoxTanker.IsChecked ?? false;
this.doubleUpDownVolumeOfCargo.IsEnabled = isTanker; this.doubleUpDownVolumeOfCargo.IsEnabled = isTanker;
this.doubleUpDownVolumeOfCargo.IsReadOnly = !isTanker;
this.comboBoxTankerHullConfig.IsEnabled = isTanker; this.comboBoxTankerHullConfig.IsEnabled = isTanker;
this.comboBoxConditionCargoBallastTanks.IsEnabled = isTanker; this.comboBoxConditionCargoBallastTanks.IsEnabled = isTanker;
this.textBoxNatureOfCargo.IsEnabled = isTanker; this.textBoxNatureOfCargo.IsEnabled = isTanker;

View File

@ -42,6 +42,7 @@ namespace ENI2.EditControls
this.doubleUpDownBunkerQuantity.Value = this.IsDeparture ? this.BRKD.BunkerFuelQuantity_TNE : this.BRKA.BunkerFuelQuantity_TNE; this.doubleUpDownBunkerQuantity.Value = this.IsDeparture ? this.BRKD.BunkerFuelQuantity_TNE : this.BRKA.BunkerFuelQuantity_TNE;
this.OKClicked += EditBKRDialog_OKClicked; this.OKClicked += EditBKRDialog_OKClicked;
this.AddVisible = true; this.AddVisible = true;
this.textBoxBunkerType.Focus();
} }
public void CopyValuesToEntity() public void CopyValuesToEntity()

View File

@ -30,7 +30,8 @@ namespace ENI2.EditControls
public void CopyValuesToEntity() 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; this.CallPurpose.CallPurposeDescription = this.textBoxDescription.Text;
} }

View File

@ -536,7 +536,10 @@ namespace ENI2
} }
if (failedLogonCount == 3) if (failedLogonCount == 3)
{
this.buttonLogin.IsEnabled = false; this.buttonLogin.IsEnabled = false;
MessageBox.Show(Properties.Resources.textWrongPasswordThreeTimes, Properties.Resources.textCaptionError);
}
} }
private void buttonExit_Click(object sender, RoutedEventArgs e) private void buttonExit_Click(object sender, RoutedEventArgs e)

View File

@ -1274,6 +1274,15 @@ namespace ENI2.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Reset password for user {0}?.
/// </summary>
public static string textConfirmPasswordReset {
get {
return ResourceManager.GetString("textConfirmPasswordReset", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Reset messages?. /// Looks up a localized string similar to Reset messages?.
/// </summary> /// </summary>
@ -3560,6 +3569,15 @@ namespace ENI2.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Reset password.
/// </summary>
public static string textResetPassword {
get {
return ResourceManager.GetString("textResetPassword", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to ResidencePermit. /// Looks up a localized string similar to ResidencePermit.
/// </summary> /// </summary>
@ -4550,6 +4568,15 @@ namespace ENI2.Properties {
} }
} }
/// <summary>
/// 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..
/// </summary>
public static string textWrongPasswordThreeTimes {
get {
return ResourceManager.GetString("textWrongPasswordThreeTimes", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap. /// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary> /// </summary>

View File

@ -1609,4 +1609,13 @@
<data name="textClose" xml:space="preserve"> <data name="textClose" xml:space="preserve">
<value>Close</value> <value>Close</value>
</data> </data>
<data name="textResetPassword" xml:space="preserve">
<value>Reset password</value>
</data>
<data name="textWrongPasswordThreeTimes" xml:space="preserve">
<value>3 logon attempts failed. Login denied. If you do not remember your password, please contact your administrator to reset it.</value>
</data>
<data name="textConfirmPasswordReset" xml:space="preserve">
<value>Reset password for user {0}?</value>
</data>
</root> </root>

Binary file not shown.

View File

@ -97,7 +97,6 @@ namespace bsmd.ExcelReadService
string receiptText = ""; string receiptText = "";
MessageCore messageCore = null; MessageCore messageCore = null;
if (attachmentLocalPath == null) if (attachmentLocalPath == null)
{ {
receiptText = "incoming E-Mail did not contain an Excel attachment!"; 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 // remove attachment
_log.InfoFormat("removing local file {0}", attachmentLocalPath); _log.InfoFormat("removing local file {0}", attachmentLocalPath);
@ -211,10 +204,15 @@ namespace bsmd.ExcelReadService
if (!Properties.Settings.Default.TestMode) if (!Properties.Settings.Default.TestMode)
File.Delete(attachmentLocalPath); File.Delete(attachmentLocalPath);
attachmentLocalPath = null; attachmentLocalPath = null;
} }
if (receiptText.Length > 0)
{
_log.Debug("sending system info email");
BSMDMail.SendSystemInfo(receiptSubject, receiptText, mailSender);
}
// remove e-Mail // remove e-Mail
_log.InfoFormat("deleting mail with messageId {0}", messageId); _log.InfoFormat("deleting mail with messageId {0}", messageId);
_log.InfoFormat("mail delete {0}", bsmdPopClient.DeleteMessageByMessageId(messageId) ? "successful" : "failed"); _log.InfoFormat("mail delete {0}", bsmdPopClient.DeleteMessageByMessageId(messageId) ? "successful" : "failed");

View File

@ -414,7 +414,7 @@ namespace bsmd.dakosy
for (int j = 0; j < vList.Visit[0].MDH.PortsOfCallLast30Days[i].CrewJoinedShipName.Length; j++) 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] = 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++) for (int i = 0; i < was.WasteDisposalServiceProvider.Count; i++)
{ {
vList.Visit[0].WAS.WasteDisposalServiceProviderName[i] = new WasteDisposalServiceProviderName(); 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; vList.Visit[0].WAS.WasteDisposalDeliverySpecified = was.WasteDisposalDelivery.HasValue;

View File

@ -31,8 +31,9 @@ namespace bsmd.database
public int CallPurposeCode { get; set; } public int CallPurposeCode { get; set; }
[ShowReport] [ShowReport]
[MaxLength(100)] [MaxLength(99)]
[ENI2Validation] [ENI2Validation]
[Validation(ValidationCode.STRING_MAXLEN, 99)]
public string CallPurposeDescription { get; set; } public string CallPurposeDescription { get; set; }
public string Identifier { get; set; } public string Identifier { get; set; }

View File

@ -78,8 +78,8 @@ namespace bsmd.database
[ShowReport] [ShowReport]
[LookupName("INFO.PortArea")] [LookupName("INFO.PortArea")]
[Validation(ValidationCode.NOT_NULL)] // ist bei NOK Transit leer [Validation(ValidationCode.PORTAREA)] // ist bei NOK Transit leer
[MaxLength(50)] [MaxLength(4)]
[ENI2Validation] [ENI2Validation]
public string PortArea { get; set; } public string PortArea { get; set; }

View File

@ -27,12 +27,12 @@ namespace bsmd.database
public SEC SEC { get; set; } public SEC SEC { get; set; }
[ShowReport] [ShowReport]
[MaxLength(100)] [MaxLength(99)]
[ENI2Validation] [ENI2Validation]
public string PortFacilityPortName { get; set; } public string PortFacilityPortName { get; set; }
[ShowReport] [ShowReport]
[MaxLength(100)] [MaxLength(99)]
[ENI2Validation] [ENI2Validation]
public string PortFacilityPortCountry { get; set; } public string PortFacilityPortCountry { get; set; }
@ -172,6 +172,13 @@ namespace bsmd.database
this.PortFacilityPortCountry ?? ""); this.PortFacilityPortCountry ?? "");
violations.Add(RuleEngine.CreateViolation(ValidationCode.V703, null, val, this.Title, this.Identifier, this.SEC.Tablename)); 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 #endregion

View File

@ -222,11 +222,18 @@ namespace bsmd.database
(this.ETDFromPortOfCall < this.ETAToPortOfCall)) (this.ETDFromPortOfCall < this.ETAToPortOfCall))
errors.Add(RuleEngine.CreateError(ValidationCode.E121, "ETDFromPortOfCall", this.ETDFromPortOfCall.ToString(), this.Title, null, this.Tablename)); 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)); 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 else
{ {

View File

@ -349,6 +349,12 @@ namespace bsmd.database
if ((value.Length > maxlen) || (value.Length == 0)) if ((value.Length > maxlen) || (value.Length == 0))
errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename)); errors.Add(RuleEngine.CreateError(validationCode, property.Name, value, entity.Title, identifier, entity.Tablename));
break; 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: case ValidationCode.FRZ:
{ {
Regex rgx = new Regex(@"^[A-Z, a-z,0-9]{4,7}$"); Regex rgx = new Regex(@"^[A-Z, a-z,0-9]{4,7}$");
@ -447,6 +453,8 @@ namespace bsmd.database
return (gerLocodeList.Contains(val.ToUpper())); return (gerLocodeList.Contains(val.ToUpper()));
} }
public static LocodeValidHandler LocodeChecker { get { return _locodeChecker; } }
#endregion #endregion
#region private helper #region private helper

View File

@ -968,7 +968,7 @@ namespace bsmd.dbh
l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysCrewJoinedShip.PortOfCallLast30DaysCrewJoinedShipName = new string[portOfCallLast30Days.CrewJoinedShip.Count]; l30d.PortOfCallLast30Days[i].PortOfCallLast30DaysCrewJoinedShip.PortOfCallLast30DaysCrewJoinedShipName = new string[portOfCallLast30Days.CrewJoinedShip.Count];
for (int j = 0; j < portOfCallLast30Days.CrewJoinedShip.Count; j++) 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; 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++) 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); choiceType3s.Add(ItemsChoiceType3.WasteDisposalServiceProviderName);
wasteItems.Add(was.WasteDisposalServiceProvider[i].WasteDisposalServiceProviderName); wasteItems.Add(((WasteDisposalServiceProvider) was.WasteDisposalServiceProvider[i]).WasteDisposalServiceProviderName);
} }

View File

@ -861,8 +861,11 @@ namespace bsmd.hisnord
} }
secItemNames.Add(ItemsChoiceType4.ValidISSCOnBoard); secItemNames.Add(ItemsChoiceType4.ValidISSCOnBoard);
secItems.Add((sec.ValidISSCOnBoard ?? false) ? yorntype.Y : yorntype.N); secItems.Add((sec.ValidISSCOnBoard ?? false) ? yorntype.Y : yorntype.N);
secItemNames.Add(ItemsChoiceType4.ReasonsForNoValidISSC); if ((!sec.ValidISSCOnBoard ?? false) && (!sec.ReasonsForNoValidISSC.IsNullOrEmpty())) {
secItems.Add(sec.ReasonsForNoValidISSC); secItemNames.Add(ItemsChoiceType4.ReasonsForNoValidISSC);
secItems.Add(sec.ReasonsForNoValidISSC);
}
if (sec.ISSCType.HasValue) if (sec.ISSCType.HasValue)
{ {
secItemNames.Add(ItemsChoiceType4.ISSCType); secItemNames.Add(ItemsChoiceType4.ISSCType);
@ -1123,8 +1126,8 @@ namespace bsmd.hisnord
List<string> crewJoinedShipList = new List<string>(); List<string> crewJoinedShipList = new List<string>();
for (int k = 0; k < portOfCallLast30Days.CrewJoinedShip.Count; k++) for (int k = 0; k < portOfCallLast30Days.CrewJoinedShip.Count; k++)
{ {
if (!portOfCallLast30Days.CrewJoinedShip[k].PortOfCallLast30DaysCrewJoinedShipName.IsNullOrEmpty()) if (!((PortOfCallLast30DaysCrewJoinedShip)portOfCallLast30Days.CrewJoinedShip[k]).PortOfCallLast30DaysCrewJoinedShipName.IsNullOrEmpty())
crewJoinedShipList.Add(portOfCallLast30Days.CrewJoinedShip[k].PortOfCallLast30DaysCrewJoinedShipName); crewJoinedShipList.Add(((PortOfCallLast30DaysCrewJoinedShip)portOfCallLast30Days.CrewJoinedShip[k]).PortOfCallLast30DaysCrewJoinedShipName);
} }
pocs.PortOfCallLast30Days[j].PortOfCallLast30DaysCrewJoinedShip = crewJoinedShipList.ToArray(); pocs.PortOfCallLast30Days[j].PortOfCallLast30DaysCrewJoinedShip = crewJoinedShipList.ToArray();
} }
@ -1181,9 +1184,9 @@ namespace bsmd.hisnord
for (int i = 0; i < was.WasteDisposalServiceProvider.Count; i++) 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); was_item_names.Add(ItemsChoiceType6.WasteDisposalServiceProviderName);
} }
} }