Fix limite sync a 1 anno
This commit is contained in:
@@ -121,21 +121,26 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public MagmanSyncModel GetLastBySync(string SyncType)
|
||||
{
|
||||
// record default al 1900..
|
||||
// record default a 1 anno fa...
|
||||
DateTime dtLim = DateTime.Today.AddYears(-1);
|
||||
MagmanSyncModel dbResult = new MagmanSyncModel()
|
||||
{
|
||||
CloudId = 0,
|
||||
SyncType = SyncType,
|
||||
DtReq = DateTime.MinValue,
|
||||
DtReq = dtLim,
|
||||
Payload = ""
|
||||
};
|
||||
using (DatabaseContext localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
var rawRes = localDbCtx
|
||||
.SyncList
|
||||
.Where(x => (!string.IsNullOrEmpty(SyncType) && x.SyncType == SyncType))
|
||||
.OrderByDescending(x => x.DtReq)
|
||||
.FirstOrDefault();
|
||||
if (rawRes != null)
|
||||
{
|
||||
dbResult = rawRes;
|
||||
}
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user