blob: 25487f30dfaed5598c1678ac2a3952a6814844aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#include "Database.hpp"
#include <Cplt/Model/Database.hpp>
#include <Cplt/Model/Workflow/ValueInternals.hpp>
#include <limits>
TableKind DatabaseRowIdValue::GetTable() const {
return mTable;
}
int64_t DatabaseRowIdValue::GetRowId() const {
return mRowId;
}
bool DatabaseRowIdValue::IsInstance(const BaseValue* value) {
return value->GetKind() == KD_DatabaseRowId;
}
DatabaseRowIdValue::DatabaseRowIdValue()
: BaseValue(KD_DatabaseRowId)
, mTable{ TableKind::Sales }
, mRowId{ std::numeric_limits<int64_t>::max() } {
}
bool SaleDatabaseRowValue::IsInstance(const BaseValue* value) {
return value->GetKind() == KD_SaleDatabaseRow;
}
SaleDatabaseRowValue::SaleDatabaseRowValue()
: BaseObjectValue(KD_SaleDatabaseRow) {
}
const BaseValue* SaleDatabaseRowValue::GetProperty(int idx) const {
switch (idx) {
case 0: return &mCustomerName;
case 1: return &mDeadline;
case 2: return &mDeliveryTime;
default: return nullptr;
}
}
bool SaleDatabaseRowValue::SetProperty(int idx, std::unique_ptr<BaseValue> value) {
switch (idx) {
case 0: return false;
case 1: CHECK_VALUE_TYPE_AND_MOVE(DateTimeValue, mDeadline, value.get()); break;
case 2: CHECK_VALUE_TYPE_AND_MOVE(DateTimeValue, mDeliveryTime, value.get()); break;
}
return true;
}
bool PurchaseDatabaseRowValue::IsInstance(const BaseValue* value) {
return value->GetKind() == KD_PurchaseDatabaseRow;
}
PurchaseDatabaseRowValue::PurchaseDatabaseRowValue()
: BaseObjectValue(KD_PurchaseDatabaseRow) {
}
const BaseValue* PurchaseDatabaseRowValue::GetProperty(int idx) const {
switch (idx) {
case 0: return &mFactoryName;
case 1: return &mOrderTime;
case 2: return &mDeliveryTime;
default: return nullptr;
}
}
bool PurchaseDatabaseRowValue::SetProperty(int idx, std::unique_ptr<BaseValue> value) {
switch (idx) {
case 0: return false;
case 1: CHECK_VALUE_TYPE_AND_MOVE(DateTimeValue, mOrderTime, value.get()); break;
case 2: CHECK_VALUE_TYPE_AND_MOVE(DateTimeValue, mDeliveryTime, value.get()); break;
}
return true;
}
|