Example #1
0
 /// <summary>
 /// 活动告警
 /// </summary>
 public static void AddAlarm(A_AAlarm alarm)
 {
     AddAlarm(new AlarmStart {
         Id               = alarm.Id,
         AreaId           = alarm.AreaId,
         StationId        = alarm.StationId,
         RoomId           = alarm.RoomId,
         FsuId            = alarm.FsuId,
         DeviceId         = alarm.DeviceId,
         PointId          = alarm.PointId,
         SerialNo         = alarm.SerialNo,
         NMAlarmId        = alarm.NMAlarmId,
         AlarmTime        = alarm.AlarmTime,
         AlarmLevel       = alarm.AlarmLevel,
         AlarmFlag        = EnmFlag.Begin,
         AlarmValue       = alarm.AlarmValue,
         AlarmDesc        = alarm.AlarmDesc,
         AlarmRemark      = alarm.AlarmRemark,
         ReservationId    = alarm.ReservationId,
         ReservationName  = null,
         ReservationStart = null,
         ReservationEnd   = null,
         PrimaryId        = alarm.PrimaryId,
         RelatedId        = alarm.RelatedId,
         FilterId         = alarm.FilterId,
         ReversalId       = alarm.ReversalId,
         ReversalCount    = alarm.ReversalCount,
         Masked           = false
     });
 }
        public List <A_AAlarm> GetEntitiesInSpan(DateTime start, DateTime end)
        {
            SqlParameter[] parms = { new SqlParameter("@Start", SqlDbType.DateTime),
                                     new SqlParameter("@End",   SqlDbType.DateTime) };

            parms[0].Value = SqlTypeConverter.DBNullDateTimeHandler(start);
            parms[1].Value = SqlTypeConverter.DBNullDateTimeHandler(end);

            var entities = new List <A_AAlarm>();

            using (var rdr = SqlHelper.ExecuteReader(this._databaseConnectionString, CommandType.Text, SqlCommands_Cs.Sql_A_AAlarm_Repository_GetEntitiesInSpan, parms)) {
                while (rdr.Read())
                {
                    var entity = new A_AAlarm();
                    entity.Id            = SqlTypeConverter.DBNullStringHandler(rdr["Id"]);
                    entity.AreaId        = SqlTypeConverter.DBNullStringHandler(rdr["AreaId"]);
                    entity.StationId     = SqlTypeConverter.DBNullStringHandler(rdr["StationId"]);
                    entity.RoomId        = SqlTypeConverter.DBNullStringHandler(rdr["RoomId"]);
                    entity.FsuId         = SqlTypeConverter.DBNullStringHandler(rdr["FsuId"]);
                    entity.DeviceId      = SqlTypeConverter.DBNullStringHandler(rdr["DeviceId"]);
                    entity.PointId       = SqlTypeConverter.DBNullStringHandler(rdr["PointId"]);
                    entity.SerialNo      = SqlTypeConverter.DBNullStringHandler(rdr["SerialNo"]);
                    entity.NMAlarmId     = SqlTypeConverter.DBNullStringHandler(rdr["NMAlarmId"]);
                    entity.AlarmTime     = SqlTypeConverter.DBNullDateTimeHandler(rdr["AlarmTime"]);
                    entity.AlarmLevel    = SqlTypeConverter.DBNullEnmLevelHandler(rdr["AlarmLevel"]);
                    entity.AlarmValue    = SqlTypeConverter.DBNullDoubleHandler(rdr["AlarmValue"]);
                    entity.AlarmDesc     = SqlTypeConverter.DBNullStringHandler(rdr["AlarmDesc"]);
                    entity.AlarmRemark   = SqlTypeConverter.DBNullStringHandler(rdr["AlarmRemark"]);
                    entity.Confirmed     = SqlTypeConverter.DBNullEnmConfirmHandler(rdr["Confirmed"]);
                    entity.Confirmer     = SqlTypeConverter.DBNullStringHandler(rdr["Confirmer"]);
                    entity.ConfirmedTime = SqlTypeConverter.DBNullDateTimeHandler(rdr["ConfirmedTime"]);
                    entity.ReservationId = SqlTypeConverter.DBNullStringHandler(rdr["ReservationId"]);
                    entity.PrimaryId     = SqlTypeConverter.DBNullStringHandler(rdr["PrimaryId"]);
                    entity.RelatedId     = SqlTypeConverter.DBNullStringHandler(rdr["RelatedId"]);
                    entity.FilterId      = SqlTypeConverter.DBNullStringHandler(rdr["FilterId"]);
                    entity.ReversalId    = SqlTypeConverter.DBNullStringHandler(rdr["ReversalId"]);
                    entity.ReversalCount = SqlTypeConverter.DBNullInt32Handler(rdr["ReversalCount"]);
                    entity.Masked        = SqlTypeConverter.DBNullBooleanHandler(rdr["Masked"]);
                    entity.CreatedTime   = SqlTypeConverter.DBNullDateTimeHandler(rdr["CreatedTime"]);
                    entities.Add(entity);
                }
            }
            return(entities);
        }
        public A_AAlarm GetEntityInPoint(string device, string point)
        {
            SqlParameter[] parms = { new SqlParameter("@DeviceId", SqlDbType.VarChar, 100),
                                     new SqlParameter("@PointId",  SqlDbType.VarChar, 100) };

            parms[0].Value = SqlTypeConverter.DBNullStringChecker(device);
            parms[1].Value = SqlTypeConverter.DBNullStringChecker(point);

            A_AAlarm entity = null;

            using (var rdr = SqlHelper.ExecuteReader(this._databaseConnectionString, CommandType.Text, SqlCommands_Cs.Sql_A_AAlarm_Repository_GetEntityInPoint, parms)) {
                if (rdr.Read())
                {
                    entity               = new A_AAlarm();
                    entity.Id            = SqlTypeConverter.DBNullStringHandler(rdr["Id"]);
                    entity.AreaId        = SqlTypeConverter.DBNullStringHandler(rdr["AreaId"]);
                    entity.StationId     = SqlTypeConverter.DBNullStringHandler(rdr["StationId"]);
                    entity.RoomId        = SqlTypeConverter.DBNullStringHandler(rdr["RoomId"]);
                    entity.FsuId         = SqlTypeConverter.DBNullStringHandler(rdr["FsuId"]);
                    entity.DeviceId      = SqlTypeConverter.DBNullStringHandler(rdr["DeviceId"]);
                    entity.PointId       = SqlTypeConverter.DBNullStringHandler(rdr["PointId"]);
                    entity.SerialNo      = SqlTypeConverter.DBNullStringHandler(rdr["SerialNo"]);
                    entity.NMAlarmId     = SqlTypeConverter.DBNullStringHandler(rdr["NMAlarmId"]);
                    entity.AlarmTime     = SqlTypeConverter.DBNullDateTimeHandler(rdr["AlarmTime"]);
                    entity.AlarmLevel    = SqlTypeConverter.DBNullEnmLevelHandler(rdr["AlarmLevel"]);
                    entity.AlarmValue    = SqlTypeConverter.DBNullDoubleHandler(rdr["AlarmValue"]);
                    entity.AlarmDesc     = SqlTypeConverter.DBNullStringHandler(rdr["AlarmDesc"]);
                    entity.AlarmRemark   = SqlTypeConverter.DBNullStringHandler(rdr["AlarmRemark"]);
                    entity.Confirmed     = SqlTypeConverter.DBNullEnmConfirmHandler(rdr["Confirmed"]);
                    entity.Confirmer     = SqlTypeConverter.DBNullStringHandler(rdr["Confirmer"]);
                    entity.ConfirmedTime = SqlTypeConverter.DBNullDateTimeHandler(rdr["ConfirmedTime"]);
                    entity.ReservationId = SqlTypeConverter.DBNullStringHandler(rdr["ReservationId"]);
                    entity.PrimaryId     = SqlTypeConverter.DBNullStringHandler(rdr["PrimaryId"]);
                    entity.RelatedId     = SqlTypeConverter.DBNullStringHandler(rdr["RelatedId"]);
                    entity.FilterId      = SqlTypeConverter.DBNullStringHandler(rdr["FilterId"]);
                    entity.ReversalId    = SqlTypeConverter.DBNullStringHandler(rdr["ReversalId"]);
                    entity.ReversalCount = SqlTypeConverter.DBNullInt32Handler(rdr["ReversalCount"]);
                    entity.Masked        = SqlTypeConverter.DBNullBooleanHandler(rdr["Masked"]);
                    entity.CreatedTime   = SqlTypeConverter.DBNullDateTimeHandler(rdr["CreatedTime"]);
                }
            }
            return(entity);
        }
