|
@@ -41,11 +41,11 @@ namespace EVCB_OCPP.WEBAPI.Services
|
|
|
time = parameters.Get<DateTime>("@LastUpdatedTime");
|
|
|
|
|
|
}
|
|
|
- catch(Exception ex)
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
|
time = DateTime.UtcNow;
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
lastUpdatedOn = DateTime.SpecifyKind(time.Value, DateTimeKind.Utc);
|
|
|
|
|
@@ -114,7 +114,7 @@ namespace EVCB_OCPP.WEBAPI.Services
|
|
|
}
|
|
|
if (_machine != null)
|
|
|
{
|
|
|
- cp.ChargeBoxSystemID = _machine.ChargePointModel+_machine.ChargePointSerialNumber;
|
|
|
+ cp.ChargeBoxSystemID = _machine.ChargePointModel + _machine.ChargePointSerialNumber;
|
|
|
cp.ChargeBoxId = _machine.ChargeBoxId;
|
|
|
cp.NumberofConnectors = _machine.GunAmt;
|
|
|
cp.RatedPower = _machine.RatedPower;
|
|
@@ -423,7 +423,7 @@ namespace EVCB_OCPP.WEBAPI.Services
|
|
|
|
|
|
try
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
bool restrictedRange = false;
|
|
|
if (startTime != new DateTime(1991, 1, 1))
|
|
|
{
|
|
@@ -431,7 +431,7 @@ namespace EVCB_OCPP.WEBAPI.Services
|
|
|
parameters.Add("@startTime", startTime, DbType.DateTime, ParameterDirection.Input);
|
|
|
parameters.Add("@stopTime", stopTime, DbType.DateTime, ParameterDirection.Input);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
using (SqlConnection conn = new SqlConnection(mainConnectionString))
|
|
|
{
|
|
|
string strSql = string.Empty;
|
|
@@ -439,17 +439,17 @@ namespace EVCB_OCPP.WEBAPI.Services
|
|
|
{
|
|
|
parameters.Add("@ChargeBoxId", chargeBoxId, DbType.String, ParameterDirection.Input);
|
|
|
parameters.Add("@TransactionId", sessionId, DbType.String, ParameterDirection.Input);
|
|
|
- strSql = "Select Top(1) * from [dbo].[TransactionRecord] where ChargeBoxId=@ChargeBoxId and Id=@TransactionId and StopTime!='1991-01-01 00:00:00.000' "+ (restrictedRange ? " and StartTime >=@startTime and StartTime <=@stopTime" : "" )+ " Order by Id desc ;";
|
|
|
+ strSql = "Select Top(1) * from [dbo].[TransactionRecord] where ChargeBoxId=@ChargeBoxId and Id=@TransactionId and StopTime!='1991-01-01 00:00:00.000' " + (restrictedRange ? " and StartTime >=@startTime and StartTime <=@stopTime" : "") + " Order by Id desc ;";
|
|
|
}
|
|
|
else if (!string.IsNullOrEmpty(idTag) && string.IsNullOrEmpty(sessionId))
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(chargeBoxId))
|
|
|
+ if (!string.IsNullOrEmpty(chargeBoxId))
|
|
|
{
|
|
|
parameters.Add("@ChargeBoxId", chargeBoxId, DbType.String, ParameterDirection.Input);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
parameters.Add("@StartIdTag", idTag, DbType.String, ParameterDirection.Input);
|
|
|
- strSql = "Select * from [dbo].[TransactionRecord] where "+ (!string.IsNullOrEmpty(chargeBoxId)? " ChargeBoxId=@ChargeBoxId and " :"")+ " StartIdTag=@StartIdTag and StopTime!='1991-01-01 00:00:00.000' " + (restrictedRange ? " and StartTime >=@startTime and StartTime <=@stopTime" : "") + " Order by Id desc ;";
|
|
|
+ strSql = "Select * from [dbo].[TransactionRecord] where " + (!string.IsNullOrEmpty(chargeBoxId) ? " ChargeBoxId=@ChargeBoxId and " : "") + " StartIdTag=@StartIdTag and StopTime!='1991-01-01 00:00:00.000' " + (restrictedRange ? " and StartTime >=@startTime and StartTime <=@stopTime" : "") + " Order by Id desc ;";
|
|
|
|
|
|
}
|
|
|
else
|
|
@@ -462,7 +462,7 @@ namespace EVCB_OCPP.WEBAPI.Services
|
|
|
}
|
|
|
|
|
|
transactionModel = conn.Query<TransactionRecordModel>(strSql, parameters, null, true, EVCBConfiguration.DB_DefaultConnectionTimeout).ToList();
|
|
|
-
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
@@ -470,6 +470,7 @@ namespace EVCB_OCPP.WEBAPI.Services
|
|
|
{
|
|
|
detail.Add(new SessionDetail()
|
|
|
{
|
|
|
+ ChargeBoxId = item.ChargeBoxId,
|
|
|
ConnectorId = (int)item.ConnectorId,
|
|
|
IdTag = item.StartIdTag,
|
|
|
MeterStart = item.MeterStart,
|
|
@@ -482,7 +483,7 @@ namespace EVCB_OCPP.WEBAPI.Services
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- catch(Exception ex)
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
}
|