editing berths and ships Pt.2 (done)
This commit is contained in:
parent
4e9151f8c8
commit
31b52038b2
@ -5,7 +5,7 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:RoleEditor"
|
xmlns:local="clr-namespace:RoleEditor"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Edit berth" Height="150" Width="450" Loaded="Window_Loaded">
|
Title="Edit berth" Height="160" Width="450" Loaded="Window_Loaded">
|
||||||
<Grid x:Name="berthGrid">
|
<Grid x:Name="berthGrid">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width=".3*" />
|
<ColumnDefinition Width=".3*" />
|
||||||
@ -19,11 +19,20 @@
|
|||||||
<RowDefinition Height="28" />
|
<RowDefinition Height="28" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Label Content="Name" HorizontalAlignment="Right" />
|
<Label Content="Name" HorizontalAlignment="Right" />
|
||||||
<TextBox x:Name="textBoxName" Grid.Column="1" Margin="2" VerticalContentAlignment="Center" Text="{Binding Name}" />
|
<TextBox x:Name="textBoxName" Grid.Column="1" Margin="2" VerticalContentAlignment="Center" Text="{Binding Name, Mode=OneWay}" />
|
||||||
<Label Content="Participant / Terminal" HorizontalAlignment="Right" Grid.Row="1" />
|
<Label Content="Participant / Terminal" HorizontalAlignment="Right" Grid.Row="1" />
|
||||||
<ComboBox x:Name="comboBoxParticipants" Grid.Row="1" Grid.Column="1" Margin="2" SelectedItem="{Binding Participant}" />
|
<Grid Grid.Row="1" Grid.Column="1">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="28" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<ComboBox x:Name="comboBoxParticipants" Margin="2" SelectedItem="{Binding Participant, Mode=OneWay}" />
|
||||||
|
<Button x:Name="buttonResetParticipant" Grid.Column="1" Margin="2" Click="buttonResetParticipant_Click">
|
||||||
|
<Image Source="./Resources/delete2.png"/>
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
<Label Content="Uses lock" HorizontalAlignment="Right" Grid.Row="2" />
|
<Label Content="Uses lock" HorizontalAlignment="Right" Grid.Row="2" />
|
||||||
<CheckBox x:Name="checkBoxLock" Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" Margin="2" IsChecked="{Binding Path=Lock, Mode=TwoWay}"/>
|
<CheckBox x:Name="checkBoxLock" Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" Margin="2" IsChecked="{Binding Path=Lock, Mode=OneWay}"/>
|
||||||
<StackPanel Grid.Column="1" Grid.Row="4" Orientation="Horizontal" FlowDirection="RightToLeft">
|
<StackPanel Grid.Column="1" Grid.Row="4" Orientation="Horizontal" FlowDirection="RightToLeft">
|
||||||
<Button x:Name="buttonCancel" Width="80" Content="Cancel" Margin="2" Click="buttonCancel_Click" />
|
<Button x:Name="buttonCancel" Width="80" Content="Cancel" Margin="2" Click="buttonCancel_Click" />
|
||||||
<Button x:Name="buttonOK" Width="80" Content="OK" Margin="2" Click="buttonOK_Click"/>
|
<Button x:Name="buttonOK" Width="80" Content="OK" Margin="2" Click="buttonOK_Click"/>
|
||||||
|
|||||||
@ -1,17 +1,6 @@
|
|||||||
using brecal.model;
|
using brecal.model;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace RoleEditor
|
namespace RoleEditor
|
||||||
{
|
{
|
||||||
@ -27,6 +16,8 @@ namespace RoleEditor
|
|||||||
|
|
||||||
public Berth Berth { get; set; } = new Berth();
|
public Berth Berth { get; set; } = new Berth();
|
||||||
|
|
||||||
|
public List<Participant> Participants { get; } = new List<Participant>();
|
||||||
|
|
||||||
private void buttonCancel_Click(object sender, RoutedEventArgs e)
|
private void buttonCancel_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
this.DialogResult = false;
|
this.DialogResult = false;
|
||||||
@ -38,8 +29,10 @@ namespace RoleEditor
|
|||||||
this.Berth.Name = this.textBoxName.Text.Trim();
|
this.Berth.Name = this.textBoxName.Text.Trim();
|
||||||
this.Berth.Lock = this.checkBoxLock.IsChecked;
|
this.Berth.Lock = this.checkBoxLock.IsChecked;
|
||||||
this.Berth.Participant = this.comboBoxParticipants.SelectedItem as Participant;
|
this.Berth.Participant = this.comboBoxParticipants.SelectedItem as Participant;
|
||||||
if(this.Berth.Participant != null)
|
if (this.Berth.Participant != null)
|
||||||
this.Berth.Participant_Id = this.Berth.Participant.Id;
|
this.Berth.Participant_Id = this.Berth.Participant.Id;
|
||||||
|
else
|
||||||
|
this.Berth.Participant_Id = null;
|
||||||
this.DialogResult = true;
|
this.DialogResult = true;
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
@ -47,6 +40,12 @@ namespace RoleEditor
|
|||||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
this.DataContext = this.Berth;
|
this.DataContext = this.Berth;
|
||||||
|
this.comboBoxParticipants.ItemsSource = this.Participants;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonResetParticipant_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.comboBoxParticipants.SelectedItem = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,9 +4,49 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:RoleEditor"
|
xmlns:local="clr-namespace:RoleEditor"
|
||||||
|
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Edit ship" Height="450" Width="800">
|
Title="Edit ship" Height="250" Width="500" Loaded="Window_Loaded">
|
||||||
<Grid>
|
<Grid x:Name="shipGrid">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width=".3*" />
|
||||||
|
<ColumnDefinition Width=".6*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Label Content="Name" HorizontalAlignment="Right" />
|
||||||
|
<TextBox x:Name="textBoxName" Grid.Column="1" Margin="2" VerticalContentAlignment="Center" Text="{Binding Name, Mode=OneWay}" />
|
||||||
|
<Label Content="Participant / Tug company" HorizontalAlignment="Right" Grid.Row="1" />
|
||||||
|
<Grid Grid.Row="1" Grid.Column="1">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="28" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<ComboBox x:Name="comboBoxParticipants" Margin="2" SelectedItem="{Binding Participant, Mode=OneWay}" />
|
||||||
|
<Button x:Name="buttonResetParticipant" Grid.Column="1" Margin="2" Click="buttonResetParticipant_Click">
|
||||||
|
<Image Source="./Resources/delete2.png"/>
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
<Label Content="IMO" HorizontalAlignment="Right" Grid.Row="2" />
|
||||||
|
<xctk:IntegerUpDown Name="integerUpDownIMO" Grid.Column="1" Grid.Row="2" Value="{Binding IMO, Mode=OneWay}" Margin="2" Minimum="1000000" Maximum="9999999"/>
|
||||||
|
<Label Content="Callsign" HorizontalAlignment="Right" Grid.Row="3" />
|
||||||
|
<TextBox x:Name="textBoxCallsign" Grid.Column="1" Grid.Row="3" Margin="2" VerticalContentAlignment="Center" Text="{Binding Callsign, Mode=OneWay}" />
|
||||||
|
<Label Content="Length" HorizontalAlignment="Right" Grid.Row="4" />
|
||||||
|
<xctk:DoubleUpDown Name="doubleUpDownLength" Grid.Row="4" Grid.Column="1" Value="{Binding Length, Mode=OneWay}" Margin="2" Minimum="0" />
|
||||||
|
<Label Content="Width" HorizontalAlignment="Right" Grid.Row="5" />
|
||||||
|
<xctk:DoubleUpDown Name="doubleUpDownWidth" Grid.Row="5" Grid.Column="1" Value="{Binding Width, Mode=OneWay}" Margin="2" Minimum="0"/>
|
||||||
|
<StackPanel Grid.Column="1" Grid.Row="7" Orientation="Horizontal" FlowDirection="RightToLeft">
|
||||||
|
<Button x:Name="buttonCancel" Width="80" Content="Cancel" Margin="2" Click="buttonCancel_Click" />
|
||||||
|
<Button x:Name="buttonOK" Width="80" Content="OK" Margin="2" Click="buttonOK_Click"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@ -1,16 +1,6 @@
|
|||||||
using System;
|
using brecal.model;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
|
|
||||||
namespace RoleEditor
|
namespace RoleEditor
|
||||||
{
|
{
|
||||||
@ -23,5 +13,43 @@ namespace RoleEditor
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Ship Ship { get; set; } = new Ship();
|
||||||
|
|
||||||
|
public List<Participant> Participants { get; } = new List<Participant>();
|
||||||
|
|
||||||
|
private void buttonCancel_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.DialogResult = false;
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonOK_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.Ship.Name = this.textBoxName.Text.Trim();
|
||||||
|
|
||||||
|
this.Ship.Participant = this.comboBoxParticipants.SelectedItem as Participant;
|
||||||
|
if (this.Ship.Participant != null)
|
||||||
|
this.Ship.Participant_Id = this.Ship.Participant.Id;
|
||||||
|
else
|
||||||
|
this.Ship.Participant_Id = null;
|
||||||
|
this.Ship.IMO = this.integerUpDownIMO.Value;
|
||||||
|
this.Ship.Callsign = this.textBoxCallsign.Text.Trim();
|
||||||
|
this.Ship.Length = this.doubleUpDownLength.Value;
|
||||||
|
this.Ship.Width = this.doubleUpDownWidth.Value;
|
||||||
|
this.DialogResult = true;
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.DataContext = this.Ship;
|
||||||
|
this.comboBoxParticipants.ItemsSource = this.Participants;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonResetParticipant_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.comboBoxParticipants.SelectedItem = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -170,10 +170,10 @@
|
|||||||
</ListBox.ContextMenu>
|
</ListBox.ContextMenu>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
<Button x:Name="buttonAddRole" Margin="2" Grid.Row="1" Grid.Column="1" Click="buttonAddRole_Click">
|
<Button x:Name="buttonAddRole" Margin="2" Grid.Row="1" Grid.Column="1" Click="buttonAddRole_Click">
|
||||||
<Image Source="./Resources/arrow_left_green.png" Margin="0,0,5,0" Height="24" DockPanel.Dock="Left" Width="22"/>
|
<Image Source="./Resources/arrow_left_green.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button x:Name="buttonRemoveRole" Margin="2" Grid.Row="2" Grid.Column="1" Click="buttonRemoveRole_Click">
|
<Button x:Name="buttonRemoveRole" Margin="2" Grid.Row="2" Grid.Column="1" Click="buttonRemoveRole_Click">
|
||||||
<Image Source="./Resources/delete2.png" Margin="0,0,5,0" Height="24" DockPanel.Dock="Left" Width="22"/>
|
<Image Source="./Resources/delete2.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Label Content="Name" Grid.Row="4" Grid.Column="1" HorizontalAlignment="Right" />
|
<Label Content="Name" Grid.Row="4" Grid.Column="1" HorizontalAlignment="Right" />
|
||||||
<Label Content="Descr." Grid.Row="5" Grid.Column="1" HorizontalAlignment="Right" />
|
<Label Content="Descr." Grid.Row="5" Grid.Column="1" HorizontalAlignment="Right" />
|
||||||
@ -222,10 +222,10 @@
|
|||||||
</ListBox.ContextMenu>
|
</ListBox.ContextMenu>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
<Button x:Name="buttonAddSecurable" Margin="2" Grid.Row="1" Grid.Column="1" Click="buttonAddSecurable_Click">
|
<Button x:Name="buttonAddSecurable" Margin="2" Grid.Row="1" Grid.Column="1" Click="buttonAddSecurable_Click">
|
||||||
<Image Source="./Resources/arrow_left_green.png" Margin="0,0,5,0" Height="24" DockPanel.Dock="Left" Width="22"/>
|
<Image Source="./Resources/arrow_left_green.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Button x:Name="buttonRemoveSecurable" Margin="2" Grid.Row="2" Grid.Column="1" Click="buttonRemoveSecurable_Click">
|
<Button x:Name="buttonRemoveSecurable" Margin="2" Grid.Row="2" Grid.Column="1" Click="buttonRemoveSecurable_Click">
|
||||||
<Image Source="./Resources/delete2.png" Margin="0,0,5,0" Height="24" DockPanel.Dock="Left" Width="22"/>
|
<Image Source="./Resources/delete2.png"/>
|
||||||
</Button>
|
</Button>
|
||||||
<Label Content="Name" Grid.Row="4" Grid.Column="1" HorizontalAlignment="Right" />
|
<Label Content="Name" Grid.Row="4" Grid.Column="1" HorizontalAlignment="Right" />
|
||||||
<TextBox x:Name="textBoxSecurableName" Grid.Row="4" Grid.Column="2" Margin="2" VerticalContentAlignment="Center"/>
|
<TextBox x:Name="textBoxSecurableName" Grid.Row="4" Grid.Column="2" Margin="2" VerticalContentAlignment="Center"/>
|
||||||
@ -249,10 +249,10 @@
|
|||||||
<local:ENIDataGrid x:Name="dataGridBerths" Grid.Row="1" SelectionMode="Single" IsReadOnly="True" AlternatingRowBackground="LightBlue" AutoGenerateColumns="False"
|
<local:ENIDataGrid x:Name="dataGridBerths" Grid.Row="1" SelectionMode="Single" IsReadOnly="True" AlternatingRowBackground="LightBlue" AutoGenerateColumns="False"
|
||||||
CanUserAddRows="False" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
|
CanUserAddRows="False" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn Header="Id" Binding="{Binding Path=Id}" />
|
<DataGridTextColumn Header="Id" Binding="{Binding Path=Id}" IsReadOnly="True"/>
|
||||||
<DataGridTextColumn Header="Name" Binding="{Binding Path=Name}" />
|
<DataGridTextColumn Header="Name" Binding="{Binding Path=Name}" IsReadOnly="True"/>
|
||||||
<DataGridCheckBoxColumn Header="Lock" Binding="{Binding Path=Lock}" />
|
<DataGridCheckBoxColumn Header="Lock" Binding="{Binding Path=Lock}" IsReadOnly="True"/>
|
||||||
<DataGridTextColumn Header="Terminal" Binding="{Binding Path=Terminal}" />
|
<DataGridTextColumn Header="Terminal" Binding="{Binding Path=Terminal, Mode=OneWay}" IsReadOnly="True"/>
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</local:ENIDataGrid>
|
</local:ENIDataGrid>
|
||||||
</Grid>
|
</Grid>
|
||||||
@ -267,14 +267,14 @@
|
|||||||
<local:ENIDataGrid x:Name="dataGridShips" Grid.Row="1" SelectionMode="Single" IsReadOnly="True" AlternatingRowBackground="LightBlue" AutoGenerateColumns="False"
|
<local:ENIDataGrid x:Name="dataGridShips" Grid.Row="1" SelectionMode="Single" IsReadOnly="True" AlternatingRowBackground="LightBlue" AutoGenerateColumns="False"
|
||||||
CanUserAddRows="False" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
|
CanUserAddRows="False" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn Header="Id" Binding="{Binding Path=Id}" />
|
<DataGridTextColumn Header="Id" Binding="{Binding Path=Id}" IsReadOnly="True"/>
|
||||||
<DataGridTextColumn Header="Name" Binding="{Binding Path=Name}" />
|
<DataGridTextColumn Header="Name" Binding="{Binding Path=Name}" IsReadOnly="True"/>
|
||||||
<DataGridCheckBoxColumn Header="Tug" Binding="{Binding Path=IsTug}" />
|
<DataGridCheckBoxColumn Header="Tug" Binding="{Binding Path=IsTug, Mode=OneWay}" IsReadOnly="True"/>
|
||||||
<DataGridTextColumn Header="Tug company" Binding="{Binding Path=TugCompany}" />
|
<DataGridTextColumn Header="Tug company" Binding="{Binding Path=TugCompany, Mode=OneWay}" IsReadOnly="True"/>
|
||||||
<DataGridTextColumn Header="IMO" Binding="{Binding Path=Name}" />
|
<DataGridTextColumn Header="IMO" Binding="{Binding Path=IMO}" IsReadOnly="True"/>
|
||||||
<DataGridTextColumn Header="Callsign" Binding="{Binding Path=Name}" />
|
<DataGridTextColumn Header="Callsign" Binding="{Binding Path=Callsign}" IsReadOnly="True"/>
|
||||||
<DataGridTextColumn Header="Length" Binding="{Binding Path=Name}" />
|
<DataGridTextColumn Header="Length" Binding="{Binding Path=Length}" IsReadOnly="True"/>
|
||||||
<DataGridTextColumn Header="Width" Binding="{Binding Path=Name}" />
|
<DataGridTextColumn Header="Width" Binding="{Binding Path=Width}" IsReadOnly="True"/>
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</local:ENIDataGrid>
|
</local:ENIDataGrid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@ -119,17 +119,35 @@ namespace RoleEditor
|
|||||||
this._ships.Remove(s);
|
this._ships.Remove(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DataGridShips_EditRequested(DbEntity obj)
|
private async void DataGridShips_EditRequested(DbEntity obj)
|
||||||
{
|
{
|
||||||
if(obj is Ship s)
|
if(obj is Ship s)
|
||||||
{
|
{
|
||||||
|
EditShipDialog esd = new();
|
||||||
|
esd.Ship = s;
|
||||||
|
esd.Participants.AddRange(this._participants);
|
||||||
|
if (esd.ShowDialog() ?? false)
|
||||||
|
{
|
||||||
|
await s.Save(_dbManager);
|
||||||
|
this.dataGridShips.ItemsSource = null;
|
||||||
|
this.dataGridShips.ItemsSource = _ships;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DataGridShips_CreateRequested()
|
private async void DataGridShips_CreateRequested()
|
||||||
{
|
{
|
||||||
Ship s = new Ship();
|
Ship s = new();
|
||||||
|
EditShipDialog esd = new();
|
||||||
|
esd.Ship = s;
|
||||||
|
esd.Participants.AddRange(this._participants);
|
||||||
|
if(esd.ShowDialog() ?? false)
|
||||||
|
{
|
||||||
|
_ships.Add(s);
|
||||||
|
await s.Save(_dbManager);
|
||||||
|
this.dataGridShips.ItemsSource = null;
|
||||||
|
this.dataGridShips.ItemsSource = _ships;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -146,22 +164,30 @@ namespace RoleEditor
|
|||||||
{
|
{
|
||||||
if(obj is Berth b)
|
if(obj is Berth b)
|
||||||
{
|
{
|
||||||
EditBerthDialog ebd = new EditBerthDialog();
|
EditBerthDialog ebd = new();
|
||||||
ebd.Berth = b;
|
ebd.Berth = b;
|
||||||
|
ebd.Participants.AddRange(this._participants);
|
||||||
if (ebd.ShowDialog() ?? false)
|
if (ebd.ShowDialog() ?? false)
|
||||||
|
{
|
||||||
await b.Save(_dbManager);
|
await b.Save(_dbManager);
|
||||||
|
this.dataGridBerths.ItemsSource = null; // extreme stupidity for me not wanting to implement INotifyPropertyChanged
|
||||||
|
this.dataGridBerths.ItemsSource = _berths;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void DataGridBerths_CreateRequested()
|
private async void DataGridBerths_CreateRequested()
|
||||||
{
|
{
|
||||||
Berth b = new Berth();
|
Berth b = new();
|
||||||
EditBerthDialog ebd = new EditBerthDialog();
|
EditBerthDialog ebd = new();
|
||||||
ebd.Berth = b;
|
ebd.Berth = b;
|
||||||
if(ebd.ShowDialog() ?? false)
|
ebd.Participants.AddRange(this._participants);
|
||||||
|
if (ebd.ShowDialog() ?? false)
|
||||||
{
|
{
|
||||||
_berths.Add(b);
|
_berths.Add(b);
|
||||||
await b.Save(_dbManager);
|
await b.Save(_dbManager);
|
||||||
|
this.dataGridBerths.ItemsSource = null;
|
||||||
|
this.dataGridBerths.ItemsSource = _berths;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,10 @@
|
|||||||
<None Remove="Resources\safe.png" />
|
<None Remove="Resources\safe.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.5.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\brecal.model\brecal.model.csproj" />
|
<ProjectReference Include="..\brecal.model\brecal.model.csproj" />
|
||||||
<ProjectReference Include="..\brecal.mysql\brecal.mysql.csproj" />
|
<ProjectReference Include="..\brecal.mysql\brecal.mysql.csproj" />
|
||||||
|
|||||||
@ -93,7 +93,7 @@ namespace brecal.model
|
|||||||
|
|
||||||
public override void SetUpdate(IDbCommand cmd)
|
public override void SetUpdate(IDbCommand cmd)
|
||||||
{
|
{
|
||||||
cmd.CommandText = "UPDATE ship SET name = @NAME, imo = @IMO, callsign = @CALLSIGN, participant_id = @PID, length = @LENGTH, widht = @WIDTH WHERE id = @ID";
|
cmd.CommandText = "UPDATE ship SET name = @NAME, imo = @IMO, callsign = @CALLSIGN, participant_id = @PID, length = @LENGTH, width = @WIDTH WHERE id = @ID";
|
||||||
this.SetParameters(cmd);
|
this.SetParameters(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user