zwei Rückmeldungen bearbeitet
This commit is contained in:
parent
c9cf0f65c7
commit
e726ff43ba
@ -279,8 +279,15 @@ namespace ENI2.Controls
|
|||||||
md.MessageCore = core;
|
md.MessageCore = core;
|
||||||
md.MessageCoreId = core.Id.Value;
|
md.MessageCoreId = core.Id.Value;
|
||||||
this.UpdateStatus(md);
|
this.UpdateStatus(md);
|
||||||
if(!maerskDataList.Contains(md)) // DatabaseEntity implements IEquatable
|
if (!maerskDataList.Contains(md)) // DatabaseEntity implements IEquatable
|
||||||
|
{
|
||||||
this.maerskDataList.Add(md);
|
this.maerskDataList.Add(md);
|
||||||
|
if(!core.VisitId.IsNullOrEmpty() && md.ColM.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
md.ColM = core.VisitId; // this can happen if client is closed before an Id has been returned, so we have to manually set it here
|
||||||
|
Task<int> saveResult = DBManagerAsync.SaveAsync(md); // actually we do not need to await this
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.TimeFilterItemSource();
|
this.TimeFilterItemSource();
|
||||||
@ -370,6 +377,7 @@ namespace ENI2.Controls
|
|||||||
List<MaerskData> importData = new List<MaerskData>();
|
List<MaerskData> importData = new List<MaerskData>();
|
||||||
uint emptyRowCnt = 0;
|
uint emptyRowCnt = 0;
|
||||||
bool isFirstRow = true;
|
bool isFirstRow = true;
|
||||||
|
int currentRow = 1;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -424,12 +432,29 @@ namespace ENI2.Controls
|
|||||||
if (!reader.IsDBNull(12)) md.ColM = ReadFieldAsString(reader, 12);
|
if (!reader.IsDBNull(12)) md.ColM = ReadFieldAsString(reader, 12);
|
||||||
if (!reader.IsDBNull(13)) md.Remark = ReadFieldAsString(reader, 13);
|
if (!reader.IsDBNull(13)) md.Remark = ReadFieldAsString(reader, 13);
|
||||||
|
|
||||||
if (!md.ColF.IsNullOrEmpty()) // only add this if IMO is set
|
bool imoIsOkay = false;
|
||||||
|
if(!md.ColF.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
if (Int32.TryParse(md.ColF, out int imo))
|
||||||
|
{
|
||||||
|
if ((imo > 1000000) && (imo < 9999999))
|
||||||
|
{
|
||||||
|
imoIsOkay = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!imoIsOkay)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"Invalid IMO in row {currentRow}, skipping entry", Properties.Resources.textCaptionError, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (imoIsOkay)
|
||||||
importData.Add(md);
|
importData.Add(md);
|
||||||
else
|
else
|
||||||
emptyRowCnt++;
|
emptyRowCnt++;
|
||||||
if (emptyRowCnt > MAX_EMPTY_ROWS_ON_IMPORT) break;
|
if (emptyRowCnt > MAX_EMPTY_ROWS_ON_IMPORT) break;
|
||||||
if (isFirstRow) isFirstRow = false;
|
if (isFirstRow) isFirstRow = false;
|
||||||
|
currentRow++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user