diff --git a/AIParkingApplication/ApiController.cs b/AIParkingApplication/ApiController.cs index 4ad551c..b5390c8 100644 --- a/AIParkingApplication/ApiController.cs +++ b/AIParkingApplication/ApiController.cs @@ -39,7 +39,7 @@ namespace AIParkingApplication } catch (Exception ex) { - Console.WriteLine($"Login Exception:\t{DateTime.Now.ToString(AppConstant.DATETIME_FORMAT)} \t {ex.Message}"); + Console.WriteLine($"Login Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}"); return new LoginDataModel { IsLoginSuccess = false @@ -68,7 +68,7 @@ namespace AIParkingApplication } catch (Exception ex) { - Console.WriteLine($"GetStatisticInfo Exception:\t{DateTime.Now.ToString(AppConstant.DATETIME_FORMAT)} \t {ex.Message}"); + Console.WriteLine($"GetStatisticInfo Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}"); return new Statistic.ParkInfo(); } } @@ -88,7 +88,7 @@ namespace AIParkingApplication } catch (Exception ex) { - Console.WriteLine($"CheckCard Exception:\t{DateTime.Now.ToString(AppConstant.DATETIME_FORMAT)} \t {ex.Message}"); + Console.WriteLine($"CheckCard Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}"); return new CardInformation(); } } @@ -124,7 +124,7 @@ namespace AIParkingApplication } catch (Exception ex) { - Console.WriteLine($"SaveLog Exception:\t{DateTime.Now.ToString(AppConstant.DATETIME_FORMAT)} \t {ex.Message}"); + Console.WriteLine($"SaveLog Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}"); return new SaveLogRespone(); } } diff --git a/AIParkingApplication/C3DeviceController.cs b/AIParkingApplication/C3DeviceController.cs index 1680ef9..69d164d 100644 --- a/AIParkingApplication/C3DeviceController.cs +++ b/AIParkingApplication/C3DeviceController.cs @@ -58,7 +58,7 @@ namespace AIParkingApplication var result = new ActionResult { HasError = false, - Message = string.Format(C3Constant.CONNECTED_SUCCESSFULLY, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), ipAddress) + Message = string.Format(C3Constant.CONNECTED_SUCCESSFULLY, DateTime.Now.GetTimeFormatted(), ipAddress) }; return result; } @@ -67,7 +67,7 @@ namespace AIParkingApplication var result = new ActionResult { HasError = true, - Message = string.Format(C3Constant.FAILED_TO_CONNECT, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), ipAddress, PullLastError()) + Message = string.Format(C3Constant.FAILED_TO_CONNECT, DateTime.Now.GetTimeFormatted(), ipAddress, PullLastError()) }; return result; } @@ -77,7 +77,7 @@ namespace AIParkingApplication var result = new ActionResult { HasError = true, - Message = string.Format(C3Constant.FAILED_TO_PING, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), ipAddress) + Message = string.Format(C3Constant.FAILED_TO_PING, DateTime.Now.GetTimeFormatted(), ipAddress) }; return result; } @@ -93,7 +93,7 @@ namespace AIParkingApplication var result = new ActionResult { HasError = false, - Message = string.Format(C3Constant.OPENNED_DOOR_SUCCESSFULLY, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), ipAddress) + Message = string.Format(C3Constant.OPENNED_DOOR_SUCCESSFULLY, DateTime.Now.GetTimeFormatted(), ipAddress) }; return result; } @@ -102,7 +102,7 @@ namespace AIParkingApplication var result = new ActionResult { HasError = true, - Message = string.Format(C3Constant.FAILED_TO_OPEN_DOOR, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), ipAddress) + Message = string.Format(C3Constant.FAILED_TO_OPEN_DOOR, DateTime.Now.GetTimeFormatted(), ipAddress) }; return result; } @@ -112,7 +112,7 @@ namespace AIParkingApplication var result = new ActionResult { HasError = true, - Message = string.Format(C3Constant.NOT_CONNECTTED, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), ipAddress) + Message = string.Format(C3Constant.NOT_CONNECTTED, DateTime.Now.GetTimeFormatted(), ipAddress) }; return result; } @@ -142,7 +142,7 @@ namespace AIParkingApplication var result = new ActionResult { HasError = true, - Message = string.Format(C3Constant.FAILED_TO_PING, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), ipAddress) + Message = string.Format(C3Constant.FAILED_TO_PING, DateTime.Now.GetTimeFormatted(), ipAddress) }; return result; } @@ -177,7 +177,7 @@ namespace AIParkingApplication { isReconnected = true; reconnectCounter = 0; - reconnectResult.Message = string.Format(C3Constant.RECONNECTED_SUCCESSFULLY, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), ipAddress); + reconnectResult.Message = string.Format(C3Constant.RECONNECTED_SUCCESSFULLY, DateTime.Now.GetTimeFormatted(), ipAddress); } return reconnectResult; } @@ -185,7 +185,7 @@ namespace AIParkingApplication var result = new ActionResult { HasError = true, - Message = string.Format(C3Constant.FAILED_TO_READ_LOG, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), ipAddress) + Message = string.Format(C3Constant.FAILED_TO_READ_LOG, DateTime.Now.GetTimeFormatted(), ipAddress) }; return result; } @@ -197,7 +197,7 @@ namespace AIParkingApplication var result = new ActionResult { HasError = true, - Message = string.Format(C3Constant.WRONG_FORMAT_DATA, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), ipAddress, ex.Message) + Message = string.Format(C3Constant.WRONG_FORMAT_DATA, DateTime.Now.GetTimeFormatted(), ipAddress, ex.Message) }; return result; } @@ -210,7 +210,7 @@ namespace AIParkingApplication var result = new ActionResult { HasError = false, - Message = string.Format(C3Constant.DISCONNECTED_SUCCESSFULLY, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), ipAddress) + Message = string.Format(C3Constant.DISCONNECTED_SUCCESSFULLY, DateTime.Now.GetTimeFormatted(), ipAddress) }; return result; } diff --git a/AIParkingApplication/LaneIn.cs b/AIParkingApplication/LaneIn.cs index 9fb8ab7..54d575f 100644 --- a/AIParkingApplication/LaneIn.cs +++ b/AIParkingApplication/LaneIn.cs @@ -85,7 +85,7 @@ namespace AIParkingApplication pictureBoxOverviewImage.UpdateImage(overviewVideoFrame.ToBitmap()); var cardInformation = await apiController.GetCardInformation(cardNumber); - ShowCardInfoOnUI(cardNumber, result.PlateString, cardInformation.CardType, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT)); + ShowCardInfoOnUI(cardNumber, result.PlateString, cardInformation.CardType, DateTime.Now.GetTimeFormatted()); var saveLogResult = await apiController.SaveLog(LaneDirection.In, cardInformation.CardRealID.ToString(), "1", result.PlateType, DateTime.Now.GetTimeFormatted(), result.PlateString, result.PlateImage, result.PlateImage, result.PlateImage, overviewVideoFrame); if (saveLogResult.Status) diff --git a/AIParkingApplication/LaneOut.cs b/AIParkingApplication/LaneOut.cs index ce54e05..cc875cd 100644 --- a/AIParkingApplication/LaneOut.cs +++ b/AIParkingApplication/LaneOut.cs @@ -92,9 +92,9 @@ namespace AIParkingApplication pictureBoxOverviewImage.UpdateImage(overviewVideoFrame.ToBitmap()); var cardInformation = await apiController.GetCardInformation(cardNumber); - ShowCardInfoOnUI(cardNumber, result.PlateString, cardInformation.CardType, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT)); + ShowCardInfoOnUI(cardNumber, result.PlateString, cardInformation.CardType, DateTime.Now.GetTimeFormatted()); - var saveLogResult = await apiController.SaveLog(LaneDirection.Out, cardInformation.CardRealID.ToString(), "1", result.PlateType, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), result.PlateString, result.PlateImage, result.PlateImage, result.PlateImage, overviewVideoFrame, cardInformation.LogID.ToString()); + var saveLogResult = await apiController.SaveLog(LaneDirection.Out, cardInformation.CardRealID.ToString(), "1", result.PlateType, DateTime.Now.GetTimeFormatted(), result.PlateString, result.PlateImage, result.PlateImage, result.PlateImage, overviewVideoFrame, cardInformation.LogID.ToString()); int.TryParse(saveLogResult.Cost, out int moneyAmount); lblMoneyAmount.Text = $"Số tiền: {string.Format("{0:n0}", moneyAmount)} vnđ"; diff --git a/AIParkingApplication/StatusBar.cs b/AIParkingApplication/StatusBar.cs index b0d69b7..401fc46 100644 --- a/AIParkingApplication/StatusBar.cs +++ b/AIParkingApplication/StatusBar.cs @@ -28,7 +28,7 @@ namespace AIParkingApplication { if (IsHandleCreated) { - lblDateTime.UpdateLabel(DateTime.Now.ToString(AppConstant.DATETIME_FORMAT)); + lblDateTime.UpdateLabel(DateTime.Now.GetTimeFormatted()); PingResult pingDoorAccessControlResult = GetPingStatus(doorAccessControlDeviceIP); lblPingTimeC3.UpdateLabel($"{pingDoorAccessControlResult.ReplyTime} ms", pingDoorAccessControlResult.BackColor, pingDoorAccessControlResult.ForeColor);