Ejemplo n.º 1
0
 private void btnAssignJob_Click(object sender, EventArgs e)
 {
     if (queen.AssignWork(cmbWorkerBeeJob.Text, (int)numShifts.Value) == false)
     {
         MessageBox.Show("No workers are available to do the job '" + cmbWorkerBeeJob.Text + "'", "The queen bee says…", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else
     {
         MessageBox.Show("The job '" + cmbWorkerBeeJob.Text + "' will be done in " + numShifts.Value + " shifts", "The queen bee says…", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 2
0
 private void buttonAssignJob_Click(object sender, EventArgs e)
 {
     if ((queen.AssignWork(comboBoxJobList.Text, (int)numericUpDownShiftsNum.Value) == false))
     {
         MessageBox.Show("No workers are avaiable to do the job '" + comboBoxJobList.Text + "', The queen bee says ...");
     }
     else
     {
         MessageBox.Show("The job '" + comboBoxJobList.Text + "' will be done in "
                         + numericUpDownShiftsNum.Value + " shifts", "The queen bee says...");
     }
 }
        private void assignJob_Click(object sender, RoutedEventArgs e)
        {
            int  shiftsNumber;
            bool isNumeric = int.TryParse(shifts.Text, out shiftsNumber);

            if (isNumeric)
            {
                if (queen.AssignWork(workerBeeJob.Text, shiftsNumber) == false)
                {
                    MessageBox.Show("No workers are available to do the job `"
                                    + workerBeeJob.Text + "`", "The queen bee says...");
                }
                else
                {
                    MessageBox.Show("The job `" + workerBeeJob.Text + "` will be done in "
                                    + shifts.Text + " shifts", "The queen bee says...");
                }
            }
            else
            {
                MessageBox.Show("Please enter an integer in the 'Shifts' textbox.");
            }
        }