40 lines
1.2 KiB
Dart
40 lines
1.2 KiB
Dart
import 'package:intl/intl.dart';
|
|
|
|
class CustomerProperty {
|
|
int? customerPropertyId;
|
|
late int propertyId;
|
|
late int customerId;
|
|
DateTime? dateAdd;
|
|
late double propertyValue;
|
|
bool newData = false;
|
|
|
|
CustomerProperty({required this.propertyId, required this.customerId, required this.dateAdd, required this.propertyValue});
|
|
|
|
CustomerProperty.fromJson(Map json) {
|
|
this.customerPropertyId = json['customerPropertyId'];
|
|
this.propertyId = json['propertyId'];
|
|
this.customerId = json['customerId'];
|
|
this.dateAdd = json['dataAdd'] ?? DateTime.now();
|
|
this.propertyValue = json['propertyValue'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
if (customerPropertyId != null) {
|
|
return {
|
|
"customerPropertyId": this.customerPropertyId,
|
|
"propertyId": this.propertyId,
|
|
"customerId": this.customerId,
|
|
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateAdd!),
|
|
"propertyValue": this.propertyValue
|
|
};
|
|
} else {
|
|
return {
|
|
"propertyId": this.propertyId,
|
|
"customerId": this.customerId,
|
|
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateAdd!),
|
|
"propertyValue": this.propertyValue
|
|
};
|
|
}
|
|
}
|
|
}
|