Esempio n. 1
0
        private void InsertMeasureDetail(DataSample data, clsDBUltity db, int _measureId)
        {
            var _hasErrDB = false;

            if (string.IsNullOrEmpty(data.strSample))
            {
                return;
            }

            if (!_hasErrDB)
            {
                if (!db.InsertMeasureDetail(data.deviceId, _measureId, data.t, data.strSample, data.actualMaxValue, data.actualMinValue, data.actualDelegate, data.result))
                {
                    _hasErrDB          = true;
                    _nameErrFileDetail = clsConfig.MEASURE_DETAIL_NAME_FILE + DateTime.Now.ToString(clsDBUltity.cstrDateTimeFormatNoMiliSecond2);
                    string content = db.GetInsertMeasureDetailSql(data.deviceId, _measureId, data.t, data.strSample, data.actualMaxValue, data.actualMinValue, data.actualDelegate, data.result);
                    WriteFileErrors(_nameErrFileDetail, content, _measureId);
                    _numberRecordWriteDetail++;
                }
            }
            else
            {
                if (string.IsNullOrEmpty(_nameErrFileDetail) || _numberRecordWriteDetail == clsConfig.MAX_RECORD_FILE_ERR)
                {
                    _numberRecordWriteDetail = 0;
                    _nameErrFileDetail       = clsConfig.MEASURE_DETAIL_NAME_FILE + DateTime.Now.ToString(clsDBUltity.cstrDateTimeFormatNoMiliSecond2);
                }
                string content = db.GetInsertMeasureDetailSql(data.deviceId, _measureId, data.t, data.strSample, data.actualMaxValue, data.actualMinValue, data.actualDelegate, data.result);
                WriteFileErrors(_nameErrFileDetail, content, _measureId);
                _numberRecordWriteDetail++;
            }
        }