Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. public void Arrivals(Notification notification, Arrival arrival)
  2. {
  3. var properties = SMSHandler.GetProperties();
  4.  
  5. var text = "";
  6.  
  7. if (arrival.Note.Equals("Landet"))
  8. {
  9. text = properties["TextArrival"].ToString().Replace("{{FlightNo}}", arrival.Flight).Replace("{{From}}", arrival.From);
  10.  
  11. helper.Notify(notification.Phone, text);
  12.  
  13. // Fjern notification
  14. context.Notifications.Remove(notification);
  15. }
  16. if (arrival.Note.Equals("Tidlig") && notification.State != SMSHelper.SMSState.ArrivalEarly)
  17. {
  18. text = properties["TextArrivalEarly"].ToString().Replace("{{FlightNo}}", arrival.Flight).Replace("{{From}}", arrival.From).Replace("{{ETA}}", arrival.Eta);
  19.  
  20. helper.Notify(notification.Phone, text);
  21.  
  22. notification.State = SMSHelper.SMSState.ArrivalEarly;
  23. }
  24. if (arrival.Note.Equals("OnTime") && notification.State != SMSHelper.SMSState.ArrivalOnTime)
  25. {
  26. text = properties["TextArrivalOnTime"].ToString().Replace("{{FlightNo}}", arrival.Flight).Replace("{{From}}", arrival.From);
  27.  
  28. helper.Notify(notification.Phone, text);
  29.  
  30. notification.State = SMSHelper.SMSState.ArrivalOnTime;
  31. }
  32. if (arrival.Note.Equals("Forsinket") && notification.State != SMSHelper.SMSState.ArrivalDelayed)
  33. {
  34. text = properties["TextArrivalDelayed"].ToString().Replace("{{FlightNo}}", arrival.Flight).Replace("{{From}}", arrival.From).Replace("{{ETA}}", arrival.Eta);
  35.  
  36. helper.Notify(notification.Phone, text);
  37.  
  38. notification.State = SMSHelper.SMSState.ArrivalDelayed;
  39. }
  40. if (arrival.Note.Equals("Aflyst"))
  41. {
  42. text = properties["TextCancelled"].ToString().Replace("{{FlightNo}}", arrival.Flight);
  43.  
  44. helper.Notify(notification.Phone, text);
  45.  
  46. // Fjern notification
  47. context.Notifications.Remove(notification);
  48. }
  49.  
  50. context.SaveChanges();
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement