Пример #1
0
        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;
        }
Пример #2
0
        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);
            }
        }
Пример #3
0
        protected void saveButton_Click(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            dt.Clear();
            dt.Columns.Add(centerLabel.Text);
            dt.Columns.Add("Disease");
            dt.Columns.Add("Medicine");
            dt.Columns.Add("Dose");
            dt.Columns.Add("Before/After Meal");
            dt.Columns.Add("Quantity Given");
            dt.Columns.Add("Note");


            Patient aPatient = new Patient();

            var diseaseList = diseaseName.Value;

            diseaseName.Value = "";
            string[] disease = diseaseList.Split(',');

            var medicineList = medicineName.Value;

            medicineName.Value = "";
            string[] medicine = medicineList.Split(',');

            var doseList = medicineDose.Value;

            medicineDose.Value = "";
            string[] dose = doseList.Split(',');

            var doseRuleList = medicineDoseType.Value;

            medicineDoseType.Value = "";
            string[] doseRule = doseRuleList.Split(',');

            var quantityList = medicineQuantityGiven.Value;

            medicineQuantityGiven.Value = "";
            string[] quantity = quantityList.Split(',');

            var noteList = notes.Value;

            notes.Value = "";
            string[] note = noteList.Split(',');

            string[] address      = addressTextBox.Text.Split(' ');
            string   districtName = address[address.Length - 1];

            aPatient.VoterId    = Convert.ToInt64(voterIdTextBox.Text);
            aPatient.DistrictId = aDistrictAndThanaManager.FindDistrict(districtName).Id;

            aPatientManager.SaveService(aPatient);

            Treatment aTreatment = new Treatment();

            aTreatment.ServiceTakenId = aPatientManager.GetServiceTakenId();
            aTreatment.Observation    = observationTextBox.Text;
            aTreatment.ServiceDate    = DateTime.Parse(dateTextBox.Value);
            aTreatment.DoctorId       = Convert.ToInt32(doctorDropDownList.SelectedValue);
            aTreatment.CenterId       = Convert.ToInt32(Session["CenterId"]);

            for (int i = 0; i < disease.Length - 1; i++)
            {
                Disease aDisease = aDiseaseManager.Find(disease[i]);
                aTreatment.DiseaseId = aDisease.Id;
                Medicine aMedicine = aMedicineManager.Find(medicine[i]);
                aTreatment.MedicineId = aMedicine.Id;
                aTreatment.Dose       = dose[i];
                aTreatment.DoseType   = doseRule[i];
                aTreatment.Quantity   = Convert.ToInt32(quantity[i]);
                aTreatment.Note       = note[i];
                aTreatmentManager.SaveTreatment(aTreatment);

                MedicineStockInCenter aMedicineStockInCenter = new MedicineStockInCenter();
                aMedicineStockInCenter.MedicineId = aTreatment.MedicineId;
                aMedicineStockInCenter.Quantity   = aTreatment.Quantity;
                aMedicineStockInCenter.CenterId   = aTreatment.CenterId;

                aMedicineManager.DeductMedicineFromCenter(aMedicineStockInCenter);

                DataRow dr = dt.NewRow();
                dr["Disease"]           = medicine[i];
                dr["Medicine"]          = disease[i];
                dr["Dose"]              = dose[i];
                dr["Before/After Meal"] = doseRule[i];
                dr["Quantity Given"]    = quantity[i];
                dr["Note"]              = note[i];
                dt.Rows.Add(dr);
            }

            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "attachment;filename=Treatment_" + voterIdTextBox.Text + ".pdf");
            Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
            StringWriter   sw  = new StringWriter();
            HtmlTextWriter hw  = new HtmlTextWriter(sw);
            GridView       grd = new GridView();

            grd.DataSource = dt.DefaultView;
            grd.DataBind();
            grd.RenderControl(hw);
            StringReader sr         = new StringReader(sw.ToString());
            Document     pdfDoc     = new Document(PageSize.A4, 50f, 50f, 50f, 50f);
            HTMLWorker   htmlparser = new HTMLWorker(pdfDoc);

            PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
            pdfDoc.Open();
            htmlparser.Parse(sr);
            pdfDoc.Close();
            Response.Write(pdfDoc);
            Response.End();
        }
Пример #4
0
        protected void saveButton_Click(object sender, EventArgs e)
        {
            Patient aPatient = new Patient();

            var diseaseList = diseaseName.Value;

            diseaseName.Value = "";
            string[] disease = diseaseList.Split(',');

            var medicineList = medicineName.Value;

            medicineName.Value = "";
            string[] medicine = medicineList.Split(',');

            var doseList = medicineDose.Value;

            medicineDose.Value = "";
            string[] dose = doseList.Split(',');

            var doseRuleList = medicineDoseType.Value;

            medicineDoseType.Value = "";
            string[] doseRule = doseRuleList.Split(',');

            var quantityList = medicineQuantityGiven.Value;

            medicineQuantityGiven.Value = "";
            string[] quantity = quantityList.Split(',');

            var noteList = notes.Value;

            notes.Value = "";
            string[] note = noteList.Split(',');

            string[] address      = addressTextBox.Text.Split(' ');
            string   districtName = address[address.Length - 1];

            aPatient.VoterId    = Convert.ToInt64(voterIdTextBox.Text);
            aPatient.DistrictId = aDistrictAndThanaManager.FindDistrict(districtName).Id;

            aPatientManager.SaveService(aPatient);

            Treatment aTreatment = new Treatment();

            aTreatment.ServiceTakenId = aPatientManager.GetServiceTakenId();
            aTreatment.Observation    = observationTextBox.Text;
            aTreatment.ServiceDate    = DateTime.Parse(dateTextBox.Value);
            aTreatment.DoctorId       = Convert.ToInt32(doctorDropDownList.SelectedValue);
            aTreatment.CenterId       = Convert.ToInt32(Session["CenterId"]);

            for (int i = 0; i < disease.Length - 1; i++)
            {
                Disease aDisease = aDiseaseManager.Find(disease[i]);
                aTreatment.DiseaseId = aDisease.Id;
                Medicine aMedicine = aMedicineManager.Find(medicine[i]);
                aTreatment.MedicineId = aMedicine.Id;
                aTreatment.Dose       = dose[i];
                aTreatment.DoseType   = doseRule[i];
                aTreatment.Quantity   = Convert.ToInt32(quantity[i]);
                aTreatment.Note       = note[i];
                aTreatmentManager.SaveTreatment(aTreatment);

                MedicineStockInCenter aMedicineStockInCenter = new MedicineStockInCenter();
                aMedicineStockInCenter.MedicineId = aTreatment.MedicineId;
                aMedicineStockInCenter.Quantity   = aTreatment.Quantity;
                aMedicineStockInCenter.CenterId   = aTreatment.CenterId;

                aMedicineManager.DeductMedicineFromCenter(aMedicineStockInCenter);
            }
        }
        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();
        }