AlarmItem.cs
3.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
using System;
using System.Threading;
namespace HslCommunication.Algorithms.Alarm
{
/// <summary>
/// 单次报警的信息内容
/// </summary>
public class AlarmItem
{
#region Contructor
/// <summary>
/// 实例化一个默认的对象
/// </summary>
public AlarmItem()
{
this.uniqueId = Interlocked.Increment(ref AlarmIdCurrent);
}
/// <summary>
/// 使用默认的用户id和报警描述信息来初始化报警
/// </summary>
/// <param name="userId">用户的自身的id标识信息</param>
/// <param name="alarmDescription">报警的描述信息</param>
public AlarmItem(int userId, string alarmDescription)
{
this.uniqueId = Interlocked.Increment(ref AlarmIdCurrent);
this.userId = userId;
this.alarmDescription = alarmDescription;
}
/// <summary>
/// 使用默认的用户id和报警描述信息来初始化报警
/// </summary>
/// <param name="alarmCode">报警的代号</param>
/// <param name="userId">用户的自身的id标识信息</param>
/// <param name="alarmDescription">报警的描述信息</param>
public AlarmItem(int alarmCode, int userId, string alarmDescription)
{
this.uniqueId = Interlocked.Increment(ref AlarmIdCurrent);
this.alarmCode = alarmCode;
this.userId = userId;
this.alarmDescription = alarmDescription;
}
#endregion
#region Public Properties
/// <summary>
/// 本次系统运行的唯一报警信息,用来标识操作的信息的
/// </summary>
public long UniqueId => uniqueId;
/// <summary>
/// 报警的ID信息
/// </summary>
public int AlarmCode
{
get => alarmCode;
set => alarmCode = value;
}
/// <summary>
/// 用户自带的标记信息,可以用来区分不同的设备的情况
/// </summary>
public int UserId
{
get => userId;
set => userId = value;
}
#endregion
#region Private Member
private long uniqueId = 0; // 报警的唯一标识
private int alarmCode = 0; // 当按照错误码处理的情况的代号
private int userId = 0; // 自定义的标识信息,可以用来标记不同的设备信息
private DateTime startTime = DateTime.Now; // 报警开始的时间
private DateTime finishTime = DateTime.Now; // 报警的结束时间
private string alarmDescription = string.Empty; // 报警的基本描述
private bool isChecked = false; // 是否被检查过
private bool isViewed = false; // 是否被查看过
private string checkName = string.Empty; // 被检查人的账户
private AlarmDegree alarmDegree = AlarmDegree.Hint; // 报警的等级信息
private static long AlarmIdCurrent = 0;
#endregion
}
}