Korrekturen / Erweiterungen für 6.8, PDF Export aus ENI2

This commit is contained in:
Daniel Schick 2021-12-23 08:01:48 +01:00
parent 04a086548a
commit 40dbb741ff
5 changed files with 44 additions and 46 deletions

View File

@ -144,6 +144,7 @@ namespace ENI2.DetailViewControls
vioItem.Click += this.buttonWarnings_Click; vioItem.Click += this.buttonWarnings_Click;
this.dataGridMessages.ContextMenu.Items.Add(vioItem); this.dataGridMessages.ContextMenu.Items.Add(vioItem);
/*
MenuItem pdfItem = new MenuItem MenuItem pdfItem = new MenuItem
{ {
Header = Properties.Resources.textCreatePDF, Header = Properties.Resources.textCreatePDF,
@ -151,6 +152,7 @@ namespace ENI2.DetailViewControls
}; };
pdfItem.Click += this.buttonCreatePDF_Click; pdfItem.Click += this.buttonCreatePDF_Click;
this.dataGridMessages.ContextMenu.Items.Add(pdfItem); this.dataGridMessages.ContextMenu.Items.Add(pdfItem);
*/
MenuItem historyItem = new MenuItem MenuItem historyItem = new MenuItem
{ {
@ -540,13 +542,16 @@ namespace ENI2.DetailViewControls
private void buttonSendPDF_Click(object sender, RoutedEventArgs e) private void buttonSendPDF_Click(object sender, RoutedEventArgs e)
{ {
SelectImportClassesDialog sicd = new SelectImportClassesDialog(); SelectImportClassesDialog sicd = new SelectImportClassesDialog();
sicd.Messages = this.Messages;
sicd.IsTransit = this.Core.IsTransit; sicd.IsTransit = this.Core.IsTransit;
if ((sicd.ShowDialog() ?? false) && (sicd.SelectedClasses.Count > 0)) if ((sicd.ShowDialog() ?? false) && (sicd.SelectedClasses.Count > 0))
{ {
string preferredFileName = string.Format("{0}_{1}.pdf", this.Core.Shipname, this.Core.DisplayId);
// get here if user selected some classes // get here if user selected some classes
SaveFileDialog sfd = new SaveFileDialog SaveFileDialog sfd = new SaveFileDialog
{ {
Filter = "PDF Files|*.pdf" Filter = "PDF Files|*.pdf",
FileName = preferredFileName
}; };
if (sfd.ShowDialog() ?? false) if (sfd.ShowDialog() ?? false)
{ {
@ -685,6 +690,8 @@ namespace ENI2.DetailViewControls
} }
} }
/* obsolete, da PDF jetzt lokal erzeugt werden können..
*
private void buttonCreatePDF_Click(object sender, RoutedEventArgs e) private void buttonCreatePDF_Click(object sender, RoutedEventArgs e)
{ {
bool cannotCreateReport = false; bool cannotCreateReport = false;
@ -727,6 +734,7 @@ namespace ENI2.DetailViewControls
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(this.Core); DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(this.Core);
this.dataGridMessages.Items.Refresh(); this.dataGridMessages.Items.Refresh();
} }
*/
private void buttonSystemErrors_Click(object sender, RoutedEventArgs e) private void buttonSystemErrors_Click(object sender, RoutedEventArgs e)
{ {
@ -750,6 +758,7 @@ namespace ENI2.DetailViewControls
{ {
SelectImportClassesDialog sicd = new SelectImportClassesDialog(); SelectImportClassesDialog sicd = new SelectImportClassesDialog();
sicd.IsTransit = this.Core.IsTransit; sicd.IsTransit = this.Core.IsTransit;
sicd.Messages = this.Messages;
if((sicd.ShowDialog() ?? false) && (sicd.SelectedClasses.Count > 0)) if((sicd.ShowDialog() ?? false) && (sicd.SelectedClasses.Count > 0))
{ {
// get here if user selected some classes // get here if user selected some classes

View File

@ -37,7 +37,7 @@
<CreateWebPageOnPublish>true</CreateWebPageOnPublish> <CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage> <WebPage>publish.html</WebPage>
<ApplicationRevision>0</ApplicationRevision> <ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>6.8.0.0</ApplicationVersion> <ApplicationVersion>6.8.1.0</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut> <CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted> <PublishWizardCompleted>true</PublishWizardCompleted>

View File

@ -5,17 +5,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
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;
using bsmd.database; using bsmd.database;
@ -35,49 +25,53 @@ namespace ENI2.EditControls
this.Loaded += SelectImportClassesDialog_Loaded; this.Loaded += SelectImportClassesDialog_Loaded;
} }
public List<bsmd.database.Message.NotificationClass> SelectedClasses public List<Message.NotificationClass> SelectedClasses
{ {
get { return _selectedClasses; } get { return _selectedClasses; }
} }
/// <summary>
/// These messages are needed to derive message classes from, already sorted in the right manner
/// </summary>
public List<Message> Messages { get; set; }
public bool IsTransit { get; set; } public bool IsTransit { get; set; }
private void SelectImportClassesDialog_Loaded(object sender, RoutedEventArgs e) private void SelectImportClassesDialog_Loaded(object sender, RoutedEventArgs e)
{ {
foreach(bsmd.database.Message.NotificationClass notificationClass in Enum.GetValues(typeof(bsmd.database.Message.NotificationClass))) foreach(Message aMessage in this.Messages)
{ {
if ((notificationClass == Message.NotificationClass.VISIT) || if ((aMessage.MessageNotificationClass == Message.NotificationClass.VISIT) ||
(notificationClass == Message.NotificationClass.TRANSIT) || (aMessage.MessageNotificationClass == Message.NotificationClass.TRANSIT) ||
(notificationClass == Message.NotificationClass.ATA) || (aMessage.MessageNotificationClass == Message.NotificationClass.ATA) ||
(notificationClass == Message.NotificationClass.ATD) || (aMessage.MessageNotificationClass == Message.NotificationClass.ATD) ||
(notificationClass == Message.NotificationClass.CREWD) || (aMessage.MessageNotificationClass == Message.NotificationClass.CREWD) ||
(notificationClass == Message.NotificationClass.STO) || (aMessage.MessageNotificationClass == Message.NotificationClass.STO) ||
(notificationClass == Message.NotificationClass.PASD) (aMessage.MessageNotificationClass == Message.NotificationClass.PASD)
) continue; ) continue;
if (IsTransit && if (IsTransit &&
((notificationClass == Message.NotificationClass.BKRD) || ((aMessage.MessageNotificationClass == Message.NotificationClass.BKRD) ||
(notificationClass == Message.NotificationClass.BPOL) || (aMessage.MessageNotificationClass == Message.NotificationClass.BPOL) ||
(notificationClass == Message.NotificationClass.HAZD) || (aMessage.MessageNotificationClass == Message.NotificationClass.HAZD) ||
(notificationClass == Message.NotificationClass.INFO) || (aMessage.MessageNotificationClass == Message.NotificationClass.INFO) ||
(notificationClass == Message.NotificationClass.LADG) || (aMessage.MessageNotificationClass == Message.NotificationClass.LADG) ||
(notificationClass == Message.NotificationClass.NAME) || (aMessage.MessageNotificationClass == Message.NotificationClass.NAME) ||
//(notificationClass == Message.NotificationClass.POBD) || (aMessage.MessageNotificationClass == Message.NotificationClass.PRE72H) ||
(notificationClass == Message.NotificationClass.PRE72H) || (aMessage.MessageNotificationClass == Message.NotificationClass.SERV) ||
(notificationClass == Message.NotificationClass.SERV) || (aMessage.MessageNotificationClass == Message.NotificationClass.TIEFD) ||
(notificationClass == Message.NotificationClass.TIEFD) || (aMessage.MessageNotificationClass == Message.NotificationClass.TOWD) ||
(notificationClass == Message.NotificationClass.TOWD) || (aMessage.MessageNotificationClass == Message.NotificationClass.WAS)
(notificationClass == Message.NotificationClass.WAS)
)) continue; )) continue;
SelectClass sc = new SelectClass(); SelectClass sc = new SelectClass();
sc.Name = Enum.GetName(typeof(bsmd.database.Message.NotificationClass), notificationClass); sc.Name = Enum.GetName(typeof(bsmd.database.Message.NotificationClass), aMessage.MessageNotificationClass);
sc.Class = notificationClass; sc.Class = aMessage.MessageNotificationClass;
sc.IsSelected = false; sc.IsSelected = false;
_selectClasses.Add(sc); _selectClasses.Add(sc);
} }
_selectClasses.Sort();
this.checkListBoxClasses.ItemsSource = _selectClasses; this.checkListBoxClasses.ItemsSource = _selectClasses;
this.OKClicked += SelectImportClassesDialog_OKClicked; this.OKClicked += SelectImportClassesDialog_OKClicked;
} }
@ -90,11 +84,11 @@ namespace ENI2.EditControls
} }
} }
class SelectClass : IComparable, INotifyPropertyChanged class SelectClass : INotifyPropertyChanged
{ {
private bool _isSelected; private bool _isSelected;
public string Name { get; set; } public string Name { get; set; }
public bsmd.database.Message.NotificationClass Class { get; set; } public Message.NotificationClass Class { get; set; }
public bool IsSelected public bool IsSelected
{ {
get { return _isSelected; } get { return _isSelected; }
@ -110,11 +104,6 @@ namespace ENI2.EditControls
{ {
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
} }
public int CompareTo(object obj)
{
return Name.CompareTo(((SelectClass)obj).Name);
}
} }
private void buttonAll_Click(object sender, RoutedEventArgs e) private void buttonAll_Click(object sender, RoutedEventArgs e)

View File

@ -2,6 +2,6 @@
[assembly: AssemblyCompany("schick Informatik")] [assembly: AssemblyCompany("schick Informatik")]
[assembly: AssemblyProduct("BSMD NSW interface")] [assembly: AssemblyProduct("BSMD NSW interface")]
[assembly: AssemblyInformationalVersion("6.8.0")] [assembly: AssemblyInformationalVersion("6.8.1")]
[assembly: AssemblyCopyright("Copyright © 2014-2021 schick Informatik")] [assembly: AssemblyCopyright("Copyright © 2014-2021 schick Informatik")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]

View File

@ -1,4 +1,4 @@
using System.Reflection; using System.Reflection;
[assembly: AssemblyVersion("6.8.0.*")] [assembly: AssemblyVersion("6.8.1.*")]