Fixed bug and added functionality to BKRD, LADG and WAS_RCPT

This commit is contained in:
Daniel Schick 2024-08-24 07:19:24 +02:00
parent a90aa4b1ab
commit c46881698f
7 changed files with 84 additions and 13 deletions

View File

@ -38,9 +38,9 @@ namespace ENI2.DetailViewControls
this.RegisterIntegerUpDownChange(this.integerUpDownCrewMemberOnBoard, Message.NotificationClass.POBA);
this.RegisterIntegerUpDownChange(this.integerUpDownPassengersOnBoard, Message.NotificationClass.POBA);
this.RegisterIntegerUpDownChange(this.integerUpDownPersonsOnBoard, Message.NotificationClass.POBA);
this.RegisterIntegerUpDownChange(this.integerUpDownStowawaysOnBoard, Message.NotificationClass.POBA);
startupComplete = true;
this.RegisterIntegerUpDownChange(this.integerUpDownStowawaysOnBoard, Message.NotificationClass.POBA);
this.dataGridBKRA.CellEditEnding += (obj, ev) => { this.SublistElementChanged(Message.NotificationClass.BKRA); };
startupComplete = true;
}
public override void Initialize()
@ -184,6 +184,8 @@ namespace ENI2.DetailViewControls
private void DataGridBKRA_CreateRequested()
{
this.dataGridBKRA.CancelEdit();
this.dataGridBKRA.CancelEdit();
EditBKRDialog ebd = new EditBKRDialog();
ebd.BRKA = new BRKA();
ebd.BRKA.Identifier = BRKA.GetNewIdentifier(this._bkraMessage.Elements);
@ -216,6 +218,8 @@ namespace ENI2.DetailViewControls
{
if (obj is BRKA brka)
{
this.dataGridBKRA.CancelEdit();
this.dataGridBKRA.CancelEdit();
// are you sure dialog is in base class
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(brka);
this._bkraMessage.Elements.Remove(brka);
@ -226,8 +230,11 @@ namespace ENI2.DetailViewControls
}
private void DataGridBKRA_EditRequested(DatabaseEntity obj)
{
{
// I am not shitting you: this has to be called TWICE(!) in a row in order to work
// see: https://stackoverflow.com/questions/20204592/wpf-datagrid-refresh-is-not-allowed-during-an-addnew-or-edititem-transaction-m
this.dataGridBKRA.CancelEdit();
this.dataGridBKRA.CancelEdit();
EditBKRDialog eld = new EditBKRDialog();
eld.IsDeparture = false;
eld.BRKA = obj as BRKA;

View File

@ -70,8 +70,24 @@
AutoGenerateColumns="False" Margin="0,5,0,0">
<DataGrid.Columns>
<DataGridTextColumn Header="" Binding="{Binding Identifier}" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static p:Resources.textBunkerType}" Binding="{Binding BunkerFuelType}" IsReadOnly="True" Width="0.2*" />
<DataGridTextColumn Header="{x:Static p:Resources.textBunkerQuantity}" Binding="{Binding BunkerFuelQuantity_TNE, Mode=TwoWay}" IsReadOnly="True" Width="0.8*" />
<DataGridTextColumn Header="{x:Static p:Resources.textBunkerType}" Width="0.2*">
<DataGridTextColumn.Binding>
<Binding Path="BunkerFuelType" Mode="TwoWay">
<Binding.ValidationRules>
<util:StringValidationRule MaxLength="100" />
</Binding.ValidationRules>
</Binding>
</DataGridTextColumn.Binding>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textBunkerQuantity}" IsReadOnly="False" Width="0.8*">
<DataGridTextColumn.Binding>
<Binding Path="BunkerFuelQuantity_TNE" Mode="TwoWay">
<Binding.ValidationRules>
<util:NumberValidationRule MaxValue="10000" />
</Binding.ValidationRules>
</Binding>
</DataGridTextColumn.Binding>
</DataGridTextColumn>
</DataGrid.Columns>
</enictrl:ENIDataGrid>
</GroupBox>

View File

@ -40,6 +40,7 @@ namespace ENI2.DetailViewControls
this.RegisterIntegerUpDownChange(this.integerUpDownPassengersOnBoard, Message.NotificationClass.POBD);
this.RegisterIntegerUpDownChange(this.integerUpDownPersonsOnBoard, Message.NotificationClass.POBD);
this.RegisterIntegerUpDownChange(this.integerUpDownStowawaysOnBoard, Message.NotificationClass.POBD);
this.dataGridBKRD.CellEditEnding += (obj, ev) => { this.OnNotificationClassChanged(Message.NotificationClass.BKRD); };
startupComplete = true;
}
@ -167,6 +168,8 @@ namespace ENI2.DetailViewControls
private void DataGridBKRD_CreateRequested()
{
this.dataGridBKRD.CancelEdit();
this.dataGridBKRD.CancelEdit();
EditBKRDialog ebd = new EditBKRDialog();
ebd.IsDeparture = true;
ebd.BRKD = new BRKD();
@ -199,6 +202,8 @@ namespace ENI2.DetailViewControls
{
if (obj is BRKD brkd)
{
this.dataGridBKRD.CancelEdit();
this.dataGridBKRD.CancelEdit();
// are you sure dialog is in base class
this._bkrdMessage.Elements.Remove(brkd);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(brkd);
@ -210,6 +215,8 @@ namespace ENI2.DetailViewControls
private void DataGridBKRD_EditRequested(DatabaseEntity obj)
{
this.dataGridBKRD.CancelEdit();
this.dataGridBKRD.CancelEdit();
EditBKRDialog eld = new EditBKRDialog();
eld.IsDeparture = true;
eld.BRKD = obj as BRKD;

View File

@ -105,8 +105,27 @@
<DataGridTextColumn Header="{x:Static p:Resources.textLACodes}" Binding="{Binding CargoLACode, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textCargoCodeNST}" Binding="{Binding CargoCodeNST, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textCargoCodeNST3}" Binding="{Binding CargoCodeNST_3, Mode=TwoWay}" IsReadOnly="True" Width="0.15*" />
<DataGridTextColumn Header="{x:Static p:Resources.textCargoNumberOfItems}" Binding="{Binding CargoNumberOfItems, Mode=TwoWay}" IsReadOnly="True" Width="0.15*" />
<DataGridTextColumn Header="{x:Static p:Resources.textCargoGrossQuantity}" Binding="{Binding CargoGrossQuantity_TNE, Mode=TwoWay, StringFormat={}{0:N3}}" IsReadOnly="True" Width="0.15*" />
<DataGridTextColumn Header="{x:Static p:Resources.textCargoNumberOfItems}" IsReadOnly="False" Width="0.15*">
<DataGridTextColumn.Binding>
<Binding Path="CargoNumberOfItems" Mode="TwoWay">
<Binding.ValidationRules>
<util:NumberValidationRule MaxValue="9999999" />
</Binding.ValidationRules>
</Binding>
</DataGridTextColumn.Binding>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textCargoGrossQuantity}" IsReadOnly="False" Width="0.15*">
<DataGridTextColumn.Binding>
<Binding Path="CargoGrossQuantity_TNE" Mode="TwoWay" StringFormat="N3">
<Binding.ValidationRules>
<util:NumberValidationRule MaxValue="1000000" MinValue="0" />
</Binding.ValidationRules>
</Binding>
</DataGridTextColumn.Binding>
</DataGridTextColumn>
<DataGridTextColumn Header="{x:Static p:Resources.textCargoPortOfLoading}" Binding="{Binding PortOfLoading, Mode=TwoWay}" IsReadOnly="True" Width="0.15*" />
<DataGridTextColumn Header="{x:Static p:Resources.textCargoPortOfDischarge}" Binding="{Binding PortOfDischarge, Mode=TwoWay}" IsReadOnly="True" Width="0.15*" />
</DataGrid.Columns>

View File

@ -56,7 +56,7 @@ namespace ENI2.DetailViewControls
this.RegisterDoubleUpDownChange(this.doubleUpDownDisplacementSummerDraught, Message.NotificationClass.INFO);
this.RegisterTextboxChange(this.textSpecialRequirements, Message.NotificationClass.INFO);
this.RegisterTextboxChange(this.textConstructionCharacteristics, Message.NotificationClass.INFO);
this.dataGridLADG.CellEditEnding += (obj, ev) => { this.OnNotificationClassChanged(Message.NotificationClass.LADG); };
}
public override void Initialize()
@ -174,6 +174,8 @@ namespace ENI2.DetailViewControls
private void DataGridLADG_CreateRequested()
{
this.dataGridLADG.CancelEdit();
this.dataGridLADG.CancelEdit();
EditLADGDialog eld = new EditLADGDialog();
eld.LADG = new LADG();
eld.LADG.MessageHeader = _ladgMessage;
@ -206,6 +208,8 @@ namespace ENI2.DetailViewControls
{
if (obj is LADG ladg)
{
this.dataGridLADG.CancelEdit();
this.dataGridLADG.CancelEdit();
// are you sure dialog is in base class
this._ladgMessage.Elements.Remove(ladg);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(ladg);
@ -217,6 +221,9 @@ namespace ENI2.DetailViewControls
private void DataGridLADG_EditRequested(DatabaseEntity obj)
{
this.dataGridLADG.CancelEdit();
this.dataGridLADG.CancelEdit();
LADG ladg = obj as LADG;
EditLADGDialog eld = new EditLADGDialog();

View File

@ -196,7 +196,7 @@
<DataGridTextColumn Header="" Binding="{Binding Identifier}" IsReadOnly="True" />
<DataGridTextColumn Header="{x:Static p:Resources.textCode}" Binding="{Binding WasteTypeDisplayGrid}" IsReadOnly="True" Width="0.2*" />
<DataGridTextColumn Header="{x:Static p:Resources.textDescription}" Binding="{Binding WasteDescription}" IsReadOnly="True" Width="0.3*" />
<DataGridTemplateColumn IsReadOnly="True" Width="0.15*">
<!--DataGridTemplateColumn IsReadOnly="True" Width="0.15*">
<DataGridTemplateColumn.HeaderTemplate>
<DataTemplate>
<TextBlock TextWrapping="Wrap" Text="{x:Static p:Resources.textAmountWasteReceived_MTQ}" FontSize="10"/>
@ -207,7 +207,16 @@
<TextBlock TextAlignment="Center" Text="{Binding AmountWasteReceived_MTQ, StringFormat={}{0:N3}}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGridTemplateColumn-->
<DataGridTextColumn Header="{x:Static p:Resources.textAmountWasteReceived_MTQ}" IsReadOnly="False" Width="0.15*">
<DataGridTextColumn.Binding>
<Binding Path="AmountWasteReceived_MTQ" Mode="TwoWay" StringFormat="N3" >
<Binding.ValidationRules>
<util:NumberValidationRule MaxValue="10000" MinValue="0" />
</Binding.ValidationRules>
</Binding>
</DataGridTextColumn.Binding>
</DataGridTextColumn>
</DataGrid.Columns>
</enictrl:ENIDataGrid>

View File

@ -47,7 +47,7 @@ namespace ENI2.DetailViewControls
this.RegisterCheckboxChange(this.checkBoxValidExemption, Message.NotificationClass.WAS);
this.RegisterDatePickerChange(this.datePickerDateLastDisposal, Message.NotificationClass.WAS);
this.RegisterTextboxChange(this.textBoxWasteDisposalServiceProviders, Message.NotificationClass.WAS);
this.dataGridWasteReceived.CellEditEnding += (obj, ev) => { this.SublistElementChanged(Message.NotificationClass.WAS_RCPT); };
}
private void CheckBoxValidExemption_Checked(object sender, RoutedEventArgs e)
@ -290,7 +290,8 @@ namespace ENI2.DetailViewControls
{
if (obj is WasteReceived wasteReceived)
{
this.dataGridWasteReceived.CancelEdit();
this.dataGridWasteReceived.CancelEdit();
// are you sure dialog is in base class
_selectedWAS_RCPT.WasteReceived.Remove(wasteReceived);
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(wasteReceived);
@ -303,6 +304,8 @@ namespace ENI2.DetailViewControls
private void DataGridWasteReceived_CreateRequested()
{
if (_selectedWAS_RCPT == null) return;
this.dataGridWasteReceived.CancelEdit();
this.dataGridWasteReceived.CancelEdit();
EditWasteReceivedDialog ewrd = new EditWasteReceivedDialog();
ewrd.WasteReceived = new WasteReceived();
ewrd.WasteReceived.WAS_RCPT = _selectedWAS_RCPT;
@ -336,6 +339,9 @@ namespace ENI2.DetailViewControls
private void DataGridWasteReceived_EditRequested(DatabaseEntity obj)
{
this.dataGridWasteReceived.CancelEdit();
this.dataGridWasteReceived.CancelEdit();
EditWasteReceivedDialog ewrd = new EditWasteReceivedDialog();
ewrd.WasteReceived = obj as WasteReceived;