ENI 6.7.2: Verbesserungsvorschläge von Christin eingebaut und neue Testversion erstellt

This commit is contained in:
Daniel Schick 2021-12-16 08:14:38 +01:00
parent 5b61ad7145
commit c21cdacedd
6 changed files with 66 additions and 7 deletions

View File

@ -83,6 +83,7 @@ namespace ENI2.DetailViewControls
this.comboBoxInitialHis.ItemsSource = Util.EnumHelper.GetAllValuesAndDescription(typeof(Message.NSWProvider));
this.comboBoxInitialHis.DataContext = this.Core;
this.buttonExcelImport.IsEnabled = !this.Core.DisplayId.IsNullOrEmpty();
Binding vtBinding = new Binding
{
@ -328,6 +329,9 @@ namespace ENI2.DetailViewControls
this.labelBSMDStatusInternal.DataContext = null;
this.labelBSMDStatusInternal.DataContext = this.Core;
this.labelBSMDStatusInternal.GetBindingExpression(Label.ContentProperty)?.UpdateTarget();
this.buttonExcelImport.IsEnabled = !this.Core.DisplayId.IsNullOrEmpty();
//MessageBox.Show(string.Format("Visit/Transit ID updated: {0}", this.Core.DisplayId));
//ShowIdDialog sid = new ShowIdDialog(this.Core)
//{
@ -719,6 +723,7 @@ namespace ENI2.DetailViewControls
private void buttonExcelImport_Click(object sender, RoutedEventArgs e)
{
SelectImportClassesDialog sicd = new SelectImportClassesDialog();
sicd.IsTransit = this.Core.IsTransit;
if((sicd.ShowDialog() ?? false) && (sicd.SelectedClasses.Count > 0))
{
// get here if user selected some classes

View File

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

View File

@ -8,7 +8,7 @@
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:p="clr-namespace:ENI2.Properties"
mc:Ignorable="d"
Title="{x:Static p:Resources.textSelectImportClasses}" Height="700" Width="250" Background="AliceBlue">
Title="{x:Static p:Resources.textSelectImportClasses}" Height="600" Width="250" Background="AliceBlue">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="27" />

View File

@ -40,15 +40,40 @@ namespace ENI2.EditControls
get { return _selectedClasses; }
}
public bool IsTransit { get; set; }
private void SelectImportClassesDialog_Loaded(object sender, RoutedEventArgs e)
{
foreach(bsmd.database.Message.NotificationClass notificationClass in Enum.GetValues(typeof(bsmd.database.Message.NotificationClass)))
{
if ((notificationClass == Message.NotificationClass.VISIT) ||
(notificationClass == Message.NotificationClass.ATA) ||
(notificationClass == Message.NotificationClass.ATD) ||
(notificationClass == Message.NotificationClass.CREWD) ||
(notificationClass == Message.NotificationClass.STO) ||
(notificationClass == Message.NotificationClass.PASD)
) continue;
if (IsTransit &&
((notificationClass == Message.NotificationClass.BKRD) ||
(notificationClass == Message.NotificationClass.BPOL) ||
(notificationClass == Message.NotificationClass.HAZD) ||
(notificationClass == Message.NotificationClass.INFO) ||
(notificationClass == Message.NotificationClass.LADG) ||
(notificationClass == Message.NotificationClass.NAME) ||
//(notificationClass == Message.NotificationClass.POBD) ||
(notificationClass == Message.NotificationClass.PRE72H) ||
(notificationClass == Message.NotificationClass.SERV) ||
(notificationClass == Message.NotificationClass.TIEFD) ||
(notificationClass == Message.NotificationClass.TOWD) ||
(notificationClass == Message.NotificationClass.WAS)
)) continue;
SelectClass sc = new SelectClass();
sc.Name = Enum.GetName(typeof(bsmd.database.Message.NotificationClass), notificationClass);
sc.Class = notificationClass;
sc.IsSelected = false;
sc.IsSelected = false;
_selectClasses.Add(sc);
}
_selectClasses.Sort();

View File

@ -262,7 +262,7 @@ namespace ENI2.Import
{
string val = this.ReadText(lookup);
if (val.Length == 2)
if ((val != null) && (val.Length == 2))
{
string isoCode = LocodeDB.CountryCodeFromName(val);
if (isoCode == null)

View File

@ -24,10 +24,15 @@ namespace ENI2.Import
internal static bool ProcessSheet(ExcelReader reader, out string readMessage, MessageCore messageCore, List<Message.NotificationClass> notificationClasses)
{
bool result = true;
// messageCore = ExcelUtil.LookupMessageCore(reader, out readMessage);
// if (messageCore == null) return false; // cannot work with this sheet or create one
readMessage = "";
MessageCore aMessageCore = ExcelUtil.LookupCoreById(reader);
if((aMessageCore == null) || (aMessageCore.Id.Value != messageCore.Id.Value))
{
readMessage = "Id not matching in import sheet";
return false;
}
// load messages if already present
List<Message> messages = DBManager.Instance.GetMessagesForCore(messageCore, DBManager.MessageLoad.ALL);
@ -2150,6 +2155,30 @@ namespace ENI2.Import
#region LookupMessageCore
/// <summary>
/// try to get the MessageCore from the open sheet by id
/// </summary>
/// <param name="reader"></param>
/// <returns></returns>
private static MessageCore LookupCoreById(ExcelReader reader)
{
MessageCore result = null;
string visitTransitId = reader.ReadTextNoWhitespace("ID");
if (visitTransitId != null)
{
if (bsmd.database.Util.IsVisitId(visitTransitId))
{
result = DBManager.Instance.GetMessageCoreByVisitId(visitTransitId);
}
else if (bsmd.database.Util.IsTransitId(visitTransitId))
{
result = DBManager.Instance.GetMessageCoreByTransitId(visitTransitId);
}
}
return result;
}
/// <summary>
/// Check with cell values if this message core is already in our DB
/// </summary>