private void dgv_MedicalCure_CellContentClick(object sender, DataGridViewCellEventArgs e) { string val = dgv_MedicalCure.Rows[e.RowIndex].Cells[e.ColumnIndex].FormattedValue.ToString(); if (val == "حزف کریں") { Treatment t = new Treatment(); string name = dgv_MedicalCure.Rows[e.RowIndex].Cells[1].FormattedValue.ToString(); t.Delete(name); t.ShowInGrid(dgv_MedicalCure); } }
private void btn_AddMedicalTreatment_Click(object sender, EventArgs e) { bool errFlag = false; Treatment t = new Treatment(); if (t.invalidMedName(cmb_MedicalCure.Text)) { errFlag = true; lbl_ErrorMedicalCureName.Text = t.errorMedName; lbl_ErrorMedicalCureName.ForeColor = System.Drawing.Color.Red; } if (t.invalidPotency(cmb_Potency.Text)) { errFlag = true; lbl_ErrorPotency.Text = t.errorPotency; lbl_ErrorPotency.ForeColor = System.Drawing.Color.Red; } if (errFlag == false && t.treatmentAlreadyInList(cmb_MedicalCure.Text, "طبی", cmb_Potency.Text)) { MessageBox.Show("یہ علاج پہلے سے موجود ہے"); return; } if (errFlag == true) { return; } t.MedName = cmb_MedicalCure.Text; t.Potency = cmb_Potency.Text; t.DoctorRecommendations = txt_DoctorsRecomendation.Text; t.Type = "طبی"; t.addToList(); t.ShowInGrid(dgv_MedicalCure); }