Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- EventDataLs = [
- sdate = "02/06/2019",
- stime = "10:00:00",
- description = "IT parti",
- spoint = "Eko park",
- epoint = "Eko park"
- ]
- & PersonEmailLs = ["ivan.ivanov@gmail.com", "missing@abv.bg", "iggi01@gmail.com", "mpetkov@gmail.com"]
- & EquipmentDataLs = ["mlqko", "skara", "fystyci"]
- & :$plnnr:cp_event.add_event (EventDataLs, EquipmentDataLs, PersonDataLs, Event_oid, MissingEmailLs)
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- void add_event(in list EventData_ls, in list EquipmentData_ls, in list PersonData_ls, out term Event_oid, out list MissingEmail_ls)
- add_event (EventData_ls, EquipmentData_ls, PersonData_ls, Event_oid, MissingEmail_ls) :-
- Event_oid = :$plnnr:cp_event.create (EventData_ls)
- & MissingEmail_ls = compute list (Email) where
- (
- Email = m:lst.member (PersonData_ls)
- & if
- PersonOid = t:$cp_person.find_obj (email, Email)
- then
- (
- :$plnnr:cl_event_person.create ([l_event = EventOid, l_person = PersonOid])
- & fail
- )
- )
- & for_all
- EquipmentLabel = m:lst.member (EquipmentData_ls)
- do
- (
- if
- not t:$cp_equipment.find_obj (label, EquipmentLabel)
- then
- EquipmentOid = :$plnnr:cp_equipment.create ([label = EquipmentLabel])
- & :$plnnr:cl_event_equipment.create ([l_event = EventOid, l_equipment = EquipmentOid])
- )
- ;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- list get_details
- get_details :-
- Value = [
- start_point = ?get:spoint,
- end_point = ?get:epoint,
- start_date = ?:type.to_str (date, [], ?get:sdate),
- start_time = ?:type.to_str (hour, [], ?get:stime)]
- ;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- list list_equipment
- list_equipment :-
- Value = compute list (Equipment_oid) where
- (
- EventEquipment_oid = m:$cl_event_equipment.find_obj (l_event, Self)
- & Equipment_oid = get:EventEquipment_oid.l_equipment
- & t:obj.is_instance (Equipment_oid)
- )
- ;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- list list_equipment_dtl
- list_equipment_dtl :-
- EquipmentOidLs = :list_equipment
- & Value = compute list (EquipmentOid = EquipmentData) where
- (
- EquipmentOid = m:lst.member (EquipmentOidLs)
- & EquipmentData = :EquipmentOid.get_details
- )
- ;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- list list_person
- list_person :-
- Value = compute list (Person_oid) where
- (
- EventPerson_oid = m:$cl_event_person.find_obj (l_event, Self)
- & Person_oid = get:EventPerson_oid.l_person
- & t:obj.is_instance (Person_oid)
- )
- ;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- list list_person_dtl
- list_person_dtl :-
- PersonOidLs = :list_person
- & Value = compute list (PersonOid = PersonData) where
- (
- PersonOid = m:lst.member (PersonOidLs)
- & PersonData = :PersonOid.get_details
- )
- ;
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement