|
@@ -1,7 +1,10 @@
|
|
|
-using EVCB_OCPP.TaskScheduler.Models;
|
|
|
+using Dapper;
|
|
|
+using EVCB_OCPP.TaskScheduler.Models;
|
|
|
using Newtonsoft.Json;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.Configuration;
|
|
|
+using System.Data.SqlClient;
|
|
|
using System.Diagnostics;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
@@ -24,6 +27,8 @@ namespace EVCB_OCPP.TaskScheduler.Services
|
|
|
private OuterHttpClient httpClient = new OuterHttpClient();
|
|
|
private int ChargeRecordCallCounter = 0;
|
|
|
|
|
|
+ private string _WebConnectionString = ConfigurationManager.ConnectionStrings["WebDBContext"].ToString();
|
|
|
+
|
|
|
public CommonCustomerService() { }
|
|
|
|
|
|
public CommonCustomerService(Guid customerId)
|
|
@@ -234,6 +239,7 @@ namespace EVCB_OCPP.TaskScheduler.Services
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ string CarNum = await GetCustomerFromIdTag(r.StartIdTag);
|
|
|
var request = new
|
|
|
{
|
|
|
ChargeBoxId = r.ChargeBoxId,
|
|
@@ -248,8 +254,8 @@ namespace EVCB_OCPP.TaskScheduler.Services
|
|
|
ReservationId=r.ReservationId,
|
|
|
Receipt = r.Receipt,
|
|
|
TotalCost = r.Cost,
|
|
|
- Fee = r.Fee
|
|
|
-
|
|
|
+ Fee = r.Fee,
|
|
|
+ CarNum = CarNum
|
|
|
};
|
|
|
|
|
|
|
|
@@ -429,5 +435,16 @@ namespace EVCB_OCPP.TaskScheduler.Services
|
|
|
|
|
|
|
|
|
}
|
|
|
+ private async Task<string> GetCustomerFromIdTag(string startIdTag)
|
|
|
+ {
|
|
|
+ string toReturn;
|
|
|
+ string sqlstatement = "SELECT [CarNum] FROM VehicleCustomer where IdTag = '" + startIdTag + "'";
|
|
|
+ using (var dbConn = new SqlConnection(_WebConnectionString))
|
|
|
+ {
|
|
|
+ dbConn.Open();
|
|
|
+ toReturn = await dbConn.ExecuteScalarAsync<string>(sqlstatement);
|
|
|
+ }
|
|
|
+ return toReturn;
|
|
|
+ }
|
|
|
}
|
|
|
}
|