Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. // Update Step
  2. var Temperature: String = "%20"
  3. var Photo: String = "4504567788_10_1234567788"
  4. var Shipment: String = "4505023244"
  5. var TruckId: String = "2"
  6. var PlanDetailId: String = "1"
  7. var Step:String = "2"
  8.  
  9. func savePhotoAndTempToDatabase(ptemperature: String, pphoto: String, pshipment: String, ptruckID: String, pplandetailID: String, pstep: String) -> Void {
  10. …..
  11. …..
  12. let myResponse = checkResult
  13. if ((myResponse) == true){
  14. print("Save Success")
  15. DispatchQueue.main.async {
  16. self.performSegue(withIdentifier: "gotoDepartureDC", sender: self)
  17. }//DispatchQueue
  18. }else{
  19. print("Cannot Save")
  20. }//if
  21. }
  22.  
  23. func askSaveAlert(title: String, message: String) -> Void {
  24. let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertController.Style.alert)
  25. alert.addAction(UIAlertAction(title: "Cancle", style: UIAlertAction.Style.default, handler: { (action) in
  26. alert.dismiss(animated: true, completion: nil)
  27. }))
  28. alert.addAction(UIAlertAction(title: "Save", style: UIAlertAction.Style.default, handler: { (action) in
  29. //call Save func
  30. self.savePhotoAndTempToDatabase(ptemperature: self.Temperature, pphoto: self.Photo, pshipment: self.Shipment, ptruckID: self.TruckId, pplandetailID: self.PlanDetailId, pstep: self.Step)
  31. }))
  32. self.present(alert,animated: true, completion: nil)
  33. }//askSaveAlert
  34.  
  35.  
  36. @IBAction func saveAndNextButton(_ sender: UIButton) {
  37. if checkSpace(photo: Photo){
  38. print("No photo!")
  39. showAlert(title: "No photo", message: "Please take a photo, and press saves for going to the next step.")
  40. }
  41. else{
  42. print("Save Data!")
  43. // Update step function
  44. askSaveAlert(title: "Save Data!", message: "Do you want to save data?")
  45. }//if
  46. }//saveAndNextButton
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement