コード例 #1
0
        protected void saveButton_Click(object sender, EventArgs e)
        {
            int     districtId = int.Parse(Session["DistrictId"].ToString());
            Patient aPatient   = new Patient();

            aPatient.VoterId = voterIdTextBox.Text;
            int count = int.Parse(serviceGivenTextBox.Text);

            aPatient.ServiceTimes = count + 1;
            if (patientManager.IfPatientExists(aPatient))
            {
                megLabel.Text = patientManager.UpdateServiceTimes(aPatient);
                AllClear();
            }
            else
            {
                megLabel.Text = patientManager.SavePatient(aPatient);
                AllClear();
            }

            aPatient.Id = patientManager.GetPatientId(aPatient);
            int centerId = int.Parse(Session["CenterId"].ToString());

            patientManager.PatientCenterTblValue(aPatient.Id, centerId, districtId);

            Treatment aTreatment = new Treatment();

            aTreatment.Observation = observationTextBox.Text;
            aTreatment.DoctorId    = int.Parse(doctorDropDownList.SelectedValue);
            string date  = Request.Form["bday"];
            int    year  = int.Parse(date.Substring(0, 4));
            int    month = int.Parse(date.Substring(5, 2));
            int    day   = int.Parse(date.Substring(8, 2));

            aTreatment.Date = year + "-" + month + "-" + day;

            int observationId = treatmentManager.SaveObservation(aTreatment, aPatient, centerId);

            foreach (var treatment in TreatmentList)
            {
                Treatment newTreatment = new Treatment();
                newTreatment.DiseaseId  = treatment.DiseaseId;
                newTreatment.MedicineId = treatment.MedicineId;
                newTreatment.Dose       = treatment.Dose;
                newTreatment.Quantity   = treatment.Quantity;
                newTreatment.Note       = treatment.Note;
                newTreatment.TakenTime  = treatment.TakenTime;
                treatmentManager.SaveTreatment(newTreatment, observationId);
            }
        }
コード例 #2
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();
        }
コード例 #3
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);
            }
        }