protected void saveButton_Click(object sender, EventArgs e) { string msg = ""; var diseaseList = diseaseName.Value; diseaseName.Value = ""; string[] disease = diseaseList.Split(','); var mediceneList = medicineName.Value; medicineName.Value = ""; string[] medicine = mediceneList.Split(','); var doseList = doseName.Value; doseName.Value = ""; string[] dose = doseList.Split(','); var timeOfMealList = timeOfMealName.Value; timeOfMealName.Value = ""; string[] timeOfMeal = timeOfMealList.Split(','); var quantityList = quantityName.Value; quantityName.Value = ""; string[] quantityValue = quantityList.Split(','); var noteList = noteName.Value; noteName.Value = ""; string[] note = noteList.Split(','); for (int i = 0; i < disease.Length - 1; i++) { Treatment aTreatment = new Treatment(); string name = nameTextBox.Text; aTreatment.PatientId = aPatientManager.Search(name).Id; aTreatment.DiseaseId = aDiseaseManager.Find(disease[i]).Id; aTreatment.DoseId = aDoseManager.Find(dose[i]).Id; aTreatment.MedicineId = aMedicineManager.Find(medicine[i]).Id; aTreatment.Note = note[i]; aTreatment.Date = dateCalendar.SelectedDate; aTreatment.Quantity = Convert.ToInt32(quantityValue[i]); aTreatment.CenterId = Convert.ToInt32(Session["id"]); if (timeOfMealRadioButtonList.Text == "Before Meal") { aTreatment.TimeOfMeal = true; } else { aTreatment.TimeOfMeal = false; } msg = aTreatmentManager.Save(aTreatment); } msgLabel.Text = msg; }
protected void saveButton_Click(object sender, EventArgs e) { var disease = diseases.Value.Split(','); var medicine = medicines.Value.Split(','); var dose = doses.Value.Split(','); var doseRule = meals.Value.Split(','); var quantity = quantities.Value.Split(','); var note = notes.Value.Split(','); var date = dateTextBox.Value; var doctorId = Convert.ToInt32(doctorDropDownList.SelectedValue); var observation = observationTextBox.Text; string[] districtName = addressTextBox.Text.Split(' '); diseases.Value = medicines.Value = doses.Value = meals.Value = quantities.Value = notes.Value = ""; Patient aPatient = new Patient() { VoterId = voterIdTextBox.Text, DistrictId = aDistrictManager.Find(districtName[districtName.Length - 1]).Id }; aPatientManager.Save(aPatient); int serviceId = aPatientManager.GetLastServiceTakenId(); for (int i = 0; i < medicine.Length - 1; i++) { Treatment aTreatment = new Treatment() { Observation = observation, Date = Convert.ToDateTime(date), DoctorId = doctorId, DiseaseId = aDiseaseManager.Find(disease[i]).Id, MedicineId = aMedicineManager.Find(medicine[i]).Id, Dose = dose[i], Quantity = Convert.ToInt32(quantity[i]), Note = note[i], DoseRules = doseRule[i], CenterId = Convert.ToInt32(Session["centerId"]), ServiceTakenId = serviceId }; aTreatmentManager.Save(aTreatment); } }
protected void saveButton_Click1(object sender, EventArgs e) { string msg = ""; var diseaseList = diseaseName.Value; diseaseName.Value = ""; string[] disease = diseaseList.Split(','); var mediceneList = medicineName.Value; medicineName.Value = ""; string[] medicine = mediceneList.Split(','); var doseList = doseName.Value; doseName.Value = ""; string[] dose = doseList.Split(','); var timeOfMealList = timeOfMealName.Value; timeOfMealName.Value = ""; string[] timeOfMeal = timeOfMealList.Split(); var quantityList = quantityName.Value; quantityName.Value = ""; string[] quantityValue = quantityList.Split(','); var noteList = noteName.Value; noteName.Value = ""; string[] note = noteList.Split(','); for (int i = 0; i < disease.Length - 1; i++) { Treatment aTreatment = new Treatment(); string name = nameTextBox.Text; aTreatment.PatientId = aPatientManager.Search(name).Id; aTreatment.DiseaseId = aDiseaseManager.Find(disease[i]).Id; aTreatment.DoseId = aDoseManager.Find(dose[i]).Id; aTreatment.MedicineId = aMedicineManager.Find(medicine[i]).Id; aTreatment.Note = note[i]; aTreatment.Date = dateCalendar.SelectedDate; aTreatment.Quantity = Convert.ToInt32(quantityValue[i]); aTreatment.CenterId = Convert.ToInt16(Session["centerId"]); aTreatment.DistrictId = aTreatmentManager.GetDistrictIdByCenterId(aTreatment.DistrictId); aTreatment.DistrictId = 1; if (timeOfMeal.Equals("Before Meal")) { aTreatment.TimeOfMeal = true; } else { aTreatment.TimeOfMeal = false; } msg = aTreatmentManager.Save(aTreatment); } msgLabel.Text = msg; DataTable table = new DataTable(); table.Clear(); table.Columns.Add("Name", typeof(string)); table.Columns.Add("Disease", typeof(string)); table.Columns.Add("Medicine", typeof(string)); table.Columns.Add("Dose", typeof(string)); table.Columns.Add("Before/After Meal", typeof(string)); table.Columns.Add("Quantity", typeof(int)); table.Columns.Add("Note", typeof(string)); for (int i = 0; i < disease.Length - 1; i++) { table.Rows.Add(nameTextBox.Text, disease[i], medicine[i], dose[i], timeOfMeal[i], quantityValue[i], note[i]); } GridView showHistoryGridView = new GridView(); showHistoryGridView.DataSource = table.DefaultView; showHistoryGridView.DataBind(); Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=AllHistoryOfAPatient.pdf"); Response.Cache.SetCacheability(HttpCacheability.NoCache); StringWriter aStringWriter = new StringWriter(); HtmlTextWriter aHtmlTextWriter = new HtmlTextWriter(aStringWriter); showHistoryGridView.RenderControl(aHtmlTextWriter); StringReader aStringReader = new StringReader(aStringWriter.ToString()); Document pdfDocument = new Document(PageSize.A4, 10f, 10f, 10f, 0f); HTMLWorker aHtmlWorker = new HTMLWorker(pdfDocument); PdfWriter.GetInstance(pdfDocument, Response.OutputStream); pdfDocument.Open(); aHtmlWorker.Parse(aStringReader); pdfDocument.Close(); Response.Write(pdfDocument); Response.End(); }