Korrekturen für Dakosy Sheet einlesen Pt. 1

This commit is contained in:
Daniel Schick 2022-05-11 09:05:04 +02:00
parent 5acd9b98b7
commit 9353da42e5
4 changed files with 47 additions and 18 deletions

View File

@ -67,12 +67,16 @@ namespace ENI2.DetailViewControls
if (this.Messages == null) return; if (this.Messages == null) return;
if (this.Core == null) return; if (this.Core == null) return;
if(DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsAdmin) if (DBManager.Instance.GetReportingPartyDict()[App.UserId.Value].IsAdmin)
{ {
this.textBoxENI.IsReadOnly = false; this.textBoxENI.IsReadOnly = false;
this.textBoxIMO.IsReadOnly = false; this.textBoxIMO.IsReadOnly = false;
this.locodePoC.IsEnabled = true; this.locodePoC.IsEnabled = true;
this.textBoxDisplayId.IsReadOnly = false; this.textBoxDisplayId.IsReadOnly = false;
}
else
{
this.buttonExcelExport.Visibility = Visibility.Hidden;
} }
this.textBoxENI.DataContext = this.Core; this.textBoxENI.DataContext = this.Core;

View File

@ -36,8 +36,8 @@
<MinimumRequiredVersion>5.4.0.0</MinimumRequiredVersion> <MinimumRequiredVersion>5.4.0.0</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish> <CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage> <WebPage>publish.html</WebPage>
<ApplicationRevision>0</ApplicationRevision> <ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>7.1.0.0</ApplicationVersion> <ApplicationVersion>7.1.0.1</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut> <CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted> <PublishWizardCompleted>true</PublishWizardCompleted>

View File

@ -228,6 +228,9 @@ namespace ENI2.Excel
} }
WAS was = wasMessage.Elements[0] as WAS; WAS was = wasMessage.Elements[0] as WAS;
was.WasteDisposalValidExemption = reader.ReadCellAsBool("waste", "C8"); was.WasteDisposalValidExemption = reader.ReadCellAsBool("waste", "C8");
was.ConfirmationOfCorrectness = true;
was.ConfirmationOfSufficiency = true;
if(!(was.WasteDisposalValidExemption ?? false)) if(!(was.WasteDisposalValidExemption ?? false))
{ {
was.LastWasteDisposalPort = reader.ReadCellAsText("waste", "C10"); was.LastWasteDisposalPort = reader.ReadCellAsText("waste", "C10");
@ -515,8 +518,8 @@ namespace ENI2.Excel
string issuerType = reader.ReadCellAsText("security", "D20"); string issuerType = reader.ReadCellAsText("security", "D20");
if(!issuerType.IsNullOrEmpty()) if(!issuerType.IsNullOrEmpty())
{ {
if (isscType.Equals("ADMINISTRATION", StringComparison.OrdinalIgnoreCase)) sec.ISSCIssuerType = 0; if (issuerType.Equals("ADMINISTRATION", StringComparison.OrdinalIgnoreCase)) sec.ISSCIssuerType = 0;
if (isscType.Equals("RSO", StringComparison.OrdinalIgnoreCase)) sec.ISSCIssuerType = 1; if (issuerType.Equals("RSO", StringComparison.OrdinalIgnoreCase)) sec.ISSCIssuerType = 1;
} }
sec.ISSCIssuerName = reader.ReadCellAsText("security", "D21"); sec.ISSCIssuerName = reader.ReadCellAsText("security", "D21");
sec.ISSCDateOfExpiration = reader.ReadCellAsDateTime("security", "D22"); sec.ISSCDateOfExpiration = reader.ReadCellAsDateTime("security", "D22");
@ -763,21 +766,21 @@ namespace ENI2.Excel
pas.PassengerIdentityDocumentIssuingState = reader.ReadCellAsText("passenger arrival", string.Format("O{0}", i + 16)); pas.PassengerIdentityDocumentIssuingState = reader.ReadCellAsText("passenger arrival", string.Format("O{0}", i + 16));
pas.PassengerIdentityDocumentExpiryDate = reader.ReadCellAsDateTime("passenger arrival", string.Format("P{0}", i + 16)); pas.PassengerIdentityDocumentExpiryDate = reader.ReadCellAsDateTime("passenger arrival", string.Format("P{0}", i + 16));
if(pas.NotificationPAX ?? false) //if(pas.NotificationPAX ?? false)
{ //{
pas.EmergencyCare = reader.ReadCellAsText("passenger arrival", string.Format("Q{0}", i + 16)); pas.EmergencyCare = reader.ReadCellAsText("passenger arrival", string.Format("Q{0}", i + 16));
pas.EmergencyContactNumber = reader.ReadCellAsText("passenger arrival", string.Format("R{0}", i + 16)); pas.EmergencyContactNumber = reader.ReadCellAsText("passenger arrival", string.Format("R{0}", i + 16));
} //}
if(pas.NotificationSchengen ?? false) //if(pas.NotificationSchengen ?? false)
{ //{
pas.PassengerIdentityDocumentType = ParseDocumentType(reader.ReadCellAsText("passenger arrival", string.Format("I{0}", i + 16))); pas.PassengerIdentityDocumentType = ParseDocumentType(reader.ReadCellAsText("passenger arrival", string.Format("I{0}", i + 16)));
pas.PassengerIdentityDocumentId = reader.ReadCellAsText("passenger arrival", string.Format("J{0}", i + 16)); pas.PassengerIdentityDocumentId = reader.ReadCellAsText("passenger arrival", string.Format("J{0}", i + 16));
pas.PassengerVisaNumber = reader.ReadCellAsText("passenger arrival", string.Format("K{0}", i + 16)); pas.PassengerVisaNumber = reader.ReadCellAsText("passenger arrival", string.Format("K{0}", i + 16));
pas.PassengerPortOfEmbarkation = reader.ReadCellAsText("passenger arrival", string.Format("L{0}", i + 16)); pas.PassengerPortOfEmbarkation = reader.ReadCellAsText("passenger arrival", string.Format("L{0}", i + 16));
pas.PassengerPortOfDisembarkation = reader.ReadCellAsText("passenger arrival", string.Format("M{0}", i + 16)); pas.PassengerPortOfDisembarkation = reader.ReadCellAsText("passenger arrival", string.Format("M{0}", i + 16));
pas.PassengerInTransit = reader.ReadCellAsBool("passenger arrival", string.Format("N{0}", i + 16)); pas.PassengerInTransit = reader.ReadCellAsBool("passenger arrival", string.Format("N{0}", i + 16));
} //}
result = true; result = true;
} }
@ -1186,15 +1189,15 @@ namespace ENI2.Excel
crew.CrewMemberGender = ParseGender(gender); crew.CrewMemberGender = ParseGender(gender);
crew.CrewMemberNationality = reader.ReadCellAsText("crew arrival", string.Format("H{0}", i + 15)); crew.CrewMemberNationality = reader.ReadCellAsText("crew arrival", string.Format("H{0}", i + 15));
if(crew.NotificationSchengen ?? false) //if(crew.NotificationSchengen ?? false)
{ //{
string idDocType = reader.ReadCellAsText("crew arrival", string.Format("I{0}", i + 15)); string idDocType = reader.ReadCellAsText("crew arrival", string.Format("I{0}", i + 15));
crew.CrewMemberIdentityDocumentType = ParseDocumentType(idDocType); crew.CrewMemberIdentityDocumentType = ParseDocumentType(idDocType);
crew.CrewMemberIdentityDocumentId = reader.ReadCellAsText("crew arrival", string.Format("J{0}", i + 15)); crew.CrewMemberIdentityDocumentId = reader.ReadCellAsText("crew arrival", string.Format("J{0}", i + 15));
crew.CrewMemberVisaNumber = reader.ReadCellAsText("crew arrival", string.Format("K{0}", i + 15)); crew.CrewMemberVisaNumber = reader.ReadCellAsText("crew arrival", string.Format("K{0}", i + 15));
crew.CrewMemberIdentityDocumentIssuingState = reader.ReadCellAsText("crew arrival", string.Format("M{0}", i + 15)); crew.CrewMemberIdentityDocumentIssuingState = reader.ReadCellAsText("crew arrival", string.Format("M{0}", i + 15));
crew.CrewMemberIdentityDocumentExpiryDate = reader.ReadCellAsDateTime("crew arrival", string.Format("N{0}", i + 15)); crew.CrewMemberIdentityDocumentExpiryDate = reader.ReadCellAsDateTime("crew arrival", string.Format("N{0}", i + 15));
} //}
crew.CrewMemberDuty = reader.ReadCellAsText("crew arrival", string.Format("L{0}", i + 15)); crew.CrewMemberDuty = reader.ReadCellAsText("crew arrival", string.Format("L{0}", i + 15));

