Пример #1
0
        public void ResetDefaultLimits(DefaultAlarmRangeLimitView record)
        {
            IEnumerable <Channel> channels = DataContext.Table <Channel>().QueryRecords(restriction: new RecordRestriction("MeasurementTypeID = {0} AND MeasurementCharacteristicID = {1}", record.MeasurementTypeID, record.MeasurementCharacteristicID));
            string channelIDs = "";

            foreach (Channel channel in channels)
            {
                if (channelIDs == "")
                {
                    channelIDs += channel.ID.ToString();
                }
                else
                {
                    channelIDs += ',' + channel.ID.ToString();
                }
            }
            IEnumerable <AlarmRangeLimit> limits = DataContext.Table <AlarmRangeLimit>().QueryRecords(restriction: new RecordRestriction($"ChannelID IN ({channelIDs})"));

            foreach (AlarmRangeLimit limit in limits)
            {
                limit.IsDefault      = true;
                limit.High           = record.High;
                limit.Low            = record.Low;
                limit.Severity       = record.Severity;
                limit.RangeInclusive = record.RangeInclusive;
                limit.PerUnit        = record.PerUnit;
                DataContext.Table <AlarmRangeLimit>().UpdateRecord(limit);
            }
        }
Пример #2
0
        public DefaultAlarmRangeLimit CreateNewAlarmRangeLimit(DefaultAlarmRangeLimitView record)
        {
            DefaultAlarmRangeLimit arl = new DefaultAlarmRangeLimit();

            arl.ID                          = record.ID;
            arl.AlarmTypeID                 = record.AlarmTypeID;
            arl.MeasurementTypeID           = record.MeasurementTypeID;
            arl.MeasurementCharacteristicID = record.MeasurementCharacteristicID;
            arl.Severity                    = record.Severity;
            arl.High                        = record.High;
            arl.Low                         = record.Low;
            arl.RangeInclusive              = record.RangeInclusive;
            arl.PerUnit                     = record.PerUnit;
            return(arl);
        }
Пример #3
0
 public void UpdateDefaultAlarmRangeLimitView(DefaultAlarmRangeLimitView record)
 {
     DataContext.Table <DefaultAlarmRangeLimit>().UpdateRecord(CreateNewAlarmRangeLimit(record));
 }
Пример #4
0
 public void AddNewDefaultAlarmRangeLimitView(DefaultAlarmRangeLimitView record)
 {
     DataContext.Table <DefaultAlarmRangeLimit>().AddNewRecord(CreateNewAlarmRangeLimit(record));
 }