private void btn_AddTreatmentAloe_Click(object sender, EventArgs e) { bool errFlag = false; Treatment t = new Treatment(); if (t.invalidMedName(cmb_TreatmentNameAloe.Text)) { errFlag = true; lbl_ErrorTreatmentNameAloe.Text = t.errorMedName; lbl_ErrorTreatmentNameAloe.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_TreatmentNameAloe.Text, "ایلو", cmb_PotencyAloe.Text)) { MessageBox.Show("یہ علاج پہلے سے موجود ہے"); return; } if (errFlag == true) { return; } t.MedName = cmb_TreatmentNameAloe.Text; t.Potency = cmb_PotencyAloe.Text; t.DoctorRecommendations = txt_DoctorsRecommendationAloe.Text; t.Type = "ایلو"; t.addToList(); t.ShowInGridAloe(dgv_TreatmentAloe); }
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); }