예제 #1
0
        private void upd_info_button_Click(object sender, EventArgs e)
        {
            if (nameTextBox.Text == "" || usernameTextBox.Text == "" || passwordTextBox.Text == "" || ((!maleRadioButton.Checked) && (!femaleRadioButton.Checked)))
            {
                MessageBox.Show("Please, insert at least the name, username, password, gender, and age.");
            }
            else
            {
                int r = controllerObj.A_UpdateReceptionist((int)_recid,
                                                           nameTextBox.Text.ToString(),
                                                           usernameTextBox.Text.ToString(),
                                                           passwordTextBox.Text.ToString(),
                                                           maleRadioButton.Checked ? "M" : "F",
                                                           (int)ageNumericUpDown.Value,
                                                           mobileNumTextBox.Text.ToString(),
                                                           addressTextBox.Text.ToString(),
                                                           -1);

                if (r > 0)
                {
                    MessageBox.Show("Information updated successfully.");
                }
                else
                {
                    MessageBox.Show("Error in updating information.");
                }
            }
        }
        private void upd_recep_button_Click(object sender, EventArgs e)
        {
            if (nameTextBox.Text == "" || usernameTextBox.Text == "" || passwordTextBox.Text == "" || ((!maleRadioButton.Checked) && (!femaleRadioButton.Checked)))
            {
                MessageBox.Show("Please, insert at least the receptionist name, username, password, gender, age and salary.");
            }
            else
            {
                int r = controllerObj.A_UpdateReceptionist(Convert.ToInt32(recepsComboBox.SelectedValue),
                                                           nameTextBox.Text.ToString(),
                                                           usernameTextBox.Text.ToString(),
                                                           passwordTextBox.Text.ToString(),
                                                           maleRadioButton.Checked ? "M" : "F",
                                                           (int)ageNumericUpDown.Value,
                                                           mobileNumTextBox.Text.ToString(),
                                                           addressTextBox.Text.ToString(),
                                                           (int)salaryNumericUpDown.Value);

                if (r > 0)
                {
                    MessageBox.Show("Receptionist updated successfully.");
                    DataTable dt1 = controllerObj.SelectReceptionistIDsNames();
                    recepsComboBox.DataSource    = dt1;
                    recepsComboBox.DisplayMember = "Name";
                    recepsComboBox.ValueMember   = "RecID";
                }
                else
                {
                    MessageBox.Show("Error in updating receptionist.");
                }
            }
        }