write editable Heading into DB

pull/1/head
DJh2o2 2022-05-09 10:35:37 +07:00
parent 65248ee37a
commit e806f55c6d
3 changed files with 29 additions and 9 deletions

@ -38,6 +38,7 @@ namespace Gremlin.Operations
CheckNewCustomDescription checkNewCustomDescription = new(lineItemVM, customDescriptionVM);
if (checkNewCustomDescription.ShowDialog() == true)
{
customDescription.Heading = checkNewCustomDescription.CustomDescriptionVM.Heading;
gremlinContext.Add(customDescription);
gremlinContext.SaveChanges();
}

@ -8,7 +8,7 @@
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<!--<RowDefinition Height="*"/>-->
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
@ -19,15 +19,25 @@
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Width="Auto">
<TextBlock x:Name="tbLI" Text="LineItem SAPDescription" Margin="5,5,5,5"/>
<StackPanel>
<TextBlock Text="LineItem SAPDescription:"/>
<TextBox x:Name="SapDescription" Margin="5,5,5,5"/>
</StackPanel>
</Grid>
<Grid Grid.Column="1" Width="Auto">
<TextBlock x:Name="tbCD" Text="CustomDescription Heading" Margin="5,5,5,5"/>
<Grid.RowDefinitions>
<RowDefinition Height="21*"/>
<RowDefinition Height="233*"/>
</Grid.RowDefinitions>
<StackPanel Grid.RowSpan="2">
<TextBlock Text="CustomDescription Heading:"/>
<TextBox x:Name="Heading" Margin="5,5,5,5"/>
</StackPanel>
</Grid>
</Grid>
<!--DataGrids-->
<Grid Grid.Row="1" Height="Auto">
<!--<Grid Grid.Row="1" Height="Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
@ -50,7 +60,7 @@
AlternatingRowBackground="LightGray"
SelectionMode="Single"/>
</Grid>
</Grid>
</Grid>-->
<!--Buttons-->
<Grid Grid.Row="2" Height="Auto">
<Grid.ColumnDefinitions>

@ -1,20 +1,29 @@
using Gremlin.MVVM.ViewModels;
using System.Windows;
using System.Windows;
namespace Gremlin.MVVM.Views
{
public partial class CheckNewCustomDescription : Window
{
public CustomDescriptionViewModel CustomDescriptionVM { get; set; }
public LineItemViewModel LineItemVM { get; set; }
public CheckNewCustomDescription(LineItemViewModel lineItemViewModel, CustomDescriptionViewModel customDescriptionViewModel)
{
InitializeComponent();
LineItemViewModel.DataContext = lineItemViewModel;
CustomDescriptionViewModel.DataContext = customDescriptionViewModel;
//LineItemViewModel.DataContext = lineItemViewModel;
LineItemVM = lineItemViewModel;
SapDescription.Text = LineItemVM.SapShortDescription;
//CustomDescriptionViewModel.DataContext = customDescriptionViewModel;
CustomDescriptionVM = customDescriptionViewModel;
Heading.Text = CustomDescriptionVM.Heading;
}
private void BtnOk_Click(object sender, RoutedEventArgs e)
{
CustomDescriptionVM.Heading = Heading.Text;
LineItemVM.SapShortDescription = SapDescription.Text;
DialogResult = true;
Close();
}