I would define a Dictionary<CheckBox,int> that held the CheckBoxes corresponding to the time-slots for appointments as its Keys, and the offset from midnight to the beginning of the time-slot as its values:
private Dictionary<CheckBox, int> dctCBxDTm;
private int currentHour;
private void YourApp_SomeInitializationEvent()
{
dctCBxDTm = new Dictionary<CheckBox, int>
{
{checkBox1, 8},
{checkBox2, 9},
{checkBox3, 10},
{checkBox4, 11},
{checkBox5, 13},
{checkBox6, 14},
{checkBox7, 15},
{checkBox8, 16}
};
}
Then I'd define a schedule update function:
private void ScheduleUpdate()
{
currentHour = DateTime.Now.Hour;
if (currentHour < 6 || currentHour > 16)
{
MessageBox.Show("Thank you for using ACA HealthCare.\r\n\r\nTry again tomorrow if you are not dead.", "Morituri te Salutamus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
foreach (var kvp in dctCBxDTm)
{
kvp.Key.Enabled = kvp.Value >= currentHour;
}
}
Obviously you need to determine how you want to call the update function, how frequently, etc. I'd do that "on demand" whenever a user of the system starts your site, after, I assume, a log-in process.