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.
PatientApp-KKUMC/lib/core/service/AlHabibMedicalService/H2O_service.dart

80 lines
3.2 KiB
Dart

import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/insert_user_activity_request_model.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/user_progress_for_today_data_model.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/user_progress_request_model.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
class H2OService extends BaseService {
List<UserProgressForTodayDataModel> userProgressForTodayDataList = List();
UserProgressRequestModel userProgressRequestModel =
UserProgressRequestModel();
Future getUserProgressForTodayData() async {
userProgressRequestModel.progress = 1;
userProgressRequestModel.mobileNumber = super.user.mobileNumber.substring(1);
userProgressRequestModel.identificationNo = super.user.patientIdentificationNo;
hasError = false;
await baseAppClient.post(H2O_GET_USER_PROGRESS,
onSuccess: (dynamic response, int statusCode) {
userProgressForTodayDataList.clear();
response['UserProgressForTodayData'].forEach((progressData) {
userProgressForTodayDataList
.add(UserProgressForTodayDataModel.fromJson(progressData));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: userProgressRequestModel.toJson());
}
Future insertUserActivity(InsertUserActivityRequestModel insertUserActivityRequestModel) async {
hasError = false;
await baseAppClient.post(H2O_INSERT_USER_ACTIVITY,
onSuccess: (dynamic response, int statusCode) {
userProgressForTodayDataList.clear();
response['UserProgressForTodayData'].forEach((progressData) {
userProgressForTodayDataList
.add(UserProgressForTodayDataModel.fromJson(progressData));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: insertUserActivityRequestModel.toJson());
}
Future getUserProgressForWeekData() async {
userProgressRequestModel.progress = 2;
hasError = false;
// await baseAppClient.post(H2O_GET_USER_PROGRESS,
// onSuccess: (dynamic response, int statusCode) {
// userProgressForTodayDataList.clear();
// response['UserProgressForWeekData'].forEach((hospital) {
// userProgressForTodayDataList.add(PatientLabOrders.fromJson(hospital));
// });
// }, onFailure: (String error, int statusCode) {
// hasError = true;
// super.error = error;
// }, body: {});
}
Future getUserProgressForMonthData() async {
userProgressRequestModel.progress = 2;
hasError = false;
// await baseAppClient.post(H2O_GET_USER_PROGRESS,
// onSuccess: (dynamic response, int statusCode) {
// userProgressForTodayDataList.clear();
// response['UserProgressForMonthData'].forEach((hospital) {
// userProgressForTodayDataList.add(PatientLabOrders.fromJson(hospital));
// });
// }, onFailure: (String error, int statusCode) {
// hasError = true;
// super.error = error;
// }, body: _requestPatientLabOrders.toJson());
}
}