public void SavePrescription(Prescription aTreatment,int treatmentID)
 {
     string query = "INSERT INTO Prescription_tbl(MedicineID,DiseaseID,Dose,Quantity,MealTime,Note,TreatmentID)VALUES('" + aTreatment.MedicineID + "','" + aTreatment.DiseaseID + "','" + aTreatment.Dose+ "','" + aTreatment.Quantity + "','"+aTreatment.mealTime+"','"+aTreatment.Note+"','"+treatmentID+"')";
     aGateway.command.CommandText = query;
     aGateway.sqlConnection.Open();
     aGateway.command.ExecuteNonQuery();
     aGateway.sqlConnection.Close();
 }
        public void TreatmentSave()
        {
            List<Prescription> treatmentList = (List<Prescription>)ViewState["TreatmentGiven"];
            Prescription newTreatment = new Prescription();

            newTreatment.DiseaseID = int.Parse(diseaseDropDownList.SelectedItem.Value);

            newTreatment.MedicineID = int.Parse(medicineDropDownList.SelectedItem.Value);
            newTreatment.Quantity = int.Parse(qtyGivenTextBox.Text);
            newTreatment.Note = noteTextBox.Text;
            newTreatment.Dose = doseTextBox.Text;
            if (afterMealRadioButton.Checked)
            {
                newTreatment.mealTime = "After Meal";
            }
            else
            {
                newTreatment.mealTime = "Before Meal";
            }

            treatmentList.Add(newTreatment);
            ViewState["TreatmentGiven"] = treatmentList;
        }
        public List<Prescription> GetPrescription(Treatment treatment)
        {
            aGateway.command.CommandText = "SELECT * FROM Prescription_tbl WHERE TreatmentID='" + treatment.ID + "'";
            aGateway.sqlConnection.Open();
            SqlDataReader reader = aGateway.command.ExecuteReader();
            List<Prescription> newPrescriptions=new List<Prescription>();

            while (reader.Read())
            {
                Prescription aPrescription=new Prescription();

                aPrescription.MedicineID= int.Parse(reader["MedicineID"].ToString());
                aPrescription.DiseaseID = int.Parse(reader["DiseaseID"].ToString());
                aPrescription.Dose = reader["Dose"].ToString();
                aPrescription.Quantity = int.Parse(reader["Quantity"].ToString());
                aPrescription.mealTime = reader["MealTime"].ToString();
                aPrescription.Note = reader["Note"].ToString();
                newPrescriptions.Add(aPrescription);

            }
            reader.Close();
            aGateway.sqlConnection.Close();
            return newPrescriptions;
        }