Build 3.7.1:
Weiteres Vorgehen bei der Validierung (Bearbeitungsdialog angefangen (ex dashface)) Speicherung der Validierungsregeln usw.
This commit is contained in:
parent
707b5c9179
commit
f9d5c4f6e3
@ -91,6 +91,19 @@ namespace ENI2.Controls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsCancelled
|
||||||
|
{
|
||||||
|
private get { return false; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
this.textBlock.Foreground = Brushes.Gray;
|
||||||
|
this.textBlock.Background = Brushes.LightGray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void SetHeaderText(string headerText, bool lockedTab)
|
public void SetHeaderText(string headerText, bool lockedTab)
|
||||||
{
|
{
|
||||||
// Container for header controls
|
// Container for header controls
|
||||||
|
|||||||
@ -18,7 +18,7 @@ using System.Windows.Navigation;
|
|||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
using bsmd.database;
|
using bsmd.database;
|
||||||
|
using System.Windows.Controls.Primitives;
|
||||||
|
|
||||||
namespace ENI2.Controls
|
namespace ENI2.Controls
|
||||||
{
|
{
|
||||||
@ -118,6 +118,48 @@ namespace ENI2.Controls
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region public
|
||||||
|
|
||||||
|
public DataGridRow GetRow(int index)
|
||||||
|
{
|
||||||
|
DataGridRow row = (DataGridRow)this.ItemContainerGenerator.ContainerFromIndex(index);
|
||||||
|
if(row == null)
|
||||||
|
{
|
||||||
|
this.UpdateLayout();
|
||||||
|
this.ScrollIntoView(this.Items[index]);
|
||||||
|
row = (DataGridRow)this.ItemContainerGenerator.ContainerFromIndex(index);
|
||||||
|
}
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataGridCell GetCell(DataGridRow row, int column)
|
||||||
|
{
|
||||||
|
if (row != null)
|
||||||
|
{
|
||||||
|
DataGridCellsPresenter presenter = GetVisualChild<DataGridCellsPresenter>(row);
|
||||||
|
|
||||||
|
if (presenter == null)
|
||||||
|
{
|
||||||
|
this.ScrollIntoView(row, this.Columns[column]);
|
||||||
|
presenter = GetVisualChild<DataGridCellsPresenter>(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
DataGridCell cell = (DataGridCell)presenter.ItemContainerGenerator.ContainerFromIndex(column);
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataGridCell GetCell(int rowIndex, int columnIndex)
|
||||||
|
{
|
||||||
|
DataGridRow row = this.GetRow(rowIndex);
|
||||||
|
return this.GetCell(row, columnIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region protected
|
||||||
|
|
||||||
protected void addItem(object sender, RoutedEventArgs e)
|
protected void addItem(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!this.IsReadOnly)
|
if (!this.IsReadOnly)
|
||||||
@ -182,6 +224,10 @@ namespace ENI2.Controls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region private
|
||||||
|
|
||||||
private void dataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
private void dataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender != null)
|
if (sender != null)
|
||||||
@ -197,6 +243,31 @@ namespace ENI2.Controls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region private static
|
||||||
|
|
||||||
|
private static T GetVisualChild<T>(Visual parent) where T : Visual
|
||||||
|
{
|
||||||
|
T child = default(T);
|
||||||
|
int numVisuals = VisualTreeHelper.GetChildrenCount(parent);
|
||||||
|
for (int i = 0; i < numVisuals; i++)
|
||||||
|
{
|
||||||
|
Visual v = (Visual)VisualTreeHelper.GetChild(parent, i);
|
||||||
|
child = v as T;
|
||||||
|
if (child == null)
|
||||||
|
{
|
||||||
|
child = GetVisualChild<T>(v);
|
||||||
|
}
|
||||||
|
if (child != null)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
26
ENI-2/ENI2/ENI2/Controls/RuleControl.xaml
Normal file
26
ENI-2/ENI2/ENI2/Controls/RuleControl.xaml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<UserControl x:Class="ENI2.Controls.RuleControl"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:p="clr-namespace:ENI2.Properties"
|
||||||
|
xmlns:util="clr-namespace:ENI2.Util"
|
||||||
|
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||||
|
xmlns:local="clr-namespace:ENI2.Controls"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="600" d:DesignWidth="800">
|
||||||
|
<GroupBox Name="groupBoxRP" Header="{x:Static p:Resources.textValidation}">
|
||||||
|
<local:ENIDataGrid Margin="2,8,2,2" x:Name="dataGridValidationRules" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||||
|
SelectionMode="Single" AutoGenerateColumns="False" >
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textName}" Binding="{Binding Name}" IsReadOnly="True" Width="0.1*" />
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textContext}" Binding="{Binding Context}" IsReadOnly="True" Width="0.2*" />
|
||||||
|
<DataGridCheckBoxColumn Header="{x:Static p:Resources.textIsActive}" Binding="{Binding IsActive}" IsReadOnly="True" Width="0.05*" />
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textCreated}" Binding="{Binding Created}" IsReadOnly="True" Width="0.1*" />
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textCreatedBy}" Binding="{Binding CreatedBy}" IsReadOnly="True" Width="0.1*" />
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textChanged}" Binding="{Binding Changed}" IsReadOnly="True" Width="0.1*" />
|
||||||
|
<DataGridTextColumn Header="{x:Static p:Resources.textChangedBy}" Binding="{Binding ChangedBy}" IsReadOnly="True" Width="0.1*" />
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</local:ENIDataGrid>
|
||||||
|
</GroupBox>
|
||||||
|
</UserControl>
|
||||||
95
ENI-2/ENI2/ENI2/Controls/RuleControl.xaml.cs
Normal file
95
ENI-2/ENI2/ENI2/Controls/RuleControl.xaml.cs
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
// Copyright (c) 2017 schick Informatik
|
||||||
|
// Description: Liste der Validierungsregeln
|
||||||
|
//
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
using bsmd.database;
|
||||||
|
using ENI2.EditControls;
|
||||||
|
|
||||||
|
namespace ENI2.Controls
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for RuleControl.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class RuleControl : UserControl
|
||||||
|
{
|
||||||
|
public RuleControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
Loaded += RuleControl_Loaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<bsmd.database.ValidationRule> ValidationRules { get; set; }
|
||||||
|
|
||||||
|
public ReportingParty UserEntity { get; set; }
|
||||||
|
|
||||||
|
private void RuleControl_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.dataGridValidationRules.Initialize();
|
||||||
|
this.dataGridValidationRules.ItemsSource = this.ValidationRules;
|
||||||
|
|
||||||
|
this.dataGridValidationRules.CreateRequested += DataGridValidationRules_CreateRequested;
|
||||||
|
this.dataGridValidationRules.AddingNewItem += DataGridValidationRules_AddingNewItem;
|
||||||
|
this.dataGridValidationRules.EditRequested += DataGridValidationRules_EditRequested;
|
||||||
|
this.dataGridValidationRules.DeleteRequested += DataGridValidationRules_DeleteRequested;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataGridValidationRules_DeleteRequested(bsmd.database.DatabaseEntity obj)
|
||||||
|
{
|
||||||
|
bsmd.database.ValidationRule vr = obj as bsmd.database.ValidationRule;
|
||||||
|
if (vr != null)
|
||||||
|
{
|
||||||
|
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(vr);
|
||||||
|
this.ValidationRules.Remove(vr);
|
||||||
|
this.dataGridValidationRules.Items.Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataGridValidationRules_EditRequested(bsmd.database.DatabaseEntity obj)
|
||||||
|
{
|
||||||
|
bsmd.database.ValidationRule vr = obj as bsmd.database.ValidationRule;
|
||||||
|
if (vr != null)
|
||||||
|
{
|
||||||
|
EditRulesDialog eld = new EditRulesDialog();
|
||||||
|
eld.ValidationRule = vr;
|
||||||
|
|
||||||
|
if (eld.ShowDialog() ?? false)
|
||||||
|
{
|
||||||
|
if (!vr.IsNew)
|
||||||
|
{
|
||||||
|
vr.Changed = DateTime.Now;
|
||||||
|
vr.ChangedBy = this.UserEntity.Logon;
|
||||||
|
}
|
||||||
|
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(vr);
|
||||||
|
this.dataGridValidationRules.Items.Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataGridValidationRules_AddingNewItem(object sender, AddingNewItemEventArgs e)
|
||||||
|
{
|
||||||
|
this.DataGridValidationRules_CreateRequested();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataGridValidationRules_CreateRequested()
|
||||||
|
{
|
||||||
|
bsmd.database.ValidationRule vr = new bsmd.database.ValidationRule();
|
||||||
|
vr.Created = DateTime.Now;
|
||||||
|
vr.CreatedBy = this.UserEntity.Logon;
|
||||||
|
|
||||||
|
EditRulesDialog erd = new EditRulesDialog();
|
||||||
|
erd.ValidationRule = vr;
|
||||||
|
|
||||||
|
if (erd.ShowDialog() ?? false)
|
||||||
|
{
|
||||||
|
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(vr);
|
||||||
|
this.ValidationRules.Add(vr);
|
||||||
|
this.dataGridValidationRules.Items.Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -138,7 +138,7 @@ namespace ENI2
|
|||||||
detailControl.Initialize();
|
detailControl.Initialize();
|
||||||
detailControl.IsEnabled = !this.LockedByOtherUser;
|
detailControl.IsEnabled = !this.LockedByOtherUser;
|
||||||
|
|
||||||
if (!detailControl.IsEnabled && (detailControl is OverViewDetailControl))
|
if (!detailControl.IsEnabled && (detailControl is OverViewDetailControl) && !(_core.Cancelled ?? false))
|
||||||
((OverViewDetailControl)detailControl).ShowLockedBy(this.LockedBy);
|
((OverViewDetailControl)detailControl).ShowLockedBy(this.LockedBy);
|
||||||
|
|
||||||
controlCache.Add(mg.MessageGroupName, detailControl);
|
controlCache.Add(mg.MessageGroupName, detailControl);
|
||||||
|
|||||||
@ -37,9 +37,9 @@
|
|||||||
<enictrl:ENIDataGrid Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" x:Name="dataGridPortOfItinerary" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
<enictrl:ENIDataGrid Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" x:Name="dataGridPortOfItinerary" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||||
SelectionMode="Single" AutoGenerateColumns="False" Margin="0,5,0,0">
|
SelectionMode="Single" AutoGenerateColumns="False" Margin="0,5,0,0">
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn Header="{x:Static p:Resources.textPortname}" Binding="{Binding PortOfItineraryName, Mode=TwoWay}" IsReadOnly="True" Width="0.3*" />
|
<DataGridTextColumn Header="{x:Static p:Resources.textPortname}" Binding="{Binding PortOfItineraryName, Mode=TwoWay}" IsReadOnly="True" Width="0.5*" />
|
||||||
<DataGridTextColumn Binding="{Binding PortOfItineraryLocode, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
|
<!--DataGridTextColumn Binding="{Binding PortOfItineraryLocode, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" /-->
|
||||||
<DataGridTextColumn Header="{x:Static p:Resources.textETA}" Binding="{Binding PortOfItineraryETA, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}, StringFormat=\{0:dd.MM.yy HH:mm\}}" IsReadOnly="True" Width="0.6*" />
|
<DataGridTextColumn Header="{x:Static p:Resources.textETA}" Binding="{Binding PortOfItineraryETA, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}, StringFormat=\{0:dd.MM.yy HH:mm\}}" IsReadOnly="True" Width="0.5*" />
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</enictrl:ENIDataGrid>
|
</enictrl:ENIDataGrid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
<CheckBox Name="checkBoxDangerousGoodsOnBoard" IsChecked="{Binding NoDPGOnBoardOnArrival, Converter={util:InverseBooleanConverter}}" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center"/>
|
<CheckBox Name="checkBoxDangerousGoodsOnBoard" IsChecked="{Binding NoDPGOnBoardOnArrival, Converter={util:InverseBooleanConverter}}" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center"/>
|
||||||
<CheckBox Name="checkBoxDGManifestOnBoard" IsChecked="{Binding DPGManifestOnBoardOnArrival}" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center"/>
|
<CheckBox Name="checkBoxDGManifestOnBoard" IsChecked="{Binding DPGManifestOnBoardOnArrival}" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center"/>
|
||||||
<CheckBox Name="checkBoxMoUBaltic" IsChecked="{Binding MOUBaltic}" Grid.Row="1" Grid.Column="3" VerticalAlignment="Center"/>
|
<CheckBox Name="checkBoxMoUBaltic" IsChecked="{Binding MOUBaltic}" Grid.Row="1" Grid.Column="3" VerticalAlignment="Center"/>
|
||||||
<ComboBox x:Name="comboBoxVesselClass" Grid.Row="1" Grid.Column="1" Margin="2" SelectedIndex="{Binding INFShipClass, Converter={util:ByteConverter}}" ContextMenu="{DynamicResource ClearContextMenu}"/>
|
<ComboBox x:Name="comboBoxVesselClass" Grid.Row="1" Grid.Column="1" Margin="2" SelectedIndex="{Binding INFShipClass, Converter={util:ByteConverter}}" ContextMenu="{DynamicResource ClearContextMenu}" IsEditable="True" />
|
||||||
<TabControl Name="tabControlPositions" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="5">
|
<TabControl Name="tabControlPositions" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="5">
|
||||||
<TabItem Header="{x:Static p:Resources.textIMDGItems}" Name="tabIMDGItems">
|
<TabItem Header="{x:Static p:Resources.textIMDGItems}" Name="tabIMDGItems">
|
||||||
<enictrl:ENIDataGrid x:Name="dataGridIMDGItems" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
<enictrl:ENIDataGrid x:Name="dataGridIMDGItems" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||||
|
|||||||
@ -75,7 +75,7 @@
|
|||||||
<CheckBox Name="checkBoxWasMedicalConsulted" IsChecked="{Binding MedicalConsulted}" Grid.Row="8" Grid.Column="3" VerticalAlignment="Center"/>
|
<CheckBox Name="checkBoxWasMedicalConsulted" IsChecked="{Binding MedicalConsulted}" Grid.Row="8" Grid.Column="3" VerticalAlignment="Center"/>
|
||||||
<CheckBox Name="checkBoxAwareOfConditions" IsChecked="{Binding AwareOfFurtherInfections}" Grid.Row="9" Grid.Column="1" VerticalAlignment="Center"/>
|
<CheckBox Name="checkBoxAwareOfConditions" IsChecked="{Binding AwareOfFurtherInfections}" Grid.Row="9" Grid.Column="1" VerticalAlignment="Center"/>
|
||||||
<CheckBox Name="checkBoxStowawaysOnBoard" IsChecked="{Binding StowawaysDetected}" Grid.Row="11" Grid.Column="1" VerticalAlignment="Center"/>
|
<CheckBox Name="checkBoxStowawaysOnBoard" IsChecked="{Binding StowawaysDetected}" Grid.Row="11" Grid.Column="1" VerticalAlignment="Center"/>
|
||||||
<TextBox Name="textBoxStowawaysJoiningLocation" Grid.Row="11" Grid.RowSpan="3" Grid.Column="3" MaxLength="100" Text="{Binding StowawaysJoiningLocationText}" Margin="2" VerticalContentAlignment="Center"/>
|
<TextBox Name="textBoxStowawaysJoiningLocation" Grid.Row="11" Grid.RowSpan="3" Grid.Column="3" MaxLength="100" Text="{Binding StowawaysJoiningLocationText}" Margin="2" VerticalContentAlignment="Top"/>
|
||||||
<CheckBox Name="checkBoxSickAnimalsOrPets" IsChecked="{Binding SickAnimalOrPetOnBoard}" Grid.Row="12" Grid.Column="1" VerticalAlignment="Center"/>
|
<CheckBox Name="checkBoxSickAnimalsOrPets" IsChecked="{Binding SickAnimalOrPetOnBoard}" Grid.Row="12" Grid.Column="1" VerticalAlignment="Center"/>
|
||||||
<CheckBox Name="checkBoxSanitaryControlExemption" IsChecked="{Binding ValidSanitaryControlExemptionOrCertificateOnBoard}" Grid.Row="13" Grid.Column="1" VerticalAlignment="Center"/>
|
<CheckBox Name="checkBoxSanitaryControlExemption" IsChecked="{Binding ValidSanitaryControlExemptionOrCertificateOnBoard}" Grid.Row="13" Grid.Column="1" VerticalAlignment="Center"/>
|
||||||
<TextBox Name="textBoxPlaceOfIssue" Grid.Row="14" Grid.Column="1" MaxLength="100" Text="{Binding PlaceOfIssue}" Margin="2" />
|
<TextBox Name="textBoxPlaceOfIssue" Grid.Row="14" Grid.Column="1" MaxLength="100" Text="{Binding PlaceOfIssue}" Margin="2" />
|
||||||
|
|||||||
@ -35,6 +35,7 @@
|
|||||||
<RowDefinition Height="28" />
|
<RowDefinition Height="28" />
|
||||||
<RowDefinition Height="4" />
|
<RowDefinition Height="4" />
|
||||||
<RowDefinition Height="32" />
|
<RowDefinition Height="32" />
|
||||||
|
<RowDefinition Height="32" />
|
||||||
<RowDefinition Height="4" />
|
<RowDefinition Height="4" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
@ -105,9 +106,10 @@
|
|||||||
</Button>
|
</Button>
|
||||||
-->
|
-->
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
<Label Grid.Column="0" Grid.Row="7" Margin="0,0,10,0" HorizontalContentAlignment="Right" Name="labelCancelled" VerticalContentAlignment="Center" FontWeight="Bold" />
|
||||||
|
|
||||||
<!-- Data Grid -->
|
<!-- Data Grid -->
|
||||||
<DataGrid Grid.Row="8" Grid.ColumnSpan="6" Margin="0,8,0,0" x:Name="dataGridMessages" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" CanUserAddRows="False"
|
<DataGrid Grid.Row="9" Grid.ColumnSpan="6" Margin="0,8,0,0" x:Name="dataGridMessages" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" CanUserAddRows="False"
|
||||||
SelectionMode="Extended" AutoGenerateColumns="False" MouseDoubleClick="dataGrid_MouseDoubleClick" PreviewKeyDown="dataGrid_PreviewKeyDown">
|
SelectionMode="Extended" AutoGenerateColumns="False" MouseDoubleClick="dataGrid_MouseDoubleClick" PreviewKeyDown="dataGrid_PreviewKeyDown">
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTemplateColumn Header=" " Width="SizeToCells" IsReadOnly="True">
|
<DataGridTemplateColumn Header=" " Width="SizeToCells" IsReadOnly="True">
|
||||||
|
|||||||
@ -13,6 +13,7 @@ using bsmd.database;
|
|||||||
using ENI2.EditControls;
|
using ENI2.EditControls;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace ENI2.DetailViewControls
|
namespace ENI2.DetailViewControls
|
||||||
{
|
{
|
||||||
@ -70,6 +71,8 @@ namespace ENI2.DetailViewControls
|
|||||||
vtBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
|
vtBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
|
||||||
BindingOperations.SetBinding(textBoxDisplayId, TextBox.TextProperty, vtBinding);
|
BindingOperations.SetBinding(textBoxDisplayId, TextBox.TextProperty, vtBinding);
|
||||||
|
|
||||||
|
if (this.Core.Cancelled ?? false) this.ShowCancelledLabel();
|
||||||
|
|
||||||
#region Meldeklassen einrichten und Icons / Gruppen / Index zuordnen
|
#region Meldeklassen einrichten und Icons / Gruppen / Index zuordnen
|
||||||
|
|
||||||
foreach (Message aMessage in this.Messages)
|
foreach (Message aMessage in this.Messages)
|
||||||
@ -339,6 +342,12 @@ namespace ENI2.DetailViewControls
|
|||||||
this.OnJumpToListElementRequest(message.ENINotificationDetailIndex);
|
this.OnJumpToListElementRequest(message.ENINotificationDetailIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ShowCancelledLabel()
|
||||||
|
{
|
||||||
|
this.labelCancelled.Content = Properties.Resources.textCancelled;
|
||||||
|
this.labelCancelled.Background = Brushes.Yellow;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region mouse event handler
|
#region mouse event handler
|
||||||
@ -426,6 +435,7 @@ namespace ENI2.DetailViewControls
|
|||||||
if (result == MessageBoxResult.Yes)
|
if (result == MessageBoxResult.Yes)
|
||||||
{
|
{
|
||||||
this.Core.Cancelled = true;
|
this.Core.Cancelled = true;
|
||||||
|
this.ShowCancelledLabel();
|
||||||
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(this.Core);
|
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(this.Core);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,8 +35,8 @@
|
|||||||
<MinimumRequiredVersion>3.5.1.0</MinimumRequiredVersion>
|
<MinimumRequiredVersion>3.5.1.0</MinimumRequiredVersion>
|
||||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||||
<WebPage>publish.html</WebPage>
|
<WebPage>publish.html</WebPage>
|
||||||
<ApplicationRevision>3</ApplicationRevision>
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
<ApplicationVersion>3.6.15.%2a</ApplicationVersion>
|
<ApplicationVersion>3.7.1.%2a</ApplicationVersion>
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||||
@ -175,6 +175,9 @@
|
|||||||
<Compile Include="Controls\ReportingPartyControl.xaml.cs">
|
<Compile Include="Controls\ReportingPartyControl.xaml.cs">
|
||||||
<DependentUpon>ReportingPartyControl.xaml</DependentUpon>
|
<DependentUpon>ReportingPartyControl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Controls\RuleControl.xaml.cs">
|
||||||
|
<DependentUpon>RuleControl.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="CustomCommands.cs" />
|
<Compile Include="CustomCommands.cs" />
|
||||||
<Compile Include="DetailBaseControl.cs" />
|
<Compile Include="DetailBaseControl.cs" />
|
||||||
<Compile Include="DetailRootControl.xaml.cs">
|
<Compile Include="DetailRootControl.xaml.cs">
|
||||||
@ -264,6 +267,9 @@
|
|||||||
<Compile Include="EditControls\EditReportingPartyDialog.xaml.cs">
|
<Compile Include="EditControls\EditReportingPartyDialog.xaml.cs">
|
||||||
<DependentUpon>EditReportingPartyDialog.xaml</DependentUpon>
|
<DependentUpon>EditReportingPartyDialog.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="EditControls\EditRulesDialog.xaml.cs">
|
||||||
|
<DependentUpon>EditRulesDialog.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="EditControls\EditSanitaryMeasureDialog.xaml.cs">
|
<Compile Include="EditControls\EditSanitaryMeasureDialog.xaml.cs">
|
||||||
<DependentUpon>EditSanitaryMeasureDialog.xaml</DependentUpon>
|
<DependentUpon>EditSanitaryMeasureDialog.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -334,6 +340,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Controls\RuleControl.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="ControlTemplates.xaml">
|
<Page Include="ControlTemplates.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@ -454,6 +464,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="EditControls\EditRulesDialog.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="EditControls\EditSanitaryMeasureDialog.xaml">
|
<Page Include="EditControls\EditSanitaryMeasureDialog.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@ -596,6 +610,10 @@
|
|||||||
<Resource Include="Resources\recycle.png" />
|
<Resource Include="Resources\recycle.png" />
|
||||||
<Resource Include="Resources\check.png" />
|
<Resource Include="Resources\check.png" />
|
||||||
<Resource Include="Resources\hand_red_card.png" />
|
<Resource Include="Resources\hand_red_card.png" />
|
||||||
|
<Resource Include="Resources\logic_and.png" />
|
||||||
|
<Resource Include="Resources\logic_not.png" />
|
||||||
|
<Resource Include="Resources\logic_or.png" />
|
||||||
|
<Resource Include="Resources\logic_xor.png" />
|
||||||
<Content Include="x64\SQLite.Interop.dll">
|
<Content Include="x64\SQLite.Interop.dll">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|||||||
@ -32,16 +32,27 @@ namespace ENI2.EditControls
|
|||||||
this.OKClicked += EditPortOfItineraryDialog_OKClicked;
|
this.OKClicked += EditPortOfItineraryDialog_OKClicked;
|
||||||
|
|
||||||
// copy into fields
|
// copy into fields
|
||||||
this.textBoxPortName.Text = this.PortOfItinerary.PortOfItineraryLocode;
|
this.textBoxPortName.Text = this.PortOfItinerary.PortOfItineraryName;
|
||||||
this.dateTimePickerETA.Value = this.PortOfItinerary.PortOfItineraryETA.HasValue ? ((DateTime?) DateTime.SpecifyKind(this.PortOfItinerary.PortOfItineraryETA.Value, DateTimeKind.Utc).ToLocalTime()) : null;
|
this.dateTimePickerETA.Value = this.PortOfItinerary.PortOfItineraryETA.HasValue ? ((DateTime?) DateTime.SpecifyKind(this.PortOfItinerary.PortOfItineraryETA.Value, DateTimeKind.Utc).ToLocalTime()) : null;
|
||||||
this.AddVisible = true;
|
this.AddVisible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CopyValuesToEntity()
|
public void CopyValuesToEntity()
|
||||||
{
|
{
|
||||||
// copy back
|
// copy back
|
||||||
this.PortOfItinerary.PortOfItineraryLocode = this.textBoxPortName.Text;
|
string portNameFromLocode = null;
|
||||||
this.PortOfItinerary.PortOfItineraryName = this.PortOfItinerary.PortOfItineraryLocode.IsNullOrEmpty() ? "" : LocodeDB.PortNameFromLocode(this.PortOfItinerary.PortOfItineraryLocode);
|
if(!this.textBoxPortName.Text.IsNullOrEmpty() && (this.textBoxPortName.Text.Length == 5))
|
||||||
|
portNameFromLocode = LocodeDB.PortNameFromLocode(this.textBoxPortName.Text.ToUpper());
|
||||||
|
|
||||||
|
if(!portNameFromLocode.IsNullOrEmpty()) // der Anwender hat einen Locode eingetragen
|
||||||
|
{
|
||||||
|
this.PortOfItinerary.PortOfItineraryLocode = this.textBoxPortName.Text;
|
||||||
|
this.PortOfItinerary.PortOfItineraryName = portNameFromLocode;
|
||||||
|
}
|
||||||
|
else // einfach Hafen als Text direkt übernehmen
|
||||||
|
{
|
||||||
|
this.PortOfItinerary.PortOfItineraryName = this.textBoxPortName.Text;
|
||||||
|
}
|
||||||
this.PortOfItinerary.PortOfItineraryETA = this.dateTimePickerETA.Value.HasValue ? ((DateTime?)DateTime.SpecifyKind(this.dateTimePickerETA.Value.Value, DateTimeKind.Local).ToUniversalTime()) : null;
|
this.PortOfItinerary.PortOfItineraryETA = this.dateTimePickerETA.Value.HasValue ? ((DateTime?)DateTime.SpecifyKind(this.dateTimePickerETA.Value.Value, DateTimeKind.Local).ToUniversalTime()) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
48
ENI-2/ENI2/ENI2/EditControls/EditRulesDialog.xaml
Normal file
48
ENI-2/ENI2/ENI2/EditControls/EditRulesDialog.xaml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<enictrl:EditWindowBase x:Class="ENI2.EditControls.EditRulesDialog"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:ENI2.EditControls"
|
||||||
|
xmlns:enictrl="clr-namespace:ENI2.Controls"
|
||||||
|
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||||
|
xmlns:p="clr-namespace:ENI2.Properties"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="{x:Static p:Resources.textEditRules}" Height="410" Width="800" WindowStyle="SingleBorderWindow" Background="AliceBlue">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="32" />
|
||||||
|
<RowDefinition Height="32" />
|
||||||
|
<RowDefinition Height="32" />
|
||||||
|
<RowDefinition Height="32" />
|
||||||
|
<RowDefinition Height="200" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="1*" />
|
||||||
|
<ColumnDefinition Width="2*" />
|
||||||
|
<ColumnDefinition Width="1*" />
|
||||||
|
<ColumnDefinition Width="2*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Name="labelName" Content="{x:Static p:Resources.textName}" Grid.Row="0" Grid.Column="0" HorizontalContentAlignment="Right" VerticalContentAlignment="Center"/>
|
||||||
|
<TextBox Name="textBoxName" Grid.Row="0" Grid.Column="1" VerticalContentAlignment="Center" Margin="2" />
|
||||||
|
<Label Name="labelContext" Content="{x:Static p:Resources.textContext}" Grid.Row="0" Grid.Column="2" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" />
|
||||||
|
<TextBox Name="textBoxContext" Grid.Row="0" Grid.Column="3" VerticalContentAlignment="Center" Margin="2" />
|
||||||
|
<Label Name="labelChanged" Content="{x:Static p:Resources.textChanged}" Grid.Row="1" Grid.Column="0" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" />
|
||||||
|
<TextBlock Name="textBlockChanged" Grid.Row="1" Grid.Column="1" FontWeight="Bold" VerticalAlignment="Center" />
|
||||||
|
<Label Name="labelChangedBy" Content="{x:Static p:Resources.textChangedBy}" Grid.Row="1" Grid.Column="2" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" />
|
||||||
|
<TextBlock Name="textBlockChangedBy" Grid.Row="1" Grid.Column="3" FontWeight="Bold" VerticalAlignment="Center" />
|
||||||
|
<Label Name="labelCreated" Content="{x:Static p:Resources.textCreated}" Grid.Row="2" Grid.Column="0" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" />
|
||||||
|
<TextBlock Name="textBlockCreated" Grid.Row="2" Grid.Column="1" FontWeight="Bold" VerticalAlignment="Center" />
|
||||||
|
<Label Name="labelCreatedBy" Content="{x:Static p:Resources.textCreatedBy}" Grid.Row="2" Grid.Column="2" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" />
|
||||||
|
<TextBlock Name="textBlockCreatedBy" Grid.Row="2" Grid.Column="3" FontWeight="Bold" VerticalAlignment="Center" />
|
||||||
|
<Label Name="labelIsActive" Content="{x:Static p:Resources.textIsActive}" Grid.Row="3" Grid.Column="0" HorizontalContentAlignment="Right" VerticalContentAlignment="Center" />
|
||||||
|
<CheckBox Name="checkBoxIsActive" Grid.Row="3" Grid.Column="1" VerticalContentAlignment="Center" Margin="2" />
|
||||||
|
<TreeView Name="treeViewRules" Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" Margin="2"/>
|
||||||
|
<GroupBox Name="groupBoxConditionDetails" Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="2" Margin="0" Header="{x:Static p:Resources.textCondition}">
|
||||||
|
<Grid>
|
||||||
|
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</GroupBox>
|
||||||
|
</Grid>
|
||||||
|
</enictrl:EditWindowBase>
|
||||||
210
ENI-2/ENI2/ENI2/EditControls/EditRulesDialog.xaml.cs
Normal file
210
ENI-2/ENI2/ENI2/EditControls/EditRulesDialog.xaml.cs
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
// Copyright (c) 2017 schick Informatik
|
||||||
|
// Description: Bearbeitungsdialog für Validierungsregeln
|
||||||
|
//
|
||||||
|
|
||||||
|
using System.Windows;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using bsmd.database;
|
||||||
|
using ENI2.Controls;
|
||||||
|
using System;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
|
namespace ENI2.EditControls
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for EditRulesDialog.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class EditRulesDialog : EditWindowBase
|
||||||
|
{
|
||||||
|
public EditRulesDialog()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
Loaded += EditRulesDialog_Loaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
public bsmd.database.ValidationRule ValidationRule { get; set; }
|
||||||
|
|
||||||
|
public ConditionGroup RootCondition
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (this.treeViewRules.Items.Count == 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ConditionGroup cg = new ConditionGroup();
|
||||||
|
cg.Conditions = new List<ValidationCondition>();
|
||||||
|
cg.SubGroups = new List<ConditionGroup>();
|
||||||
|
cg.GroupOperator = ((GroupNode)this.treeViewRules.Items[0]).ConditionGroup.GroupOperator;
|
||||||
|
this.BuildConditionGroups(this.treeViewRules.Items, cg);
|
||||||
|
return cg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == null) return;
|
||||||
|
GroupNode rootNode = this.CreateGroupNode(value);
|
||||||
|
this.treeViewRules.Items.Add(rootNode);
|
||||||
|
this.BuildTree(rootNode.Items, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BuildTree(ItemCollection items, ConditionGroup root)
|
||||||
|
{
|
||||||
|
if (root.Conditions == null)
|
||||||
|
root.Conditions = new List<ValidationCondition>();
|
||||||
|
|
||||||
|
foreach (ValidationCondition vc in root.Conditions)
|
||||||
|
{
|
||||||
|
ConditionNode cn = new ConditionNode();
|
||||||
|
cn.Condition = vc;
|
||||||
|
cn.Header = cn.ToString();
|
||||||
|
//cn.ImageIndex = 4; // TODO : set image
|
||||||
|
//cn.SelectedImageIndex = 4;
|
||||||
|
items.Add(cn);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (root.SubGroups == null)
|
||||||
|
root.SubGroups = new List<ConditionGroup>();
|
||||||
|
|
||||||
|
foreach (ConditionGroup cg in root.SubGroups)
|
||||||
|
{
|
||||||
|
GroupNode gn = this.CreateGroupNode(cg);
|
||||||
|
items.Add(gn);
|
||||||
|
this.BuildTree(gn.Items, cg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private GroupNode CreateGroupNode(ConditionGroup cg)
|
||||||
|
{
|
||||||
|
GroupNode gn = new GroupNode();
|
||||||
|
gn.ConditionGroup = cg;
|
||||||
|
gn.Header = gn.ToString();
|
||||||
|
|
||||||
|
// TODO: Icon setzen je nach typ
|
||||||
|
|
||||||
|
|
||||||
|
return gn;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BuildConditionGroups(ItemCollection items, ConditionGroup parent)
|
||||||
|
{
|
||||||
|
foreach(TreeViewItem node in items)
|
||||||
|
{
|
||||||
|
if(node is ConditionNode)
|
||||||
|
{
|
||||||
|
parent.Conditions.Add(((ConditionNode)node).Condition);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ConditionGroup cg = ((GroupNode) node).ConditionGroup;
|
||||||
|
cg.Conditions.Clear();
|
||||||
|
parent.SubGroups.Add(cg);
|
||||||
|
this.BuildConditionGroups(node.Items, cg); // recurse down
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private void EditRulesDialog_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.textBlockChanged.Text = this.ValidationRule.Changed?.ToString();
|
||||||
|
this.textBlockChangedBy.Text = this.ValidationRule.ChangedBy;
|
||||||
|
this.textBlockCreated.Text = this.ValidationRule.Created.ToString();
|
||||||
|
this.textBlockCreatedBy.Text = this.ValidationRule.CreatedBy;
|
||||||
|
this.textBoxName.Text = this.ValidationRule.Name;
|
||||||
|
this.textBoxContext.Text = this.ValidationRule.Context;
|
||||||
|
this.checkBoxIsActive.IsChecked = this.ValidationRule.IsActive;
|
||||||
|
|
||||||
|
// TODO: init logic tree with rule
|
||||||
|
|
||||||
|
this.OKClicked += EditRulesDialog_OKClicked;
|
||||||
|
this.AddVisible = false;
|
||||||
|
|
||||||
|
// init tree context Menu
|
||||||
|
this.treeViewRules.ContextMenu = new ContextMenu();
|
||||||
|
|
||||||
|
MenuItem addItem = new MenuItem();
|
||||||
|
addItem.Header = Properties.Resources.textNewGroup;
|
||||||
|
addItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/add.png")) };
|
||||||
|
addItem.Click += this.createNewGroup;
|
||||||
|
this.treeViewRules.ContextMenu.Items.Add(addItem);
|
||||||
|
|
||||||
|
MenuItem deleteItem = new MenuItem();
|
||||||
|
deleteItem.Header = Properties.Resources.textDelete;
|
||||||
|
deleteItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/delete.png")) };
|
||||||
|
deleteItem.Click += this.deleteItem;
|
||||||
|
this.treeViewRules.ContextMenu.Items.Add(deleteItem);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteItem(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createNewGroup(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CopyValuesToEntity()
|
||||||
|
{
|
||||||
|
this.ValidationRule.Name = this.textBoxName.Text;
|
||||||
|
this.ValidationRule.Context = this.textBoxContext.Text;
|
||||||
|
this.ValidationRule.IsActive = this.checkBoxIsActive.IsChecked;
|
||||||
|
|
||||||
|
// TODO: serialize logical tree back into string
|
||||||
|
this.ValidationRule.Rule = bsmd.database.ValidationCondition.SaveToString(this.RootCondition);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EditRulesDialog_OKClicked()
|
||||||
|
{
|
||||||
|
this.CopyValuesToEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
#region class GroupNode
|
||||||
|
|
||||||
|
internal class GroupNode : TreeViewItem
|
||||||
|
{
|
||||||
|
public ConditionGroup ConditionGroup { get; set; }
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
if (this.ConditionGroup == null) return "+++";
|
||||||
|
return string.Format("{0}", Enum.GetName(typeof(ConditionGroup.GroupOperatorEnum), this.ConditionGroup.GroupOperator));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region class ConditionNode
|
||||||
|
|
||||||
|
internal class ConditionNode : TreeViewItem
|
||||||
|
{
|
||||||
|
public ValidationCondition Condition { get; set; }
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
if (this.Condition == null) return "---";
|
||||||
|
return string.Format("{0} {1} {2}",
|
||||||
|
this.Condition.FieldName,
|
||||||
|
Enum.GetName(typeof(ValidationCondition.ConditionOperatorEnum), this.Condition.ConditionOperator),
|
||||||
|
this.Condition.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -65,12 +65,14 @@
|
|||||||
<ColumnDefinition Width="auto" />
|
<ColumnDefinition Width="auto" />
|
||||||
<ColumnDefinition Width="auto" />
|
<ColumnDefinition Width="auto" />
|
||||||
<ColumnDefinition Width="auto" />
|
<ColumnDefinition Width="auto" />
|
||||||
|
<ColumnDefinition Width="auto" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Image Grid.Column="0" x:Name="logoImage" HorizontalAlignment="Left" Height="75" Width="75" Source="Resources/EUREPORT.png" Stretch="Fill" MouseUp="logoImage_MouseUp" Margin="2"/>
|
<Image Grid.Column="0" x:Name="logoImage" HorizontalAlignment="Left" Height="75" Width="75" Source="Resources/EUREPORT.png" Stretch="Fill" MouseUp="logoImage_MouseUp" Margin="2"/>
|
||||||
<Button Grid.Column="1" x:Name="buttonNewId" Content="{x:Static p:Resources.textNewVisitTransitId}" HorizontalAlignment="Left" VerticalAlignment="Center" Click="buttonNewTransitIdClick" Background="Transparent" Margin="2"/>
|
<Button Grid.Column="1" x:Name="buttonNewId" Content="{x:Static p:Resources.textNewVisitTransitId}" HorizontalAlignment="Left" VerticalAlignment="Center" Click="buttonNewTransitIdClick" Background="Transparent" Margin="2"/>
|
||||||
<Button Grid.Column="2" x:Name="buttonNewWithId" Content="{x:Static p:Resources.textNewWithId}" HorizontalAlignment="Left" VerticalAlignment="Center" Click="buttonNewWithIdClick" Background="Transparent" Margin="2"/>
|
<Button Grid.Column="2" x:Name="buttonNewWithId" Content="{x:Static p:Resources.textNewWithId}" HorizontalAlignment="Left" VerticalAlignment="Center" Click="buttonNewWithIdClick" Background="Transparent" Margin="2"/>
|
||||||
<Button Grid.Column="3" x:Name="buttonUserAdmin" Content="{x:Static p:Resources.textUserAdministration}" HorizontalAlignment="Left" VerticalAlignment="Center" Width="auto" Click="buttonUserAdmin_Click" Background="Transparent" Visibility="Hidden" Margin="2"/>
|
<Button Grid.Column="3" x:Name="buttonUserAdmin" Content="{x:Static p:Resources.textUserAdministration}" HorizontalAlignment="Left" VerticalAlignment="Center" Width="auto" Click="buttonUserAdmin_Click" Background="Transparent" Visibility="Hidden" Margin="2"/>
|
||||||
|
<Button Grid.Column="4" x:Name="buttonEditRules" Content="{x:Static p:Resources.textEditRules}" HorizontalAlignment="Left" VerticalAlignment="Center" Width="auto" Click="buttonEditRules_Click" Background="Transparent" Visibility="Hidden" Margin="2" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid DockPanel.Dock="Bottom" Height="22" Background="#FFE8F6FF">
|
<Grid DockPanel.Dock="Bottom" Height="22" Background="#FFE8F6FF">
|
||||||
|
|||||||
@ -32,7 +32,9 @@ namespace ENI2
|
|||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private bool userAdministrationVisible;
|
private bool userAdministrationVisible;
|
||||||
|
private bool rulesVisible;
|
||||||
private ReportingPartyControl rpControl;
|
private ReportingPartyControl rpControl;
|
||||||
|
private RuleControl ruleControl;
|
||||||
private bool dbConnected;
|
private bool dbConnected;
|
||||||
private SucheControl sucheControl;
|
private SucheControl sucheControl;
|
||||||
private List<MessageCore> anmeldungen = new List<MessageCore>();
|
private List<MessageCore> anmeldungen = new List<MessageCore>();
|
||||||
@ -76,33 +78,42 @@ namespace ENI2
|
|||||||
{
|
{
|
||||||
if (!openTabs.ContainsKey(aMessageCore.Id.Value))
|
if (!openTabs.ContainsKey(aMessageCore.Id.Value))
|
||||||
{
|
{
|
||||||
ClosableTabItem searchResultItem = new ClosableTabItem();
|
ClosableTabItem searchResultItem = new ClosableTabItem();
|
||||||
|
|
||||||
// try to lock the item
|
// try to lock the item
|
||||||
Guid lockedUserId = Guid.Empty;
|
Guid lockedUserId = Guid.Empty;
|
||||||
try
|
|
||||||
|
if (!(aMessageCore.Cancelled ?? false))
|
||||||
{
|
{
|
||||||
lockedUserId = App.LockingServiceClient.Lock(aMessageCore.Id.Value, this.userEntity.Id.Value);
|
try
|
||||||
if(lockedUserId == Guid.Empty)
|
|
||||||
{
|
{
|
||||||
this.lockedCores[searchResultItem] = aMessageCore.Id.Value;
|
lockedUserId = App.LockingServiceClient.Lock(aMessageCore.Id.Value, this.userEntity.Id.Value);
|
||||||
|
if (lockedUserId == Guid.Empty)
|
||||||
|
{
|
||||||
|
this.lockedCores[searchResultItem] = aMessageCore.Id.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// TODO: wenn der Locking Service nicht erreichbar ist sollte das Ganze trotzdem noch irgendwie funktionieren
|
||||||
|
_log.ErrorFormat("LockingService.Lock: {0}", ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
bool iDidLockIt = (lockedUserId == Guid.Empty) && !(aMessageCore.Cancelled ?? false);
|
||||||
{
|
|
||||||
// TODO: wenn der Locking Service nicht erreichbar ist sollte das Ganze trotzdem noch irgendwie funktionieren
|
|
||||||
_log.ErrorFormat("LockingService.Lock: {0}", ex.Message);
|
|
||||||
}
|
|
||||||
bool iDidLockIt = (lockedUserId == Guid.Empty);
|
|
||||||
|
|
||||||
searchResultItem.TabClosing += SearchResultItem_TabClosing;
|
searchResultItem.TabClosing += SearchResultItem_TabClosing;
|
||||||
DateTime? eta = aMessageCore.IsTransit ? aMessageCore.ETAKielCanal : aMessageCore.ETA;
|
DateTime? eta = aMessageCore.IsTransit ? aMessageCore.ETAKielCanal : aMessageCore.ETA;
|
||||||
searchResultItem.SetHeaderText(string.Format("{0} [{1}-{2}]", aMessageCore.Shipname, aMessageCore.PoC, eta.HasValue ? eta.Value.ToShortDateString() : ""),
|
searchResultItem.SetHeaderText(string.Format("{0} [{1}-{2}]", aMessageCore.Shipname, aMessageCore.PoC, eta.HasValue ? eta.Value.ToShortDateString() : ""),
|
||||||
iDidLockIt);
|
iDidLockIt);
|
||||||
|
searchResultItem.IsCancelled = aMessageCore.Cancelled ?? false;
|
||||||
|
|
||||||
DetailRootControl drc = new DetailRootControl(aMessageCore);
|
DetailRootControl drc = new DetailRootControl(aMessageCore);
|
||||||
drc.LockedByOtherUser = !iDidLockIt;
|
drc.LockedByOtherUser = !iDidLockIt;
|
||||||
drc.LockedBy = iDidLockIt ? this.userEntity : DBManager.Instance.GetReportingPartyDict()[lockedUserId];
|
|
||||||
|
if (!aMessageCore.Cancelled ?? false)
|
||||||
|
{
|
||||||
|
drc.LockedBy = iDidLockIt ? this.userEntity : DBManager.Instance.GetReportingPartyDict()[lockedUserId];
|
||||||
|
}
|
||||||
|
|
||||||
searchResultItem.Content = drc;
|
searchResultItem.Content = drc;
|
||||||
this.mainFrame.Items.Add(searchResultItem);
|
this.mainFrame.Items.Add(searchResultItem);
|
||||||
@ -194,6 +205,29 @@ namespace ENI2
|
|||||||
this.userAdministrationVisible = !this.userAdministrationVisible; // toggle
|
this.userAdministrationVisible = !this.userAdministrationVisible; // toggle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void buttonEditRules_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if(this.rulesVisible)
|
||||||
|
{
|
||||||
|
this.rootContainer.Children.Remove(ruleControl);
|
||||||
|
this.rootContainer.Children.Add(this.mainFrame);
|
||||||
|
this.buttonEditRules.Content = Properties.Resources.textEditRules;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.rootContainer.Children.Remove(this.mainFrame);
|
||||||
|
if(this.ruleControl == null)
|
||||||
|
{
|
||||||
|
this.ruleControl = new RuleControl();
|
||||||
|
this.ruleControl.UserEntity = this.userEntity;
|
||||||
|
this.ruleControl.ValidationRules = DBManager.Instance.GetValidationRules();
|
||||||
|
}
|
||||||
|
this.rootContainer.Children.Add(ruleControl);
|
||||||
|
this.buttonEditRules.Content = Properties.Resources.textNotifications;
|
||||||
|
}
|
||||||
|
this.rulesVisible = !this.rulesVisible;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region window lifetime event handler
|
#region window lifetime event handler
|
||||||
@ -275,7 +309,6 @@ namespace ENI2
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CanExecuteClearCommand(object sender, CanExecuteRoutedEventArgs e)
|
private void CanExecuteClearCommand(object sender, CanExecuteRoutedEventArgs e)
|
||||||
@ -454,7 +487,11 @@ namespace ENI2
|
|||||||
this.busyIndicator.IsBusy = false;
|
this.busyIndicator.IsBusy = false;
|
||||||
this.labelStatusBar.Text = string.Format("Rep.Party: {0} {1} [{2}]", this.userEntity.FirstName, this.userEntity.LastName, this.userEntity.Logon);
|
this.labelStatusBar.Text = string.Format("Rep.Party: {0} {1} [{2}]", this.userEntity.FirstName, this.userEntity.LastName, this.userEntity.Logon);
|
||||||
App.UserId = this.userEntity.Id;
|
App.UserId = this.userEntity.Id;
|
||||||
if (this.userEntity.IsAdmin) this.buttonUserAdmin.Visibility = Visibility.Visible;
|
if (this.userEntity.IsAdmin)
|
||||||
|
{
|
||||||
|
this.buttonUserAdmin.Visibility = Visibility.Visible;
|
||||||
|
this.buttonEditRules.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ReportingParty.LogonResult.FAILED:
|
case ReportingParty.LogonResult.FAILED:
|
||||||
this.labelLoginResult.Content = Properties.Resources.textWrongPassword;
|
this.labelLoginResult.Content = Properties.Resources.textWrongPassword;
|
||||||
@ -468,14 +505,14 @@ namespace ENI2
|
|||||||
|
|
||||||
if (failedLogonCount == 3)
|
if (failedLogonCount == 3)
|
||||||
this.buttonLogin.IsEnabled = false;
|
this.buttonLogin.IsEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonExit_Click(object sender, RoutedEventArgs e)
|
private void buttonExit_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
121
ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs
generated
121
ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs
generated
@ -410,6 +410,46 @@ namespace ENI2.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
public static System.Drawing.Bitmap logic_and {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("logic_and", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
public static System.Drawing.Bitmap logic_not {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("logic_not", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
public static System.Drawing.Bitmap logic_or {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("logic_or", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
public static System.Drawing.Bitmap logic_xor {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("logic_xor", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -849,6 +889,15 @@ namespace ENI2.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Cancelled.
|
||||||
|
/// </summary>
|
||||||
|
public static string textCancelled {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("textCancelled", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Confirm deletion.
|
/// Looks up a localized string similar to Confirm deletion.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -1065,6 +1114,15 @@ namespace ENI2.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Condition.
|
||||||
|
/// </summary>
|
||||||
|
public static string textCondition {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("textCondition", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Confirmation.
|
/// Looks up a localized string similar to Confirmation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -1155,6 +1213,15 @@ namespace ENI2.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Context.
|
||||||
|
/// </summary>
|
||||||
|
public static string textContext {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("textContext", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Control temperature.
|
/// Looks up a localized string similar to Control temperature.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -1209,6 +1276,15 @@ namespace ENI2.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Created by.
|
||||||
|
/// </summary>
|
||||||
|
public static string textCreatedBy {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("textCreatedBy", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Create PDF.
|
/// Looks up a localized string similar to Create PDF.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -1533,6 +1609,15 @@ namespace ENI2.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Edit rules.
|
||||||
|
/// </summary>
|
||||||
|
public static string textEditRules {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("textEditRules", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to E-Mail.
|
/// Looks up a localized string similar to E-Mail.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -2046,6 +2131,15 @@ namespace ENI2.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Is active.
|
||||||
|
/// </summary>
|
||||||
|
public static string textIsActive {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("textIsActive", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to ISM company.
|
/// Looks up a localized string similar to ISM company.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -2541,6 +2635,24 @@ namespace ENI2.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to New condition.
|
||||||
|
/// </summary>
|
||||||
|
public static string textNewCondition {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("textNewCondition", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to New group.
|
||||||
|
/// </summary>
|
||||||
|
public static string textNewGroup {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("textNewGroup", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Create new id.
|
/// Looks up a localized string similar to Create new id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -3855,6 +3967,15 @@ namespace ENI2.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Validation.
|
||||||
|
/// </summary>
|
||||||
|
public static string textValidation {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("textValidation", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Valid exemption.
|
/// Looks up a localized string similar to Valid exemption.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -1447,4 +1447,43 @@
|
|||||||
<data name="textSendDate" xml:space="preserve">
|
<data name="textSendDate" xml:space="preserve">
|
||||||
<value>Send date</value>
|
<value>Send date</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="textCancelled" xml:space="preserve">
|
||||||
|
<value>Cancelled</value>
|
||||||
|
</data>
|
||||||
|
<data name="textEditRules" xml:space="preserve">
|
||||||
|
<value>Edit rules</value>
|
||||||
|
</data>
|
||||||
|
<data name="textContext" xml:space="preserve">
|
||||||
|
<value>Context</value>
|
||||||
|
</data>
|
||||||
|
<data name="textCreatedBy" xml:space="preserve">
|
||||||
|
<value>Created by</value>
|
||||||
|
</data>
|
||||||
|
<data name="textIsActive" xml:space="preserve">
|
||||||
|
<value>Is active</value>
|
||||||
|
</data>
|
||||||
|
<data name="textValidation" xml:space="preserve">
|
||||||
|
<value>Validation</value>
|
||||||
|
</data>
|
||||||
|
<data name="logic_and" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\logic_and.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="logic_not" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\logic_not.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="logic_or" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\logic_or.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="logic_xor" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\logic_xor.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="textCondition" xml:space="preserve">
|
||||||
|
<value>Condition</value>
|
||||||
|
</data>
|
||||||
|
<data name="textNewCondition" xml:space="preserve">
|
||||||
|
<value>New condition</value>
|
||||||
|
</data>
|
||||||
|
<data name="textNewGroup" xml:space="preserve">
|
||||||
|
<value>New group</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
BIN
ENI-2/ENI2/ENI2/Resources/logic_and.png
Normal file
BIN
ENI-2/ENI2/ENI2/Resources/logic_and.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
ENI-2/ENI2/ENI2/Resources/logic_not.png
Normal file
BIN
ENI-2/ENI2/ENI2/Resources/logic_not.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
ENI-2/ENI2/ENI2/Resources/logic_or.png
Normal file
BIN
ENI-2/ENI2/ENI2/Resources/logic_or.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
ENI-2/ENI2/ENI2/Resources/logic_xor.png
Normal file
BIN
ENI-2/ENI2/ENI2/Resources/logic_xor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
@ -60,6 +60,16 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
<DataGrid Grid.Row="1" Margin="0,8,0,0" x:Name="dataGrid" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" CanUserAddRows="False"
|
<DataGrid Grid.Row="1" Margin="0,8,0,0" x:Name="dataGrid" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" CanUserAddRows="False"
|
||||||
SelectionMode="Single" AutoGenerateColumns="False" MouseDoubleClick="dataGrid_MouseDoubleClick" PreviewKeyDown="dataGrid_PreviewKeyDown" >
|
SelectionMode="Single" AutoGenerateColumns="False" MouseDoubleClick="dataGrid_MouseDoubleClick" PreviewKeyDown="dataGrid_PreviewKeyDown" >
|
||||||
|
<DataGrid.RowStyle>
|
||||||
|
<Style TargetType="DataGridRow">
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding Cancelled}" Value="true">
|
||||||
|
<Setter Property="Background" Value="LightGray"></Setter>
|
||||||
|
<Setter Property="Foreground" Value="Gray"></Setter>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.RowStyle>
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn Header="Type" Binding="{Binding HerbergReportType}" IsReadOnly="True" />
|
<DataGridTextColumn Header="Type" Binding="{Binding HerbergReportType}" IsReadOnly="True" />
|
||||||
<DataGridTextColumn Header="IMO" Binding="{Binding IMO}" IsReadOnly="True" />
|
<DataGridTextColumn Header="IMO" Binding="{Binding IMO}" IsReadOnly="True" />
|
||||||
|
|||||||
@ -24,6 +24,7 @@ namespace ENI2.Util
|
|||||||
private static Brush textBoxDefaultColor;
|
private static Brush textBoxDefaultColor;
|
||||||
private static Brush intUpDownDefaultColor;
|
private static Brush intUpDownDefaultColor;
|
||||||
private static Brush doubleUpDownDefaultColor;
|
private static Brush doubleUpDownDefaultColor;
|
||||||
|
private static Brush checkBoxDefaultColor;
|
||||||
|
|
||||||
#region Construction
|
#region Construction
|
||||||
|
|
||||||
@ -192,6 +193,21 @@ namespace ENI2.Util
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(control is CheckBox)
|
||||||
|
{
|
||||||
|
CheckBox cb = (CheckBox)control;
|
||||||
|
if (checkBoxDefaultColor == null)
|
||||||
|
checkBoxDefaultColor = cb.Background;
|
||||||
|
|
||||||
|
switch(highlightStyle)
|
||||||
|
{
|
||||||
|
case HighlightStyle.ERROR:
|
||||||
|
cb.Background = new SolidColorBrush(Color.FromArgb(150, 255, 0, 0));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@ using System.Threading.Tasks;
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using System.Windows.Markup.Primitives;
|
using System.Windows.Markup.Primitives;
|
||||||
|
using bsmd.database;
|
||||||
|
|
||||||
namespace ENI2.Util
|
namespace ENI2.Util
|
||||||
{
|
{
|
||||||
@ -102,6 +103,8 @@ namespace ENI2.Util
|
|||||||
ICollection<DependencyObject> sources)
|
ICollection<DependencyObject> sources)
|
||||||
{
|
{
|
||||||
var dependencyProperties = new List<DependencyProperty>();
|
var dependencyProperties = new List<DependencyProperty>();
|
||||||
|
if ((dependencyObject == null) || (propertyName.IsNullOrEmpty())) return; // sanity
|
||||||
|
|
||||||
dependencyProperties.AddRange(MarkupWriter.GetMarkupObjectFor(dependencyObject).Properties.Where(x => x.DependencyProperty != null).Select(x => x.DependencyProperty).ToList());
|
dependencyProperties.AddRange(MarkupWriter.GetMarkupObjectFor(dependencyObject).Properties.Where(x => x.DependencyProperty != null).Select(x => x.DependencyProperty).ToList());
|
||||||
dependencyProperties.AddRange(MarkupWriter.GetMarkupObjectFor(dependencyObject).Properties.Where(x => x.IsAttached && x.DependencyProperty != null).Select(x => x.DependencyProperty).ToList());
|
dependencyProperties.AddRange(MarkupWriter.GetMarkupObjectFor(dependencyObject).Properties.Where(x => x.IsAttached && x.DependencyProperty != null).Select(x => x.DependencyProperty).ToList());
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
15
nsw/Source/SQL/ValidationRule.sql
Normal file
15
nsw/Source/SQL/ValidationRule.sql
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
CREATE TABLE [dbo].[ValidationRule] (
|
||||||
|
[Id] UNIQUEIDENTIFIER NOT NULL,
|
||||||
|
[Name] NVARCHAR (100) NULL,
|
||||||
|
[Context] NVARCHAR (255) NULL,
|
||||||
|
[Rule] NVARCHAR (MAX) NULL,
|
||||||
|
[Changed] DATETIME NULL,
|
||||||
|
[ChangedBy] NVARCHAR (100) NULL,
|
||||||
|
[Created] DATETIME NULL,
|
||||||
|
[CreatedBy] NVARCHAR (100) NULL,
|
||||||
|
[IsActive] BIT NULL,
|
||||||
|
CONSTRAINT [PK_Table] PRIMARY KEY CLUSTERED ([Id] ASC)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
GO
|
||||||
@ -315,6 +315,11 @@ namespace bsmd.ExcelReadService
|
|||||||
{
|
{
|
||||||
reader.Conf.ConfirmText(bpolLocode, poi.PortOfItineraryLocode, ExcelReader.ReadState.WARN);
|
reader.Conf.ConfirmText(bpolLocode, poi.PortOfItineraryLocode, ExcelReader.ReadState.WARN);
|
||||||
}
|
}
|
||||||
|
if(poi.PortOfItineraryName.IsNullOrEmpty() && !poi.PortOfItineraryLocode.IsNullOrEmpty() && (poi.PortOfItineraryLocode.Length == 5))
|
||||||
|
{
|
||||||
|
poi.PortOfItineraryName = LocodeDB.PortNameFromLocode(poi.PortOfItineraryLocode);
|
||||||
|
}
|
||||||
|
|
||||||
poi.PortOfItineraryETA = reader.ReadDateTime(bpolETADate, bpolETATime);
|
poi.PortOfItineraryETA = reader.ReadDateTime(bpolETADate, bpolETATime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,7 @@ namespace bsmd.database
|
|||||||
private static DBManager _instance;
|
private static DBManager _instance;
|
||||||
private static ILog _log = LogManager.GetLogger(typeof(DBManager));
|
private static ILog _log = LogManager.GetLogger(typeof(DBManager));
|
||||||
private static Dictionary<Guid, ReportingParty> allReportingParties;
|
private static Dictionary<Guid, ReportingParty> allReportingParties;
|
||||||
private static Dictionary<string, PortArea> allPortAreas;
|
private static Dictionary<string, PortArea> allPortAreas;
|
||||||
private object _lock = new object();
|
private object _lock = new object();
|
||||||
private bool _closeConnectionAfterUse = false;
|
private bool _closeConnectionAfterUse = false;
|
||||||
|
|
||||||
@ -365,6 +365,19 @@ namespace bsmd.database
|
|||||||
return DBManager.allReportingParties;
|
return DBManager.allReportingParties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ValidationRule> GetValidationRules()
|
||||||
|
{
|
||||||
|
ValidationRule vr = new ValidationRule();
|
||||||
|
SqlCommand cmd = new SqlCommand();
|
||||||
|
vr.PrepareLoadCommand(cmd, Message.LoadFilter.ALL);
|
||||||
|
SqlDataReader reader = this.PerformCommand(cmd);
|
||||||
|
List<DatabaseEntity> allRules = vr.LoadList(reader);
|
||||||
|
List<ValidationRule> result = new List<ValidationRule>();
|
||||||
|
foreach (ValidationRule aVR in allRules)
|
||||||
|
result.Add(aVR);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public Dictionary<string, PortArea> GetPortAreaDict()
|
public Dictionary<string, PortArea> GetPortAreaDict()
|
||||||
{
|
{
|
||||||
if(DBManager.allPortAreas == null)
|
if(DBManager.allPortAreas == null)
|
||||||
@ -672,10 +685,12 @@ namespace bsmd.database
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* Meldung ist überflüssig
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_log.DebugFormat("cannot create a message class for notification type {0}", message.MessageNotificationClass);
|
_log.DebugFormat("cannot create a message class for notification type {0}", message.MessageNotificationClass);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -53,7 +53,7 @@ namespace bsmd.database
|
|||||||
|
|
||||||
[ShowReport]
|
[ShowReport]
|
||||||
[LookupName("INFO.PortArea")]
|
[LookupName("INFO.PortArea")]
|
||||||
[Validation(ValidationCode.NOT_NULL)]
|
// [Validation(ValidationCode.NOT_NULL)] // ist bei NOK Transit leer
|
||||||
[MaxLength(50)]
|
[MaxLength(50)]
|
||||||
public string PortArea { get; set; }
|
public string PortArea { get; set; }
|
||||||
|
|
||||||
|
|||||||
@ -72,7 +72,7 @@ namespace bsmd.database
|
|||||||
|
|
||||||
public override void PrepareLoadCommand(IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
|
public override void PrepareLoadCommand(IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
|
||||||
{
|
{
|
||||||
string query = string.Format("SELECT Id, ImportHeaderId, NotificationClass, Name, Value, Identifier FROM {0} ", this.Tablename);
|
string query = string.Format("SELECT Id, ImportHeaderId, NotificationClass, Name, Value, Identifier, Status FROM {0} ", this.Tablename);
|
||||||
|
|
||||||
switch (filter)
|
switch (filter)
|
||||||
{
|
{
|
||||||
@ -134,6 +134,11 @@ namespace bsmd.database
|
|||||||
dc.AllowDBNull = true;
|
dc.AllowDBNull = true;
|
||||||
dc.DataType = Type.GetType("System.Int32");
|
dc.DataType = Type.GetType("System.Int32");
|
||||||
}
|
}
|
||||||
|
else if(p.Name == "Status")
|
||||||
|
{
|
||||||
|
dc.AllowDBNull = true;
|
||||||
|
dc.DataType = Type.GetType("System.Byte");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dc.DataType = propType;
|
dc.DataType = propType;
|
||||||
|
|||||||
@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
[assembly: AssemblyCompany("Informatikbüro Daniel Schick")]
|
[assembly: AssemblyCompany("Informatikbüro Daniel Schick")]
|
||||||
[assembly: AssemblyProduct("BSMD NSW interface")]
|
[assembly: AssemblyProduct("BSMD NSW interface")]
|
||||||
[assembly: AssemblyInformationalVersion("3.6.16")]
|
[assembly: AssemblyInformationalVersion("3.7.0")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2014-2017 Informatikbüro Daniel Schick. All rights reserved.")]
|
[assembly: AssemblyCopyright("Copyright © 2014-2017 Informatikbüro Daniel Schick. All rights reserved.")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
@ -1,4 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("3.6.16.*")]
|
[assembly: AssemblyVersion("3.7.0.*")]
|
||||||
|
|
||||||
|
|||||||
306
nsw/Source/bsmd.database/ValidationCondition.cs
Normal file
306
nsw/Source/bsmd.database/ValidationCondition.cs
Normal file
@ -0,0 +1,306 @@
|
|||||||
|
// Copyright (c) 2015-2017 schick Informatik
|
||||||
|
// Description: Validierungsbedingung, die (als Gruppe) als Validierungsregel serialisiert und
|
||||||
|
// ausgewertet wird
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
using log4net;
|
||||||
|
|
||||||
|
namespace bsmd.database
|
||||||
|
{
|
||||||
|
public class ValidationCondition : ICloneable
|
||||||
|
{
|
||||||
|
private static ILog log = LogManager.GetLogger(typeof(ValidationCondition));
|
||||||
|
|
||||||
|
public ValidationCondition() { }
|
||||||
|
|
||||||
|
public enum ConditionOperatorEnum
|
||||||
|
{
|
||||||
|
EQUAL,
|
||||||
|
NOT_EQUAL,
|
||||||
|
GREATER,
|
||||||
|
LESS
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
public string FieldName { get; set; }
|
||||||
|
|
||||||
|
public ConditionOperatorEnum ConditionOperator { get; set; }
|
||||||
|
|
||||||
|
public string Value { get; set; }
|
||||||
|
|
||||||
|
public string ErrorMessage { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region static methods
|
||||||
|
|
||||||
|
public static bool? CheckConditions(MessageCore core, List<Message> messages, ConditionGroup cGroup, out string message)
|
||||||
|
{
|
||||||
|
bool? result = null;
|
||||||
|
message = "";
|
||||||
|
bool conditionResult = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
foreach (ValidationCondition condition in cGroup.Conditions)
|
||||||
|
{
|
||||||
|
object[] otherargs = null;
|
||||||
|
|
||||||
|
// switch case type
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
string errorMessage = condition.ErrorMessage;
|
||||||
|
if (otherargs != null)
|
||||||
|
errorMessage = string.Format(errorMessage, otherargs);
|
||||||
|
|
||||||
|
result = ValidationCondition.CombineConditions(result, conditionResult, cGroup.GroupOperator);
|
||||||
|
|
||||||
|
// Fehlermeldung hinzufügen falls Bedingung verletzt wurde
|
||||||
|
if (!conditionResult && ((cGroup.GroupOperator == ConditionGroup.GroupOperatorEnum.AND) || (cGroup.GroupOperator == ConditionGroup.GroupOperatorEnum.OR)))
|
||||||
|
message += string.Format("- {0}{1}", errorMessage, Environment.NewLine);
|
||||||
|
//if (conditionResult && ((cGroup.GroupOperator == ConditionGroup.GroupOperatorEnum.NAND) || (cGroup.GroupOperator == ConditionGroup.GroupOperatorEnum.NOR)))
|
||||||
|
// message += string.Format("- {0}{1}", errorMessage, Environment.NewLine);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// check internal groups recursively
|
||||||
|
|
||||||
|
foreach (ConditionGroup subGroup in cGroup.SubGroups)
|
||||||
|
{
|
||||||
|
string subMessage = "";
|
||||||
|
bool? subResult = ValidationCondition.CheckConditions(core, messages, subGroup, out subMessage);
|
||||||
|
if (!subResult.HasValue) // an error occurred evaluating this element
|
||||||
|
{
|
||||||
|
return subResult;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = ValidationCondition.CombineConditions(result, subResult.Value, cGroup.GroupOperator);
|
||||||
|
// Fehlermeldung hinzufügen falls Bedingung verletzt wurde
|
||||||
|
if (!subResult.Value && ((cGroup.GroupOperator == ConditionGroup.GroupOperatorEnum.AND) || (cGroup.GroupOperator == ConditionGroup.GroupOperatorEnum.OR)))
|
||||||
|
message += string.Format("- {0}{1}", subMessage, Environment.NewLine);
|
||||||
|
//if (subResult.Value && ((cGroup.GroupOperator == ConditionGroup.GroupOperatorEnum.NAND) || (cGroup.GroupOperator == ConditionGroup.GroupOperatorEnum.NOR)))
|
||||||
|
// message += string.Format("- {0}{1}", subMessage, Environment.NewLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// falls in einer "OR" Gruppe eine Bedingung fehlschlägt aber die Condition nach true evaluiert
|
||||||
|
// wird die Fehlermeldung zwecks Verwirrungsvermeidung gedroppt. Dasselbe natürl. auch für NAND
|
||||||
|
if ((cGroup.GroupOperator == ConditionGroup.GroupOperatorEnum.OR) && result.Value) message = "";
|
||||||
|
//if ((cGroup.GroupOperator == ConditionGroup.GroupOperatorEnum.NAND) && !result.Value) message = "";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
message = string.Format("Validation threw exception: {0}", ex.ToString());
|
||||||
|
log.Error(message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ConditionGroup LoadFromString(string serializedConditions)
|
||||||
|
{
|
||||||
|
if ((serializedConditions == null) ||
|
||||||
|
(serializedConditions.Trim().Length == 0))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
using (StringReader sr = new StringReader(serializedConditions))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
XmlSerializer serializer = new XmlSerializer(typeof(ConditionGroup));
|
||||||
|
ConditionGroup container = serializer.Deserialize(sr) as ConditionGroup;
|
||||||
|
return container;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string SaveToString(ConditionGroup group)
|
||||||
|
{
|
||||||
|
if (group == null) return null;
|
||||||
|
|
||||||
|
using (StringWriter sw = new StringWriter())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Type theType = Type.GetType("bsmd.database.ConditionGroup, bsmd.database");
|
||||||
|
XmlSerializer serializer = new XmlSerializer(theType);
|
||||||
|
serializer.Serialize(sw, group);
|
||||||
|
return sw.ToString();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// evaluate logical group operator
|
||||||
|
/// </summary>
|
||||||
|
private static bool CombineConditions(bool? c1, bool c2, ConditionGroup.GroupOperatorEnum op)
|
||||||
|
{
|
||||||
|
if (!c1.HasValue) return c2;
|
||||||
|
switch (op)
|
||||||
|
{
|
||||||
|
case ConditionGroup.GroupOperatorEnum.AND:
|
||||||
|
return c1.Value & c2;
|
||||||
|
case ConditionGroup.GroupOperatorEnum.OR:
|
||||||
|
return c1.Value | c2;
|
||||||
|
case ConditionGroup.GroupOperatorEnum.NOT:
|
||||||
|
return !(c1.Value);
|
||||||
|
case ConditionGroup.GroupOperatorEnum.XOR:
|
||||||
|
return (c1.Value ^ c2);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsConditionTrue(string val1, string val2, ValidationCondition.ConditionOperatorEnum condition)
|
||||||
|
{
|
||||||
|
switch (condition)
|
||||||
|
{
|
||||||
|
case ValidationCondition.ConditionOperatorEnum.EQUAL:
|
||||||
|
return val1.Equals(val2);
|
||||||
|
default:
|
||||||
|
return !val1.Equals(val2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsConditionTrue(bool val1, bool val2, ValidationCondition.ConditionOperatorEnum condition)
|
||||||
|
{
|
||||||
|
switch (condition)
|
||||||
|
{
|
||||||
|
case ValidationCondition.ConditionOperatorEnum.EQUAL:
|
||||||
|
return val1.Equals(val2);
|
||||||
|
default:
|
||||||
|
return !val1.Equals(val2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsConditionTrue(DateTime val1, DateTime val2, ValidationCondition.ConditionOperatorEnum condition)
|
||||||
|
{
|
||||||
|
switch (condition)
|
||||||
|
{
|
||||||
|
case ValidationCondition.ConditionOperatorEnum.EQUAL:
|
||||||
|
return val1 == val2;
|
||||||
|
case ValidationCondition.ConditionOperatorEnum.GREATER:
|
||||||
|
return val1 > val2;
|
||||||
|
case ValidationCondition.ConditionOperatorEnum.LESS:
|
||||||
|
return val1 < val2;
|
||||||
|
case ValidationCondition.ConditionOperatorEnum.NOT_EQUAL:
|
||||||
|
return val1 != val2;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsConditionTrue(TimeSpan val1, TimeSpan val2, ValidationCondition.ConditionOperatorEnum condition)
|
||||||
|
{
|
||||||
|
switch (condition)
|
||||||
|
{
|
||||||
|
case ValidationCondition.ConditionOperatorEnum.EQUAL:
|
||||||
|
return val1 == val2;
|
||||||
|
case ValidationCondition.ConditionOperatorEnum.GREATER:
|
||||||
|
return val1 > val2;
|
||||||
|
case ValidationCondition.ConditionOperatorEnum.LESS:
|
||||||
|
return val1 < val2;
|
||||||
|
case ValidationCondition.ConditionOperatorEnum.NOT_EQUAL:
|
||||||
|
return val1 != val2;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsConditionTrue(double val1, double val2, ValidationCondition.ConditionOperatorEnum condition)
|
||||||
|
{
|
||||||
|
switch (condition)
|
||||||
|
{
|
||||||
|
case ValidationCondition.ConditionOperatorEnum.EQUAL:
|
||||||
|
return val1 == val2;
|
||||||
|
case ValidationCondition.ConditionOperatorEnum.GREATER:
|
||||||
|
return val1 > val2;
|
||||||
|
case ValidationCondition.ConditionOperatorEnum.LESS:
|
||||||
|
return val1 < val2;
|
||||||
|
case ValidationCondition.ConditionOperatorEnum.NOT_EQUAL:
|
||||||
|
return val1 != val2;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region ICloneable implementation
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
return this.MemberwiseClone();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#region class ConditionGroup
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class ConditionGroup
|
||||||
|
{
|
||||||
|
|
||||||
|
public enum GroupOperatorEnum
|
||||||
|
{
|
||||||
|
AND,
|
||||||
|
OR,
|
||||||
|
NOT,
|
||||||
|
XOR
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConditionGroup() { }
|
||||||
|
|
||||||
|
public List<ValidationCondition> Conditions
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GroupOperatorEnum GroupOperator
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ConditionGroup> SubGroups
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region struct KeyValuePairS
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
[XmlType(TypeName = "schickKeyValuePair")]
|
||||||
|
public struct KeyValuePairS<K, V>
|
||||||
|
{
|
||||||
|
public K Key { get; set; }
|
||||||
|
public V Value { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
122
nsw/Source/bsmd.database/ValidationRule.cs
Normal file
122
nsw/Source/bsmd.database/ValidationRule.cs
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
// Copyright (c) 2015-2017 schick Informatik
|
||||||
|
// Description: Klasse kapselt eine vom ENI-2 verwendete Validierungsregel
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
|
||||||
|
namespace bsmd.database
|
||||||
|
{
|
||||||
|
public class ValidationRule : DatabaseEntity
|
||||||
|
{
|
||||||
|
|
||||||
|
public ValidationRule()
|
||||||
|
{
|
||||||
|
this.tablename = "[dbo].[ValidationRule]";
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public string Context { get; set; }
|
||||||
|
|
||||||
|
public string Rule { get; set; }
|
||||||
|
|
||||||
|
public DateTime Created { get; set; }
|
||||||
|
|
||||||
|
public string CreatedBy { get; set; }
|
||||||
|
|
||||||
|
public DateTime? Changed { get; set; }
|
||||||
|
|
||||||
|
public string ChangedBy { get; set; }
|
||||||
|
|
||||||
|
public bool? IsActive { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region overrides
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return this.Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region DatabaseEntity implementation
|
||||||
|
|
||||||
|
public override List<DatabaseEntity> LoadList(IDataReader reader)
|
||||||
|
{
|
||||||
|
List<DatabaseEntity> result = new List<DatabaseEntity>();
|
||||||
|
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
ValidationRule vr = new ValidationRule();
|
||||||
|
|
||||||
|
vr.id = reader.GetGuid(0);
|
||||||
|
if (!reader.IsDBNull(1)) vr.Name = reader.GetString(1);
|
||||||
|
if (!reader.IsDBNull(2)) vr.Context = reader.GetString(2);
|
||||||
|
if (!reader.IsDBNull(3)) vr.Rule = reader.GetString(3);
|
||||||
|
if (!reader.IsDBNull(4)) vr.Changed = reader.GetDateTime(4);
|
||||||
|
if (!reader.IsDBNull(5)) vr.ChangedBy = reader.GetString(5);
|
||||||
|
if (!reader.IsDBNull(6)) vr.Created = reader.GetDateTime(6);
|
||||||
|
if (!reader.IsDBNull(7)) vr.CreatedBy = reader.GetString(7);
|
||||||
|
if (!reader.IsDBNull(8)) vr.IsActive = reader.GetBoolean(8);
|
||||||
|
|
||||||
|
result.Add(vr);
|
||||||
|
}
|
||||||
|
reader.Close();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void PrepareLoadCommand(IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
|
||||||
|
{
|
||||||
|
string query = string.Format("SELECT Id, Name, Context, [Rule], Changed, ChangedBy, Created, CreatedBy, IsActive FROM {0} ORDER BY Name",
|
||||||
|
this.Tablename);
|
||||||
|
|
||||||
|
switch (filter)
|
||||||
|
{
|
||||||
|
case Message.LoadFilter.ALL:
|
||||||
|
default:
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd.CommandText = query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void PrepareSave(IDbCommand cmd)
|
||||||
|
{
|
||||||
|
SqlCommand scmd = cmd as SqlCommand;
|
||||||
|
|
||||||
|
scmd.Parameters.AddWithNullableValue("@P1", this.Name);
|
||||||
|
scmd.Parameters.AddWithNullableValue("@P2", this.Context);
|
||||||
|
scmd.Parameters.AddWithNullableValue("@P3", this.Rule);
|
||||||
|
scmd.Parameters.AddWithNullableValue("@P4", this.Changed);
|
||||||
|
scmd.Parameters.AddWithNullableValue("@P5", this.ChangedBy);
|
||||||
|
scmd.Parameters.AddWithNullableValue("@P6", this.Created);
|
||||||
|
scmd.Parameters.AddWithNullableValue("@P7", this.CreatedBy);
|
||||||
|
scmd.Parameters.AddWithNullableValue("@P8", this.IsActive);
|
||||||
|
|
||||||
|
if (this.IsNew)
|
||||||
|
{
|
||||||
|
this.CreateId();
|
||||||
|
scmd.Parameters.AddWithValue("@ID", this.Id);
|
||||||
|
scmd.CommandText = string.Format("INSERT INTO {0} (Id, Name, Context, [Rule], Changed, ChangedBy, Created, CreatedBy, IsActive) " +
|
||||||
|
"VALUES ( @ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8 )",
|
||||||
|
this.Tablename);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scmd.Parameters.AddWithValue(@"ID", this.Id);
|
||||||
|
scmd.CommandText = string.Format("UPDATE {0} SET Name = @P1, Context = @P2, [Rule] = @P3, Changed = @P4, ChangedBy = @P5, " +
|
||||||
|
"Created = @P6, CreatedBy = @P7, IsActive = @P8 WHERE Id = @ID", this.Tablename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -121,6 +121,8 @@
|
|||||||
<Compile Include="TOWD.cs" />
|
<Compile Include="TOWD.cs" />
|
||||||
<Compile Include="Util.cs" />
|
<Compile Include="Util.cs" />
|
||||||
<Compile Include="ValidationAttribute.cs" />
|
<Compile Include="ValidationAttribute.cs" />
|
||||||
|
<Compile Include="ValidationCondition.cs" />
|
||||||
|
<Compile Include="ValidationRule.cs" />
|
||||||
<Compile Include="WAS.cs" />
|
<Compile Include="WAS.cs" />
|
||||||
<Compile Include="Waste.cs" />
|
<Compile Include="Waste.cs" />
|
||||||
<Compile Include="WasteDisposalServiceProvider.cs" />
|
<Compile Include="WasteDisposalServiceProvider.cs" />
|
||||||
|
|||||||
@ -34,6 +34,7 @@ namespace bsmd.hisnord
|
|||||||
//XNamespace ns15 = "http://api.national-single-window.de/statusForClientRequestId";
|
//XNamespace ns15 = "http://api.national-single-window.de/statusForClientRequestId";
|
||||||
XNamespace soap = "http://schemas.xmlsoap.org/soap/envelope/";
|
XNamespace soap = "http://schemas.xmlsoap.org/soap/envelope/";
|
||||||
XNamespace ns15 = "http://api.national-single-window.de/visitIdResponse";
|
XNamespace ns15 = "http://api.national-single-window.de/visitIdResponse";
|
||||||
|
XNamespace ns16 = "http://api.national-single-window.de/transitIdResponse";
|
||||||
XNamespace ladgNS = "http://api.national-single-window.de/ladg";
|
XNamespace ladgNS = "http://api.national-single-window.de/ladg";
|
||||||
XNamespace hazaNS = "http://api.national-single-window.de/haza";
|
XNamespace hazaNS = "http://api.national-single-window.de/haza";
|
||||||
XNamespace hazdNS = "http://api.national-single-window.de/hazd";
|
XNamespace hazdNS = "http://api.national-single-window.de/hazd";
|
||||||
@ -94,7 +95,7 @@ namespace bsmd.hisnord
|
|||||||
lookupName = ns15 + "VisitIdResponse";
|
lookupName = ns15 + "VisitIdResponse";
|
||||||
break;
|
break;
|
||||||
case Message.NotificationClass.TRANSIT:
|
case Message.NotificationClass.TRANSIT:
|
||||||
lookupName = ns15 + "VisitIdResponse";
|
lookupName = ns16 + "TransitIdResponse";
|
||||||
break;
|
break;
|
||||||
case Message.NotificationClass.LADG:
|
case Message.NotificationClass.LADG:
|
||||||
lookupName = ladgNS + "LADGResponse";
|
lookupName = ladgNS + "LADGResponse";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user