public DataTable GetMaintenancePrioritiesForRegionsReport(string unitNo, bool udiDesc, bool udiAsc, bool priority, RegionReportLevel level, DateTime?from, DateTime?to) { string wherePart = ""; switch (level) { case RegionReportLevel.Region: wherePart = (int.Parse(unitNo) == 0) ? "" : string.Format(" where REGION_ID={0} ", unitNo); break; case RegionReportLevel.Subdistrict: wherePart = (string.IsNullOrEmpty(unitNo) || unitNo == "0") ? "" : string.Format(" where SUBDISTRICT='{0}' ", unitNo); break; case RegionReportLevel.District: wherePart = (string.IsNullOrEmpty(unitNo) || unitNo == "0") ? "" : string.Format(" where DIST_NAME='{0}' ", unitNo); break; case RegionReportLevel.Municipality: wherePart = (string.IsNullOrEmpty(unitNo) || unitNo == "0") ? "" : string.Format(" where MUNIC_NAME='{0}' ", unitNo); break; case RegionReportLevel.None: default: return(new DataTable()); } if (from == null || to == null) //|| survey == 0) { return(new DataTable()); } string orderByPart = GetOrderByPriorityPart(udiDesc, udiAsc, priority); string sql = string.Format("select * from VW_LATEST_PRIO_REGIONS {0} and SURVEY_DATE BETWEEN TO_DATE('{1}','DD/MM/YYYY') AND TO_DATE('{2}','DD/MM/YYYY') {3} ", wherePart, from.Value.ToString("dd/MM/yyyy"), to.Value.ToString("dd/MM/yyyy"), orderByPart); return(db.ExecuteQuery(sql)); }
public DataTable GetMaintenancePrioritiesForRegionsReport(string unitNo, bool udiDesc, bool udiAsc, bool priority, RegionReportLevel level) { string wherePart = ""; switch (level) { case RegionReportLevel.Region: wherePart = (int.Parse(unitNo) == 0) ? "" : string.Format(" where REGION_ID={0} ", unitNo); break; case RegionReportLevel.Subdistrict: wherePart = (string.IsNullOrEmpty(unitNo) || unitNo == "0") ? "" : string.Format(" where SUBDISTRICT='{0}' ", unitNo); break; case RegionReportLevel.District: wherePart = (string.IsNullOrEmpty(unitNo) || unitNo == "0") ? "" : string.Format(" where DIST_NAME='{0}' ", unitNo); break; case RegionReportLevel.Municipality: wherePart = (string.IsNullOrEmpty(unitNo) || unitNo == "0") ? "" : string.Format(" where MUNIC_NAME='{0}' ", unitNo); break; case RegionReportLevel.None: default: return(new DataTable()); } string orderByPart = GetOrderByPriorityPart(udiDesc, udiAsc, priority); string sql = string.Format("select * from VW_LATEST_PRIO_REGIONS {0} {1} ", wherePart, orderByPart); return(db.ExecuteQuery(sql)); }