Erste Version Excel-Reader deployment (3.2.0)
This commit is contained in:
parent
dad76beb2c
commit
384dad5950
Binary file not shown.
@ -66,11 +66,7 @@ namespace bsmd.ExcelReadService
|
|||||||
|
|
||||||
using (BSMDPopClient bsmdPopClient = new BSMDPopClient())
|
using (BSMDPopClient bsmdPopClient = new BSMDPopClient())
|
||||||
{
|
{
|
||||||
if (!bsmdPopClient.IsConnected)
|
if(bsmdPopClient.IsConnected)
|
||||||
{
|
|
||||||
_log.Error("cannot connect to pop3 server!");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -121,70 +121,142 @@ namespace bsmd.ExcelReadService
|
|||||||
|
|
||||||
internal byte? ReadGender(string lookup)
|
internal byte? ReadGender(string lookup)
|
||||||
{
|
{
|
||||||
|
byte? result = null;
|
||||||
string val = this.ReadText(lookup);
|
string val = this.ReadText(lookup);
|
||||||
if (val == null) return null;
|
if (val != null)
|
||||||
if (val.Equals("m", StringComparison.CurrentCultureIgnoreCase) || val.Equals("male", StringComparison.CurrentCultureIgnoreCase)) return 0;
|
{
|
||||||
if (val.Equals("f", StringComparison.CurrentCultureIgnoreCase) || val.Equals("female", StringComparison.CurrentCultureIgnoreCase)) return 1;
|
if (val.Equals("m", StringComparison.CurrentCultureIgnoreCase) || val.Equals("male", StringComparison.CurrentCultureIgnoreCase)) {
|
||||||
|
this.HighlightLookup(lookup, ReadState.OK);
|
||||||
|
result = 0;
|
||||||
|
}
|
||||||
|
else if (val.Equals("f", StringComparison.CurrentCultureIgnoreCase) || val.Equals("female", StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
this.HighlightLookup(lookup, ReadState.OK);
|
||||||
|
result = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = 2;
|
||||||
this.HighlightLookup(lookup, ReadState.WARN);
|
this.HighlightLookup(lookup, ReadState.WARN);
|
||||||
return 2; // whatever
|
}
|
||||||
|
}
|
||||||
|
if(result == null)
|
||||||
|
{
|
||||||
|
this.HighlightLookup(lookup, ReadState.FAIL);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal byte? ReadIdentityDocumentType(string lookup)
|
internal byte? ReadIdentityDocumentType(string lookup)
|
||||||
{
|
{
|
||||||
|
byte? result = null;
|
||||||
string val = this.ReadText(lookup);
|
string val = this.ReadText(lookup);
|
||||||
if (val == null) return null;
|
if (val != null)
|
||||||
if (val.Equals("identity_card", StringComparison.CurrentCultureIgnoreCase)) return 0;
|
{
|
||||||
if (val.Equals("passport", StringComparison.CurrentCultureIgnoreCase)) return 1;
|
if (val.Equals("identity_card", StringComparison.CurrentCultureIgnoreCase)) result = 0;
|
||||||
if (val.Equals("muster_book", StringComparison.CurrentCultureIgnoreCase)) return 2;
|
if (val.Equals("passport", StringComparison.CurrentCultureIgnoreCase)) result = 1;
|
||||||
if (val.Equals("picture_id", StringComparison.CurrentCultureIgnoreCase)) return 3;
|
if (val.Equals("muster_book", StringComparison.CurrentCultureIgnoreCase)) result = 2;
|
||||||
if (val.Equals("residental_permit", StringComparison.CurrentCultureIgnoreCase)) return 4;
|
if (val.Equals("picture_id", StringComparison.CurrentCultureIgnoreCase)) result = 3;
|
||||||
if (val.Equals("other_legal_identity_document", StringComparison.CurrentCultureIgnoreCase)) return 5;
|
if (val.Equals("residental_permit", StringComparison.CurrentCultureIgnoreCase)) result = 4;
|
||||||
|
if (val.Equals("other_legal_identity_document", StringComparison.CurrentCultureIgnoreCase)) result = 5;
|
||||||
|
if (val.Equals("ic", StringComparison.CurrentCultureIgnoreCase)) result = 0;
|
||||||
|
|
||||||
return 5; // default?
|
if (result == null)
|
||||||
|
this.HighlightLookup(lookup, ReadState.WARN);
|
||||||
|
else
|
||||||
|
this.HighlightLookup(lookup, ReadState.OK);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.HighlightLookup(lookup, ReadState.FAIL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal byte? ReadShippingArea(string lookup)
|
internal byte? ReadShippingArea(string lookup)
|
||||||
{
|
{
|
||||||
string val = this.ReadText(lookup);
|
string val = this.ReadText(lookup);
|
||||||
if (val == null) return null;
|
byte? result = null;
|
||||||
if (val.IndexOf("baltic", StringComparison.OrdinalIgnoreCase) >= 0) return 0;
|
if (val != null)
|
||||||
if (val.IndexOf("europe", StringComparison.OrdinalIgnoreCase) >= 0) return 1;
|
{
|
||||||
if (val.IndexOf("overseas", StringComparison.OrdinalIgnoreCase) >= 0) return 2;
|
if (val.IndexOf("baltic", StringComparison.OrdinalIgnoreCase) >= 0) result = 0;
|
||||||
|
if (val.IndexOf("europe", StringComparison.OrdinalIgnoreCase) >= 0) result = 1;
|
||||||
|
if (val.IndexOf("overseas", StringComparison.OrdinalIgnoreCase) >= 0) result = 2;
|
||||||
|
if (result == null)
|
||||||
|
this.HighlightLookup(lookup, ReadState.WARN);
|
||||||
|
else
|
||||||
|
this.HighlightLookup(lookup, ReadState.OK);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this.HighlightLookup(lookup, ReadState.FAIL);
|
this.HighlightLookup(lookup, ReadState.FAIL);
|
||||||
return null;
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal byte? ReadHullConfiguration(string lookup)
|
internal byte? ReadHullConfiguration(string lookup)
|
||||||
{
|
{
|
||||||
string val = this.ReadText(lookup);
|
string val = this.ReadText(lookup);
|
||||||
if (val == null) return null;
|
byte? result = null;
|
||||||
if (val.IndexOf("sbt", StringComparison.OrdinalIgnoreCase) >= 0) return 1;
|
if (val != null)
|
||||||
if (val.IndexOf("single", StringComparison.OrdinalIgnoreCase) >= 0) return 0;
|
{
|
||||||
if (val.IndexOf("double", StringComparison.OrdinalIgnoreCase) >= 0) return 2;
|
if (val.IndexOf("sbt", StringComparison.OrdinalIgnoreCase) >= 0) result = 1;
|
||||||
|
if (val.IndexOf("single", StringComparison.OrdinalIgnoreCase) >= 0) result = 0;
|
||||||
|
if (val.IndexOf("double", StringComparison.OrdinalIgnoreCase) >= 0) result = 2;
|
||||||
|
if (result == null)
|
||||||
|
this.HighlightLookup(lookup, ReadState.WARN);
|
||||||
|
else
|
||||||
|
this.HighlightLookup(lookup, ReadState.OK);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this.HighlightLookup(lookup, ReadState.FAIL);
|
this.HighlightLookup(lookup, ReadState.FAIL);
|
||||||
return null;
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal byte? ReadConditionTanks(string lookup)
|
internal byte? ReadConditionTanks(string lookup)
|
||||||
{
|
{
|
||||||
string val = this.ReadText(lookup);
|
string val = this.ReadText(lookup);
|
||||||
if (val == null) return null;
|
byte? result = null;
|
||||||
if (val.IndexOf("full", StringComparison.OrdinalIgnoreCase) >= 0) return 0;
|
if (val != null)
|
||||||
if (val.IndexOf("empty", StringComparison.OrdinalIgnoreCase) >= 0) return 1;
|
{
|
||||||
if (val.IndexOf("inerted", StringComparison.OrdinalIgnoreCase) >= 0) return 2;
|
if (val.IndexOf("full", StringComparison.OrdinalIgnoreCase) >= 0) result = 0;
|
||||||
|
if (val.IndexOf("empty", StringComparison.OrdinalIgnoreCase) >= 0) result = 1;
|
||||||
|
if (val.IndexOf("inerted", StringComparison.OrdinalIgnoreCase) >= 0) result = 2;
|
||||||
|
if (result == null)
|
||||||
|
this.HighlightLookup(lookup, ReadState.WARN);
|
||||||
|
else
|
||||||
|
this.HighlightLookup(lookup, ReadState.OK);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this.HighlightLookup(lookup, ReadState.FAIL);
|
this.HighlightLookup(lookup, ReadState.FAIL);
|
||||||
return null;
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal byte? ReadDelivery(string lookup)
|
internal byte? ReadDelivery(string lookup)
|
||||||
{
|
{
|
||||||
string val = this.ReadText(lookup);
|
string val = this.ReadText(lookup);
|
||||||
if (val == null) return null;
|
byte? result = null;
|
||||||
if (val.IndexOf("all", StringComparison.OrdinalIgnoreCase) >= 0) return 0;
|
|
||||||
if (val.IndexOf("some", StringComparison.OrdinalIgnoreCase) >= 0) return 1;
|
if (val != null)
|
||||||
if (val.IndexOf("none", StringComparison.OrdinalIgnoreCase) >= 0) return 2;
|
{
|
||||||
|
if (val.IndexOf("all", StringComparison.OrdinalIgnoreCase) >= 0) result = 0;
|
||||||
|
if (val.IndexOf("some", StringComparison.OrdinalIgnoreCase) >= 0) result = 1;
|
||||||
|
if (val.IndexOf("none", StringComparison.OrdinalIgnoreCase) >= 0) result = 2;
|
||||||
|
if (result == null)
|
||||||
|
this.HighlightLookup(lookup, ReadState.WARN);
|
||||||
|
else
|
||||||
|
this.HighlightLookup(lookup, ReadState.OK);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this.HighlightLookup(lookup, ReadState.FAIL);
|
this.HighlightLookup(lookup, ReadState.FAIL);
|
||||||
return null;
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
@ -199,18 +271,45 @@ namespace bsmd.ExcelReadService
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!_nameDict.ContainsKey(lookup)) return null;
|
DateTime? date = null;
|
||||||
|
|
||||||
|
if (_nameDict.ContainsKey(lookup))
|
||||||
|
{
|
||||||
var val = _nameDict[lookup].RefersToRange.Value;
|
var val = _nameDict[lookup].RefersToRange.Value;
|
||||||
if (val is DateTime) return val;
|
if (val is DateTime) return val;
|
||||||
if (val is double)
|
if (val is double)
|
||||||
return DateTime.FromOADate(val);
|
{
|
||||||
DateTime date;
|
try
|
||||||
if (DateTime.TryParse(val, out date))
|
{
|
||||||
return date;
|
date = DateTime.FromOADate(val);
|
||||||
// TODO: weitere varianten ausprobieren
|
}
|
||||||
|
catch (ArgumentException) { /* .. */ }
|
||||||
|
if(date == null)
|
||||||
|
{
|
||||||
|
CultureInfo provider = CultureInfo.InvariantCulture;
|
||||||
|
string dateString = val.ToString();
|
||||||
|
string format = "yyyyMMdd";
|
||||||
|
DateTime tmpDate;
|
||||||
|
if (DateTime.TryParseExact(dateString, format, provider, DateTimeStyles.None, out tmpDate))
|
||||||
|
date = tmpDate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (date == null)
|
||||||
|
{
|
||||||
|
DateTime tmpDate;
|
||||||
|
if (DateTime.TryParse(val, out tmpDate))
|
||||||
|
date = tmpDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: weitere varianten ausprobieren
|
||||||
|
if (date != null)
|
||||||
|
this.HighlightLookup(lookup, ReadState.OK);
|
||||||
|
else
|
||||||
this.HighlightLookup(lookup, ReadState.WARN);
|
this.HighlightLookup(lookup, ReadState.WARN);
|
||||||
return null;
|
}
|
||||||
|
|
||||||
|
return date;
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@ -238,53 +337,105 @@ namespace bsmd.ExcelReadService
|
|||||||
|
|
||||||
internal DateTime? ReadTime(string lookup)
|
internal DateTime? ReadTime(string lookup)
|
||||||
{
|
{
|
||||||
|
DateTime? result = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!_nameDict.ContainsKey(lookup)) return null;
|
if (_nameDict.ContainsKey(lookup))
|
||||||
|
{
|
||||||
var val = _nameDict[lookup].RefersToRange.Value;
|
var val = _nameDict[lookup].RefersToRange.Value;
|
||||||
if (val is DateTime) return val;
|
if (val is DateTime)
|
||||||
|
{
|
||||||
|
result = val;
|
||||||
|
}
|
||||||
if (val is double)
|
if (val is double)
|
||||||
return DateTime.FromOADate(val);
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
result = DateTime.FromOADate(val);
|
||||||
|
}
|
||||||
|
catch(ArgumentException) { }
|
||||||
|
|
||||||
|
if (result == null)
|
||||||
|
{
|
||||||
|
CultureInfo provider = CultureInfo.InvariantCulture;
|
||||||
|
string dateString = val.ToString();
|
||||||
|
string format = "HHmm";
|
||||||
|
DateTime tmpDate;
|
||||||
|
if (DateTime.TryParseExact(dateString, format, provider, DateTimeStyles.None, out tmpDate))
|
||||||
|
result = tmpDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (result == null)
|
||||||
|
{
|
||||||
DateTime date;
|
DateTime date;
|
||||||
if (DateTime.TryParseExact(val, "HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.NoCurrentDateDefault, out date))
|
if (DateTime.TryParseExact(val, "HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.NoCurrentDateDefault, out date))
|
||||||
return date;
|
result = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result == null)
|
||||||
|
{
|
||||||
|
DateTime date;
|
||||||
if (DateTime.TryParseExact(val, "HH:mm", CultureInfo.InvariantCulture, DateTimeStyles.NoCurrentDateDefault, out date))
|
if (DateTime.TryParseExact(val, "HH:mm", CultureInfo.InvariantCulture, DateTimeStyles.NoCurrentDateDefault, out date))
|
||||||
return date;
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result != null)
|
||||||
|
{
|
||||||
|
this.HighlightLookup(lookup, ReadState.OK);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this.HighlightLookup(lookup, ReadState.WARN);
|
this.HighlightLookup(lookup, ReadState.WARN);
|
||||||
return null;
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
this.HighlightLookup(lookup, ReadState.FAIL);
|
this.HighlightLookup(lookup, ReadState.FAIL);
|
||||||
_log.WarnFormat("error reading time for lookup {0}", lookup);
|
_log.WarnFormat("error reading time for lookup {0}", lookup);
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal double? ReadNumber(string lookup)
|
internal double? ReadNumber(string lookup)
|
||||||
{
|
{
|
||||||
double result;
|
double? result = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!_nameDict.ContainsKey(lookup)) return null;
|
if (_nameDict.ContainsKey(lookup))
|
||||||
|
{
|
||||||
var val = _nameDict[lookup].RefersToRange.Value;
|
var val = _nameDict[lookup].RefersToRange.Value;
|
||||||
if (val is double) return val;
|
if (val is double) result = val;
|
||||||
if (val is string)
|
if (val is string)
|
||||||
{
|
{
|
||||||
if (double.TryParse(val, NumberStyles.None, CultureInfo.InvariantCulture, out result))
|
double tmpDouble;
|
||||||
return result;
|
if (double.TryParse(val, NumberStyles.None, CultureInfo.InvariantCulture, out tmpDouble))
|
||||||
if (double.TryParse(val, out result))
|
result = tmpDouble;
|
||||||
return result;
|
if (result == null)
|
||||||
|
{
|
||||||
|
if (double.TryParse(val, out tmpDouble))
|
||||||
|
result = tmpDouble;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (result != null)
|
||||||
|
{
|
||||||
|
this.HighlightLookup(lookup, ReadState.OK);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this.HighlightLookup(lookup, ReadState.WARN);
|
this.HighlightLookup(lookup, ReadState.WARN);
|
||||||
return null;
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
this.HighlightLookup(lookup, ReadState.FAIL);
|
this.HighlightLookup(lookup, ReadState.FAIL);
|
||||||
_log.WarnFormat("error reading number for lookup {0}", lookup);
|
_log.WarnFormat("error reading number for lookup {0}", lookup);
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal bool? ReadBoolean(string lookup)
|
internal bool? ReadBoolean(string lookup)
|
||||||
@ -292,13 +443,15 @@ namespace bsmd.ExcelReadService
|
|||||||
string val = this.ReadText(lookup);
|
string val = this.ReadText(lookup);
|
||||||
if (val == null)
|
if (val == null)
|
||||||
{
|
{
|
||||||
this.HighlightLookup(lookup, ReadState.WARN);
|
this.HighlightLookup(lookup, ReadState.FAIL);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.HighlightLookup(lookup, ReadState.OK);
|
||||||
|
|
||||||
if ((val == "y") || (val == "Y") || (val == "yes") || (val == "YES") || (val == "1") || (val == "x") || (val == "X"))
|
if ((val == "y") || (val == "Y") || (val == "yes") || (val == "YES") || (val == "1") || (val == "x") || (val == "X"))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -949,7 +949,8 @@ namespace bsmd.ExcelReadService
|
|||||||
result = DBManager.Instance.GetMessageCoreByTransitId(visitTransitId);
|
result = DBManager.Instance.GetMessageCoreByTransitId(visitTransitId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if(result == null)
|
||||||
{
|
{
|
||||||
// lookup poc, imo, eta
|
// lookup poc, imo, eta
|
||||||
poc = reader.ReadText("Visit.PortOfCall");
|
poc = reader.ReadText("Visit.PortOfCall");
|
||||||
@ -974,10 +975,15 @@ namespace bsmd.ExcelReadService
|
|||||||
aGermanPortName = poc.Split(',')[0];
|
aGermanPortName = poc.Split(',')[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (RuleEngine.IsGermanLocode(aGermanPortName))
|
||||||
|
poc = aGermanPortName;
|
||||||
|
else
|
||||||
|
{
|
||||||
// somehow lookup LOCODE from the port's name!
|
// somehow lookup LOCODE from the port's name!
|
||||||
poc = LocodeDB.LocodeGERFromCity(aGermanPortName);
|
poc = LocodeDB.LocodeGERFromCity(aGermanPortName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
imo = reader.ReadText("Visit.IMONumber");
|
imo = reader.ReadText("Visit.IMONumber");
|
||||||
|
|
||||||
@ -1028,6 +1034,15 @@ namespace bsmd.ExcelReadService
|
|||||||
_log.WarnFormat("IMO {0} is longer than 7 chars, truncating!", result.IMO);
|
_log.WarnFormat("IMO {0} is longer than 7 chars, truncating!", result.IMO);
|
||||||
result.IMO = result.IMO.Substring(0, 7);
|
result.IMO = result.IMO.Substring(0, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(visitTransitId != null)
|
||||||
|
{
|
||||||
|
if (bsmd.database.Util.IsVisitId(visitTransitId))
|
||||||
|
result.VisitId = visitTransitId;
|
||||||
|
else
|
||||||
|
result.TransitId = visitTransitId;
|
||||||
|
}
|
||||||
|
|
||||||
DBManager.Instance.Save(result);
|
DBManager.Instance.Save(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -459,8 +459,8 @@ namespace bsmd.database
|
|||||||
{
|
{
|
||||||
case NotificationClass.BKRA: return 5;
|
case NotificationClass.BKRA: return 5;
|
||||||
case NotificationClass.BKRD: return 5;
|
case NotificationClass.BKRD: return 5;
|
||||||
case NotificationClass.LADG: return 5;
|
case NotificationClass.LADG: return 36;
|
||||||
case NotificationClass.CREW: return 30;
|
case NotificationClass.CREW: return 40;
|
||||||
case NotificationClass.PAS: return 30;
|
case NotificationClass.PAS: return 30;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -21,6 +21,7 @@ namespace bsmd.email
|
|||||||
private Pop3Client pop3Client;
|
private Pop3Client pop3Client;
|
||||||
private bool _connected = false;
|
private bool _connected = false;
|
||||||
private ILog _log = LogManager.GetLogger(typeof(BSMDPopClient));
|
private ILog _log = LogManager.GetLogger(typeof(BSMDPopClient));
|
||||||
|
private int currentMail = 1;
|
||||||
|
|
||||||
public BSMDPopClient()
|
public BSMDPopClient()
|
||||||
{
|
{
|
||||||
@ -34,6 +35,7 @@ namespace bsmd.email
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_log.ErrorFormat("Error connecting to POP3 Server: {0}", ex.Message);
|
_log.ErrorFormat("Error connecting to POP3 Server: {0}", ex.Message);
|
||||||
|
_log.DebugFormat("User:{0} Pw:{1}", Properties.Settings.Default.POP3User, Properties.Settings.Default.POP3Password);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +52,7 @@ namespace bsmd.email
|
|||||||
int messageCount = this.pop3Client.GetMessageCount();
|
int messageCount = this.pop3Client.GetMessageCount();
|
||||||
if (messageCount > 0)
|
if (messageCount > 0)
|
||||||
{
|
{
|
||||||
Message mailMessage = this.pop3Client.GetMessage(1);
|
Message mailMessage = this.pop3Client.GetMessage(this.currentMail);
|
||||||
|
|
||||||
if ((mailMessage.Headers.Sender != null) && mailMessage.Headers.Sender.HasValidMailAddress)
|
if ((mailMessage.Headers.Sender != null) && mailMessage.Headers.Sender.HasValidMailAddress)
|
||||||
sender = mailMessage.Headers.Sender.MailAddress.Address;
|
sender = mailMessage.Headers.Sender.MailAddress.Address;
|
||||||
@ -69,6 +71,8 @@ namespace bsmd.email
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.currentMail++; // advance message pointer
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user