private void dgv_TreatmentHomoeo_CellContentClick(object sender, DataGridViewCellEventArgs e) { string val = dgv_TreatmentHomoeo.Rows[e.RowIndex].Cells[e.ColumnIndex].FormattedValue.ToString(); if (val == "حزف کریں") { Treatment t = new Treatment(); string name = dgv_TreatmentHomoeo.Rows[e.RowIndex].Cells[1].FormattedValue.ToString(); t.Delete(name); t.ShowInGridHomoeo(dgv_TreatmentHomoeo); } }
private void btn_AddTreamentHomoeo_Click(object sender, EventArgs e) { bool errFlag = false; Treatment t = new Treatment(); if (t.invalidMedName(cmb_TreatmentNameHomoeo.Text)) { errFlag = true; lbl_ErrorTreatmentNameHomoeo.Text = t.errorMedName; lbl_ErrorTreatmentNameHomoeo.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_TreatmentNameHomoeo.Text, "ہومیو", cmb_PotencyHomoeo.Text)) { MessageBox.Show("یہ علاج پہلے سے موجود ہے"); return; } if (errFlag == true) { return; } t.MedName = cmb_TreatmentNameHomoeo.Text; t.Potency = cmb_PotencyHomoeo.Text; t.DoctorRecommendations = txt_DoctorsRecommendationHomoeo.Text; t.Type = "ہومیو"; t.addToList(); t.ShowInGridHomoeo(dgv_TreatmentHomoeo); }