Пример #1
0
        private void save_Btn_Click(object sender, EventArgs e)
        {
            // Check if a Job Type name is not empty
            if (name_Txt.Text == "")
            {
                MessageBox.Show("Job Type Name can not be empty. Please input!");
                name_Txt.Focus();
                return;
            }

            // Check if a background color is not empty
            if (background_Lbl.Text == "")
            {
                MessageBox.Show("Background Color field can not be empty. Please input!");
                background_Lbl.Focus();
                return;
            }

            //// Check if a working hours is numeric value
            //double d;
            //if (!double.TryParse(workingHours_Txt.Text, out d))
            //{
            //    MessageBox.Show("Invalid Input! Working hours should be numeric value. Please input!");
            //    workingHours_Txt.Focus();
            //    return;
            //}

            // Create a new technician
            JobType newJobType = new JobType
            {
                typeName   = name_Txt.Text,
                background = background_Lbl.Text
            };

            if (DatabaseControl.addJobType(newJobType))
            {
                MessageBox.Show("New Job Type has been added succesfully!");
                UIControl.newBookingForm.updateJobTypes();
                UIControl.editBookingForm.updateJobTypes();
                UIControl.jobTypesGridForm.showJobTypes();
                clearFields();
            }
        }