Пример #1
0
        private void btn_update_Click(object sender, RoutedEventArgs e)
        {
            if (docselected == null)
            {
                return;
            }

            String   updated_firstname = firstnametxt_update.Text;
            String   updated_lastname  = lastnametxt_update.Text;
            String   updated_username  = usernametxt_update.Text;
            String   updated_password  = passwordbox_update.Password;
            String   updated_cellno    = cellno_update.Text;
            int      updated_salary    = int.Parse(salary_update.Text);
            DateTime dob = new DateTime();

            dob = (DateTime)datepicker_update.SelectedDate;
            int    catid  = int.Parse(specialization_update.SelectedValue.ToString());
            String type   = "doctor";
            String gender = "male";

            if (rbFemale_update.IsChecked ?? false)
            {
                gender = "female";
            }

            docselected.Employee.emp_firstname = updated_firstname;
            docselected.Employee.emp_lastname  = updated_lastname;
            docselected.Employee.emp_phone     = updated_cellno;
            docselected.Employee.emp_gender    = gender;
            docselected.Employee.emp_salary    = updated_salary;
            docselected.Employee.emp_dob       = dob;
            docselected.cat_id = catid;

            docselected.Employee.User.user_type     = type;
            docselected.Employee.User.user_password = updated_password;
            docselected.Employee.User.user_name     = updated_username;

            hmsfac.updateDoctor(docselected);
            dataGrid_Doctor.Items.Refresh();
            patientList = hmsfac.getPatient();
            dataGrid_Patient.Items.Refresh();

            this.btn_update.IsEnabled   = false;
            this.btn_delete.IsEnabled   = false;
            firstnametxt_update.Text    = "";
            lastnametxt_update.Text     = "";
            usernametxt_update.Text     = "";
            passwordbox_update.Password = "";
            datepicker_update.Text      = "";
            specialization_update.Text  = "";
            salary_update.Text          = "";
            rbMale_update.IsChecked     = false;
            rbFemale_update.IsChecked   = false;
        }