protected void showButton_Click(object sender, EventArgs e) { string startDate = FromCalendar.SelectedDate.ToString("d"); string endDate = ToCalendar.SelectedDate.ToString("d"); District newDistrict= new District(); newDistrict.ID = int.Parse(districtDropDownList.SelectedItem.Value); List<Patient> newPatient = aCenterManager.GetPatientList(startDate, endDate, newDistrict); diseaseReportChart.DataSource = newPatient; diseaseReportChart.DataBind(); }
public List<Patient> GetPatientList(string startDate,string endDate,District newDistrict) { newPatient = new List<Patient>(); List<Thana> thanaList = aCenterGateway.GetAllThanasByDistrict(newDistrict.ID); foreach (Thana aThana in thanaList) { List<DAL.DAO.Center> aCenter=aCenterGateway.GetAllCenterByThana(aThana.ID); foreach (DAL.DAO.Center newCenter in aCenter) { List<Treatment> treatmentList = aCenterGateway.GetTreatmentListByCenterID(newCenter.ID,startDate,endDate); foreach (Treatment treatment in treatmentList) { List<int> getDiseases = aCenterGateway.GetAllDiseasesbyTreatment(treatment.ID); foreach (int newDisease in getDiseases) { if (IsDiseaseExist(newDisease)) { continue; } else { Patient aPatient=new Patient(); aPatient.ID = newDisease; aPatient.number = 1; newPatient.Add(aPatient); } } } } } foreach (Patient aPatient in newPatient) { aPatient.DiseaseName = aCenterGateway.DiseaseName(aPatient.ID); } return newPatient; }
public List<District> GetAllDistricts() { aGateway.command.CommandText = "SELECT * FROM District_tbl"; aGateway.sqlConnection.Open(); SqlDataReader reader = aGateway.command.ExecuteReader(); List<District> districtslList = new List<District>(); if (reader != null) while (reader.Read()) { District aDistrict = new District(); aDistrict.ID = Convert.ToInt16(reader["ID"].ToString()); aDistrict.Name = reader["Name"].ToString(); districtslList.Add(aDistrict); } reader.Close(); aGateway.sqlConnection.Close(); return districtslList; }