예제 #1
0
        private void dgv_TreatmentAloe_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string val = dgv_TreatmentAloe.Rows[e.RowIndex].Cells[e.ColumnIndex].FormattedValue.ToString();

            if (val == "حزف کریں")
            {
                Treatment t    = new Treatment();
                string    name = dgv_TreatmentAloe.Rows[e.RowIndex].Cells[1].FormattedValue.ToString();
                t.Delete(name);
                t.ShowInGridAloe(dgv_TreatmentAloe);
            }
        }
예제 #2
0
        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);
        }