|
|
|
|
@ -11,14 +11,18 @@ import 'package:diplomaticquarterapp/core/service/base_service.dart';
|
|
|
|
|
|
|
|
|
|
class EReferralService extends BaseService {
|
|
|
|
|
List<GetAllRelationshipTypeResponseModel> _relationTypes = List();
|
|
|
|
|
|
|
|
|
|
List<GetAllRelationshipTypeResponseModel> get relationTypes => _relationTypes;
|
|
|
|
|
List<GetAllCitiesResponseModel> _allCities = List();
|
|
|
|
|
|
|
|
|
|
List<GetAllCitiesResponseModel> get allCities => _allCities;
|
|
|
|
|
|
|
|
|
|
List<GetAllProjectsResponseModel> _allProjects = List();
|
|
|
|
|
|
|
|
|
|
List<GetAllProjectsResponseModel> get allProjects => _allProjects;
|
|
|
|
|
|
|
|
|
|
List<SearchEReferralResponseModel> _allReferral = List();
|
|
|
|
|
|
|
|
|
|
List<SearchEReferralResponseModel> get allReferral => _allReferral;
|
|
|
|
|
String _activationCode;
|
|
|
|
|
String _logInTokenID;
|
|
|
|
|
@ -46,33 +50,30 @@ class EReferralService extends BaseService {
|
|
|
|
|
Future getAllCities() async {
|
|
|
|
|
await baseAppClient.post(GET_ALL_CITIES,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
_allCities.clear();
|
|
|
|
|
response['ListCities'].forEach((city) {
|
|
|
|
|
_allCities
|
|
|
|
|
.add(GetAllCitiesResponseModel.fromJson(city));
|
|
|
|
|
});
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = error;
|
|
|
|
|
}, body: {});
|
|
|
|
|
_allCities.clear();
|
|
|
|
|
response['ListCities'].forEach((city) {
|
|
|
|
|
_allCities.add(GetAllCitiesResponseModel.fromJson(city));
|
|
|
|
|
});
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = error;
|
|
|
|
|
}, body: {});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future getAllProjects() async {
|
|
|
|
|
await baseAppClient.post(GET_PROJECT,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
_allProjects.clear();
|
|
|
|
|
response['ListProject'].forEach((city) {
|
|
|
|
|
_allProjects
|
|
|
|
|
.add(GetAllProjectsResponseModel.fromJson(city));
|
|
|
|
|
});
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = error;
|
|
|
|
|
}, body: {});
|
|
|
|
|
_allProjects.clear();
|
|
|
|
|
response['ListProject'].forEach((city) {
|
|
|
|
|
_allProjects.add(GetAllProjectsResponseModel.fromJson(city));
|
|
|
|
|
});
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = error;
|
|
|
|
|
}, body: {});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future sendActivationCodeForEReferral(
|
|
|
|
|
|
|
|
|
|
SendActivationCodeForEReferralRequestModel
|
|
|
|
|
sendActivationCodeForEReferralRequestModel) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
@ -81,24 +82,21 @@ class EReferralService extends BaseService {
|
|
|
|
|
print(response["VerificationCode"]);
|
|
|
|
|
_activationCode = response["VerificationCode"];
|
|
|
|
|
_logInTokenID = response["LogInTokenID"];
|
|
|
|
|
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = error;
|
|
|
|
|
}, body: sendActivationCodeForEReferralRequestModel.toJson());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future checkActivationCodeForEReferral(
|
|
|
|
|
CheckActivationCodeForEReferralResponseModel
|
|
|
|
|
checkActivationCodeForEReferralRequestModel) async {
|
|
|
|
|
checkActivationCodeForEReferralRequestModel.isDentalAllowedBackend = false;
|
|
|
|
|
checkActivationCodeForEReferralRequestModel.logInTokenID= _logInTokenID;
|
|
|
|
|
hasError =false;
|
|
|
|
|
checkActivationCodeForEReferralRequestModel.logInTokenID = _logInTokenID;
|
|
|
|
|
hasError = false;
|
|
|
|
|
await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_E_REFERRAL,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
_isActivationCodeValid = true;
|
|
|
|
|
_isActivationCodeValid = true;
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = error;
|
|
|
|
|
@ -106,40 +104,36 @@ class EReferralService extends BaseService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<dynamic> createEReferral(
|
|
|
|
|
CreateEReferralRequestModel createEReferralRequestModel
|
|
|
|
|
) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
dynamic localRes;
|
|
|
|
|
await baseAppClient.post(CREATE_E_REFERRAL/*'Services/Patients.svc/REST/CreateEReferral'*/,
|
|
|
|
|
CreateEReferralRequestModel createEReferralRequestModel) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
dynamic localRes;
|
|
|
|
|
await baseAppClient.post(
|
|
|
|
|
CREATE_E_REFERRAL /*'Services/Patients.svc/REST/CreateEReferral'*/,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
// TODO Waiting for fix service
|
|
|
|
|
localRes = response;
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = error;
|
|
|
|
|
}, body: createEReferralRequestModel.toJson());
|
|
|
|
|
return Future.value(localRes);
|
|
|
|
|
// TODO Waiting for fix service
|
|
|
|
|
localRes = response;
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = error;
|
|
|
|
|
}, body: createEReferralRequestModel.toJson());
|
|
|
|
|
return Future.value(localRes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future getEReferrals(
|
|
|
|
|
SearchEReferralRequestModel searchEReferralRequestModel
|
|
|
|
|
) async {
|
|
|
|
|
SearchEReferralRequestModel searchEReferralRequestModel) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
// TODO return this code when the fix the server
|
|
|
|
|
// await baseAppClient.post(GET_E_REFERRALS,
|
|
|
|
|
// onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
// print("EEEEEE");
|
|
|
|
|
// // TODO Waiting for fix service
|
|
|
|
|
// // ToDo change this one when you have data
|
|
|
|
|
// _allReferral.clear();
|
|
|
|
|
// // response['ListCities'].forEach((city) {
|
|
|
|
|
// // _allReferral
|
|
|
|
|
// // .add(SearchEReferralResponseModel.fromJson(city));
|
|
|
|
|
// // });
|
|
|
|
|
//
|
|
|
|
|
// }, onFailure: (String error, int statusCode) {
|
|
|
|
|
// hasError = true;
|
|
|
|
|
// super.error = error;
|
|
|
|
|
// }, body: searchEReferralRequestModel.toJson());
|
|
|
|
|
|
|
|
|
|
dynamic localRes;
|
|
|
|
|
|
|
|
|
|
await baseAppClient.post(GET_E_REFERRALS,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
print("EEEEEE");
|
|
|
|
|
_allReferral.clear();
|
|
|
|
|
localRes = response;
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
super.error = error;
|
|
|
|
|
}, body: searchEReferralRequestModel.toJson());
|
|
|
|
|
return Future.value(localRes);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|