Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Update Step
- var Temperature: String = "%20"
- var Photo: String = "4504567788_10_1234567788"
- var Shipment: String = "4505023244"
- var TruckId: String = "2"
- var PlanDetailId: String = "1"
- var Step:String = "2"
- func savePhotoAndTempToDatabase(ptemperature: String, pphoto: String, pshipment: String, ptruckID: String, pplandetailID: String, pstep: String) -> Void {
- …..
- …..
- let myResponse = checkResult
- if ((myResponse) == true){
- print("Save Success")
- DispatchQueue.main.async {
- self.performSegue(withIdentifier: "gotoDepartureDC", sender: self)
- }//DispatchQueue
- }else{
- print("Cannot Save")
- }//if
- }
- func askSaveAlert(title: String, message: String) -> Void {
- let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertController.Style.alert)
- alert.addAction(UIAlertAction(title: "Cancle", style: UIAlertAction.Style.default, handler: { (action) in
- alert.dismiss(animated: true, completion: nil)
- }))
- alert.addAction(UIAlertAction(title: "Save", style: UIAlertAction.Style.default, handler: { (action) in
- //call Save func
- self.savePhotoAndTempToDatabase(ptemperature: self.Temperature, pphoto: self.Photo, pshipment: self.Shipment, ptruckID: self.TruckId, pplandetailID: self.PlanDetailId, pstep: self.Step)
- }))
- self.present(alert,animated: true, completion: nil)
- }//askSaveAlert
- @IBAction func saveAndNextButton(_ sender: UIButton) {
- if checkSpace(photo: Photo){
- print("No photo!")
- showAlert(title: "No photo", message: "Please take a photo, and press saves for going to the next step.")
- }
- else{
- print("Save Data!")
- // Update step function
- askSaveAlert(title: "Save Data!", message: "Do you want to save data?")
- }//if
- }//saveAndNextButton
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement