Browse Source

fix build error

Robert 1 năm trước cách đây
mục cha
commit
590d17b0df
1 tập tin đã thay đổi với 43 bổ sung43 xóa
  1. 43 43
      EVCB_OCPP.TaskScheduler/Services/DatabaseService.cs

+ 43 - 43
EVCB_OCPP.TaskScheduler/Services/DatabaseService.cs

@@ -161,9 +161,9 @@ public class DatabaseService
                 {
                     sqlString = $"""
                         SELECT Top({size}) Id,ReservationId, ChargeBoxId,ConnectorId,StartTime,MeterStart,StartIdTag 
-                            FROM [dbo].[TransactionRecord]
-                            WHERE CustomerId=@CustomerId and StopTime='1991/1/1' and StartTransactionReportedOn='1991/1/1'
-                            """;
+                        FROM [dbo].[TransactionRecord]
+                        WHERE CustomerId=@CustomerId and StopTime='1991/1/1' and StartTransactionReportedOn='1991/1/1'
+                        """;
                 }
                 else
                 {
@@ -171,17 +171,17 @@ public class DatabaseService
                     {
                         sqlString = $"""
                             SELECT Top({size}) Id,ReservationId,ChargeBoxId,ConnectorId,StartTime,StopTime,MeterStart,MeterStop,StartIdTag ,StopReasonId,Receipt,Cost,Fee 
-                                FROM [dbo].[TransactionRecord] 
-                                WHERE CustomerId=@CustomerId and StopTime!='1991/1/1' and StopTransactionReportedOn='1991/1/1' and  BillingDone=1
-                                """;
+                            FROM [dbo].[TransactionRecord] 
+                            WHERE CustomerId=@CustomerId and StopTime!='1991/1/1' and StopTransactionReportedOn='1991/1/1' and  BillingDone=1
+                            """;
                     }
                     else
                     {
                         sqlString = $"""
                             SELECT Top({size}) Id,ReservationId,ChargeBoxId,ConnectorId,StartTime,StopTime,MeterStart,MeterStop,StartIdTag ,StopReasonId,Receipt,Cost,Fee 
-                                FROM [dbo].[TransactionRecord] 
-                                WHERE CustomerId=@CustomerId and StopTime!='1991/1/1' and StopTransactionReportedOn='1991/1/1' 
-                                """;
+                            FROM [dbo].[TransactionRecord] 
+                            WHERE CustomerId=@CustomerId and StopTime!='1991/1/1' and StopTransactionReportedOn='1991/1/1' 
+                            """;
                     }
                 }
 
@@ -205,16 +205,16 @@ public class DatabaseService
         //    WHERE StopTime='1991/1/1' and StartTransactionReportedOn='1991/1/1'
         //    """;
         string sqlString = $"""
-             WITH CTE AS (
-                	 SELECT Id, CustomerId,ReservationId, ChargeBoxId,ConnectorId,StartTime,MeterStart,StartIdTag 
-                		, ROW_NUMBER() OVER (PARTITION BY CustomerId ORDER BY Id desc) AS RowNum
-                	 FROM [dbo].[TransactionRecord]
-                	 WHERE StopTime='1991/1/1' and StartTransactionReportedOn='1991/1/1'
-                )
-                SELECT Id, CustomerId,ReservationId, ChargeBoxId,ConnectorId,StartTime,MeterStart,StartIdTag 
-                FROM CTE
-                WHERE RowNum < {size};
-                """;
+            WITH CTE AS (
+                	SELECT Id, CustomerId,ReservationId, ChargeBoxId,ConnectorId,StartTime,MeterStart,StartIdTag 
+                	, ROW_NUMBER() OVER (PARTITION BY CustomerId ORDER BY Id desc) AS RowNum
+                	FROM [dbo].[TransactionRecord]
+                	WHERE StopTime='1991/1/1' and StartTransactionReportedOn='1991/1/1'
+            )
+            SELECT Id, CustomerId,ReservationId, ChargeBoxId,ConnectorId,StartTime,MeterStart,StartIdTag 
+            FROM CTE
+            WHERE RowNum < {size};
+            """;
 
         using var dbConn = await mainDbConnectionFactory.CreateAsync();
         return (await dbConn.QueryAsync<Transaction>(sqlString)).ToList();
@@ -229,15 +229,15 @@ public class DatabaseService
         //    """;
         string sqlString = $"""
             WITH CTE AS (
-                    SELECT Id,CustomerId,ReservationId,ChargeBoxId,ConnectorId,StartTime,StopTime,MeterStart,MeterStop,StartIdTag ,StopReasonId,Receipt,Cost,Fee 
-                	    , ROW_NUMBER() OVER (PARTITION BY CustomerId ORDER BY Id desc) AS RowNum
-                    FROM [dbo].[TransactionRecord] 
-                    WHERE StopTime!='1991/1/1' and StopTransactionReportedOn='1991/1/1'
-                )
-                SELECT Id,CustomerId,ReservationId,ChargeBoxId,ConnectorId,StartTime,StopTime,MeterStart,MeterStop,StartIdTag ,StopReasonId,Receipt,Cost,Fee
-                FROM CTE
-                WHERE RowNum < {size};
-                """;
+                SELECT Id,CustomerId,ReservationId,ChargeBoxId,ConnectorId,StartTime,StopTime,MeterStart,MeterStop,StartIdTag ,StopReasonId,Receipt,Cost,Fee 
+                	, ROW_NUMBER() OVER (PARTITION BY CustomerId ORDER BY Id desc) AS RowNum
+                FROM [dbo].[TransactionRecord] 
+                WHERE StopTime!='1991/1/1' and StopTransactionReportedOn='1991/1/1'
+            )
+            SELECT Id,CustomerId,ReservationId,ChargeBoxId,ConnectorId,StartTime,StopTime,MeterStart,MeterStop,StartIdTag ,StopReasonId,Receipt,Cost,Fee
+            FROM CTE
+            WHERE RowNum < {size};
+            """;
 
         using var dbConn = await mainDbConnectionFactory.CreateAsync();
         return (await dbConn.QueryAsync<Transaction>(sqlString)).ToList();
@@ -258,10 +258,10 @@ public class DatabaseService
 
                 sqlString = $"""
                     SELECT Top({size}) Machine.CustomerId, record.Id, record.ChargeBoxId,record.Action,record.SerialNo,record.Status,record.EVSE_Value,record.EVSE_Status
