private void buttonOK_Click(object sender, EventArgs e)
{
if (dateStart.Value > dateStop.Value)
{
//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
var messageBox = new MessageBoxForm("The end date of a show must fall after the start date.", "Date Error", false, true);
messageBox.ShowDialog();
return;
}
_scheduleItem.StartDate = dateStart.Value;
_scheduleItem.EndDate = dateStop.Value;
_scheduleItem.Sunday = checkSunday.Checked;
_scheduleItem.Monday = checkMonday.Checked;
_scheduleItem.Tuesday = checkTuesday.Checked;
_scheduleItem.Wednesday = checkWednesday.Checked;
_scheduleItem.Thursday = checkThursday.Checked;
_scheduleItem.Friday = checkFriday.Checked;
_scheduleItem.Saturday = checkSaturday.Checked;
_scheduleItem.StartTime = dateStartTime.Value;
_scheduleItem.EndTime = dateEndTime.Value;
_scheduleItem.Enabled = checkEnabled.Checked;
if (comboBoxShow.SelectedIndex >= 0)
{
Shows.Show show = ((comboBoxShow.SelectedItem as Common.Controls.ComboBoxItem).Value) as Shows.Show;
_scheduleItem.ShowID = show.ID;
}
else
{
var messageBox = new MessageBoxForm("You must select a Show to run.", "Schedule Error", MessageBoxButtons.OK,
SystemIcons.Error);
messageBox.ShowDialog();
return;
}
DialogResult = DialogResult.OK;
Close();
}