fixed an error and created a preliminary test version
This commit is contained in:
parent
29cead2389
commit
3af6bda7e5
@ -56,7 +56,35 @@
|
||||
<enictrl:LocodeControl Grid.Row="2" Grid.Column="1" x:Name="locodeCtrlLastWastePort" LocodeValue="{Binding LastWasteDisposalPort, Mode=TwoWay}" LocodeSource="SSN" />
|
||||
<TextBox Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3" Grid.RowSpan="2" Name="textBoxWasteDisposalServiceProviders" Text="{Binding WasteDisposalServiceProviderText, Converter={util:TrimStringConverter}}" Margin="2" />
|
||||
<Label Grid.Row="6" Grid.Column="0" HorizontalContentAlignment="Right" Content="{x:Static p:Resources.textAgentTemplate}" Margin="0,0,10,0" />
|
||||
<ComboBox Grid.Row="6" Grid.Column="1" Name="comboBox_WSDPTemplate" Margin="2" SelectedValuePath="Id" DisplayMemberPath="WasteDisposalServiceProviderName" SelectionChanged="comboBox_WSDPTemplate_SelectionChanged" />
|
||||
<ComboBox Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="2" Name="comboBox_WSDPTemplate" Margin="2" SelectedValuePath="Id" DisplayMemberPath="WasteDisposalServiceProviderName" SelectionChanged="comboBox_WSDPTemplate_SelectionChanged" />
|
||||
<Grid Grid.Row="6" Grid.Column="3" Grid.ColumnSpan="1" Name="gridTemplateControls" Visibility="Visible">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<!-- Name -->
|
||||
<ColumnDefinition Width="26"/>
|
||||
<!-- Save button -->
|
||||
<ColumnDefinition Width="26"/>
|
||||
<!-- Delete button -->
|
||||
<ColumnDefinition Width="52"/>
|
||||
<!-- Undo button -->
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Grid.Column="0" Margin="2" Name="textBoxTemplateTitle" VerticalContentAlignment="Center"/>
|
||||
<Button Name="buttonSaveTemplate" Grid.Column="1" Grid.Row="0" Margin="2" Click="buttonSaveTemplate_Click" BorderThickness="0" Background="Transparent" ToolTip="Save template">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Source="../Resources/floppy_disk_blue.png" Margin="0,0,0,0" Height="20" Width="20" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Name="buttonDeleteTemplate" Grid.Column="2" 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>
|
||||
<Button Name="buttonUndoTemplate" Grid.Column="3" Grid.Row="0" Margin="22,2,2,2" Click="buttonUndoTemplate_Click" BorderThickness="0" Background="Transparent" ToolTip="Undo last overwrite" IsEnabled="False">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image Source="../Resources/undo.png" Margin="0,0,0,0" Height="20" Width="20" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Grid>
|
||||
<Button Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="1" Name="buttonAddMissingEntries" Content="{x:Static p:Resources.textAddMissingEntries}" Margin="2" Click="buttonAddMissingEntries_Click"/>
|
||||
<Button Grid.Row="7" Grid.Column="2" Grid.ColumnSpan="1" Name="buttonImportFromExcel" Content="{x:Static p:Resources.textImportFromExcel}" Margin="2" Click="buttonImportFromExcel_Click" />
|
||||
</Grid>
|
||||
|
||||
@ -13,6 +13,7 @@ using ExcelDataReader;
|
||||
using System.IO;
|
||||
using System;
|
||||
using Microsoft.Win32;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ENI2.DetailViewControls
|
||||
{
|
||||
@ -29,7 +30,7 @@ namespace ENI2.DetailViewControls
|
||||
|
||||
private static List<WasteDisposalServiceProvider_Template> _wsdpTemplates = null;
|
||||
private WasteDisposalServiceProvider_Template _currentTemplate;
|
||||
private WasteDisposalServiceProvider_Template _undoTemplate;
|
||||
private string _undoTemplate;
|
||||
|
||||
private static readonly string[] _wasteDeliveryList =
|
||||
{
|
||||
@ -101,7 +102,7 @@ namespace ENI2.DetailViewControls
|
||||
}
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
public async override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
@ -182,6 +183,18 @@ namespace ENI2.DetailViewControls
|
||||
|
||||
#endregion
|
||||
|
||||
#region init WSDP provider
|
||||
|
||||
if(_wsdpTemplates == null)
|
||||
{
|
||||
_wsdpTemplates = await DBManagerAsync.GetWastDisposalServiceProviderTemplatesAsync();
|
||||
_wsdpTemplates.Sort();
|
||||
Trace.WriteLine($"{_wsdpTemplates.Count} WSDP templates loaded");
|
||||
}
|
||||
this.comboBox_WSDPTemplate.ItemsSource = _wsdpTemplates;
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
#region Waste receipt grid event handler
|
||||
@ -585,9 +598,91 @@ namespace ENI2.DetailViewControls
|
||||
|
||||
#endregion
|
||||
|
||||
#region Waste disposal Service Provider templates event handler
|
||||
|
||||
private void comboBox_WSDPTemplate_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
|
||||
Trace.WriteLine("WSDP combo selection changed");
|
||||
if(this.comboBox_WSDPTemplate.SelectedItem is WasteDisposalServiceProvider_Template wdsp_t)
|
||||
{
|
||||
this.textBoxTemplateTitle.Text = wdsp_t.Remark;
|
||||
this.buttonDeleteTemplate.IsEnabled = true;
|
||||
this._currentTemplate = wdsp_t;
|
||||
this._undoTemplate = this.textBoxWasteDisposalServiceProviders.Text.Trim();
|
||||
this.buttonUndoTemplate.IsEnabled = this._undoTemplate.Length > 0;
|
||||
this.textBoxWasteDisposalServiceProviders.Text = wdsp_t.WasteDisposalServiceProviderName;
|
||||
}
|
||||
}
|
||||
|
||||
private async void buttonSaveTemplate_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string currentWSDPProviderName = this.textBoxWasteDisposalServiceProviders.Text.Trim();
|
||||
string currentRemark = this.textBoxTemplateTitle.Text.Trim();
|
||||
|
||||
if ((currentWSDPProviderName.Length == 0) || (currentRemark.Length == 0)) return;
|
||||
|
||||
WasteDisposalServiceProvider_Template existingTemplate = null;
|
||||
foreach(WasteDisposalServiceProvider_Template wdsp_template in _wsdpTemplates)
|
||||
{
|
||||
// bei gefundenem Match wird ggf. der Remark überschrieben
|
||||
if (wdsp_template.Remark.Equals(currentRemark))
|
||||
{
|
||||
existingTemplate = wdsp_template;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(existingTemplate != null)
|
||||
{
|
||||
if (MessageBox.Show("A template with this name already exists, overwrite?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.No)
|
||||
return;
|
||||
|
||||
existingTemplate.WasteDisposalServiceProviderName = currentWSDPProviderName;
|
||||
await DBManagerAsync.SaveAsync(existingTemplate);
|
||||
return;
|
||||
}
|
||||
|
||||
WasteDisposalServiceProvider_Template newTemplate = new WasteDisposalServiceProvider_Template();
|
||||
newTemplate.WasteDisposalServiceProviderName = currentWSDPProviderName;
|
||||
newTemplate.Remark = currentRemark;
|
||||
await DBManagerAsync.SaveAsync(newTemplate);
|
||||
|
||||
comboBox_WSDPTemplate.ItemsSource = null;
|
||||
_wsdpTemplates.Add(newTemplate);
|
||||
_wsdpTemplates.Sort();
|
||||
comboBox_WSDPTemplate.ItemsSource = _wsdpTemplates;
|
||||
MessageBox.Show("Template saved", "OK", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
|
||||
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.comboBox_WSDPTemplate.SelectedItem = null;
|
||||
this.comboBox_WSDPTemplate.ItemsSource = null;
|
||||
DBManager.Instance.Delete(_currentTemplate);
|
||||
_wsdpTemplates.Remove(_currentTemplate);
|
||||
this.textBoxTemplateTitle.Text = null;
|
||||
this.buttonDeleteTemplate.IsEnabled = false;
|
||||
this.comboBox_WSDPTemplate.ItemsSource = _wsdpTemplates;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonUndoTemplate_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if(this._undoTemplate != null)
|
||||
{
|
||||
this.textBoxWasteDisposalServiceProviders.Text = this._undoTemplate;
|
||||
this.buttonUndoTemplate.IsEnabled = false;
|
||||
this._undoTemplate = null;
|
||||
this.comboBox_WSDPTemplate.SelectedItem = null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<TargetFrameworkProfile />
|
||||
<PublishUrl>eni2.publish\</PublishUrl>
|
||||
<PublishUrl>eni_test\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Web</InstallFrom>
|
||||
<UpdateEnabled>true</UpdateEnabled>
|
||||
@ -28,16 +28,16 @@
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<InstallUrl>http://192.168.2.24/eni2.publish/</InstallUrl>
|
||||
<InstallUrl>http://192.168.2.24/eni_test/</InstallUrl>
|
||||
<SupportUrl>http://www.textbausteine.net/</SupportUrl>
|
||||
<ProductName>ENI</ProductName>
|
||||
<ProductName>ENI Testversion</ProductName>
|
||||
<PublisherName>Informatikbüro Daniel Schick</PublisherName>
|
||||
<SuiteName>NSW</SuiteName>
|
||||
<MinimumRequiredVersion>5.4.0.0</MinimumRequiredVersion>
|
||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||
<WebPage>publish.html</WebPage>
|
||||
<ApplicationRevision>5</ApplicationRevision>
|
||||
<ApplicationVersion>7.12.0.%2a</ApplicationVersion>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>7.13.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user