-                        FROM [dbo].[MachineOperateRecord] record
-                        left join[dbo].[Machine] on record.ChargeBoxId = Machine.ChargeBoxId
-                        WHERE Machine.CustomerId =@CustomerId and Status!= 0 and RequestType = 1 and ReportedOn = '1991/01/01'
-                        """;
+                    FROM [dbo].[MachineOperateRecord] record
+                    left join[dbo].[Machine] on record.ChargeBoxId = Machine.ChargeBoxId
+                    WHERE Machine.CustomerId =@CustomerId and Status!= 0 and RequestType = 1 and ReportedOn = '1991/01/01'
+                    """;
                 result = (await dbConn.QueryAsync<MachineOperateRecord>(sqlString, parameters)).ToList();
             }
         }
@@ -488,23 +488,23 @@ public class DatabaseService
                     parameters.Add("@HeartbeatUpdatedOn", new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1), DbType.DateTime, ParameterDirection.Input);
                     var requestResult = await dbConn.QueryAsync<ChargerAmountDto>($"""
                         SELECT  count(ChargeBoxId) as Charger_Count , Customer.Name as CustomerName 
-                            FROM [dbo].[Machine]
-                            inner join Customer on Customer.id =[Machine].CustomerId 
-                            where IsDelete=0 and Customer.Name='PHT' 
-                            {(inner ? "and [ChargePointVendor]!='Electric Avenue'" : "and [ChargePointVendor]='Electric Avenue'")}
-                            and HeartbeatUpdatedOn>=@HeartbeatUpdatedOn group by  CustomerId,Customer.Name
-                            """, parameters);
+                        FROM [dbo].[Machine]
+                        inner join Customer on Customer.id =[Machine].CustomerId 
+                        where IsDelete=0 and Customer.Name='PHT' 
+                        {(inner ? "and [ChargePointVendor]!='Electric Avenue'" : "and [ChargePointVendor]='Electric Avenue'")}
+                        and HeartbeatUpdatedOn>=@HeartbeatUpdatedOn group by  CustomerId,Customer.Name
+                        """, parameters);
                     result = requestResult.ToList();
                 }
                 else
                 {
                     var requestResult = await dbConn.QueryAsync<ChargerAmountDto>($"""
                         SELECT count(ChargeBoxId) as Charger_Count , Customer.Name as CustomerName 
-                            FROM [dbo].[Machine]
-                            inner join Customer on Customer.id =[Machine].CustomerId where IsDelete=0
-                            {(inner ? "and [ChargePointVendor]!='Electric Avenue'" : "and [ChargePointVendor]='Electric Avenue'")}
-                            and Customer.Name='PHT' group by  CustomerId,Customer.Name
-                            """);
+                        FROM [dbo].[Machine]
+                        inner join Customer on Customer.id =[Machine].CustomerId where IsDelete=0
+                        {(inner ? "and [ChargePointVendor]!='Electric Avenue'" : "and [ChargePointVendor]='Electric Avenue'")}
+                        and Customer.Name='PHT' group by  CustomerId,Customer.Name
+                        """);
                     result = requestResult.ToList();
                 }