public void Update(EBreakOilHistoryRecord entity) { using (IRepository repository = SessionManager.CreateRepository(typeof(EBreakOilHistoryRecord))) { repository.Update(entity); } }
//插入命令历史记录 private void InsertBreakOilHistoryRecord(EGPSCurrentInfo info, string tenantCode, string userCode, EnumOilCommandType commandType) { EBreakOilHistoryRecord history = new EBreakOilHistoryRecord(); history.RecordID = Guid.NewGuid(); history.ACC = info.ACCState; history.AntennaState = info.AntennaState; history.CommandType = (int)commandType; history.GPSCode = info.GPSCode; history.IsBreakOil = commandType == EnumOilCommandType.BreakOil ? true : false; history.Latitude = info.Latitude; history.Longitude = info.Longitude; history.OilState = info.OilState; history.SerialNumber = Guid.NewGuid(); history.SetTime = DateTime.Now; history.Speed = info.Speed; history.TenantCode = tenantCode; history.UserCode = userCode; history.VehicleCode = info.VehicleCode; DACFacade.Gps.BreakOilHistoryRecordDAC.InsertSQL(history); EBreakOilLastRecord lastRecord = DACFacade.Gps.BreakOilHistoryRecordDAC.ExistsLast(history.VehicleCode); if (lastRecord == null) { lastRecord = new EBreakOilLastRecord(); lastRecord.VehicleCode = history.VehicleCode; lastRecord.BreakOilHistoryRecord = history; DACFacade.Gps.BreakOilHistoryRecordDAC.InsertLast(lastRecord); } else { lastRecord.BreakOilHistoryRecord = history; DACFacade.Gps.BreakOilHistoryRecordDAC.UpdateLast(lastRecord); } this.VehicleControl(info.GPSCode, commandType, history.SerialNumber); }