move private methods to end of class.

change LogEventTime implementation to return a LogEventResponse object.
#17
This commit is contained in:
chris.watts90@outlook.com 2017-04-16 19:40:33 +01:00
parent 094afc2903
commit c92ed064fc

View File

@ -99,26 +99,6 @@ namespace SQLiteRepository
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)
{
_logger.Trace("Searching SQLite database for the term: {0}", searchParam);
@ -361,8 +341,9 @@ namespace SQLiteRepository
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>(
SQLiteProcedures.GET_CARDS_BY_UNIQUE_ID,
identifier.UniqueId);
@ -378,7 +359,9 @@ namespace SQLiteRepository
UpdateIdentifierLastUsed(DateTimeOffset.UtcNow, ident.Id);
logId = -1;
//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
{
@ -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);
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);
logId = timeLog.Id;
return OperationResponse.SUCCESS;
ret.Direction = (LogDirection)(int)logDirection;
ret.ProcessResponse = OperationResponse.SUCCESS;
return ret;
}
/*Groups*/
@ -565,6 +551,26 @@ namespace SQLiteRepository
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)
{
switch (logSource)