Reworked.

This commit is contained in:
Преподобный Ален
2022-05-25 11:58:40 +03:00
parent e0ea1fcf34
commit 63740a62f2
10 changed files with 281 additions and 663 deletions

View File

@@ -65,7 +65,7 @@ namespace Apostol {
}
//--------------------------------------------------------------------------------------------------------------
CString DateToString(const CDateTime &Value, const CString &Format) {
CString DateToString(CDateTime Value, const CString &Format) {
TCHAR Buffer[25] = {0};
DateTimeToStr(Value, Buffer, sizeof(Buffer), Format.c_str());
return Buffer;
@@ -226,9 +226,9 @@ namespace Apostol {
CDealType CDeal::StringToType(const CString &Value) {
const auto &status = Value.Lower();
if (status.Find("prepaid") != CString::npos || status.Find("prepayment") != CString::npos) {
if (status.Find("prepayment") != CString::npos || status.Find("prepaid") != CString::npos) {
return dtPrepaid;
} else if (status.Find("postpaid") != CString::npos || status.Find("postpayment") != CString::npos) {
} else if (status.Find("postpayment") != CString::npos || status.Find("postpaid") != CString::npos) {
return dtPostpaid;
} else {
throw ExceptionFrm(R"(Invalid order type value: "%s".)", status.c_str());
@@ -239,9 +239,9 @@ namespace Apostol {
CString CDeal::TypeToString(CDealType Type) {
switch (Type) {
case dtPrepaid:
return "Prepaid";
return "Prepayment";
case dtPostpaid:
return "Postpaid";
return "Postpayment";
default:
return "Unknown";
}
@@ -250,9 +250,9 @@ namespace Apostol {
CString CDeal::TypeCodeToString(const CString &Code) {
if (Code == "prepaid.deal") {
return CString("Prepaid");
return {"Prepayment"};
} else if (Code == "postpaid.deal") {
return CString("Postpaid");
return {"Postpayment"};
} else {
throw ExceptionFrm(R"(Invalid type code value: "%s".)", Code.c_str());
}
@@ -526,7 +526,6 @@ namespace Apostol {
}
}
using namespace Apostol::Deal;
#ifdef __cplusplus
}
#endif // __cplusplus

View File

@@ -43,7 +43,7 @@ namespace Apostol {
CString DoubleToBTC(const double &Value, const CString &Format = _T("%f BTC"));
CDateTime StringToDate(const CString &Value, const CString &Format = _T("%04d-%02d-%02d %02d:%02d:%02d"));
CString DateToString(const CDateTime &Value, const CString &Format = _T("%Y-%m-%d %H:%M:%S UTC"));
CString DateToString(CDateTime Value, const CString &Format = _T("%Y-%m-%d %H:%M:%S UTC"));
//--------------------------------------------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
Program name:
ship-safety
dm
Module Name:
@@ -10,7 +10,7 @@ Module Name:
Notices:
Ship Safety Service
Deal Module
Author:
@@ -21,8 +21,8 @@ Author:
--*/
#ifndef APOSTOL_HEADER_HPP
#define APOSTOL_HEADER_HPP
#ifndef APOSTOL_DM_HEADER_HPP
#define APOSTOL_DM_HEADER_HPP
//----------------------------------------------------------------------------------------------------------------------
#include <wait.h>
@@ -38,9 +38,10 @@ Author:
#include "PGP.hpp"
#include "Bitcoin.hpp"
#include "Deal.hpp"
#include "Context.hpp"
//----------------------------------------------------------------------------------------------------------------------
#include "Core.hpp"
//----------------------------------------------------------------------------------------------------------------------
#endif //APOSTOL_HEADER_HPP
#endif //APOSTOL_DM_HEADER_HPP