public object Invoke(object obj, object root) { object result; IDbRecordset reader = obj as IDbRecordset; if (reader == null) { throw new ArgumentException(string.Format("Invalid type of argument: {0}", obj)); } result = ((IDbRecordset)obj).GetValue(_field); /* * int idx = reader.GetOrdinal(_field); * if (idx == -1) * throw new Exception(String.Format("Recordset does not contain field '{0}'", _field)); * result = reader.GetValue(idx); */ if (result is DbEngine.DbRef) { result = ((DbEngine.DbRef)result).GetObject(); } return(result); }
public List<Segment> Build(IDbRecordset recordset) { var points = new List<Point>(); while (recordset.Read()) { var dateTime = (DateTime)recordset["EndTime"]; var latitude = (double)Convert.ChangeType(recordset["Latitude"], typeof(double)); var longitude = (double)Convert.ChangeType(recordset["Longitude"], typeof(double)); var satellitesCount = (int)recordset["SatellitesCount"]; var point = new Point(dateTime, latitude, longitude, satellitesCount); points.Add(point); } var builder = new TrackBuilder(Options); return builder.Build(points); }
public List <Segment> Build(IDbRecordset recordset) { var points = new List <Point>(); while (recordset.Read()) { var dateTime = (DateTime)recordset["EndTime"]; var latitude = (double)Convert.ChangeType(recordset["Latitude"], typeof(double)); var longitude = (double)Convert.ChangeType(recordset["Longitude"], typeof(double)); var satellitesCount = (int)recordset["SatellitesCount"]; var point = new Point(dateTime, latitude, longitude, satellitesCount); points.Add(point); } var builder = new TrackBuilder(Options); return(builder.Build(points)); }
public int ExecuteCount() { try { TimeStamp.Start("ExecuteCount"); int rc = 0; using (IDbRecordset rs = Execute()) while (rs.Next()) { rc++; } return(rc); } finally { TimeStamp.Log("ExecuteCount", _text); } }