public void SaveMsg(CAlarmMsgEventArgs e) { if (bDebug) { return; } string stmp = "insert into AL_SOELog(Date_Time,ServerName,ProjectName,StationName,AlarmType,Recorder,Remark,ConfirmTime,ConfirmName,rowguid,Priority)values('"; if (e.Date_Time == null) { stmp += "',"; } else { stmp += ((DateTime)e.Date_Time).ToString("yyyy-MM-dd HH:mm:ss") + "',"; } stmp += "'" + HostName + "','" + frmMain.staPrj.Name + "','" + e.StaName + "','"; stmp += e.AlarmTypeString + "','" + e.Recorder + "','" + e.Remark + "',"; if (e.ConfirmTime == null) { stmp += "null,'"; } else { stmp += "'" + ((DateTime)e.Date_Time).ToString("yyyy-MM-dd HH:mm:ss") + "','"; } stmp += e.ConfirmName + "','" + e.ALGuid.ToString() + "'," + e.PriorityStringNum + ");"; // Debug.WriteLine(stmp); int iVal = MySqlHelper.ExecuteNonQuery(constrSOE, stmp); //sMsgSaveSQL += stmp; }
private void CellDoubleClick(DataGridView dGV, int iRow, EAlarmPriority priority) { try { string sbConfirm = dGV.Rows[iRow].Cells[0].Value.ToString(); if (sbConfirm == "已确认") { return; } string sGUID = dGV.Rows[iRow].Cells[8].Value.ToString(); for (int i = 0; i < staAlarm.cAlarmMsg.ListAlarmMsg.Count; i++) { if (staAlarm.cAlarmMsg.ListAlarmMsg[i].ALGuid.ToString() != sGUID) { continue; } CAlarmMsgEventArgs MsgE = staAlarm.cAlarmMsg.ListAlarmMsg[i]; staAlarm.SetConfirm(MsgE); dGV.Rows[iRow].Cells[0].Value = "已确认"; dGV.Rows[iRow].DefaultCellStyle.ForeColor = Color.Black; if (staAlarm.cAlarmMsg.ListAlarmMsg[i].ConfirmTime != null) { dGV.Rows[iRow].Cells[6].Value = ((DateTime)MsgE.ConfirmTime).ToString("yyyy-MM-dd HH:mm:ss"); } dGV.Rows[iRow].Cells[7].Value = staAlarm.cAlarmMsg.ListAlarmMsg[i].ConfirmName; } } catch (Exception ex) { } }
public void UpdateMsg(CAlarmMsgEventArgs e) { if (bDebug) { return; } //stmp = "update P_ProcessInfo set DT_End = '" + sDT + "',Status = " + Status.ToString() + " where rowguid='" + nP.rowguid.ToString() + "';"; string stmp = "update AL_SOELog set Recorder = '" + e.Recorder + "',"; stmp += "Remark = '" + e.Remark + "',"; if (e.ConfirmTime != null) { stmp += "ConfirmTime='" + ((DateTime)e.Date_Time).ToString("yyyy-MM-dd HH:mm:ss") + "',"; } stmp += "ConfirmName = '" + e.ConfirmName + "' where rowguid='" + e.ALGuid.ToString() + "';"; // Debug.WriteLine(stmp); int iVal = MySqlHelper.ExecuteNonQuery(constrSOE, stmp); //sMsgSaveSQL += stmp; }
private void FillDGVRealTime() { List <string[]> obj1 = new List <string[]>(); List <string[]> obj2 = new List <string[]>(); List <string[]> obj3 = new List <string[]>(); for (int i = staAlarm.cAlarmMsg.ListAlarmMsg.Count - 1; i >= 0; i--) { CAlarmMsgEventArgs pressShowMsg = staAlarm.cAlarmMsg.ListAlarmMsg[i]; string[] sCell1 = new string[9]; if (pressShowMsg == null) { continue; } if (pressShowMsg.bConfirm) { sCell1[0] = "未确认"; //sRow.DefaultCellStyle.ForeColor = Color.Red; } else { sCell1[0] = "已确认"; } if (pressShowMsg.Date_Time != null) { sCell1[1] = ((DateTime)pressShowMsg.Date_Time).ToString("yyyy-MM-dd HH:mm:ss"); } sCell1[2] = pressShowMsg.PriorityString; sCell1[3] = pressShowMsg.AlarmTypeString; sCell1[4] = pressShowMsg.StaName; sCell1[5] = pressShowMsg.Recorder; if (pressShowMsg.ConfirmTime != null) { sCell1[6] = ((DateTime)pressShowMsg.ConfirmTime).ToString("yyyy-MM-dd HH:mm:ss"); } sCell1[7] = pressShowMsg.ConfirmName; sCell1[8] = pressShowMsg.ALGuid.ToString(); if (pressShowMsg.eAlarmType == EAlarmType.ManualAct) { obj3.Add(sCell1); } else { if (pressShowMsg.priority == EAlarmPriority.PRIORITY_3) { obj2.Add(sCell1); } else { obj1.Add(sCell1); } } } dGV1.Rows.Clear(); foreach (string[] rowArray in obj1) { int i = dGV1.Rows.Add(rowArray); if (rowArray[0] == "未确认") { dGV1.Rows[i].DefaultCellStyle.ForeColor = Color.Red; } else { dGV1.Rows[i].DefaultCellStyle.ForeColor = Color.Black; } } dGV2.Rows.Clear(); foreach (string[] rowArray in obj2) { int i = dGV2.Rows.Add(rowArray); if (rowArray[0] == "未确认") { dGV2.Rows[i].DefaultCellStyle.ForeColor = Color.Red; } else { dGV2.Rows[i].DefaultCellStyle.ForeColor = Color.Black; } } dGV3.Rows.Clear(); foreach (string[] rowArray in obj3) { rowArray[0] = ""; int i = dGV3.Rows.Add(rowArray); dGV3.Rows[i].DefaultCellStyle.ForeColor = Color.Black; } staAlarm.cAlarmMsg.bUpdate = false; }