static void exe() { string urlAdd = "http://localhost:3301/api/node/add"; for (int i = 0; i < 1800; i++) { GPS gps = new GPS(); gps.GetTime = DateTime.Now; gps.Lat = 12.33342m + i % 100; gps.Lng = 12.33452m; gps.TEID = "a00023" + i % 10; OBD obd = new OBD(); obd.GetTime = DateTime.Now; obd.TEID = gps.TEID; obd.Speed = 20 + i % 30; obd.OilPressure = 30; GpsObdContainer r = new GpsObdContainer(); r.Gps = gps; r.Obd = obd; Console.WriteLine("开始上传"); int nID = AngleX.AppXGlobal.IHttp.PostData <int>(urlAdd, r); Console.WriteLine(nID); System.Threading.Thread.Sleep(100); } }
public int AddR(GPS gps, OBD obd) { int nTable = SqlTemplate.FindTableMod(gps.TEID); Dictionary <string, object> dicPars = new Dictionary <string, object>(); dicPars.Add(SqlTemplate.TEIDKey, gps.TEID); int nCode = gps.GetTime.ToPartCode(); string timeStr = gps.GetTime.ToString("yyyy-MM-dd HH:mm:ss"); string sqlInsert = string.Format(SqlTemplate.InsertGPS, nTable, nCode, timeStr, gps.Lng, gps.Lng); using (var con = SqlHelper.GetConnection(SqlConnectString)) { System.Data.DataTable dtID = SqlHelper.ExecuteDataset(con, sqlInsert, dicPars); int nID = Convert.ToInt32(dtID.Rows[0][0]); string sqlInto2 = string.Format(SqlTemplate.InsertOBD, nTable, nID, nCode, timeStr, obd.Speed, obd.Rotate , obd.Restrictor, obd.WaterT, obd.OilT, obd.OilPressure, obd.OilRemain); SqlHelper.ExecuteNonQuery(con, sqlInto2, dicPars); return(nID); } }
public List <OBD> QueryOBD(string TEID, DateTime StartTime, DateTime EndTime, int Top) { int nStartCode = StartTime.ToPartCode(); int nEndCode = EndTime.ToPartCode(); int nTable = SqlTemplate.FindTableMod(TEID); Dictionary <string, object> dicPars = new Dictionary <string, object>(); dicPars.Add(SqlTemplate.TEIDKey, TEID); string sqlQuery = string.Format(SqlTemplate.QueryOBD, nTable, nStartCode, nEndCode, Top); DataTable dtRows = null; using (var con = SqlHelper.GetConnection(SqlConnectString)) { dtRows = SqlHelper.ExecuteDataset(con, sqlQuery, dicPars); } List <OBD> list = new List <OBD>(); if (dtRows != null) { foreach (DataRow drItem in dtRows.Rows) { OBD obd = new OBD { ID = Convert.ToInt32(drItem[SqlTemplate.RKeyID]), GetTime = Convert.ToDateTime(drItem[SqlTemplate.RKeyGetTime]), InputTime = Convert.ToDateTime(drItem[SqlTemplate.RKeyInputTime]), Speed = Convert.ToInt32(drItem[SqlTemplate.RKeySpeed]), Rotate = Convert.ToInt32(drItem[SqlTemplate.RKeyRotate]), Restrictor = Convert.ToInt32(drItem[SqlTemplate.RkeyRestrictor]), WaterT = Convert.ToInt32(drItem[SqlTemplate.RKeyWaterT]), OilT = Convert.ToInt32(drItem[SqlTemplate.RKeyOilT]), OilPressure = Convert.ToInt32(drItem[SqlTemplate.RKeyOilPressure]), OilRemain = Convert.ToInt32(drItem[SqlTemplate.RKeyOilRemain]), TEID = drItem[SqlTemplate.RKeyTEID].ToString(), PartitionCode = Convert.ToInt32(drItem[SqlTemplate.RKeyPartitionCode]) }; list.Add(obd); } } return(list); }
private void DrawIOCAImage(Container imc, List <ImageInfo> images, float xStartingInch, float yStartingInch, PrintPageEventArgs e) { // Each container may hold one image or several, as tiles. Draw each one with consideration to its offset from the original draw point foreach (ImageInfo image in images) { // Get the positioning and scaling info based on the current object environment container OBD oaDescriptor = imc.GetStructure <OBD>(); OBP oaPosition = imc.GetStructure <OBP>(); if (oaDescriptor != null && oaPosition != null) { // Get sizing info triplets ObjectAreaSize oaSize = oaDescriptor.GetTriplet <ObjectAreaSize>(); MeasurementUnits mu = oaDescriptor.GetTriplet <MeasurementUnits>(); // Get inch origins based on unit scaling int xUnitOrigin = oaPosition.XOrigin + oaPosition.XContentOrigin; int yUnitOrigin = oaPosition.YOrigin + oaPosition.YContentOrigin; float xInchOrigin = xStartingInch + (float)(Converters.GetInches(xUnitOrigin, mu.XUnitsPerBase, mu.BaseUnit) * 100); float yInchOrigin = yStartingInch + (float)(Converters.GetInches(yUnitOrigin, mu.YUnitsPerBase, mu.BaseUnit) * 100); // Get inch scaling values double heightInches = Converters.GetInches((int)oaSize.YExtent, mu.YUnitsPerBase, mu.BaseUnit); // We have the inch value and number of pixels, so set DPI based on those values Bitmap bmp = new Bitmap(new MemoryStream(image.Data)); float dpi = (float)Math.Round(bmp.Height / heightInches); bmp.SetResolution(dpi, dpi); e.Graphics.DrawImage(bmp, xInchOrigin, yInchOrigin); } else { throw new NotImplementedException("Image could not be displayed - no OBD/OBP fields found."); } } }