///<summary>Gets up to 30 days of open time slots based on the recall passed in. ///Open time slots are found by looping through operatories flagged for Web Sched and finding openings that can hold the recall. ///The amount of time required to be considered "available" is dictated by the RecallType associated to the recall passed in. ///Throws exceptions.</summary> public static List <TimeSlot> GetAvailableWebSchedTimeSlots(long recallNum, DateTime dateStart, DateTime dateEnd, long provNum = 0, bool allowOtherProv = true) { //No need to check RemotingRole; no call to db. Clinic clinic = Clinics.GetClinicForRecall(recallNum); Recall recall = Recalls.GetRecall(recallNum); if (recall == null) { throw new ODException(Lans.g("WebSched", "The recall appointment you are trying to schedule is no longer available.") + "\r\n" + Lans.g("WebSched", "Please call us to schedule your appointment.")); } List <Provider> listProviders = Providers.GetProvidersForWebSched(recall.PatNum); if (provNum > 0 && !allowOtherProv) { listProviders = listProviders.FindAll(x => x.ProvNum == provNum); } RecallType recallType = RecallTypes.GetFirstOrDefault(x => x.RecallTypeNum == recall.RecallTypeNum); return(GetAvailableWebSchedTimeSlots(recallType, listProviders, clinic, dateStart, dateEnd, recall)); }
///<summary>Gets up to 30 days of open time slots based on the recall passed in. ///Open time slots are found by looping through operatories flagged for Web Sched and finding openings that can hold the recall. ///The amount of time required to be considered "available" is dictated by the RecallType associated to the recall passed in. ///Throws exceptions.</summary> public static List <TimeSlot> GetAvailableWebSchedTimeSlots(long recallNum, DateTime dateStart, DateTime dateEnd, long provNum = 0, bool allowOtherProv = true, Logger.IWriteLine log = null) { //No need to check RemotingRole; no call to db. Clinic clinic = Clinics.GetClinicForRecall(recallNum); Recall recall = Recalls.GetRecall(recallNum); if (recall == null) { throw new ODException(Lans.g("WebSched", "The recall appointment you are trying to schedule is no longer available.") + "\r\n" + Lans.g("WebSched", "Please call us to schedule your appointment.")); } List <Provider> listProviders = Providers.GetProvidersForWebSched(recall.PatNum, clinic?.ClinicNum ?? 0); if (provNum > 0 && !allowOtherProv) { listProviders = listProviders.FindAll(x => x.ProvNum == provNum); } log?.WriteLine("listProviders:\r\n\t" + string.Join(",\r\n\t", listProviders.Select(x => x.ProvNum + " - " + x.Abbr)), LogLevel.Verbose); RecallType recallType = RecallTypes.GetFirstOrDefault(x => x.RecallTypeNum == recall.RecallTypeNum); return(GetAvailableWebSchedTimeSlots(recallType, listProviders, clinic, dateStart, dateEnd, recall, log)); }