private void save_btn_Click_1(object sender, RoutedEventArgs e) { Hairdresser hairdresser = new Hairdresser(); hairdresser.edit(Convert.ToInt32(index), phone_txtbox.Text.ToString()); FillDataGrid(); }
private void writeToDB() { string name = name1_txtbox.Text + " " + name2_txtbox.Text; string category = string.Empty; string phone = phone_txtbox.Text; Boolean error = true; if (name1_txtbox.Text == null || name1_txtbox.Text == " " || name1_txtbox.Text == "" || name2_txtbox.Text == "" || name2_txtbox.Text == null || name2_txtbox.Text == " ") { MessageBox.Show("Please enter hairdresser's name"); error = true; } else { error = false; //checks empty fields if (radio_btn1.IsChecked == true) { category = radio_btn1.Content.ToString(); error = false; } else if (radio_btn2.IsChecked == true) { category = radio_btn2.Content.ToString(); error = false; } else { MessageBox.Show("Category must be selected"); error = true; } } if (error == false) { Hairdresser newHairdresser = new Hairdresser(); newHairdresser.add(name, category, phone); FillDataGrid(); } }