public FilterResponse GetFilteredGraphData(FilterCriteriaRequest filterCriteria) { var vaccinationToQuery = string.Empty; var districtToQuery = string.Empty; if (filterCriteria.VaccineIdList.Count > 0) { vaccinationToQuery = "SchId in (" + string.Join(",", filterCriteria.VaccineIdList) + ")"; } if (filterCriteria.DistrictIdList.Count > 0) { districtToQuery = "DistrictId in (" + string.Join(",", filterCriteria.DistrictIdList) + ")"; } FilterResponse filterres = new FilterResponse(); if (filterCriteria.StatusList.Count > 0) { foreach (int status in filterCriteria.StatusList) { if (status == 0)//Done { var query = string.Format(@"SELECT Count(*) FROM ListOfSuccessfullVacc WHERE VaccinatedDate>='{0}' AND VaccinatedDate<='{1}' AND {2} AND {3}", filterCriteria.FromYear, filterCriteria.ToYear, districtToQuery, vaccinationToQuery); filterres.DoneCount = Convert.ToInt32(dbService.ExecuteScalar(query)); } else if (status == 1)//Due { var query = string.Format(@"SELECT Count(*) FROM ListOfVaccinationDue WHERE VAccStartOn>='{0}' AND VAccStartOn<='{1}'AND {2} AND {3} ", filterCriteria.FromYear, filterCriteria.ToYear, districtToQuery, vaccinationToQuery); filterres.DueCount = Convert.ToInt32(dbService.ExecuteScalar(query)); } else if (status == 2)//OverDue/Missed { var query = string.Format(@"SELECT Count(*) FROM ListOfVaccinationOverDue WHERE VAccStartOn>='{0}' AND VAccStartOn<='{1}' AND {2} AND {3}", filterCriteria.FromYear, filterCriteria.ToYear, districtToQuery, vaccinationToQuery); filterres.MissedCount = Convert.ToInt32(dbService.ExecuteScalar(query)); } } } //int Totalstatuscount = filterres.DueCount + filterres.DoneCount + filterres.MissedCount; //filterres.DoneCount = (filterres.DoneCount / Totalstatuscount) * 100; //filterres.DueCount = (filterres.DueCount / Totalstatuscount) * 100; //filterres.MissedCount = (filterres.MissedCount / Totalstatuscount) * 100; return(filterres); }
public FilterResponse GetFilteredGraphData(FilterCriteriaRequest filterCriteria) { return(adminService.GetFilteredGraphData(filterCriteria)); }