public ActionResult Flights(FlightReportFilter ReportFilter) { if (!exLogic.User.hasAccess("REPORT.FLIGHTS")) return RedirectToAction("NoAccess", "Home"); var theReport = new exLogic.Report(); qView nView = new qView(theReport.getFlightReportSQL(ReportFilter)); if (Request.IsAjaxRequest()) { Response.ContentType = "text/javascript"; return PartialView("qViewData", nView); } else { ViewBag.ReportFilter = ReportFilter; return View(nView); }//if(IsAjaxRequest) }
public List<FlightReportData>getFlightReportData(FlightReportFilter Filter = null) { var Request = HttpContext.Current.Request; var thisReport = new exLogic.Report(); var Records = new List<FlightReportData>(); if (Filter == null) Filter = new FlightReportFilter(); var SQL = thisReport.getFlightReportSQL(Filter, true) ; SQL = SQL + "\nORDER BY DroneFlight.ID DESC"; using (var db = new ExponentPortalEntities()) { using (var cmd = db.Database.Connection.CreateCommand()) { db.Database.Connection.Open(); cmd.CommandText = SQL; using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { var TheRow = new FlightReportData { ID = Util.toInt(reader["Ref"]), FlightDate = reader.GetDateTime(reader.GetOrdinal("FlightDate")), FlightTime = reader["FlightTime"].ToString(), Pilot = reader["Pilot"].ToString(), UAS = reader["UAS"].ToString(), BoundaryAlerts = reader["BoundaryAlerts"].ToString(), HeightAlerts = reader["AltitudeAlerts"].ToString(), ProximityAlerts = reader["ProximityAlerts"].ToString(), MaxAltitude = reader["MaxAltitude"].ToString(), Height = Util.toInt(reader["Height"]), HeightCritical = Util.toInt(reader["HeightCritical"]), Boundary = Util.toInt(reader["Boundary"]), BoundaryCritical = Util.toInt(reader["BoundaryCritical"]), Proximity = Util.toInt(reader["Proximity"]), ProximityCritical = Util.toInt(reader["ProximityCritical"]) }; Records.Add(TheRow); }//while }//using reader } }//using (var db = new ExponentPortalEntities()) return Records; }//getFlightReportData