Fix Nc application bug when reading and editing alarms
This commit is contained in:
@@ -247,13 +247,19 @@ namespace Nc_Demo_Application.Database
|
||||
|
||||
public List<NcAlarmModel> GetNcAlarms()
|
||||
{
|
||||
int lastId = 0;
|
||||
List<NcAlarmModel> alarms = new List<NcAlarmModel>();
|
||||
foreach (DataRow row in ncAlarmDataTable.Rows)
|
||||
{
|
||||
if (Convert.IsDBNull(row["id"]))
|
||||
lastId = lastId + 1;
|
||||
else
|
||||
lastId = Convert.ToInt32(row["id"]);
|
||||
|
||||
// Convert DataTable.row into alarm model
|
||||
NcAlarmModel tmpAlarm = new NcAlarmModel
|
||||
{
|
||||
id = Convert.ToInt32(row["id"]),
|
||||
id = lastId,
|
||||
text = row["text"].ToString(),
|
||||
code = Convert.ToInt32(row["code"]),
|
||||
processId = Convert.ToInt32(row["process_id"])
|
||||
|
||||
Reference in New Issue
Block a user