live care web service
parent
7c4e3defd3
commit
ee8d481504
@ -0,0 +1,36 @@
|
||||
class StatsticsForCertainDoctorRequest {
|
||||
bool outSA;
|
||||
int doctorID;
|
||||
String tokenID;
|
||||
int channel;
|
||||
int projectID;
|
||||
String generalid;
|
||||
|
||||
StatsticsForCertainDoctorRequest(
|
||||
{this.outSA,
|
||||
this.doctorID,
|
||||
this.tokenID,
|
||||
this.channel,
|
||||
this.projectID,
|
||||
this.generalid});
|
||||
|
||||
StatsticsForCertainDoctorRequest.fromJson(Map<String, dynamic> json) {
|
||||
outSA = json['OutSA'];
|
||||
doctorID = json['DoctorID'];
|
||||
tokenID = json['TokenID'];
|
||||
channel = json['Channel'];
|
||||
projectID = json['ProjectID'];
|
||||
generalid = json['generalid'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['OutSA'] = this.outSA;
|
||||
data['DoctorID'] = this.doctorID;
|
||||
data['TokenID'] = this.tokenID;
|
||||
data['Channel'] = this.channel;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['generalid'] = this.generalid;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
import 'package:doctor_app_flutter/client/base_app_client.dart';
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/models/doctor/statstics_for_certain_doctor_request.dart';
|
||||
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
|
||||
import 'package:doctor_app_flutter/util/helpers.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
Helpers helpers = Helpers();
|
||||
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
||||
|
||||
StatsticsForCertainDoctorRequest _statsticsForCertainDoctorRequest = StatsticsForCertainDoctorRequest();
|
||||
|
||||
|
||||
var certainDoctorsStasticsList = [];
|
||||
|
||||
/*@author: ibrahem albitar
|
||||
*@Date:22/6/2020
|
||||
*@desc: Doctor Provider
|
||||
*/
|
||||
|
||||
class DoctorsProvider with ChangeNotifier {
|
||||
|
||||
bool isLoading = false;
|
||||
bool isError = false;
|
||||
String error = '';
|
||||
|
||||
resetDefaultValues() {
|
||||
isLoading = true;
|
||||
isError = false;
|
||||
error = '';
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
|
||||
/*@author: ibrahem albitar
|
||||
*@Date:22/6/2020
|
||||
*@desc: StatsticsForCertainDoctor
|
||||
*/
|
||||
getStatsticsForCertainDoctor(String generalId) async {
|
||||
resetDefaultValues();
|
||||
try {
|
||||
_statsticsForCertainDoctorRequest.generalid = generalId;
|
||||
await BaseAppClient.post(LIVE_CARE_STATISTICS_FOR_CERTAIN_DOCTOR_URL,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
certainDoctorsStasticsList = response['List_LiveCareCertainDoctorsStastics'];
|
||||
isLoading = false;
|
||||
isError = false;
|
||||
this.error = '';
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
isLoading = false;
|
||||
isError = true;
|
||||
this.error = error;
|
||||
}, body: _statsticsForCertainDoctorRequest.toJson());
|
||||
notifyListeners();
|
||||
} catch (err) {
|
||||
handelCatchErrorCase(err);
|
||||
}
|
||||
}
|
||||
|
||||
handelCatchErrorCase(err) {
|
||||
isLoading = false;
|
||||
isError = true;
|
||||
error = helpers.generateContactAdminMsg(err);
|
||||
notifyListeners();
|
||||
throw err;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue