Zwischenversion, bösartigen HAZA Positionsfehler beseitigt (CAST AS INT!!!)
Speichern von Validierungsregeln nahezu vollständig
This commit is contained in:
parent
44cec6dd9f
commit
4edb616a04
@ -73,8 +73,10 @@ namespace ENI2
|
||||
LADG.CargoCodesNST = LocalizedLookup.getCargoCodesNST();
|
||||
LADG.CargoCodesNST3 = LocalizedLookup.getCargoCodesNST3();
|
||||
|
||||
// Connect to locking service (if enabled)
|
||||
// Preload validation fields
|
||||
List<ValidationField> vFields = bsmd.database.ValidationRule.ValidationFields;
|
||||
|
||||
// Connect to locking service (if enabled)
|
||||
try
|
||||
{
|
||||
if (ENI2.Properties.Settings.Default.UseLocking)
|
||||
|
||||
@ -11,9 +11,9 @@
|
||||
d:DesignHeight="150" d:DesignWidth="300">
|
||||
<Grid Name="gridContent">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.3*" />
|
||||
<ColumnDefinition Width="0.2*" />
|
||||
<ColumnDefinition Width="0.5*" />
|
||||
<ColumnDefinition Width="0.25*" />
|
||||
<ColumnDefinition Width="0.25*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="32" />
|
||||
@ -24,8 +24,8 @@
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textFieldName}" VerticalContentAlignment="Center"/>
|
||||
<Label Grid.Row="0" Grid.Column="1" Content="{x:Static p:Resources.textOperator}" VerticalContentAlignment="Center"/>
|
||||
<Label Grid.Row="0" Grid.Column="2" Content="{x:Static p:Resources.textValue}" VerticalContentAlignment="Center"/>
|
||||
<ComboBox Name="comboBoxFieldName" Grid.Row="1" Grid.Column="0" Margin="2" />
|
||||
<ComboBox Name="comboBoxOperator" Grid.Row="1" Grid.Column="1" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" />
|
||||
<ComboBox Name="comboBoxFieldName" Grid.Row="1" Grid.Column="0" Margin="2" SelectedValuePath="FullName" SelectedValue="{Binding FieldName}" />
|
||||
<ComboBox Name="comboBoxOperator" Grid.Row="1" Grid.Column="1" Margin="2" SelectedValuePath="Key" DisplayMemberPath="Value" SelectedValue="{Binding ConditionOperator}"/>
|
||||
<TextBox Name="textBoxValue" Grid.Row="1" Grid.Column="2" Margin="2" Text="{Binding Value}" VerticalContentAlignment="Center" />
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textFailureMessage}" VerticalContentAlignment="Center" />
|
||||
<TextBox Name="textBoxFailureMessage" Grid.Row="2" Grid.Column="1" Grid.RowSpan="2" Grid.ColumnSpan="2" Margin="2" Text="{Binding ErrorMessage}"/>
|
||||
|
||||
@ -36,6 +36,7 @@ namespace ENI2.Controls
|
||||
|
||||
private void ValidationConditionControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.comboBoxFieldName.ItemsSource = bsmd.database.ValidationRule.ValidationFields;
|
||||
this.comboBoxOperator.ItemsSource = Util.EnumHelper.GetAllValuesAndDescription(typeof(ValidationCondition.ConditionOperatorEnum));
|
||||
}
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||
<WebPage>publish.html</WebPage>
|
||||
<ApplicationRevision>1</ApplicationRevision>
|
||||
<ApplicationVersion>3.7.1.%2a</ApplicationVersion>
|
||||
<ApplicationVersion>3.7.2.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
|
||||
@ -204,7 +204,7 @@ namespace bsmd.database
|
||||
break;
|
||||
}
|
||||
|
||||
query += " ORDER BY CAST(Identifier AS INT)";
|
||||
query += " ORDER BY Identifier";
|
||||
|
||||
cmd.CommandText = query;
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ namespace bsmd.database
|
||||
break;
|
||||
}
|
||||
|
||||
query += " ORDER BY CAST(Identifier AS INT)";
|
||||
query += " ORDER BY Identifier";
|
||||
|
||||
cmd.CommandText = query;
|
||||
}
|
||||
|
||||
@ -353,7 +353,7 @@ namespace bsmd.database
|
||||
break;
|
||||
}
|
||||
|
||||
query += " ORDER BY CAST(Identifier AS INT)";
|
||||
query += " ORDER BY Identifier";
|
||||
|
||||
cmd.CommandText = query;
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ namespace bsmd.database
|
||||
break;
|
||||
}
|
||||
|
||||
query += " ORDER BY CAST(Identifier AS INT)";
|
||||
query += " ORDER BY Identifier";
|
||||
|
||||
cmd.CommandText = query;
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ namespace bsmd.database
|
||||
break;
|
||||
}
|
||||
|
||||
query += " ORDER BY CAST(Identifier AS INT)";
|
||||
query += " ORDER BY Identifier";
|
||||
|
||||
cmd.CommandText = query;
|
||||
|
||||
|
||||
@ -2,6 +2,6 @@
|
||||
|
||||
[assembly: AssemblyCompany("Informatikbüro Daniel Schick")]
|
||||
[assembly: AssemblyProduct("BSMD NSW interface")]
|
||||
[assembly: AssemblyInformationalVersion("3.7.1")]
|
||||
[assembly: AssemblyInformationalVersion("3.7.2")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014-2017 Informatikbüro Daniel Schick. All rights reserved.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
@ -1,4 +1,4 @@
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion("3.7.1.*")]
|
||||
[assembly: AssemblyVersion("3.7.2.*")]
|
||||
|
||||
|
||||
@ -76,12 +76,9 @@ namespace bsmd.database
|
||||
/// Wenn ein Property damit dekoriert ist, steht es im Validierungs-Editor als Parameter zur Verfügung
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public class ENI2Validation : Attribute
|
||||
public class ENI2ValidationAttribute : Attribute
|
||||
{
|
||||
public ENI2Validation()
|
||||
{
|
||||
|
||||
}
|
||||
public ENI2ValidationAttribute() { }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -11,6 +11,7 @@ using System.Collections.ObjectModel;
|
||||
using System.Collections;
|
||||
using System.Windows.Data;
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
|
||||
namespace bsmd.database
|
||||
{
|
||||
@ -31,9 +32,9 @@ namespace bsmd.database
|
||||
GREATER,
|
||||
[Description("<")]
|
||||
LESS,
|
||||
[Description("IS NULL")]
|
||||
[Description("== NULL")]
|
||||
NULL,
|
||||
[Description("IS NOT NULL")]
|
||||
[Description("!= NULL")]
|
||||
NOT_NULL
|
||||
}
|
||||
|
||||
@ -406,13 +407,27 @@ namespace bsmd.database
|
||||
/// </summary>
|
||||
public class ValidationField
|
||||
{
|
||||
PropertyInfo _info;
|
||||
|
||||
public ValidationField(PropertyInfo propertyInfo)
|
||||
{
|
||||
_info = propertyInfo;
|
||||
}
|
||||
|
||||
public string PropertyName { get; set; }
|
||||
public string NotificationClassText { get; set; }
|
||||
|
||||
public Message.NotificationClass NotificationClass { get; set; }
|
||||
public Message.NotificationClass? NotificationClass { get; set; }
|
||||
|
||||
public bool IsInListType { get; set; }
|
||||
|
||||
public PropertyInfo PropertyInfo { get { return _info; } }
|
||||
|
||||
public string FullName
|
||||
{
|
||||
get { return this.ToString(); }
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}.{1}", NotificationClassText, PropertyName);
|
||||
|
||||
@ -5,11 +5,14 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace bsmd.database
|
||||
{
|
||||
public class ValidationRule : DatabaseEntity
|
||||
{
|
||||
private static List<ValidationField> _validationFields = null;
|
||||
|
||||
public ValidationRule()
|
||||
{
|
||||
@ -34,6 +37,101 @@ namespace bsmd.database
|
||||
|
||||
public bool? IsActive { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region static Properties
|
||||
|
||||
/// <summary>
|
||||
/// Validierungsregeln werden aus diesen Feldern konstruiert. Mit dieser Liste wird die Auswahlbox befüllt.
|
||||
/// </summary>
|
||||
public static List<ValidationField> ValidationFields
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_validationFields == null)
|
||||
{
|
||||
_validationFields = new List<ValidationField>();
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(AGNT), false, Message.NotificationClass.AGNT));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(ATA), false, Message.NotificationClass.ATA));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(ATD), false, Message.NotificationClass.ATD));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(BRKA), true, Message.NotificationClass.BKRA));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(BRKD), true, Message.NotificationClass.BKRD));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(BPOL), false, Message.NotificationClass.BPOL));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(CallPurpose), false, null));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(CREW), true, Message.NotificationClass.CREW));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(Customer), false, null));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(HAZ), false, Message.NotificationClass.HAZA));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(IBCPosition), true, null));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(IGCPosition), true, null));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(IMDGPosition), true, null));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(IMSBCPosition), true, null));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(InfectedArea), true, null));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(INFO), false, Message.NotificationClass.INFO));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(LADG), true, Message.NotificationClass.LADG));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(LastTenPortFacilitiesCalled), true, null));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(MARPOL_Annex_I_Position), true, null));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(MDH), false, Message.NotificationClass.MDH));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(NAME), false, Message.NotificationClass.NAME));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(NOA_NOD), false, Message.NotificationClass.NOA_NOD));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(PAS), true, Message.NotificationClass.PAS));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(POBA), false, Message.NotificationClass.POBA));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(POBD), false, Message.NotificationClass.POBD));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(PortArea), true, null));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(PortOfCallLast30Days), true, null));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(PortOfCallLast30DaysCrewJoinedShip), true, null));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(PortOfItinerary),true ,null));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(PRE72H), false, Message.NotificationClass.PRE72H));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(ReportingParty), false, null));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(SanitaryMeasuresDetail), true, null));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(SEC), false, Message.NotificationClass.SEC));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(SERV), true, Message.NotificationClass.SERV));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(ShipToShipActivitiesDuringLastTenPortFacilitiesCalled), true, null));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(STAT), false, Message.NotificationClass.STAT));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(STO), true, Message.NotificationClass.STO));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(StowawaysJoiningLocation), true, null));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(SubsidiaryRisks), true, null));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(TIEFA), false, Message.NotificationClass.TIEFA));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(TIEFD), false, Message.NotificationClass.TIEFD));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(TOWA), true, Message.NotificationClass.TOWA));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(TOWD), true, Message.NotificationClass.TOWD));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(WAS), false, Message.NotificationClass.WAS));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(Waste), true, null));
|
||||
_validationFields.AddRange(GetFieldsForClass(typeof(WasteDisposalServiceProvider), true, null));
|
||||
|
||||
// Ergebnis sortiert nach Klassenname - Propertyname
|
||||
_validationFields.Sort(delegate (ValidationField c1, ValidationField c2) {
|
||||
int result = c1.NotificationClassText.CompareTo(c2.NotificationClassText);
|
||||
if (result == 0)
|
||||
result = c1.PropertyName.CompareTo(c2.PropertyName);
|
||||
return result;
|
||||
});
|
||||
|
||||
}
|
||||
return _validationFields;
|
||||
}
|
||||
}
|
||||
|
||||
private static List<ValidationField> GetFieldsForClass(Type objType, bool isList, Message.NotificationClass? notificationClass)
|
||||
{
|
||||
List<ValidationField> result = new List<ValidationField>();
|
||||
|
||||
var props = objType.GetProperties().Where(
|
||||
prop => Attribute.IsDefined(prop, typeof(ENI2ValidationAttribute)));
|
||||
|
||||
foreach (PropertyInfo property in props)
|
||||
{
|
||||
ValidationField vField = new ValidationField(property);
|
||||
vField.NotificationClassText = objType.Name;
|
||||
vField.PropertyName = property.Name;
|
||||
vField.IsInListType = isList;
|
||||
vField.NotificationClass = notificationClass;
|
||||
result.Add(vField);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region overrides
|
||||
|
||||
Loading…
Reference in New Issue
Block a user