You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			102 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			Dart
		
	
			
		
		
	
	
			102 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			Dart
		
	
| import 'package:test_sa/models/new_models/room_model.dart';
 | |
| 
 | |
| import '../base.dart';
 | |
| 
 | |
| class TrafDepartment extends Base {
 | |
|   TrafDepartment({
 | |
|     this.departmentName, this.departmentCode, this.ntCode, this.costCenterNumber, this.costCenterName, this.name, this.id, this.createdBy, this.createdDate, this.modifiedBy, this.modifiedDate
 | |
|   }) : super(identifier: id?.toString() ?? '', name: departmentName); // Handle potential null id
 | |
| 
 | |
|   TrafDepartment.fromJson(Map<String, dynamic> json) {
 | |
|     departmentName = json['departmentName'] ?? json['name'];
 | |
|     departmentCode = json['departmentCode'];
 | |
|     ntCode = json['ntCode'];
 | |
|     costCenterNumber = json['costCenterNumber'];
 | |
|     costCenterName = json['costCenterName'];
 | |
|     name = json['name'];
 | |
|     id = json['id'];
 | |
|     createdBy = json['createdBy'];
 | |
|     createdDate = json['createdDate'];
 | |
|     modifiedBy = json['modifiedBy'];
 | |
|     modifiedDate = json['modifiedDate'];
 | |
|   }
 | |
| 
 | |
|   num? id; // Now nullable
 | |
|   String? departmentName; // Now nullable
 | |
|   String? departmentCode; // Now nullable
 | |
|   String? ntCode;
 | |
|   String? costCenterNumber;
 | |
|   String? costCenterName;
 | |
|   String? name;
 | |
|   String? createdBy;
 | |
|   String? createdDate;
 | |
|   String? modifiedBy;
 | |
|   String? modifiedDate;
 | |
| 
 | |
|   // TrafDepartment copyWith({
 | |
|   //   num? id, // Parameters are now nullable
 | |
|   //   String? departmentName,
 | |
|   //   String? departmentCode,
 | |
|   //   String? departmentId,
 | |
|   //   String? ntCode,
 | |
|   //   List<Rooms>? rooms,
 | |
|   // }) =>
 | |
|   //     TrafDepartment(
 | |
|   //       id: id ?? this.id,
 | |
|   //       departmentName: departmentName ?? this.departmentName,
 | |
|   //       departmentCode: departmentCode ?? this.departmentCode,
 | |
|   //       departmentId: departmentId ?? this.departmentId,
 | |
|   //       ntCode: ntCode ?? this.ntCode,
 | |
|   //       rooms: rooms ?? this.rooms,
 | |
|   //     );
 | |
| 
 | |
| 
 | |
| }
 | |
| 
 | |
| // class TrafDepartment extends Base {
 | |
| //   String? departmentName;
 | |
| //   String? departmentCode;
 | |
| //   Null? ntCode;
 | |
| //   Null? costCenterNumber;
 | |
| //   Null? costCenterName;
 | |
| //   String? name;
 | |
| //   int? id;
 | |
| //   String? createdBy;
 | |
| //   String? createdDate;
 | |
| //   Null? modifiedBy;
 | |
| //   Null? modifiedDate;
 | |
| //
 | |
| //   TrafDepartment(
 | |
| //       {this.departmentName, this.departmentCode, this.ntCode, this.costCenterNumber, this.costCenterName, this.name, this.id, this.createdBy, this.createdDate, this.modifiedBy, this.modifiedDate});
 | |
| //
 | |
| //   TrafDepartment.fromJson(Map<String, dynamic> json) {
 | |
| //     departmentName = json['departmentName'];
 | |
| //     departmentCode = json['departmentCode'];
 | |
| //     ntCode = json['ntCode'];
 | |
| //     costCenterNumber = json['costCenterNumber'];
 | |
| //     costCenterName = json['costCenterName'];
 | |
| //     name = json['name'];
 | |
| //     id = json['id'];
 | |
| //     createdBy = json['createdBy'];
 | |
| //     createdDate = json['createdDate'];
 | |
| //     modifiedBy = json['modifiedBy'];
 | |
| //     modifiedDate = json['modifiedDate'];
 | |
| //   }
 | |
| //
 | |
| //   Map<String, dynamic> toJson() {
 | |
| //     final Map<String, dynamic> data = new Map<String, dynamic>();
 | |
| //     data['departmentName'] = this.departmentName;
 | |
| //     data['departmentCode'] = this.departmentCode;
 | |
| //     data['ntCode'] = this.ntCode;
 | |
| //     data['costCenterNumber'] = this.costCenterNumber;
 | |
| //     data['costCenterName'] = this.costCenterName;
 | |
| //     data['name'] = this.name;
 | |
| //     data['id'] = this.id;
 | |
| //     data['createdBy'] = this.createdBy;
 | |
| //     data['createdDate'] = this.createdDate;
 | |
| //     data['modifiedBy'] = this.modifiedBy;
 | |
| //     data['modifiedDate'] = this.modifiedDate;
 | |
| //     return data;
 | |
| //   }
 | |
| // }
 |