UI Umbau, WIP
This commit is contained in:
parent
b94835ee4b
commit
1d222259bb
@ -26,13 +26,9 @@
|
|||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Label Content="Calendar week" />
|
<Label Content="Calendar week" />
|
||||||
<xctk:DoubleUpDown x:Name="doubleUpDownCalendarWeek" VerticalContentAlignment="Center" VerticalAlignment="Center"
|
|
||||||
HorizontalAlignment="Stretch" Margin="2" Value="01" ValueChanged="doubleUpDownCalendarWeek_ValueChanged"/>
|
|
||||||
<Label Content="Type" />
|
<Label Content="Type" />
|
||||||
<ComboBox x:Name="comboBoxFilterType" Margin="2" SelectionChanged="comboBoxFilterType_SelectionChanged" Width="100" />
|
<Button x:Name="buttonExcelExport" Margin="2" Content="Export Excel" Width="100" />
|
||||||
|
<Button x:Name="buttonSaveChanges" Margin="2" Content="Save changes" Width="100" IsEnabled="False" />
|
||||||
<Button x:Name="buttonExcelExport" Margin="2" Click="buttonExcelExport_Click" Content="Export Excel" Width="100" />
|
|
||||||
<Button x:Name="buttonSaveChanges" Margin="2" Click="buttonSaveChanges_Click" Content="Save changes" Width="100" IsEnabled="False" />
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<local:ENIDataGrid Grid.Row="1" Margin="2,8,2,2" x:Name="dataGridPOCores" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
<local:ENIDataGrid Grid.Row="1" Margin="2,8,2,2" x:Name="dataGridPOCores" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||||
SelectionMode="Single" AutoGenerateColumns="False" CellEditEnding="dataGridPOCores_CellEditEnding" CanUserAddRows="False">
|
SelectionMode="Single" AutoGenerateColumns="False" CellEditEnding="dataGridPOCores_CellEditEnding" CanUserAddRows="False">
|
||||||
|
|||||||
@ -25,14 +25,6 @@ namespace ENI2.Controls
|
|||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private readonly string[] _comboBoxEntries =
|
|
||||||
{
|
|
||||||
"All",
|
|
||||||
"Maersk BRV/WHV",
|
|
||||||
"SeaGo BHV",
|
|
||||||
"SeaGo WHV"
|
|
||||||
};
|
|
||||||
|
|
||||||
private List<MessageCore> searchResult = new List<MessageCore>();
|
private List<MessageCore> searchResult = new List<MessageCore>();
|
||||||
private readonly List<MessageCore> filteredResult = new List<MessageCore>();
|
private readonly List<MessageCore> filteredResult = new List<MessageCore>();
|
||||||
|
|
||||||
@ -52,103 +44,12 @@ namespace ENI2.Controls
|
|||||||
|
|
||||||
private void POList_Loaded(object sender, RoutedEventArgs e)
|
private void POList_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
this.comboBoxFilterType.ItemsSource = this._comboBoxEntries;
|
|
||||||
this.doubleUpDownCalendarWeek.Value = bsmd.database.Util.GetIso8601WeekOfYear(DateTime.Now);
|
|
||||||
this.dataGridPOCores.ItemsSource = this.filteredResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonExcelExport_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
if (this.filteredResult.Count == 0) return;
|
|
||||||
|
|
||||||
OpenFileDialog ofd = new OpenFileDialog
|
|
||||||
{
|
|
||||||
Filter = "Excel Files|*.xls;*.xlsx"
|
|
||||||
};
|
|
||||||
if (ofd.ShowDialog() ?? false)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
|
|
||||||
excelApp.DisplayAlerts = false;
|
|
||||||
Workbook workBook = excelApp.Workbooks.Open(ofd.FileName);
|
|
||||||
Worksheet workSheet = workBook.Worksheets[1];
|
|
||||||
|
|
||||||
int rowIndex = 3;
|
|
||||||
foreach(MessageCore core in this.filteredResult)
|
|
||||||
{
|
|
||||||
workSheet.Cells[rowIndex, 7].Value = core.Shipname;
|
|
||||||
workSheet.Cells[rowIndex, 10].Value = core.PoC.Substring(2);
|
|
||||||
if(core.POATA.HasValue)
|
|
||||||
workSheet.Cells[rowIndex, 11].Value = core.POATA.Value.ToShortDateString();
|
|
||||||
workSheet.Cells[rowIndex, 13].Value = core.PONumber;
|
|
||||||
rowIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
workBook.Save();
|
|
||||||
workBook.Close();
|
|
||||||
Marshal.ReleaseComObject(workBook);
|
|
||||||
excelApp.Quit();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonSaveChanges_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
foreach(MessageCore messageCore in this.filteredResult)
|
|
||||||
{
|
|
||||||
if (messageCore.IsDirty)
|
|
||||||
{
|
|
||||||
DBManager.Instance.Save(messageCore);
|
|
||||||
messageCore.IsDirty = false;
|
|
||||||
// load ATA for this Core
|
|
||||||
/* DAS ATA WIRD JETZT NICHT MEHR IN DIE MELDEKLASSE GESPEICHERT
|
|
||||||
Message ataMessage = DBManager.Instance.GetMessage(messageCore, Message.NotificationClass.ATA);
|
|
||||||
if(ataMessage?.Elements.Count == 1)
|
|
||||||
{
|
|
||||||
if(messageCore.ATA != ((ATA)ataMessage.Elements[0]).ATAPortOfCall)
|
|
||||||
{
|
|
||||||
((ATA)ataMessage.Elements[0]).ATAPortOfCall = messageCore.ATA;
|
|
||||||
DBManager.Instance.Save(ataMessage.Elements[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.buttonSaveChanges.IsEnabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void doubleUpDownCalendarWeek_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
|
|
||||||
{
|
|
||||||
if (!this.IsLoaded) return;
|
|
||||||
this.comboBoxFilterType.SelectedIndex = -1;
|
|
||||||
this.PerformSearch();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void comboBoxFilterType_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
||||||
{
|
|
||||||
this.dataGridPOCores.ItemsSource = null;
|
|
||||||
if (this.comboBoxFilterType.SelectedIndex == -1) return;
|
|
||||||
|
|
||||||
this.filteredResult.Clear();
|
|
||||||
foreach (MessageCore core in this.searchResult)
|
|
||||||
{
|
|
||||||
switch (this.comboBoxFilterType.SelectedIndex)
|
|
||||||
{
|
|
||||||
case 0: this.filteredResult.Add(core); break;
|
|
||||||
case 1: if (core.IsFlagSet(MessageCore.CoreFlags.MAERSK_BHV)) this.filteredResult.Add(core); break;
|
|
||||||
case 2: if (core.IsFlagSet(MessageCore.CoreFlags.SEAGO_BHV)) this.filteredResult.Add(core); break;
|
|
||||||
case 3: if (core.IsFlagSet(MessageCore.CoreFlags.SEAGO_WHV)) this.filteredResult.Add(core); break;
|
|
||||||
case 4: if (core.IsFlagSet(MessageCore.CoreFlags.HOEGH)) this.filteredResult.Add(core); break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.dataGridPOCores.ItemsSource = this.filteredResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void dataGridPOCores_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
private void dataGridPOCores_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||||
{
|
{
|
||||||
@ -216,11 +117,9 @@ namespace ENI2.Controls
|
|||||||
this.dataGridPOCores.ItemsSource = null;
|
this.dataGridPOCores.ItemsSource = null;
|
||||||
this.filteredResult.Clear();
|
this.filteredResult.Clear();
|
||||||
|
|
||||||
if (!this.doubleUpDownCalendarWeek.Value.HasValue) return;
|
|
||||||
|
|
||||||
Dictionary<MessageCore.SearchFilterType, string> filterDict = new Dictionary<MessageCore.SearchFilterType, string>();
|
Dictionary<MessageCore.SearchFilterType, string> filterDict = new Dictionary<MessageCore.SearchFilterType, string>();
|
||||||
|
|
||||||
DateTime start = bsmd.database.Util.FirstDateOfWeekISO8601(DateTime.Now.Year, (int)this.doubleUpDownCalendarWeek.Value);
|
DateTime start = DateTime.Now; // bsmd.database.Util.FirstDateOfWeekISO8601(DateTime.Now.Year, (int)this.doubleUpDownCalendarWeek.Value);
|
||||||
DateTime end = start.Add(new TimeSpan(6, 23, 59, 59));
|
DateTime end = start.Add(new TimeSpan(6, 23, 59, 59));
|
||||||
|
|
||||||
// Die Suche findet in einem erweiterten Intervall statt, da später wenn möglich nach ATA gefiltert wird
|
// Die Suche findet in einem erweiterten Intervall statt, da später wenn möglich nach ATA gefiltert wird
|
||||||
|
|||||||
@ -7,6 +7,18 @@
|
|||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
<Grid>
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="28" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Label Grid.Row="0" Content="Maersk lists" />
|
||||||
|
<TabControl x:Name="tabControlMaersk" Grid.Row="1">
|
||||||
|
<TabItem Name="tabItemBRV" Header="DEBRV">
|
||||||
|
<local:MaerskListControl x:Name="brvListControl" />
|
||||||
|
</TabItem>
|
||||||
|
<TabItem Name="tabItemWVN" Header="DEWVN">
|
||||||
|
<local:MaerskListControl x:Name="wvnListControl" />
|
||||||
|
</TabItem>
|
||||||
|
</TabControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
2
ENI2/Properties/Resources.Designer.cs
generated
2
ENI2/Properties/Resources.Designer.cs
generated
@ -3733,7 +3733,7 @@ namespace ENI2.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to PO numbers.
|
/// Looks up a localized string similar to Maersk.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string textPOLists {
|
public static string textPOLists {
|
||||||
get {
|
get {
|
||||||
|
|||||||
@ -1709,7 +1709,7 @@
|
|||||||
<value>IMO hazard class (Group)</value>
|
<value>IMO hazard class (Group)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="textPOLists" xml:space="preserve">
|
<data name="textPOLists" xml:space="preserve">
|
||||||
<value>PO numbers</value>
|
<value>Maersk</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="textMaerskSeago" xml:space="preserve">
|
<data name="textMaerskSeago" xml:space="preserve">
|
||||||
<value>Maersk / SeaGo</value>
|
<value>Maersk / SeaGo</value>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user