move private methods to end of class.
change LogEventTime implementation to return a LogEventResponse object. #17
This commit is contained in:
parent
094afc2903
commit
c92ed064fc
@ -99,26 +99,6 @@ namespace SQLiteRepository
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private DateTime GetLastLogDateTime(TimeLogDb timeLog)
|
|
||||||
{
|
|
||||||
if (timeLog != null)
|
|
||||||
{
|
|
||||||
return timeLog.SwipeEventDateTime.DateTime;
|
|
||||||
}
|
|
||||||
return DateTime.MinValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool GetUserState(LogDirectionDb logDirection)
|
|
||||||
{
|
|
||||||
switch (logDirection)
|
|
||||||
{
|
|
||||||
case LogDirectionDb.OUT:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserList Search(string searchParam)
|
public UserList Search(string searchParam)
|
||||||
{
|
{
|
||||||
_logger.Trace("Searching SQLite database for the term: {0}", searchParam);
|
_logger.Trace("Searching SQLite database for the term: {0}", searchParam);
|
||||||
@ -361,8 +341,9 @@ namespace SQLiteRepository
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OperationResponse LogEventTime(Identifier identifier, out int logId)
|
public LogEventResponse LogEventTime(Identifier identifier, out int logId)
|
||||||
{
|
{
|
||||||
|
var ret = new LogEventResponse();
|
||||||
var cardIdQuery = _connection.Query<CardUniqueId>(
|
var cardIdQuery = _connection.Query<CardUniqueId>(
|
||||||
SQLiteProcedures.GET_CARDS_BY_UNIQUE_ID,
|
SQLiteProcedures.GET_CARDS_BY_UNIQUE_ID,
|
||||||
identifier.UniqueId);
|
identifier.UniqueId);
|
||||||
@ -378,7 +359,9 @@ namespace SQLiteRepository
|
|||||||
UpdateIdentifierLastUsed(DateTimeOffset.UtcNow, ident.Id);
|
UpdateIdentifierLastUsed(DateTimeOffset.UtcNow, ident.Id);
|
||||||
logId = -1;
|
logId = -1;
|
||||||
//dont try to log any timelogs against this card, as it is unassigned to a user.
|
//dont try to log any timelogs against this card, as it is unassigned to a user.
|
||||||
return OperationResponse.SUCCESS;
|
ret.ProcessResponse=OperationResponse.SUCCESS;
|
||||||
|
ret.Direction = LogDirection.UNKNOWN;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -404,7 +387,9 @@ namespace SQLiteRepository
|
|||||||
{
|
{
|
||||||
_logger.Error("Not logging event for user id: {0}, logged event within TimeGap Threshold of {1}", ident.UserId_FK, threshold);
|
_logger.Error("Not logging event for user id: {0}, logged event within TimeGap Threshold of {1}", ident.UserId_FK, threshold);
|
||||||
logId = -1;
|
logId = -1;
|
||||||
return OperationResponse.FAILED;
|
ret.ProcessResponse = OperationResponse.FAILED;
|
||||||
|
ret.Direction = LogDirection.UNKNOWN;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,8 +416,9 @@ namespace SQLiteRepository
|
|||||||
UpdateIdentifierLastUsed(timeLog.SwipeEventDateTime, timeLog.IdentifierId);
|
UpdateIdentifierLastUsed(timeLog.SwipeEventDateTime, timeLog.IdentifierId);
|
||||||
|
|
||||||
logId = timeLog.Id;
|
logId = timeLog.Id;
|
||||||
|
ret.Direction = (LogDirection)(int)logDirection;
|
||||||
return OperationResponse.SUCCESS;
|
ret.ProcessResponse = OperationResponse.SUCCESS;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Groups*/
|
/*Groups*/
|
||||||
@ -565,6 +551,26 @@ namespace SQLiteRepository
|
|||||||
return OperationResponse.UPDATED;
|
return OperationResponse.UPDATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DateTime GetLastLogDateTime(TimeLogDb timeLog)
|
||||||
|
{
|
||||||
|
if (timeLog != null)
|
||||||
|
{
|
||||||
|
return timeLog.SwipeEventDateTime.DateTime;
|
||||||
|
}
|
||||||
|
return DateTime.MinValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool GetUserState(LogDirectionDb logDirection)
|
||||||
|
{
|
||||||
|
switch (logDirection)
|
||||||
|
{
|
||||||
|
case LogDirectionDb.OUT:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private int ConvertSourceToIdentifierId(LogSource logSource)
|
private int ConvertSourceToIdentifierId(LogSource logSource)
|
||||||
{
|
{
|
||||||
switch (logSource)
|
switch (logSource)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user