private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "" || textBox6.Text == "" || (radioButton1.Checked == false && radioButton2.Checked == false)) { MessageBox.Show("Please fill all data"); } else { int check = control_object.Add_new_patient(textBox1.Text, textBox2.Text, textBox3.Text, Convert.ToInt32(textBox4.Text), textBox5.Text, dateTimePicker1.Value, radioButton1.Checked ? "M" : "F"); int check2 = control_object.Add_new_appointment(dateTimePicker2.Value, textBox6.Text, radioButton3.Checked?"New":"NULL", Convert.ToInt32(textBox4.Text), Convert.ToInt32(comboBox1.SelectedValue)); if (check > 0 && check2 > 0) { MessageBox.Show("Appointment added successfully"); textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); radioButton1.Checked = false; radioButton2.Checked = false; dataGridView1.DataSource = null; dataGridView1.Refresh(); } else { MessageBox.Show("Error!Cannot add Appointemt"); } } }
private void button2_Click(object sender, EventArgs e) { if (textBox4.Text == "" || (radioButton1.Checked == false && radioButton2.Checked == false)) { MessageBox.Show("Please fill all data"); } else { int check = control_object.Add_new_appointment(dateTimePicker1.Value, textBox4.Text, radioButton1.Checked ? "Cure" : "Consult", patient_id, Convert.ToInt32(comboBox2.SelectedValue)); if (check > 0) { MessageBox.Show("Appointment added successfully"); } else { MessageBox.Show("Error!Cannot add Appointment"); } } }