public bool isLive(int FlightID) { if (_DroneID == 0) _DroneID = getDroneIDForFlight(FlightID); String SQL = "SELECT IsLiveVideo FROM MSTR_Drone WHERE DroneID=" + _DroneID; int IsLiveVideo = Util.getDBInt(SQL); if (IsLiveVideo == 1) { int LastFlightID = getLastFlightID(_DroneID); if (LastFlightID == FlightID) return true; } return false; }
public static bool hasDrone(int DroneID) { if (exLogic.User.hasAccess("DRONE.MANAGE")) return true; String SQL = "SELECT Count(*) FROM\n" + "MSTR_Drone\n" + "WHERE\n" + " DroneID=" + DroneID + " AND\n" + " AccountID=" + Util.getAccountID(); int Count = Util.getDBInt(SQL); if (Count > 0) return true; return false; }
public bool isLiveFlight(int FlightID) { //return true; if (_DroneID == 0) _DroneID = getDroneIDForFlight(FlightID); String SQL = @"select Count(*) FROM [MSTR_Drone] WHERE DroneID = " + _DroneID + @" and LastFlightID=" + FlightID + @" AND FlightTime > DATEADD(MINUTE, -1, GETDATE())"; int LiveCount = Util.getDBInt(SQL); return (LiveCount > 0); }
public static bool hasAccessUser(String PermissionID,int UserID) { HttpSessionState Session = HttpContext.Current.Session; String SQL = "select\n" + " Count(MSTR_Menu.MenuID) as PermissionCount\n" + "FROM\n" + " MSTR_User,\n" + " MSTR_Profile,\n" + " M2M_ProfileMenu,\n" + " MSTR_Menu\n" + "WHERE\n" + " MSTR_User.UserID = " + UserID + " AND\n" + " MSTR_User.UserProfileId = MSTR_Profile.ProfileId AND\n" + " M2M_ProfileMenu.ProfileID = MSTR_Profile.ProfileId AND\n" + " MSTR_Menu.MenuId = M2M_ProfileMenu.MenuID AND\n" + " MSTR_Menu.PermissionId = '" + PermissionID + "'"; int PermissionCount = Util.getDBInt(SQL); return (PermissionCount > 0); }
}//getBulkInsertRow() private int getDroneID(ExponentPortalEntities ctx, String Line) { String SQL; int DroneSerial = 0; // Parse the line to get ID String[] Data = Line.Split(','); Int32.TryParse(Data[1], out DroneSerial); //Step 1: Find the drone serial from Blackbox data /* SQL = "SELECT TOP 1 Drone_Serial FROM #BlackBoxData"; int DroneSerial = Util.getDBInt(SQL, ctx); if(DroneSerial == 0) throw new Exception("Can not find the Drone ID to parse data"); */ //Step 2: get the drone ID using the serial number SQL = "SELECT TOP 1 DroneID From MSTR_Drone WHERE DroneSerialNo=" + DroneSerial; int DroneID = Util.getDBInt(SQL, ctx); if (DroneID == 0) throw new Exception("Can not find drone id for the serial number " + DroneSerial); return DroneID; } //getDroneID(()
public int getDroneIDForFlight(int FlightID) { String SQL = "Select DroneID From DroneFlight WHERE ID=" + FlightID; return Util.getDBInt(SQL); }
public int getPayloadCount(int FlightID = 0) { FlightID = 310; String SQL = "SELECT Count(*) FROM PayLoadFlight where flightid=" + FlightID; return Util.getDBInt(SQL); }
public int getGeoTagCount(int FlightID) { String SQL = "select Count(*) from DroneDocuments where flightid=" + FlightID + " and DocumentType = 'Geo Tag'"; return Util.getDBInt(SQL); }
public int getPlayListCount(int FlightID) { String SQL = "select Count(*) from DroneFlightVideo WHERE FlightID=" + FlightID; return Util.getDBInt(SQL); }
public int getLastFlightID(int DroneID) { String SQL = "SELECT Max(ID) FROM DroneFlight WHERE DroneID=" + DroneID; return Util.getDBInt(SQL); }
} //getDroneID(() private int getFlightID(ExponentPortalEntities ctx, int DroneID, int BBFlightID) { String SQL = "SELECT ID FROM DroneFlight WHERE DroneID=" + DroneID + " AND BBFlightID=" + BBFlightID; return Util.getDBInt(SQL, ctx); }
private int getYardID(String FlightUniqueID) { String SQL = @"SELECT YardID From PayLoadFlight WHERE FlightUniqueID='" + FlightUniqueID + "'"; return Util.getDBInt(SQL); }