View File

@ -566,7 +566,7 @@ namespace ENI2.Excel
try try
{ {
Worksheet workSheet = (Worksheet) _workBook.Worksheets[sheetName]; Worksheet workSheet = (Worksheet) _workBook.Worksheets[sheetName];
string result = workSheet.Range[range].Text.ToString(); string result = workSheet.Range[range].Text.ToString();
return result; return result;
} }
catch(Exception e) catch(Exception e)
@ -576,6 +576,26 @@ namespace ENI2.Excel
return null; return null;
} }
// TODO THIS IS NOT WORKING
internal string ReadTextFromDropdown(string sheetName, string range)
{
try
{
Worksheet workSheet = (Worksheet)_workBook.Worksheets[sheetName];
Shapes shapes = workSheet.Shapes;
Shape aShape = shapes.Item("bla");
Range aRange = workSheet.Range[range];
string formulaRange = aRange.Validation.Formula1;
}
catch (Exception e)
{
_log.Warn(e.Message);
}
return null;
}
internal bool? ReadCellAsBool(string sheetName, string range) internal bool? ReadCellAsBool(string sheetName, string range)
{ {
string boolString = ReadCellAsText(sheetName, range); string boolString = ReadCellAsText(sheetName, range);
@ -632,11 +652,13 @@ namespace ENI2.Excel
CultureInfo provider = CultureInfo.InvariantCulture; CultureInfo provider = CultureInfo.InvariantCulture;
const string dateTimeFormat = "yyyy/MM/dd HH:mm"; const string dateTimeFormat = "yyyy/MM/dd HH:mm";
if (DateTime.TryParseExact(dateString, dateTimeFormat, provider, DateTimeStyles.None, out DateTime tmpDate)) if (DateTime.TryParseExact(dateString, dateTimeFormat, provider, DateTimeStyles.None, out DateTime tmpDate))
return tmpDate; return tmpDate.ToUniversalTime();
const string dateFormat = "yyyy/MM/dd"; const string dateFormat = "yyyy/MM/dd";
if (DateTime.TryParseExact(dateString, dateFormat, provider, DateTimeStyles.None, out DateTime tmpDate2)) if (DateTime.TryParseExact(dateString, dateFormat, provider, DateTimeStyles.None, out DateTime tmpDate2))
return tmpDate2; return tmpDate2;
const string dateFormat2 = "dd.MM.yyyy";
if (DateTime.TryParseExact(dateString, dateFormat2, provider, DateTimeStyles.None, out DateTime tmpDate3))
return tmpDate3;
return null; return null;
} }
else return null; else return null;