private void buttonAcceptPS_Click(object sender, EventArgs e) { DataSetHospitalTableAdapters.TablePrimeSpecsTableAdapter ta = new DataSetHospitalTableAdapters.TablePrimeSpecsTableAdapter(); try { string gen = ""; if (radioButtonMan.Checked == true) { gen = "مرد"; } else if (radioButtonWoman.Checked == true) { gen = "زن"; } ta.Insert(Convert.ToInt32(numericUpDownPatientId.Value), textBoxFirstName.Text, textBoxLastName.Text, textBoxFathersName.Text, textBoxSocialSecurityNumber.Text, gen, dateTimePickerBirthDate.Value, textBoxCityPS.Text, richTextBoxAddressPS.Text, richTextBoxDescriptionPS.Text); pId = Convert.ToInt32(numericUpDownPatientId.Value); textBoxPatientIdHA.Text = pId.ToString(); textBoxPatientIdPE.Text = pId.ToString(); textBoxPatientIdS1.Text = pId.ToString(); textBoxPatientIdS2.Text = pId.ToString(); textBoxPatientIdWA.Text = pId.ToString(); numericUpDownPatientId.Value = r.Next(minId, maxId); MessageBox.Show("با موفقیت اضافه شد", "مشخصات اولیه", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show("متاسفانه، انجام نشد", "مشخصات اولیه", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { DataSetHospitalTableAdapters.TablePrimeSpecsTableAdapter tps = new DataSetHospitalTableAdapters.TablePrimeSpecsTableAdapter(); FormReleasePatient f = new FormReleasePatient(); f.PId = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value); f.SSN = dataGridView1.SelectedRows[0].Cells[4].Value.ToString(); if (MessageBox.Show("آیا از ترخیص بیمار مربوطه اطمینان دارید؟", "ترخیص بیمار", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { try { f.ShowDialog(); if (f.Release) { tps.DeleteQuery(f.SSN, f.PId); MessageBox.Show("با موفقیت ترخیص شد", "ترخیص بیمار", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { throw new Exception(); } } catch { MessageBox.Show("انجام نشد", "ترخیص بیمار", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.myViewTableAdapter.Fill(this.dataSetHospital1.MyView); } } }