예제 #1
0
        public void ResetAlarmToDefault(AlarmRangeLimitView record)
        {
            IEnumerable <DefaultAlarmRangeLimit> defaultLimits = DataContext.Table <DefaultAlarmRangeLimit>().QueryRecords(restriction: new RecordRestriction("MeasurementTypeID = {0} AND MeasurementCharacteristicID = {1}", record.MeasurementTypeID, record.MeasurementCharacteristicID));

            if (defaultLimits.Any())
            {
                record.Severity       = defaultLimits.First().Severity;
                record.High           = defaultLimits.First().High;
                record.Low            = defaultLimits.First().Low;
                record.RangeInclusive = defaultLimits.First().RangeInclusive;
                record.PerUnit        = defaultLimits.First().PerUnit;
                record.IsDefault      = true;

                DataContext.Table <AlarmRangeLimit>().UpdateRecord(CreateNewAlarmRangeLimit(record));
            }
        }
예제 #2
0
        public AlarmRangeLimit CreateNewAlarmRangeLimit(AlarmRangeLimitView record)
        {
            AlarmRangeLimit arl = new AlarmRangeLimit();

            arl.ID          = record.ID;
            arl.ChannelID   = record.ChannelID;
            arl.AlarmTypeID = record.AlarmTypeID;
            arl.Enabled     = record.Enabled;


            arl.Severity       = record.Severity;
            arl.High           = record.High;
            arl.Low            = record.Low;
            arl.RangeInclusive = record.RangeInclusive;
            arl.PerUnit        = record.PerUnit;
            arl.IsDefault      = record.IsDefault;

            return(arl);
        }