Ejemplo n.º 1
0
        protected void showButton_Click(object sender, EventArgs e)
        {
            Patient aPatient = new Patient();

            aPatient.VoterId = nationalIdTextBox.Text;
            GetPatientInformation(aPatient.VoterId);
            aPatient.Id           = patientManager.GetPatientId(aPatient);
            aPatient.ServiceTimes = patientManager.GetServiceTimes(aPatient);
            if (aPatient.ServiceTimes < 1)
            {
                megLabel.Text     = "Didn't take any treatment!";
                pdfButton.Visible = false;
            }
            else
            {
                int count = 0;
                List <Treatment> ObservationList = treatmentManager.GetObservationList(aPatient);
                foreach (var observation in ObservationList)
                {
                    count++;
                    string           centerName     = centerManager.GetCenterName(observation.CenterId);
                    string           Date           = observation.Date;
                    string           DoctorName     = doctorManager.GetDoctorName(observation.DoctorId);
                    string           Observation    = observation.Observation;
                    List <Treatment> treatmentList  = treatmentManager.GetTreatmentList(observation.ObservationId);
                    List <Treatment> aTreatmentList = new List <Treatment>();
                    foreach (var treatment in treatmentList)
                    {
                        string    diseaseName  = diseaseManager.GetDiseaseName(treatment.DiseaseId);
                        string    medicineName = medicineManager.GetMedicineName(treatment.MedicineId);
                        Treatment aTreatment   = new Treatment();
                        aTreatment.NameOfDisease  = diseaseName;
                        aTreatment.NameOfMedicine = medicineName;
                        aTreatment.Dose           = treatment.Dose;
                        aTreatment.TakenTime      = treatment.TakenTime;
                        aTreatment.Quantity       = treatment.Quantity;
                        aTreatment.Note           = treatment.Note;

                        aTreatmentList.Add(aTreatment);
                    }
                    ShowAllTreatment(centerName, Date, DoctorName, Observation, count, aTreatmentList);
                }
                pdfButton.Visible = true;
            }
        }
Ejemplo n.º 2
0
        protected void showReportButton_Click(object sender, EventArgs e)
        {
            string dateFrom = Request.Form["dateFrom"];
            string dateTo   = Request.Form["dateTo"];

            int yearFrom  = int.Parse(dateFrom.Substring(0, 4));
            int monthFrom = int.Parse(dateFrom.Substring(5, 2));
            int dayFrom   = int.Parse(dateFrom.Substring(8, 2));


            int monthTo = int.Parse(dateTo.Substring(5, 2));
            int dayTo   = int.Parse(dateTo.Substring(8, 2));
            int yearTo  = int.Parse(dateTo.Substring(0, 4));

            List <int> patientIdList = new List <int>();

            if (yearTo < yearFrom)
            {
                megLabel.Text = "Incorrect date formet!";
            }
            else if (yearFrom == yearTo && monthTo < monthFrom)
            {
                megLabel.Text = "Incorrect date formet!";
            }
            else if (yearFrom == yearTo && monthTo == monthFrom && dayTo < dayFrom)
            {
                megLabel.Text = "Incorrect date formet!";
            }
            else
            {
                megLabel.Text = "";
                for (int i = dayFrom; ; i++)
                {
                    if (yearTo == yearFrom && monthTo == monthFrom && i == dayTo)
                    {
                        string date2    = yearFrom + "-" + monthFrom + "-" + i;
                        int    patient2 = treatmentManager.GetPatientId(date2);
                        patientIdList.Add(patient2);
                        break;
                    }
                    string date    = yearFrom + "-" + monthFrom + "-" + i;
                    int    patient = treatmentManager.GetPatientId(date);
                    patientIdList.Add(patient);
                    if (i == 31 && monthFrom != 12)
                    {
                        monthFrom++;
                        i = 0;
                    }
                    else if (monthFrom == 12 && dayFrom == 31)
                    {
                        yearFrom++;
                        monthFrom = 1;
                        i         = 0;
                    }
                }
            }
            List <int> districtWasePatientIdList = new List <int>();
            int        districtId = int.Parse(districtDropDownList.SelectedValue);

            foreach (int id in patientIdList)
            {
                int patientIdDistrictWase = patientManager.GetDistictWaisePatientId(id, districtId);
                districtWasePatientIdList.Add(patientIdDistrictWase);
            }
            List <int> observationIdList = new List <int>();

            foreach (int id in districtWasePatientIdList)
            {
                int observationId = treatmentManager.GetObservationId(id);
                observationIdList.Add(observationId);
            }
            List <Disease> diseaseNameList    = new List <Disease>();
            List <Disease> allDiseaseNameList = diseaseManager.GetAllDiseases();

            foreach (int id in observationIdList)
            {
                List <int> diseaseIdList = treatmentManager.GetDiseaseId(id);
                foreach (int disId in diseaseIdList)
                {
                    Disease aDisease = new Disease();
                    aDisease.NameOfDisease = diseaseManager.GetDiseaseName(disId);
                    diseaseNameList.Add(aDisease);
                }
            }
            Series series = Chart1.Series["Series1"];

            foreach (var diseaseName in allDiseaseNameList)
            {
                int count = 0;
                foreach (var nameOfDisease in diseaseNameList)
                {
                    if (diseaseName.NameOfDisease.Equals(nameOfDisease.NameOfDisease))
                    {
                        count++;
                    }
                }
                series.Points.AddXY(diseaseName.NameOfDisease, count);
            }
        }