Exemple #1
0
        private void InsertMeasureLimit(DataSample data, clsDBUltity db, int _measureId)
        {
            var _hasErrDB = false;

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

            if (!_hasErrDB)
            {
                if (!db.InsertMeasureDetailLimit(data.deviceId, _measureId, data.t, data.strSample, data.actualMaxValue, data.actualMinValue, data.actualDelegate, data.result))
                {
                    _hasErrDB         = true;
                    _nameErrFileLimit = clsConfig.MEASURE_DETAIL_LIMIT_NAME_FILE + DateTime.Now.ToString(clsDBUltity.cstrDateTimeFormatNoMiliSecond2);
                    string content = db.GetInsertMeasureDetailLimitSql(data.deviceId, _measureId, data.t, data.strSample, data.actualMaxValue, data.actualMinValue, data.actualDelegate, data.result);
                    WriteFileErrors(_nameErrFileLimit, content, _measureId);
                    _numberRecordWriteLimit++;
                }
            }
            else
            {
                if (string.IsNullOrEmpty(_nameErrFileLimit) || _numberRecordWriteLimit == clsConfig.MAX_RECORD_FILE_ERR)
                {
                    _numberRecordWriteLimit = 0;
                    _nameErrFileLimit       = clsConfig.MEASURE_DETAIL_LIMIT_NAME_FILE + DateTime.Now.ToString(clsDBUltity.cstrDateTimeFormatNoMiliSecond2);
                }
                string content = db.GetInsertMeasureDetailLimitSql(data.deviceId, _measureId, data.t, data.strSample, data.actualMaxValue, data.actualMinValue, data.actualDelegate, data.result);
                WriteFileErrors(_nameErrFileLimit, content, _measureId);
                _numberRecordWriteLimit++;
            }
        }