private static void SaveModeSRec(adsbEntities modeSctx, string line) { modeSRec msr = Utils.createModeSRec(line); ModeS ms = new ModeS(); ms.icao_id = msr.icao_id; ms.callsign = msr.callsign; ms.altitude = msr.altitude; ms.gndspeed = msr.gndspeed; ms.gndtrack = msr.gndtrack; ms.lat = msr.lat; ms.lon = msr.lon; ms.squawk = msr.squawk; ms.timestamp = msr.timestamp; ms.timestampDate = msr.timestampDate; ms.timestampTime = msr.timestampTime; modeSctx.ModeS.Add(ms); }
public static modeSRec createModeSRec(string dataRow) { string[] dataVals = dataRow.Split(','); modeSRec sRec = new modeSRec(); sRec.icao_id = dataVals[0]; sRec.callsign = dataVals[3]; sRec.altitude = parseInt(dataVals[4]); sRec.gndspeed = parseInt(dataVals[5]); sRec.gndtrack = parseInt(dataVals[6]); sRec.lat = parseDecimal(dataVals[7]); sRec.lon = parseDecimal(dataVals[8]); sRec.vrate = parseInt(dataVals[9]); sRec.squawk = parseInt(dataVals[10]); DateTime dt = DateTime.Parse(dataVals[1] + " " + dataVals[2]); sRec.timestamp = dt; sRec.timestampDate = dt.Date; DateTime theTime = DateTime.Parse(dataVals[2]); sRec.timestampTime = theTime; return(sRec); }