diff --git a/ENI2/Controls/EasyPeasyControl.xaml b/ENI2/Controls/EasyPeasyControl.xaml
index 8939797e..1cec118d 100644
--- a/ENI2/Controls/EasyPeasyControl.xaml
+++ b/ENI2/Controls/EasyPeasyControl.xaml
@@ -76,8 +76,8 @@
+ AutoGenerateColumns="False" SelectionMode="Extended" x:Name="dataGridGoodsItems" CanUserAddRows="False"
+ PreviewKeyDown="DataGrid_PreviewKeyDown">
diff --git a/ENI2/Controls/EasyPeasyControl.xaml.cs b/ENI2/Controls/EasyPeasyControl.xaml.cs
index 0b1380de..bc5406a4 100644
--- a/ENI2/Controls/EasyPeasyControl.xaml.cs
+++ b/ENI2/Controls/EasyPeasyControl.xaml.cs
@@ -14,6 +14,7 @@ using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
+using System.Windows.Media.Imaging;
using System.Xml;
using System.Xml.Serialization;
@@ -30,7 +31,22 @@ namespace ENI2.Controls
public EasyPeasyControl()
{
InitializeComponent();
- }
+
+ this.dataGridGoodsItems.ContextMenu = new ContextMenu();
+
+ MenuItem addItem = new MenuItem();
+ addItem.Header = Properties.Resources.textAdd;
+ addItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/add.png")) };
+ addItem.Click += AddItem_Click;
+ this.dataGridGoodsItems.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 += DeleteItem_Click;
+ this.dataGridGoodsItems.ContextMenu.Items.Add(deleteItem);
+
+ }
public void SaveState()
{
@@ -39,7 +55,33 @@ namespace ENI2.Controls
EasyPeasyState.Save(_vm);
}
catch { }
- }
+ }
+
+ #region context menu event handler
+
+ private void AddItem_Click(object sender, RoutedEventArgs e)
+ {
+ if (_vm?.ProofInformationT2LT2LF?.GoodsShipmentForT2LT2LF?.GoodsItemsForT2LT2LF == null) return;
+ var list = _vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF;
+ int nextItemNo = list.Any() ? list.Max(x => x.GoodsItemNumber) + 1 : 1;
+ var item = new GoodsItemForT2LT2LF
+ {
+ GoodsItemNumber = nextItemNo
+ };
+ list.Add(item);
+ }
+
+ private void DeleteItem_Click(object sender, RoutedEventArgs e)
+ {
+ foreach(GoodsItemForT2LT2LF item in this.dataGridGoodsItems.SelectedItems.Cast().ToArray())
+ {
+ if (_vm?.ProofInformationT2LT2LF?.GoodsShipmentForT2LT2LF?.GoodsItemsForT2LT2LF == null) return;
+ var list = _vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF;
+ list.Remove(item);
+ }
+ }
+
+ #endregion
#region button event handler
@@ -108,7 +150,8 @@ namespace ENI2.Controls
// after loading/creating _vm
if (_vm.ProofInformationT2LT2LF?.GoodsShipmentForT2LT2LF?.GoodsItemsForT2LT2LF == null)
_vm.ProofInformationT2LT2LF.GoodsShipmentForT2LT2LF.GoodsItemsForT2LT2LF = new ObservableCollection();
-
+
+ _vm.ProofInformationT2LT2LF.DeclarationDate = DateTime.Now; // reset to today
this.DataContext = _vm;
}
@@ -130,6 +173,7 @@ namespace ENI2.Controls
LocationOfGoods = new LocationOfGoods(),
TransportDocuments = new TransportDocuments()
};
+ _vm.ProofInformationT2LT2LF.DeclarationDate = DateTime.Now; // reset to today
this.DataContext = _vm;
}
@@ -287,6 +331,10 @@ namespace ENI2.Controls
item.GoodsMeasure.NetMass = net;
}
+ item.DescriptionOfGoods = "Brand New Vehicles"; // per spec
+ item.Packaging.TypeOfPackages = "UN"; // per spec
+ item.Packaging.ShippingMarks = "-"; // per spec
+
list.Add(item);
anyAdded = true;
}
diff --git a/ENI2/SheetDisplayControls/PortControl.xaml.cs b/ENI2/SheetDisplayControls/PortControl.xaml.cs
index b0cb6a32..ddcef7cc 100644
--- a/ENI2/SheetDisplayControls/PortControl.xaml.cs
+++ b/ENI2/SheetDisplayControls/PortControl.xaml.cs
@@ -7,7 +7,6 @@ using ENI2.EditControls;
using ExcelDataReader;
using Microsoft.Win32;
using System;
-using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
@@ -33,8 +32,7 @@ namespace ENI2.SheetDisplayControls
private AGNT _agnt;
private SEC _sec;
private WAS _was;
- private Message _stoMessage;
- // private Message _crewMessage;
+ private Message _stoMessage;
private Dictionary portAreas = null;