|
|
|
|
@ -149,13 +149,20 @@ extension HMG_Geofence{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func notifyServer(forRegion:CLRegion, transition:Transition, location:CLLocation?){
|
|
|
|
|
showNotification(title: "Notifying server..." , subtitle: forRegion.identifier, message: "")
|
|
|
|
|
|
|
|
|
|
if let idString = forRegion.identifier.split(separator: "_").first, let idInt = Int(idString){
|
|
|
|
|
let body:[String:Any] = ["PointsID":idInt,"GeoType":transition.rawValue,"PatientID":"1231755"]
|
|
|
|
|
let url = "https://hmgwebservices.com/Services/Patients.svc/REST/GeoF_InsertPatientFileInfo"
|
|
|
|
|
httpPostRequest(urlString: url, jsonBody: body){ (status,json) in
|
|
|
|
|
showNotification(title: transition.name(), subtitle: forRegion.identifier, message: status ? "Success: notified to server ✔️" : "Failed to notified server ✖️")
|
|
|
|
|
if let userProfileJson = UserDefaults.standard.string(forKey: "user-profile"),
|
|
|
|
|
let userProfile = dictionary(from: userProfileJson), let patientId = userProfile["PatientID"] as? String{
|
|
|
|
|
|
|
|
|
|
if let idString = forRegion.identifier.split(separator: "_").first, let idInt = Int(idString){
|
|
|
|
|
let body:[String:Any] = [
|
|
|
|
|
"PointsID":idInt,
|
|
|
|
|
"GeoType":transition.rawValue,
|
|
|
|
|
"PatientID":patientId
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
let url = "https://hmgwebservices.com/Services/Patients.svc/REST/GeoF_InsertPatientFileInfo"
|
|
|
|
|
httpPostRequest(urlString: url, jsonBody: body){ (status,json) in
|
|
|
|
|
showNotification(title: transition.name(), subtitle: forRegion.identifier, message: status ? "Success: notified to server ✔️" : "Failed to notified server ✖️")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|