Example #4
0
        public List <A_AAlarm> GetAllAlarms()
        {
            var entities = new List <A_AAlarm>();

            using (var rdr = SqlHelper.ExecuteReader(this._databaseConnectionString, CommandType.Text, SqlCommands_Cs.Sql_A_AAlarm_Repository_GetAllAlarms, null)) {
                while (rdr.Read())
                {
                    var entity = new A_AAlarm();
                    entity.Id            = SqlTypeConverter.DBNullStringHandler(rdr["Id"]);
                    entity.AreaId        = SqlTypeConverter.DBNullStringHandler(rdr["AreaId"]);
                    entity.StationId     = SqlTypeConverter.DBNullStringHandler(rdr["StationId"]);
                    entity.RoomId        = SqlTypeConverter.DBNullStringHandler(rdr["RoomId"]);
                    entity.FsuId         = SqlTypeConverter.DBNullStringHandler(rdr["FsuId"]);
                    entity.DeviceId      = SqlTypeConverter.DBNullStringHandler(rdr["DeviceId"]);
                    entity.PointId       = SqlTypeConverter.DBNullStringHandler(rdr["PointId"]);
                    entity.SerialNo      = SqlTypeConverter.DBNullStringHandler(rdr["SerialNo"]);
                    entity.NMAlarmId     = SqlTypeConverter.DBNullStringHandler(rdr["NMAlarmId"]);
                    entity.AlarmTime     = SqlTypeConverter.DBNullDateTimeHandler(rdr["AlarmTime"]);
                    entity.AlarmLevel    = SqlTypeConverter.DBNullEnmLevelHandler(rdr["AlarmLevel"]);
                    entity.AlarmValue    = SqlTypeConverter.DBNullDoubleHandler(rdr["AlarmValue"]);
                    entity.AlarmDesc     = SqlTypeConverter.DBNullStringHandler(rdr["AlarmDesc"]);
                    entity.AlarmRemark   = SqlTypeConverter.DBNullStringHandler(rdr["AlarmRemark"]);
                    entity.Confirmed     = SqlTypeConverter.DBNullEnmConfirmStatusHandler(rdr["Confirmed"]);
                    entity.Confirmer     = SqlTypeConverter.DBNullStringHandler(rdr["Confirmer"]);
                    entity.ConfirmedTime = SqlTypeConverter.DBNullDateTimeNullableHandler(rdr["ConfirmedTime"]);
                    entity.ReservationId = SqlTypeConverter.DBNullStringHandler(rdr["ReservationId"]);
                    entity.PrimaryId     = SqlTypeConverter.DBNullStringHandler(rdr["PrimaryId"]);
                    entity.RelatedId     = SqlTypeConverter.DBNullStringHandler(rdr["RelatedId"]);
                    entity.FilterId      = SqlTypeConverter.DBNullStringHandler(rdr["FilterId"]);
                    entity.ReversalId    = SqlTypeConverter.DBNullStringHandler(rdr["ReversalId"]);
                    entity.ReversalCount = SqlTypeConverter.DBNullInt32Handler(rdr["ReversalCount"]);
                    entity.Masked        = SqlTypeConverter.DBNullBooleanHandler(rdr["Masked"]);
                    entity.CreatedTime   = SqlTypeConverter.DBNullDateTimeHandler(rdr["CreatedTime"]);
                    entities.Add(entity);
                }
            }
            return(entities);
        }