public override string getQuery(AppointmentBookingRequest i_Request = null, AdditionalObjectsUtils.eAdditionalObjectQuery i_AdditionalObjQuery = default) { ServiceParent parent = null; foreach (ServiceParent parentObj in m_ABData.ServiceParent.Values) { if (parentObj.Id == m_ABData.ServiceToSchedule.ParentRecordId) { parent = parentObj; break; } } if (parent == null) { throw new Exception("Service parent was not retrieved properly"); } //TODO: make generic for all types of parent string visitingHoursCalId = parent.VisitingHours__c; if (visitingHoursCalId == null) { return(String.Empty); } string query = "Select id,TimeZone, " + "(Select DayOfWeek, Type, StartTime, EndTime From TimeSlots order by DayOfWeek, StartTime) " + $"From OperatingHours where id = '{visitingHoursCalId}' limit 1]"; return(formatQueryString(query)); }
private string addRequiredFields(DateTime i_MinDate, DateTime i_MaxDate) { ServiceAppointment service = m_ABData.ServiceToSchedule; HashSet <string> requiredSkillsIds = new HashSet <string>(); ServiceParent serviceParent = m_ABData.ServiceParent[service.ParentRecordId]; foreach (SkillRequirement skillReq in serviceParent.SkillRequirements) { requiredSkillsIds.Add(skillReq.SkillId); } HashSet <string> relevantSecondariesToRetrieve = new HashSet <string>(); if (service.ServiceTerritory.Id != null) { relevantSecondariesToRetrieve.Add(service.ServiceTerritory.Id); } return(getFields(requiredSkillsIds, relevantSecondariesToRetrieve, i_MinDate, i_MaxDate)); }