From 80fdd81ae0a8ed1c563a73c171ab22643342188b Mon Sep 17 00:00:00 2001 From: her_username Date: Tue, 19 May 2020 12:40:15 +0300 Subject: [PATCH 1/2] change name in Doctor Reply --- lib/providers/doctor_reply_provider.dart | 14 +++++++------- lib/screens/QR_reader_screen.dart | 9 +++++++++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/providers/doctor_reply_provider.dart b/lib/providers/doctor_reply_provider.dart index 9572312f..d28d12cd 100644 --- a/lib/providers/doctor_reply_provider.dart +++ b/lib/providers/doctor_reply_provider.dart @@ -20,24 +20,24 @@ class DoctorReplyProvider with ChangeNotifier { bool isLoading = true; bool isError = false; String error = ''; - RequestDoctorReply _requestSchedule = RequestDoctorReply(); + RequestDoctorReply _requestDoctorReply = RequestDoctorReply(); DoctorReplyProvider() { - getDoctorSchedule(); + getDoctorReply(); } - getDoctorSchedule() async { + getDoctorReply() async { const url = BASE_URL + 'DoctorApplication.svc/REST/GtMyPatientsQuestions'; Map profile = await sharedPref.getObj(DOCTOR_PROFILE); String token = await sharedPref.getString(TOKEN); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - _requestSchedule.doctorID = doctorProfile.doctorID; - _requestSchedule.projectID = doctorProfile.projectID; - _requestSchedule.tokenID = token; + _requestDoctorReply.doctorID = doctorProfile.doctorID; + _requestDoctorReply.projectID = doctorProfile.projectID; + _requestDoctorReply.tokenID = token; try { if (await Helpers.checkConnection()) { final response = await client.post(url, - body: json.encode(_requestSchedule.toJson())); + body: json.encode(_requestDoctorReply.toJson())); final int statusCode = response.statusCode; if (statusCode < 200 || statusCode >= 400 || json == null) { isLoading = false; diff --git a/lib/screens/QR_reader_screen.dart b/lib/screens/QR_reader_screen.dart index 71be8b75..4750b38e 100644 --- a/lib/screens/QR_reader_screen.dart +++ b/lib/screens/QR_reader_screen.dart @@ -1,6 +1,7 @@ import 'package:barcode_scan/platform_wrapper.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patient_model.dart'; import 'package:doctor_app_flutter/models/patient/topten_users_res_model.dart'; @@ -153,6 +154,14 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); patientList = []; }); String token = await sharedPref.getString(TOKEN); +// Map profile = await sharedPref.getObj(DOCTOR_PROFILE); +// DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); +// patient.PatientID = 8808; +// patient.TokenID = token; +// patient.setDoctorID = doctorProfile.projectID; +// patient.setClinicID = doctorProfile.clinicID; +// patient.setProjectID = doctorProfile.projectID; +// Provider.of(context, listen: false); patient.PatientID = 8808; patient.TokenID = token; Provider.of(context, listen: false) From 1f33e1a90116f993faf2523ac19275559cdb9424 Mon Sep 17 00:00:00 2001 From: Mohammad ALjammal Date: Tue, 19 May 2020 13:57:53 +0300 Subject: [PATCH 2/2] Add fix data for request in config file --- lib/config/config.dart | 10 ++++++++++ lib/models/request_doctor_reply.dart | 26 ++++++++++++++------------ lib/models/request_schedule.dart | 24 +++++++++++++----------- lib/providers/schedule_provider.dart | 2 +- 4 files changed, 38 insertions(+), 24 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 372fab75..c0e8b511 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -44,3 +44,13 @@ var SERVICES_PATIANT_HEADER = [ // Colors ////// by : ibrahim const PRIMARY_COLOR = 0xff58434F; + +const TRANSACTION_NO = 0; +const LANGUAGE_ID = 2; +const STAMP = '2020-04-27T12:17:17.721Z'; +const IP_ADDRESS = '11.11.11.11'; +const VERSION_ID = 1.2; +const CHANNEL = 9; +const SESSION_ID = '2Z7FX4Lokp'; +const IS_LOGIN_FOR_DOCTOR_APP = true; +const PATIENT_OUT_SA = false; diff --git a/lib/models/request_doctor_reply.dart b/lib/models/request_doctor_reply.dart index 17e1e225..e93850a2 100644 --- a/lib/models/request_doctor_reply.dart +++ b/lib/models/request_doctor_reply.dart @@ -1,3 +1,5 @@ +import 'package:doctor_app_flutter/config/config.dart'; + class RequestDoctorReply { int projectID; int doctorID; @@ -13,18 +15,18 @@ class RequestDoctorReply { bool patientOutSA; RequestDoctorReply( - {this.projectID = 15, - this.doctorID = 70907, - this.transactionNo = 0, - this.languageID = 2, - this.stamp = '2020-04-27T12:17:17.721Z', - this.iPAdress = '11.11.11.11', - this.versionID = 1.2, - this.channel = 9, - this.tokenID = '@dm!n', - this.sessionID = '2Z7FX4Lokp', - this.isLoginForDoctorApp = true, - this.patientOutSA = false}); + {this.projectID , + this.doctorID , + this.transactionNo = TRANSACTION_NO, + this.languageID = LANGUAGE_ID, + this.stamp = STAMP, + this.iPAdress = IP_ADDRESS, + this.versionID = VERSION_ID, + this.channel = CHANNEL, + this.tokenID , + this.sessionID = SESSION_ID, + this.isLoginForDoctorApp = IS_LOGIN_FOR_DOCTOR_APP, + this.patientOutSA = PATIENT_OUT_SA}); RequestDoctorReply.fromJson(Map json) { projectID = json['ProjectID']; diff --git a/lib/models/request_schedule.dart b/lib/models/request_schedule.dart index cddfe0f8..d704e9bb 100644 --- a/lib/models/request_schedule.dart +++ b/lib/models/request_schedule.dart @@ -1,3 +1,5 @@ +import 'package:doctor_app_flutter/config/config.dart'; + class RequestSchedule { int projectID; int clinicID; @@ -14,21 +16,21 @@ class RequestSchedule { bool patientOutSA; int patientTypeID; - RequestSchedule( + RequestSchedule({ this.projectID, this.clinicID, this.doctorID, - this.doctorWorkingHoursDays, - this.languageID, - this.stamp, - this.iPAdress, - this.versionID, - this.channel, + this.doctorWorkingHoursDays = 7, + this.languageID = LANGUAGE_ID, + this.stamp = STAMP, + this.iPAdress = IP_ADDRESS, + this.versionID = VERSION_ID, + this.channel = CHANNEL, this.tokenID, - this.sessionID, - this.isLoginForDoctorApp, - this.patientOutSA, - this.patientTypeID); + this.sessionID = SESSION_ID, + this.isLoginForDoctorApp = IS_LOGIN_FOR_DOCTOR_APP, + this.patientOutSA = PATIENT_OUT_SA, + this.patientTypeID = 1}); RequestSchedule.fromJson(Map json) { projectID = json['ProjectID']; diff --git a/lib/providers/schedule_provider.dart b/lib/providers/schedule_provider.dart index 44ed24de..65945f52 100644 --- a/lib/providers/schedule_provider.dart +++ b/lib/providers/schedule_provider.dart @@ -20,7 +20,7 @@ class ScheduleProvider with ChangeNotifier { bool isLoading = true; bool isError = false; String error = ''; - RequestSchedule requestSchedule = RequestSchedule(15, 1, 1485, 7, 2, '2020-04-22T11:25:57.640Z', '11.11.11.11', 1.2, 9, '2lMDFT8U+Uy5jxRzCO8n2w==', 'vV6tg9yyVJ222', true, false, 1); + RequestSchedule requestSchedule = RequestSchedule(); ScheduleProvider() { getDoctorSchedule();