Beispiel #1
0
        private void add_dr_button_Click(object sender, EventArgs e)
        {
            if (nameTextBox.Text == "" || usernameTextBox.Text == "" || passwordTextBox.Text == "" || ((!maleRadioButton.Checked) && (!femaleRadioButton.Checked)))
            {
                MessageBox.Show("Please, insert at least the doctor name, username, password, gender, age, department and salary.");
            }
            else
            {
                int r = controllerObj.A_AddDoctor(nameTextBox.Text.ToString(),
                                                  usernameTextBox.Text.ToString(),
                                                  passwordTextBox.Text.ToString(),
                                                  maleRadioButton.Checked ? "M" : "F",
                                                  (int)ageNumericUpDown.Value,
                                                  mobileNumTextBox.Text.ToString(),
                                                  addressTextBox.Text.ToString(),
                                                  (int)depComboBox.SelectedValue,
                                                  "" + (int)shiftStartNumericUpDown.Value + " " + (string)AMPMcomboBox1.SelectedValue,
                                                  "" + (int)shiftEndNumericUpDown.Value + " " + (string)AMPMcomboBox2.SelectedValue,
                                                  (int)salaryNumericUpDown.Value);

                if (r > 0)
                {
                    MessageBox.Show("Doctor added successfully.");
                    DataTable dt1 = controllerObj.SelectDoctorIDsNames();
                    drsComboBox.DataSource    = dt1;
                    drsComboBox.DisplayMember = "Name";
                    drsComboBox.ValueMember   = "DID";
                }
                else
                {
                    MessageBox.Show("Error in adding doctor.");
                }
            }
        }