private void BtnUpdate_Click(object sender, EventArgs e) { if (dataGridView1.Rows.Count == 0) { MessageBox.Show("لا يوجد مرضى"); } else { if (Application.OpenForms.OfType <frmPatientsCRUD>().Any()) { return; } else { new frmPatientsCRUD(this, PatientsLogic.EditButton(dataGridView1), null, null).Show(); } } }
private void BtnSearch_Click(object sender, EventArgs e) { PatientsLogic.SearchButton(dataGridView1, txtSearch, cmbSearchCriteria, null, false); }
private void TxtSearch_TextChanged(object sender, EventArgs e) { PatientsLogic.SearchButton(dataGridView1, txtSearch, cmbSearchCriteria, null, true); }
private void BtnDelete_Click(object sender, EventArgs e) { PatientsLogic.DeleteButton(dataGridView1); }
private void BtnCRUD_Click(object sender, EventArgs e) { int patientid; if (parameters.Count > 0 || patientID.HasValue) { //تعديل من شاشة الحجز if (patientID.HasValue) { patientid = this.patientID.Value; } //تعديل من شاشة المرضى else { patientid = int.Parse(parameters[0]); } try { if (Edit(patientid, cmbxCategoryName.Text, txtWifeName.Text, txtWifePhone.Text, byte.Parse(txtWifeAge.Text), txtWifeJob.Text, dtpWifeBirthDate.Value.ToString("yyyy-MM-dd"), byte.Parse(numMarryCurrent.Value.ToString()), byte.Parse(numNumOfKids.Value.ToString()), txtAddress.Text, txtEmail.Text, chkDidMarry.Checked, byte.Parse(numOldMarryPeriod.Value.ToString()), txtHusbandName.Text, txtHusbandPhone.Text, byte.Parse(numHusbandAge.Value.ToString()), txtHusbandJob.Text, dtpHusbandBirthDate.Value.ToString("yyyy-MM-dd"), txtusbandRelation.Text, txtHusbandEmail.Text, txtHusbandSmokingType.Text)) { ; } { //في حالة التعديل من شاشة المرضى if (frmPatients != null) { frmPatients.Focus(); PatientsLogic.RefreshAfterEdit(frmPatients.dataGridView1); parameters.Clear(); details.Clear(); parameters.TrimExcess(); details.TrimExcess(); this.Close(); } //في حالة التعديل من شاشة الحجز else { parameters.Clear(); details.Clear(); parameters.TrimExcess(); details.TrimExcess(); this.Close(); } } } catch (Exception) { throw; } } //add else { try { if (Insert(cmbxCategoryName.Text, txtWifeName.Text, txtWifePhone.Text, byte.Parse(txtWifeAge.Text), txtWifeJob.Text, dtpWifeBirthDate.Value.ToString("yyyy-MM-dd"), byte.Parse(numMarryCurrent.Value.ToString()), byte.Parse(numNumOfKids.Value.ToString()), txtAddress.Text, txtEmail.Text, chkDidMarry.Checked, byte.Parse(numOldMarryPeriod.Value.ToString()), txtHusbandName.Text, txtHusbandPhone.Text, byte.Parse(numHusbandAge.Value.ToString()), txtHusbandJob.Text, dtpHusbandBirthDate.Value.ToString("yyyy-MM-dd"), txtusbandRelation.Text, txtHusbandEmail.Text, txtHusbandSmokingType.Text)) { //في حالة الاضافة من شاشة المرضى if (frmPatients != null) { frmPatients.Focus(); PatientsLogic.RefreshAfterAdd(frmPatients.dataGridView1); parameters.Clear(); parameters.TrimExcess(); this.Close(); } //في حالة الاضافة من شاشة الحجز else { this.Close(); } } } catch (Exception) { throw; } } }