|
@@ -1,86 +0,0 @@
|
|
|
-using EVCB_OCPP.TaskScheduler.Models;
|
|
|
-using System;
|
|
|
-using System.Collections.Generic;
|
|
|
-using System.Data.SqlClient;
|
|
|
-using System.Linq;
|
|
|
-using System.Text;
|
|
|
-using System.Threading.Tasks;
|
|
|
-using System.Transactions;
|
|
|
-
|
|
|
-namespace EVCB_OCPP.TaskScheduler.DBTool
|
|
|
-{
|
|
|
- internal class SQLHepler
|
|
|
- {
|
|
|
- private NLog.ILogger logger = NLog.LogManager.GetCurrentClassLogger();
|
|
|
- private string ConnectString = "data source=172.1.0.142;initial catalog=OCPP_MainDBContext;persist security info=True;user id=sa;password=Ph0930118811;MultipleActiveResultSets=True;App=EntityFramework";
|
|
|
-
|
|
|
-
|
|
|
- internal SQLHepler()
|
|
|
- {
|
|
|
- // ConnectString = connectString;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public void Run()
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- using (SqlConnection conn = new SqlConnection(ConnectString))
|
|
|
- {
|
|
|
-
|
|
|
- string queryString = "update [OCPP_MainDBContext].[dbo].[Machine] set OfflineOn=HeartbeatUpdatedOn where ChargeBoxId=@ChargeBoxId";
|
|
|
- conn.Open();
|
|
|
- using (SqlCommand cmd = new SqlCommand(queryString, conn))
|
|
|
- {
|
|
|
- // cmd.Parameters.Add(new SqlParameter("OfflineOn"));
|
|
|
- cmd.Parameters.Add(new SqlParameter("ChargeBoxId", "RDTEST103"));
|
|
|
- cmd.ExecuteNonQuery();
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- private List<EVSECurrentStatus> GetEVSECurrentStatuses()
|
|
|
- {
|
|
|
- List<EVSECurrentStatus> result = new List<EVSECurrentStatus>();
|
|
|
- try
|
|
|
- {
|
|
|
- //using (var tranScope = new TransactionScope())
|
|
|
- //{
|
|
|
- // SqlParameter ss = new SqlParameter() { v} ;
|
|
|
-
|
|
|
- // using (SqlConnection conn = new SqlConnection(ConnectString))
|
|
|
- // {
|
|
|
- // string strSql = " UPDATE Users SET col1=@c1 WHERE col2=@c2";
|
|
|
- // dynamic datas = new[]{ new { c1 = "A", c2 = "A2" }
|
|
|
- // , new { c1 = "B", c2 = "B2" }
|
|
|
- // , new { c1 = "C", c2 = "C2" }};
|
|
|
- // conn.(strSql, datas);
|
|
|
- // }
|
|
|
- // tranScope.Complete();
|
|
|
- //}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- logger.Error(string.Format("GetEVSECurrentStatuses Exception: {0}", ex.ToString()));
|
|
|
- }
|
|
|
-
|
|
|
- return result;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-}
|