SERV templates (only in classic mode yet)
This commit is contained in:
parent
626b058119
commit
abc2afdc11
@ -11,7 +11,7 @@
|
|||||||
<section name="ENI2.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
<section name="ENI2.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||||
</sectionGroup>
|
</sectionGroup>
|
||||||
</configSections>
|
</configSections>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||||
</startup>
|
</startup>
|
||||||
<applicationSettings>
|
<applicationSettings>
|
||||||
@ -85,7 +85,7 @@
|
|||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.4" newVersion="9.0.0.4" />
|
<bindingRedirect oldVersion="0.0.0.0-9.0.0.6" newVersion="9.0.0.6" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
|||||||
@ -101,11 +101,40 @@
|
|||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width=".1*" />
|
<ColumnDefinition Width=".1*" />
|
||||||
<ColumnDefinition Width=".2*" />
|
<ColumnDefinition Width=".2*" />
|
||||||
<ColumnDefinition Width=".3*" />
|
<ColumnDefinition Width="26" />
|
||||||
|
<ColumnDefinition Width="26" />
|
||||||
|
<ColumnDefinition Width="26" />
|
||||||
|
<ColumnDefinition Width="26" />
|
||||||
|
<ColumnDefinition Width="26" />
|
||||||
|
|
||||||
|
<ColumnDefinition Width=".2*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textSERVTemplate}" Name="label_MaerskSeaGo" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
|
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textSERVTemplate}" Name="label_MaerskSeaGo" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
|
||||||
<ComboBox Grid.Row="0" Grid.Column="1" x:Name="comboBoxGroup" Margin="2,2,4,2" ItemsSource="{StaticResource arrList}"
|
<ComboBox Grid.Row="0" Grid.Column="1" x:Name="comboBoxGroup" Margin="2,2,4,2" DisplayMemberPath="ServiceName"
|
||||||
DisplayMemberPath="Key" SelectedValuePath="Value" SelectionChanged="comboBoxGroup_SelectionChanged" ContextMenu="{DynamicResource ClearContextMenu}" />
|
SelectionChanged="comboBoxGroup_SelectionChanged" ContextMenu="{DynamicResource ClearContextMenu}" />
|
||||||
|
<Button Name="buttonSetTemplate" Margin="2" Click="buttonSetTemplate_Click" BorderThickness="0" Background="Transparent" Grid.Column="2"
|
||||||
|
ToolTip="Apply template" HorizontalContentAlignment="Right" IsEnabled="False">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image Source="../Resources/check.png" Margin="0,0,0,0" Height="20" Width="20" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button Name="buttonEditTemplate" Grid.Column="4" Grid.Row="0" Margin="2" Click="buttonEditTemplate_Click" BorderThickness="0" Background="Transparent" ToolTip="Edit template">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image Source="../Resources/pencil.png" Margin="0,0,0,0" Height="20" Width="20" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
<Button Name="buttonNewTemplate" Grid.Column="5" Grid.Row="0" Margin="2" Click="buttonNewTemplate_Click" BorderThickness="0" Background="Transparent" ToolTip="New template">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image Source="../Resources/document_plain_new.png" Margin="0,0,0,0" Height="20" Width="20" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
<Button Name="buttonDeleteTemplate" Grid.Column="6" Grid.Row="0" Margin="2" Click="buttonDeleteTemplate_Click" BorderThickness="0" Background="Transparent" ToolTip="Delete template" IsEnabled="False">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image Source="../Resources/delete.png" Margin="0,0,0,0" Height="20" Width="20" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<enictrl:ENIDataGrid Grid.Row="1" x:Name="dataGridSERV" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
<enictrl:ENIDataGrid Grid.Row="1" x:Name="dataGridSERV" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||||
AutoGenerateColumns="False" Margin="0,5,0,0">
|
AutoGenerateColumns="False" Margin="0,5,0,0">
|
||||||
|
|||||||
@ -16,6 +16,8 @@ using ENI2.EditControls;
|
|||||||
using ENI2.Util;
|
using ENI2.Util;
|
||||||
|
|
||||||
using bsmd.database;
|
using bsmd.database;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace ENI2.DetailViewControls
|
namespace ENI2.DetailViewControls
|
||||||
{
|
{
|
||||||
@ -25,12 +27,18 @@ namespace ENI2.DetailViewControls
|
|||||||
public partial class PortNotificationDetailControl : DetailBaseControl
|
public partial class PortNotificationDetailControl : DetailBaseControl
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
|
||||||
private Message _nameMessage;
|
private Message _nameMessage;
|
||||||
private Message _infoMessage;
|
private Message _infoMessage;
|
||||||
private Message _servMessage;
|
private Message _servMessage;
|
||||||
private Message _ladgMessage;
|
private Message _ladgMessage;
|
||||||
private Message _crewaMessage;
|
private Message _crewaMessage;
|
||||||
private Dictionary<string, string> portAreas = null;
|
private Dictionary<string, string> portAreas = null;
|
||||||
|
private static List<SERV_Template> _servTemplates = null;
|
||||||
|
private SERV_Template _currentTemplate;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
private static readonly string[] shippingAreas = {
|
private static readonly string[] shippingAreas = {
|
||||||
Properties.Resources.textShippingAreaNORTHBALTIC,
|
Properties.Resources.textShippingAreaNORTHBALTIC,
|
||||||
@ -60,7 +68,7 @@ namespace ENI2.DetailViewControls
|
|||||||
this.dataGridLADG.CellEditEnding += (obj, ev) => { this.OnNotificationClassChanged(Message.NotificationClass.LADG); };
|
this.dataGridLADG.CellEditEnding += (obj, ev) => { this.OnNotificationClassChanged(Message.NotificationClass.LADG); };
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Initialize()
|
public override async void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
@ -157,16 +165,22 @@ namespace ENI2.DetailViewControls
|
|||||||
this.dataGridLADG.DeleteRequested += DataGridLADG_DeleteRequested;
|
this.dataGridLADG.DeleteRequested += DataGridLADG_DeleteRequested;
|
||||||
this.dataGridLADG.CreateRequested += DataGridLADG_CreateRequested;
|
this.dataGridLADG.CreateRequested += DataGridLADG_CreateRequested;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region init helper Maersk / SeaGo Field
|
#region init SERV templates
|
||||||
|
|
||||||
if (this.Core.IsFlagSet(MessageCore.CoreFlags.MAERSK_BHV)) this.comboBoxGroup.SelectedIndex = 1;
|
if(_servTemplates == null)
|
||||||
if (this.Core.IsFlagSet(MessageCore.CoreFlags.SEAGO_BHV)) this.comboBoxGroup.SelectedIndex = 2;
|
{
|
||||||
if (this.Core.IsFlagSet(MessageCore.CoreFlags.SEAGO_WHV)) this.comboBoxGroup.SelectedIndex = 3;
|
_servTemplates = await DBManagerAsync.GetSERVTemplatesAsync(); // initial load
|
||||||
if (this.Core.IsFlagSet(MessageCore.CoreFlags.HOEGH)) this.comboBoxGroup.SelectedIndex = 4;
|
_servTemplates.Sort();
|
||||||
if (this.Core.IsFlagSet(MessageCore.CoreFlags.ELBE_BULK)) this.comboBoxGroup.SelectedIndex = 5;
|
Trace.WriteLine($"{_servTemplates.Count} SERV templates loaded");
|
||||||
if (this.Core.IsFlagSet(MessageCore.CoreFlags.FCT_JUNGE)) this.comboBoxGroup.SelectedIndex = 6;
|
}
|
||||||
|
|
||||||
|
this.comboBoxGroup.ItemsSource = _servTemplates;
|
||||||
|
|
||||||
|
this.buttonDeleteTemplate.Visibility = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor ? Visibility.Visible : Visibility.Hidden;
|
||||||
|
this.buttonEditTemplate.Visibility = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor ? Visibility.Visible : Visibility.Hidden;
|
||||||
|
this.buttonNewTemplate.Visibility = DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsEditor ? Visibility.Visible : Visibility.Hidden;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -371,35 +385,93 @@ namespace ENI2.DetailViewControls
|
|||||||
|
|
||||||
private void comboBoxGroup_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void comboBoxGroup_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
// clear all
|
if(this.comboBoxGroup.SelectedItem is SERV_Template st)
|
||||||
this.Core.SetFlag(false, MessageCore.CoreFlags.MAERSK_BHV);
|
{
|
||||||
this.Core.SetFlag(false, MessageCore.CoreFlags.SEAGO_BHV);
|
this.buttonDeleteTemplate.IsEnabled = true;
|
||||||
this.Core.SetFlag(false, MessageCore.CoreFlags.SEAGO_WHV);
|
this.buttonSetTemplate.IsEnabled = true;
|
||||||
this.Core.SetFlag(false, MessageCore.CoreFlags.HOEGH);
|
this._currentTemplate = st;
|
||||||
this.Core.SetFlag(false, MessageCore.CoreFlags.ELBE_BULK);
|
|
||||||
this.Core.SetFlag(false, MessageCore.CoreFlags.FCT_JUNGE);
|
|
||||||
|
|
||||||
if (this.comboBoxGroup.SelectedItem == null)
|
|
||||||
{
|
|
||||||
this.comboBoxGroup.SelectedIndex = 0;
|
|
||||||
DBManager.Instance.Save(this.Core);
|
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
|
||||||
|
private void buttonSetTemplate_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (this.comboBoxGroup.SelectedItem is SERV_Template st)
|
||||||
{
|
{
|
||||||
DictionaryEntry selectedItem = (DictionaryEntry)this.comboBoxGroup.SelectedItem;
|
bool found = false;
|
||||||
if (Int32.TryParse((string)selectedItem.Value, out int selectedValue))
|
foreach (SERV serv in _servMessage.Elements.Cast<SERV>())
|
||||||
{
|
{
|
||||||
if (selectedValue == (int)MessageCore.CoreFlags.MAERSK_BHV) CheckServiceEntryMaerskBHV();
|
if (serv.ServiceName.Equals(st.ServiceName))
|
||||||
if (selectedValue == (int)MessageCore.CoreFlags.SEAGO_BHV) CheckServiceEntrySeaGoBHV();
|
{
|
||||||
if (selectedValue == (int)MessageCore.CoreFlags.HOEGH) CheckServiceEntryHoegh();
|
found = true; break;
|
||||||
if (selectedValue == (int)MessageCore.CoreFlags.ELBE_BULK) CheckServiceEntryElbeBulk();
|
}
|
||||||
if (selectedValue == (int)MessageCore.CoreFlags.FCT_JUNGE) CheckServiceEntryFctJunge();
|
}
|
||||||
this.Core.SetFlag(true, (MessageCore.CoreFlags)selectedValue);
|
|
||||||
DBManager.Instance.Save(this.Core);
|
if (!found)
|
||||||
|
{
|
||||||
|
SERV newServ = new SERV();
|
||||||
|
newServ.ServiceName = st.ServiceName;
|
||||||
|
newServ.ServiceBeneficiary = st.ServiceBeneficiary;
|
||||||
|
newServ.ServiceInvoiceRecipient = st.ServiceInvoiceRecipient;
|
||||||
|
|
||||||
|
newServ.MessageHeader = this._servMessage;
|
||||||
|
newServ.Identifier = SERV.GetNewIdentifier(_servMessage.Elements);
|
||||||
|
this._servMessage.Elements.Add(newServ);
|
||||||
|
this.dataGridSERV.Items.Refresh();
|
||||||
|
this.SublistElementChanged(Message.NotificationClass.SERV);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void buttonNewTemplate_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
SERV_Template newTemplate = new SERV_Template();
|
||||||
|
EditSERVDialog esd = new EditSERVDialog();
|
||||||
|
esd.AddVisible = false;
|
||||||
|
esd.SERV_Template = newTemplate;
|
||||||
|
if(esd.ShowDialog() ?? false)
|
||||||
|
{
|
||||||
|
_ = DBManagerAsync.SaveAsync(esd.SERV_Template);
|
||||||
|
this.comboBoxGroup.ItemsSource = null;
|
||||||
|
_servTemplates.Add(newTemplate);
|
||||||
|
_servTemplates.Sort();
|
||||||
|
this.comboBoxGroup.ItemsSource = _servTemplates;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonEditTemplate_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (this.comboBoxGroup.SelectedItem is SERV_Template st)
|
||||||
|
{
|
||||||
|
EditSERVDialog editSERVDialog = new EditSERVDialog();
|
||||||
|
editSERVDialog.AddVisible = false;
|
||||||
|
editSERVDialog.SERV_Template = st;
|
||||||
|
if (editSERVDialog.ShowDialog() ?? false)
|
||||||
|
{
|
||||||
|
_ = DBManagerAsync.SaveAsync(st);
|
||||||
|
this.comboBoxGroup.ItemsSource = null;
|
||||||
|
_servTemplates.Sort();
|
||||||
|
this.comboBoxGroup.ItemsSource = _servTemplates;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonDeleteTemplate_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (_currentTemplate != null)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Delete this template?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
|
this.comboBoxGroup.SelectedItem = null;
|
||||||
|
this.comboBoxGroup.ItemsSource = null;
|
||||||
|
_ = DBManagerAsync.DeleteAsync(_currentTemplate);
|
||||||
|
_servTemplates.Remove(_currentTemplate);
|
||||||
|
this.buttonDeleteTemplate.IsEnabled = false;
|
||||||
|
this.comboBoxGroup.ItemsSource = _servTemplates;
|
||||||
|
this.buttonSetTemplate.IsEnabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region special entry ship service check
|
#region special entry ship service check
|
||||||
@ -538,17 +610,7 @@ namespace ENI2.DetailViewControls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private void MenuItem_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void contextMenuClearMaersk_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonCopyNameFromCREWA_Click(object sender, RoutedEventArgs e)
|
private void buttonCopyNameFromCREWA_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
@ -568,5 +630,6 @@ namespace ENI2.DetailViewControls
|
|||||||
this.SublistElementChanged(Message.NotificationClass.NAME);
|
this.SublistElementChanged(Message.NotificationClass.NAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1047,6 +1047,7 @@
|
|||||||
<Content Include="Report\Logo.png">
|
<Content Include="Report\Logo.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Resource Include="Resources\pencil.png" />
|
||||||
<Content Include="x64\SQLite.Interop.dll">
|
<Content Include="x64\SQLite.Interop.dll">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
// Copyright (c) 2017 schick Informatik
|
// Copyright (c) 2017 schick Informatik
|
||||||
// Description:
|
// Description: Edit SERV and SERV_template entities
|
||||||
//
|
//
|
||||||
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
@ -14,36 +14,78 @@ namespace ENI2.EditControls
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class EditSERVDialog : EditWindowBase
|
public partial class EditSERVDialog : EditWindowBase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#region Construction
|
||||||
|
|
||||||
public EditSERVDialog()
|
public EditSERVDialog()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Loaded += EditSERVDialog_Loaded;
|
Loaded += EditSERVDialog_Loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
public SERV SERV { get; set; }
|
||||||
|
|
||||||
|
public SERV_Template SERV_Template { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region event handler
|
||||||
|
|
||||||
private void EditSERVDialog_Loaded(object sender, RoutedEventArgs e)
|
private void EditSERVDialog_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
this.OKClicked += EditSERVDialog_OKClicked;
|
this.OKClicked += EditSERVDialog_OKClicked;
|
||||||
|
|
||||||
// copy into fields
|
// copy into fields
|
||||||
this.textBoxServiceName.Text = this.SERV.ServiceName;
|
if (this.SERV != null)
|
||||||
this.textBoxServiceBeneficiary.Text = this.SERV.ServiceBeneficiary;
|
{
|
||||||
this.textBoxServiceInvoiceRecipient.Text = this.SERV.ServiceInvoiceRecipient;
|
this.textBoxServiceName.Text = this.SERV.ServiceName;
|
||||||
this.AddVisible = true;
|
this.textBoxServiceBeneficiary.Text = this.SERV.ServiceBeneficiary;
|
||||||
|
this.textBoxServiceInvoiceRecipient.Text = this.SERV.ServiceInvoiceRecipient;
|
||||||
|
this.AddVisible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.SERV_Template != null)
|
||||||
|
{
|
||||||
|
this.textBoxServiceName.Text = this.SERV_Template.ServiceName;
|
||||||
|
this.textBoxServiceBeneficiary.Text = this.SERV_Template.ServiceBeneficiary;
|
||||||
|
this.textBoxServiceInvoiceRecipient.Text = this.SERV_Template.ServiceInvoiceRecipient;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
private void EditSERVDialog_OKClicked()
|
||||||
|
{
|
||||||
|
this.CopyValuesToEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region public methods
|
||||||
|
|
||||||
public void CopyValuesToEntity()
|
public void CopyValuesToEntity()
|
||||||
{
|
{
|
||||||
// copy back
|
|
||||||
this.SERV.ServiceName = this.textBoxServiceName.Text.Trim();
|
if (this.SERV != null)
|
||||||
this.SERV.ServiceBeneficiary = this.textBoxServiceBeneficiary.Text.Trim();
|
{
|
||||||
this.SERV.ServiceInvoiceRecipient = this.textBoxServiceInvoiceRecipient.Text.Trim();
|
// copy back
|
||||||
|
this.SERV.ServiceName = this.textBoxServiceName.Text.Trim();
|
||||||
|
this.SERV.ServiceBeneficiary = this.textBoxServiceBeneficiary.Text.Trim();
|
||||||
|
this.SERV.ServiceInvoiceRecipient = this.textBoxServiceInvoiceRecipient.Text.Trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.SERV_Template != null)
|
||||||
|
{
|
||||||
|
// copy back
|
||||||
|
this.SERV_Template.ServiceName = this.textBoxServiceName.Text.Trim();
|
||||||
|
this.SERV_Template.ServiceBeneficiary = this.textBoxServiceBeneficiary.Text.Trim();
|
||||||
|
this.SERV_Template.ServiceInvoiceRecipient = this.textBoxServiceInvoiceRecipient.Text.Trim();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EditSERVDialog_OKClicked()
|
#endregion
|
||||||
{
|
|
||||||
this.CopyValuesToEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
public SERV SERV { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
10
ENI2/Properties/Resources.Designer.cs
generated
10
ENI2/Properties/Resources.Designer.cs
generated
@ -750,6 +750,16 @@ namespace ENI2.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
public static System.Drawing.Bitmap pencil {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("pencil", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -2242,4 +2242,7 @@
|
|||||||
<data name="textSERVTemplate" xml:space="preserve">
|
<data name="textSERVTemplate" xml:space="preserve">
|
||||||
<value>SERV-Template</value>
|
<value>SERV-Template</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="pencil" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\pencil.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
BIN
ENI2/Resources/pencil.png
Normal file
BIN
ENI2/Resources/pencil.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
25
SQL/SERV_template.sql
Normal file
25
SQL/SERV_template.sql
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
PRINT N'Creating [dbo].[SERV_template]...';
|
||||||
|
|
||||||
|
GO
|
||||||
|
CREATE TABLE [dbo].[SERV_template] (
|
||||||
|
[Id] UNIQUEIDENTIFIER NOT NULL,
|
||||||
|
[ServiceName] NVARCHAR (100) NULL,
|
||||||
|
[ServiceBeneficiary] NVARCHAR (256) NULL,
|
||||||
|
[ServiceInvoiceRecipient] NVARCHAR (256) NULL,
|
||||||
|
[Created] DATETIME NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
[Changed] DATETIME NULL,
|
||||||
|
PRIMARY KEY CLUSTERED ([Id] ASC)
|
||||||
|
);
|
||||||
|
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE TRIGGER SERV_template_Trigger_Change_Log
|
||||||
|
ON
|
||||||
|
dbo.SERV_template
|
||||||
|
FOR UPDATE
|
||||||
|
AS
|
||||||
|
SET NOCOUNT ON
|
||||||
|
IF NOT UPDATE([Changed])
|
||||||
|
UPDATE SERV_template SET [Changed] = GETDATE() WHERE Id IN (SELECT Id FROM [inserted])
|
||||||
|
|
||||||
|
GO
|
||||||
@ -112,6 +112,16 @@ namespace bsmd.database
|
|||||||
return (await at.LoadListAsync(reader)).ConvertAll(x => (AGNT_Template)x);
|
return (await at.LoadListAsync(reader)).ConvertAll(x => (AGNT_Template)x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async Task<List<SERV_Template>> GetSERVTemplatesAsync()
|
||||||
|
{
|
||||||
|
SqlCommand cmd = new SqlCommand();
|
||||||
|
SERV_Template st = new SERV_Template();
|
||||||
|
st.PrepareLoadCommand(cmd, Message.LoadFilter.ALL);
|
||||||
|
SqlDataReader reader = await PerformCommandAsync(cmd);
|
||||||
|
return (await st.LoadListAsync(reader)).ConvertAll(x => (SERV_Template)x);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static async Task<List<WasteDisposalServiceProvider_Template>> GetWastDisposalServiceProviderTemplatesAsync()
|
public static async Task<List<WasteDisposalServiceProvider_Template>> GetWastDisposalServiceProviderTemplatesAsync()
|
||||||
{
|
{
|
||||||
SqlCommand cmd = new SqlCommand();
|
SqlCommand cmd = new SqlCommand();
|
||||||
|
|||||||
128
bsmd.database/SERV_Template.cs
Normal file
128
bsmd.database/SERV_Template.cs
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
// Copyright (c) 2024-present schick Informatik
|
||||||
|
// Description:
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace bsmd.database
|
||||||
|
{
|
||||||
|
public class SERV_Template : DatabaseEntityAsync, IComparable
|
||||||
|
{
|
||||||
|
#region Construction
|
||||||
|
|
||||||
|
public SERV_Template()
|
||||||
|
{
|
||||||
|
this.tablename = "[dbo].[SERV_template]";
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
[MaxLength(99)]
|
||||||
|
public string ServiceName { get; set; }
|
||||||
|
|
||||||
|
[MaxLength(255)]
|
||||||
|
public string ServiceBeneficiary { get; set; }
|
||||||
|
|
||||||
|
[MaxLength(255)]
|
||||||
|
public string ServiceInvoiceRecipient { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region DatabaseEntity implementation
|
||||||
|
|
||||||
|
public override void PrepareSave(IDbCommand cmd)
|
||||||
|
{
|
||||||
|
SqlCommand scmd = cmd as SqlCommand;
|
||||||
|
|
||||||
|
if (this.ServiceName != null) scmd.Parameters.AddWithValue("@P1", this.ServiceName);
|
||||||
|
else scmd.Parameters.AddWithValue("@P1", DBNull.Value);
|
||||||
|
if (this.ServiceBeneficiary != null) scmd.Parameters.AddWithValue(@"P2", this.ServiceBeneficiary);
|
||||||
|
else scmd.Parameters.AddWithValue("@P2", DBNull.Value);
|
||||||
|
if (this.ServiceInvoiceRecipient != null) scmd.Parameters.AddWithValue("@P3", this.ServiceInvoiceRecipient);
|
||||||
|
else scmd.Parameters.AddWithValue("@P3", DBNull.Value);
|
||||||
|
|
||||||
|
if (this.IsNew)
|
||||||
|
{
|
||||||
|
this.CreateId();
|
||||||
|
cmd.CommandText = string.Format("INSERT INTO {0} (Id, ServiceName, ServiceBeneficiary, ServiceInvoiceRecipient) VALUES " +
|
||||||
|
"(@ID, @P1, @P2, @P3)", this.Tablename);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cmd.CommandText = string.Format("UPDATE {0} SET ServiceName = @P1, ServiceBeneficiary = @P2, ServiceInvoiceRecipient = @P3 WHERE Id = @ID", this.Tablename);
|
||||||
|
}
|
||||||
|
scmd.Parameters.AddWithValue("@ID", this.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void PrepareLoadCommand(IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
|
||||||
|
{
|
||||||
|
string query = string.Format("SELECT Id, ServiceName, ServiceBeneficiary, ServiceInvoiceRecipient FROM {0}", this.Tablename);
|
||||||
|
|
||||||
|
switch (filter)
|
||||||
|
{
|
||||||
|
case Message.LoadFilter.ALL:
|
||||||
|
default:
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
cmd.CommandText = query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override List<DatabaseEntity> LoadList(System.Data.IDataReader reader)
|
||||||
|
{
|
||||||
|
List<DatabaseEntity> result = new List<DatabaseEntity>();
|
||||||
|
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
SERV_Template serv_t = new SERV_Template();
|
||||||
|
serv_t.id = reader.GetGuid(0);
|
||||||
|
if (!reader.IsDBNull(1)) serv_t.ServiceName = reader.GetString(1);
|
||||||
|
if (!reader.IsDBNull(2)) serv_t.ServiceBeneficiary = reader.GetString(2);
|
||||||
|
if (!reader.IsDBNull(3)) serv_t.ServiceInvoiceRecipient = reader.GetString(3);
|
||||||
|
|
||||||
|
result.Add(serv_t);
|
||||||
|
}
|
||||||
|
reader.Close();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override DatabaseEntityAsync ReadRowFromReader(IDataReader reader)
|
||||||
|
{
|
||||||
|
SERV_Template serv_t = null;
|
||||||
|
if (reader != null)
|
||||||
|
{
|
||||||
|
serv_t = new SERV_Template();
|
||||||
|
serv_t.id = reader.GetGuid(0);
|
||||||
|
if (!reader.IsDBNull(1)) serv_t.ServiceName = reader.GetString(1);
|
||||||
|
if (!reader.IsDBNull(2)) serv_t.ServiceBeneficiary = reader.GetString(2);
|
||||||
|
if (!reader.IsDBNull(3)) serv_t.ServiceInvoiceRecipient = reader.GetString(3);
|
||||||
|
|
||||||
|
}
|
||||||
|
return serv_t;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region IComparable implementation
|
||||||
|
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is SERV_Template template)
|
||||||
|
{
|
||||||
|
return this.ServiceName.CompareTo(template.ServiceName);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -173,6 +173,7 @@
|
|||||||
<Compile Include="SanitaryMeasuresDetail.cs" />
|
<Compile Include="SanitaryMeasuresDetail.cs" />
|
||||||
<Compile Include="SEC.cs" />
|
<Compile Include="SEC.cs" />
|
||||||
<Compile Include="SERV.cs" />
|
<Compile Include="SERV.cs" />
|
||||||
|
<Compile Include="SERV_Template.cs" />
|
||||||
<Compile Include="ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.cs" />
|
<Compile Include="ShipToShipActivitiesDuringLastTenPortFacilitiesCalled.cs" />
|
||||||
<Compile Include="ShowReportAttribute.cs" />
|
<Compile Include="ShowReportAttribute.cs" />
|
||||||
<Compile Include="SOAPLoggerExtension.cs" />
|
<Compile Include="SOAPLoggerExtension.cs" />
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user