Exemple #1
0
        /// <summary>
        /// 获取告警类型表所有数据
        /// </summary>
        /// <returns>List<Model.TB_AlarmType></returns>
        public ResultAlarmTypes GetAlarmTypeList(QueryAlarmSetting query)
        {
            ResultAlarmTypes resultAlarmTypes = new ResultAlarmTypes();
            var list = _dal.GetAlarmTypeList("");
            #region 组织数据
            var alarmTypeList = list.Select(p =>
                                    new AlarmType
                                    {
                                        ID = p.ID,
                                        ProjectId = p.ProjectId,
                                        SystemId = p.SystemId,
                                        Type = p.Type,
                                        Name = p.Name,
                                        AlarmLevel = p.AlarmLevel
                                    }).Skip((query.PageCurrent - 1) * query.PageSize).Take(query.PageSize).ToList();

            foreach (AlarmType at in alarmTypeList)
            {
                var aeLst = _dal.GetAlarmEventByAlarmTypeId(at.Type).Select(p =>
                                new AlarmEvent
                                {
                                    ID = p.ID,
                                    ProjectId = p.ProjectId,
                                    SystemId = p.SystemId,
                                    AlarmTypeId = p.AlarmTypeId,
                                    PlugIn = p.PlugIn,
                                    TrigMode = p.TrigMode,
                                    RunMode = p.RunMode,
                                    RunCount = p.RunCount,
                                    RunTime = p.RunTime,
                                    Options = p.Options
                                }).ToList();
                at.PlugIns = aeLst;
            }
            resultAlarmTypes.AlarmTypeList = alarmTypeList;

            resultAlarmTypes.Page = new Padding();
            resultAlarmTypes.Page.Current = query.PageCurrent;
            resultAlarmTypes.Page.Total = list.Count();
            return resultAlarmTypes;
            #endregion
        }
Exemple #2
0
        public ResultAlarmScaleTypes GetAlarmScaleList(QueryAlarmSetting query)
        {
            ResultAlarmScaleTypes resultAlarmTypes = new ResultAlarmScaleTypes();
            var list = _dal.GetAlarmScaleList();
            #region 组织数据

            var alarmScaleList = list.Select(p =>
                                    new AlarmScale
                                    {
                                        ID = p.ID,
                                        AlarmType = p.AlarmType,
                                        AlarmName = p.AlarmName,
                                        Scale = p.Scale
                                    }).Skip((query.PageCurrent - 1) * query.PageSize).Take(query.PageSize).ToList();

            resultAlarmTypes.AlarmScaleList = alarmScaleList;

            resultAlarmTypes.Page = new Padding();
            resultAlarmTypes.Page.Current = query.PageCurrent;
            resultAlarmTypes.Page.Total = list.Count();
            return resultAlarmTypes;
            #endregion
        }