Advertisement
f0rsakenbg

Untitled

May 17th, 2019
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.51 KB | None | 0 0
  1.  
  2. EventDataLs = [
  3. sdate = "02/06/2019",
  4. stime = "10:00:00",
  5. description = "IT parti",
  6. spoint = "Eko park",
  7. epoint = "Eko park"
  8. ]
  9. & PersonEmailLs = ["ivan.ivanov@gmail.com", "missing@abv.bg", "iggi01@gmail.com", "mpetkov@gmail.com"]
  10. & EquipmentDataLs = ["mlqko", "skara", "fystyci"]
  11. & :$plnnr:cp_event.add_event (EventDataLs, EquipmentDataLs, PersonDataLs, Event_oid, MissingEmailLs)
  12.  
  13. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  14.  
  15. void add_event(in list EventData_ls, in list EquipmentData_ls, in list PersonData_ls, out term Event_oid, out list MissingEmail_ls)
  16.  
  17. add_event (EventData_ls, EquipmentData_ls, PersonData_ls, Event_oid, MissingEmail_ls) :-
  18. Event_oid = :$plnnr:cp_event.create (EventData_ls)
  19. & MissingEmail_ls = compute list (Email) where
  20. (
  21. Email = m:lst.member (PersonData_ls)
  22. & if
  23. PersonOid = t:$cp_person.find_obj (email, Email)
  24. then
  25. (
  26. :$plnnr:cl_event_person.create ([l_event = EventOid, l_person = PersonOid])
  27. & fail
  28. )
  29. )
  30. & for_all
  31. EquipmentLabel = m:lst.member (EquipmentData_ls)
  32. do
  33. (
  34. if
  35. not t:$cp_equipment.find_obj (label, EquipmentLabel)
  36. then
  37. EquipmentOid = :$plnnr:cp_equipment.create ([label = EquipmentLabel])
  38. & :$plnnr:cl_event_equipment.create ([l_event = EventOid, l_equipment = EquipmentOid])
  39. )
  40. ;
  41.  
  42. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  43.  
  44. list get_details
  45.  
  46. get_details :-
  47. Value = [
  48. start_point = ?get:spoint,
  49. end_point = ?get:epoint,
  50. start_date = ?:type.to_str (date, [], ?get:sdate),
  51. start_time = ?:type.to_str (hour, [], ?get:stime)]
  52. ;
  53.  
  54. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  55.  
  56. list list_equipment
  57.  
  58. list_equipment :-
  59. Value = compute list (Equipment_oid) where
  60. (
  61. EventEquipment_oid = m:$cl_event_equipment.find_obj (l_event, Self)
  62. & Equipment_oid = get:EventEquipment_oid.l_equipment
  63. & t:obj.is_instance (Equipment_oid)
  64. )
  65. ;
  66.  
  67. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  68.  
  69. list list_equipment_dtl
  70.  
  71. list_equipment_dtl :-
  72. EquipmentOidLs = :list_equipment
  73. & Value = compute list (EquipmentOid = EquipmentData) where
  74. (
  75. EquipmentOid = m:lst.member (EquipmentOidLs)
  76. & EquipmentData = :EquipmentOid.get_details
  77. )
  78. ;
  79.  
  80. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  81.  
  82. list list_person
  83.  
  84. list_person :-
  85. Value = compute list (Person_oid) where
  86. (
  87. EventPerson_oid = m:$cl_event_person.find_obj (l_event, Self)
  88. & Person_oid = get:EventPerson_oid.l_person
  89. & t:obj.is_instance (Person_oid)
  90. )
  91. ;
  92.  
  93. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  94.  
  95. list list_person_dtl
  96.  
  97. list_person_dtl :-
  98. PersonOidLs = :list_person
  99. & Value = compute list (PersonOid = PersonData) where
  100. (
  101. PersonOid = m:lst.member (PersonOidLs)
  102. & PersonData = :PersonOid.get_details
  103. )
  104. ;
  105.  
  106. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement