private void InsertMeasureRaw(DataSample data, clsDBUltity db, DeviceInfo device) { var _hasErrDB = false; if (string.IsNullOrEmpty(data.strSample)) { return; } double dblMax; double dblMin; double dblDelegate; string strValue; string[] arrValue; var result = (int)clsDBUltity.emMeasureResult.Pass; GetDataFromSample(data.strSample, out arrValue, out strValue, out dblMax, out dblMin, out dblDelegate); if (device.MeasureType == emMeasureType.AlarmTest) { result = device.AlarmValue > (int)dblDelegate ? (int)clsDBUltity.emMeasureResult.Normal : (int)clsDBUltity.emMeasureResult.Alarm; } if (!_hasErrDB) { if (!db.InsertMeasureDetailRaw(data.deviceId, device.MeasureId, data.t, data.strSample, (int)dblMax, (int)dblMin, (int)dblDelegate, result)) { _hasErrDB = true; _nameErrFileRaw = clsConfig.MEASURE_DETAIL_RAW_NAME_FILE + DateTime.Now.ToString(clsDBUltity.cstrDateTimeFormatNoMiliSecond2); string content = db.GetInsertMeasureDetailRawSql(data.deviceId, device.MeasureId, data.t, data.strSample, (int)dblMax, (int)dblMin, (int)dblDelegate, result); WriteFileErrors(_nameErrFileRaw, content, device.MeasureId); _numberRecordWriteRaw++; } } else { if (string.IsNullOrEmpty(_nameErrFileRaw) || _numberRecordWriteRaw == clsConfig.MAX_RECORD_FILE_ERR) { _numberRecordWriteRaw = 0; _nameErrFileRaw = clsConfig.MEASURE_DETAIL_RAW_NAME_FILE + DateTime.Now.ToString(clsDBUltity.cstrDateTimeFormatNoMiliSecond2); } string content = db.GetInsertMeasureDetailRawSql(data.deviceId, device.MeasureId, data.t, data.strSample, (int)dblMax, (int)dblMin, (int)dblDelegate, result); WriteFileErrors(_nameErrFileRaw, content, device.MeasureId); _numberRecordWriteRaw++; } }