Merge branch 'mohammad' into 'master'
Done Dr Schedule See merge request Cloud_Solution/doctor_app_flutter!28merge-requests/29/merge
commit
aa95e48c3c
@ -0,0 +1,68 @@
|
|||||||
|
class ScheduleRequest {
|
||||||
|
int projectID;
|
||||||
|
int clinicID;
|
||||||
|
int doctorID;
|
||||||
|
int doctorWorkingHoursDays;
|
||||||
|
int languageID;
|
||||||
|
String stamp;
|
||||||
|
String iPAdress;
|
||||||
|
double versionID;
|
||||||
|
int channel;
|
||||||
|
String tokenID;
|
||||||
|
String sessionID;
|
||||||
|
bool isLoginForDoctorApp;
|
||||||
|
bool patientOutSA;
|
||||||
|
int patientTypeID;
|
||||||
|
|
||||||
|
ScheduleRequest(
|
||||||
|
this.projectID,
|
||||||
|
this.clinicID,
|
||||||
|
this.doctorID,
|
||||||
|
this.doctorWorkingHoursDays,
|
||||||
|
this.languageID,
|
||||||
|
this.stamp,
|
||||||
|
this.iPAdress,
|
||||||
|
this.versionID,
|
||||||
|
this.channel,
|
||||||
|
this.tokenID,
|
||||||
|
this.sessionID,
|
||||||
|
this.isLoginForDoctorApp,
|
||||||
|
this.patientOutSA,
|
||||||
|
this.patientTypeID);
|
||||||
|
|
||||||
|
ScheduleRequest.fromJson(Map<String, dynamic> json) {
|
||||||
|
projectID = json['ProjectID'];
|
||||||
|
clinicID = json['ClinicID'];
|
||||||
|
doctorID = json['DoctorID'];
|
||||||
|
doctorWorkingHoursDays = json['DoctorWorkingHoursDays'];
|
||||||
|
languageID = json['LanguageID'];
|
||||||
|
stamp = json['stamp'];
|
||||||
|
iPAdress = json['IPAdress'];
|
||||||
|
versionID = json['VersionID'];
|
||||||
|
channel = json['Channel'];
|
||||||
|
tokenID = json['TokenID'];
|
||||||
|
sessionID = json['SessionID'];
|
||||||
|
isLoginForDoctorApp = json['IsLoginForDoctorApp'];
|
||||||
|
patientOutSA = json['PatientOutSA'];
|
||||||
|
patientTypeID = json['PatientTypeID'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['ProjectID'] = this.projectID;
|
||||||
|
data['ClinicID'] = this.clinicID;
|
||||||
|
data['DoctorID'] = this.doctorID;
|
||||||
|
data['DoctorWorkingHoursDays'] = this.doctorWorkingHoursDays;
|
||||||
|
data['LanguageID'] = this.languageID;
|
||||||
|
data['stamp'] = this.stamp;
|
||||||
|
data['IPAdress'] = this.iPAdress;
|
||||||
|
data['VersionID'] = this.versionID;
|
||||||
|
data['Channel'] = this.channel;
|
||||||
|
data['TokenID'] = this.tokenID;
|
||||||
|
data['SessionID'] = this.sessionID;
|
||||||
|
data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp;
|
||||||
|
data['PatientOutSA'] = this.patientOutSA;
|
||||||
|
data['PatientTypeID'] = this.patientTypeID;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
class ListDoctorWorkingHoursTable {
|
||||||
|
String date;
|
||||||
|
String dayName;
|
||||||
|
String workingHours;
|
||||||
|
|
||||||
|
ListDoctorWorkingHoursTable({this.date, this.dayName, this.workingHours});
|
||||||
|
|
||||||
|
ListDoctorWorkingHoursTable.fromJson(Map<String, dynamic> json) {
|
||||||
|
date = json['Date'];
|
||||||
|
dayName = json['DayName'];
|
||||||
|
workingHours = json['WorkingHours'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['Date'] = this.date;
|
||||||
|
data['DayName'] = this.dayName;
|
||||||
|
data['WorkingHours'] = this.workingHours;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:doctor_app_flutter/config/config.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/helpers.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:http/http.dart';
|
||||||
|
import 'package:http_interceptor/http_client_with_interceptor.dart';
|
||||||
|
|
||||||
|
import '../interceptor/http_interceptor.dart';
|
||||||
|
import '../models/list_doctor_working_hours_table_model.dart';
|
||||||
|
import '../models/ScheduleRequest.dart';
|
||||||
|
|
||||||
|
class ScheduleProvider with ChangeNotifier {
|
||||||
|
Client client =
|
||||||
|
HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]);
|
||||||
|
|
||||||
|
List<ListDoctorWorkingHoursTable> listDoctorWorkingHoursTable = [];
|
||||||
|
bool isLoading = true;
|
||||||
|
bool isError = false;
|
||||||
|
String error = '';
|
||||||
|
ScheduleRequest scheduleRequest = ScheduleRequest(
|
||||||
|
15,
|
||||||
|
1,
|
||||||
|
70907,
|
||||||
|
7,
|
||||||
|
2,
|
||||||
|
'2020-04-22T11:25:57.640Z',
|
||||||
|
'11.11.11.11',
|
||||||
|
1.2,
|
||||||
|
9,
|
||||||
|
'2lMDFT8U+Uy5jxRzCO8n2w==',
|
||||||
|
'vV6tg9yyVJ222',
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
1);
|
||||||
|
|
||||||
|
ScheduleProvider() {
|
||||||
|
geDoctorSchedule();
|
||||||
|
}
|
||||||
|
|
||||||
|
geDoctorSchedule() async {
|
||||||
|
const url = BASE_URL + 'Doctors.svc/REST/GetDoctorWorkingHoursTable';
|
||||||
|
try {
|
||||||
|
if (await Helpers.checkConnection()) {
|
||||||
|
final response = await client.post(url, body: json.encode(scheduleRequest.toJson()));
|
||||||
|
final int statusCode = response.statusCode;
|
||||||
|
if (statusCode < 200 || statusCode >= 400 || json == null) {
|
||||||
|
isLoading = false;
|
||||||
|
isError = true;
|
||||||
|
error = 'Error While Fetching data';
|
||||||
|
} else {
|
||||||
|
var parsed = json.decode(response.body.toString());
|
||||||
|
parsed['List_DoctorWorkingHoursTable'].forEach((v) {
|
||||||
|
listDoctorWorkingHoursTable
|
||||||
|
.add(new ListDoctorWorkingHoursTable.fromJson(v));
|
||||||
|
});
|
||||||
|
isError = false;
|
||||||
|
isLoading = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
isLoading = false;
|
||||||
|
isError = true;
|
||||||
|
error = 'Please Check The Internet Connection';
|
||||||
|
}
|
||||||
|
notifyListeners();
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue