Use DateTime.Now.GetTimeFormatted() instead DateTime.Now.ToString(AppConstant.DATETIME_FORMAT)

This commit is contained in:
DucDangAnh 2020-07-01 10:53:34 +07:00
parent d541accb33
commit cd4fd83d4c
5 changed files with 19 additions and 19 deletions

View File

@ -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();
}
}

View File

@ -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;
}

View File

@ -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)

View File

@ -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đ";

View File

@ -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);