コード例 #1
0
        /// <summary>Checks for specialty mismatch between pat and op. Then prompts user according to behavior defined by
        /// PrefName.ApptSchedEnforceSpecialty.  Returns true if the Appointment is allowed to be scheduled, false otherwise.</summary>
        public static bool IsSpecialtyMismatchAllowed(long patNum, long clinicNum)
        {
            try {
                Appointments.HasSpecialtyConflict(patNum, clinicNum); //throws exception if we need to prompt user
            }
            catch (ODException odex) {                                //Warn/Block
                switch ((ApptSchedEnforceSpecialty)odex.ErrorCode)
                {
                case ApptSchedEnforceSpecialty.Warn:
                    if (!MsgBox.Show("Appointment", MsgBoxButtons.YesNo, odex.Message + "\r\nSchedule appointment anyway?", "Specialty Mismatch"))
                    {
                        return(false);
                    }
                    break;

                case ApptSchedEnforceSpecialty.Block:
                    MsgBox.Show("Appointment", odex.Message, "Specialty Mismatch");
                    return(false);
                }
            }
            return(true);
        }