Esempio n. 1
0
        private void save_Btn_Click(object sender, EventArgs e)
        {
            // Check if a technician name is not empty
            if (name_Txt.Text == "")
            {
                MessageBox.Show("Name field can not be empty. Please input!");
                name_Txt.Focus();
                return;
            }

            // Check if a working hours is not empty
            if (hoursOnMonFri_Txt.Text == "")
            {
                MessageBox.Show("Working Hours can not be empty. Please input!");
                hoursOnMonFri_Txt.Focus();
                return;
            }



            // Create a new technician
            Technician newTechnician = new Technician
            {
                name         = name_Txt.Text,
                workingHours = Convert.ToDouble(hoursOnMonFri_Txt.Text),
                date         = DateTime.Now
            };

            if (DatabaseControl.addTechnician(newTechnician))
            {
                MessageBox.Show("New Technician has been added succesfully!");
                UIControl.technicianGridForm.showTechnicians();
                clearFields();
            }
        }