///<summary>Deletes everything from the appointment table.  Does not truncate the table so that PKs are not reused on accident.</summary>
        public static void ClearAppointmentRuleTable()
        {
            string command = "DELETE FROM appointmentrule WHERE AppointmentRuleNum > 0";

            DataCore.NonQ(command);
            AppointmentRules.RefreshCache();
        }
        ///<summary></summary>
        public static AppointmentRule CreateAppointmentRule(string desc, string codeStart, string codeEnd)
        {
            AppointmentRule apptRule = new AppointmentRule()
            {
                RuleDesc  = desc,
                CodeStart = codeStart,
                CodeEnd   = codeEnd,
                IsEnabled = true
            };

            AppointmentRules.Insert(apptRule);
            AppointmentRules.RefreshCache();
            return(apptRule);
        }
Exemple #3
0
        ///<summary>Checks to see if the provider has any double booking issues with the appointment time pattern passed in.
        ///Logic in this method ignores HYG conflicts purposefully for Web Sched. timePattern must be a time pattern in 5 minute increments.
        ///If there is no appointment type specified, checks for double booking purely based on time. If an appointment type is specified, checks if
        ///there are any appointment rules for codes associated with that appointment type. If there are rules, checks for double-booking according
        ///to those rules using Appointments.GetDoubleBookedCodes. Otherwise, if there are no rules, checks preferences WebSchedNewPatApptDoubleBooking
        ///and WebSchedRecallDoubleBooking to determine the double booking rules to use.</summary>
        private static bool IsApptTimeSlotDoubleBooked(List <ApptSearchProviderSchedule> listProviderSchedules, List <Appointment> listApptsForDateAndOp
                                                       , long provNum, string timePattern, DateTime dateTimeAppointmentStart, long defNumApptType = 0, bool isDoubleBookingAllowed = true)
        {
            //No need to check RemotingRole; no call to db and this is a private method.
            AppointmentType apptType = AppointmentTypes.GetWebSchedNewPatApptTypeByDef(defNumApptType);

            //If there is an appointment type, try to determine double booking based on any rules associated with those proc codes
            if (apptType != null)
            {
                System.Collections.ArrayList apptTypeProcCodes = new System.Collections.ArrayList(apptType.CodeStr.Split(','));
                Appointment apptTemp = new Appointment()
                {
                    ProvNum            = provNum,
                    Pattern            = timePattern,
                    AptDateTime        = dateTimeAppointmentStart,
                    AppointmentTypeNum = apptType.AppointmentTypeNum,
                };
                DataTable   dtAppts      = Appointments.GetPeriodApptsTableMini(dateTimeAppointmentStart, provNum);
                List <long> listApptNums = new List <long>();
                foreach (DataRow row in dtAppts.Rows)
                {
                    listApptNums.Add(PIn.Long(row["AptNum"].ToString()));
                }
                List <Procedure>             procsMultApts = Procedures.GetProcsMultApts(listApptNums);
                System.Collections.ArrayList dbCodes       = Appointments.GetDoubleBookedCodes(apptTemp, dtAppts, procsMultApts, new Procedure[] { });
                //Check for appointment rules and specific blocked appointments/codes
                if (AppointmentRules.IsBlocked(apptTypeProcCodes))
                {
                    return(dbCodes.Count > 0);
                }
            }
            //There was no appointment type, or there were no appointment rules, or none of the codes were double booked
            //In this case we look at the double booking preferences (passed down from calling method)
            if (!isDoubleBookingAllowed)
            {
                return(IsApptPatternDoubleBooked(listProviderSchedules, provNum, timePattern, dateTimeAppointmentStart));
            }
            return(false);
        }