public void LoadAlarmHistoryData(DateTime FirstDay, DateTime LastDay) { AlarmStatistics tmpSt = new AlarmStatistics(); string tmpDate = ""; string tmpString = ""; int tmpNum = 0; m_AlarmHistoryDataList.Clear(); for (int i = 0; i <= (LastDay - FirstDay).TotalDays; i++) { tmpDate = System.Convert.ToString(DateAndTime.DateAdd("d", System.Convert.ToDouble(-i), LastDay).ToString("yyyyMMdd")); tmpNum = int.Parse(BVar.FileRorW.ReadINI(tmpDate, "TotalAlarmNum", "0", "D:\\BZ-Parameter\\BAM\\AlarmHistoryData.ini")); if (tmpNum <= 0) { continue; } for (int j = tmpNum; j >= 1; j--) { tmpString = BVar.FileRorW.ReadINI(tmpDate, "Alarm" + (j).ToString(), "00:00:00,00:00:00,F0000,Not Known", "D:\\BZ-Parameter\\BAM\\AlarmHistoryData.ini"); FormatAlarmHistoryString(tmpSt, tmpString); tmpSt.dDate = DateAndTime.DateAdd("d", System.Convert.ToDouble(-i), LastDay); m_AlarmHistoryDataList.Add(tmpSt); } } AlarmDataGridView_CellContentClick(null, null); for (var i = 30; i <= 50; i++) { BVar.FileRorW.DelIniSec(System.Convert.ToString(DateAndTime.DateAdd("d", System.Convert.ToDouble(-i), DateTime.Now.Date).ToString("yyyyMMdd")), "D:\\BZ-Parameter\\BAM\\AlarmHistoryData.ini"); } }
public Color GetBackColor(AlarmStatistics tmpdSt) { string str = GetDuration(tmpdSt); if (System.Convert.ToInt16(str.Substring(0, 2)) > 0) { return(Color.Red); } else if (System.Convert.ToInt16(Strings.Left(str.Substring(3), 2)) > 15 && System.Convert.ToInt16(str.Substring(0, 2)) <= 0) { return(Color.Yellow); } else { return(Color.White); } }
private void FormatAlarmHistoryString(AlarmStatistics tmpSt, string strTemp) { string[] strTmp = null; strTmp = strTemp.Split(','); if (strTmp.Length < 4) { strTmp = new string[4]; strTmp[0] = "00:00:00"; strTmp[1] = "00:00:00"; strTmp[2] = "F0000"; strTmp[3] = "Not Known"; } tmpSt.strBeginTime = strTmp[0]; tmpSt.strEndTime = strTmp[1]; tmpSt.strErrcode = strTmp[2]; tmpSt.strCategory = strTmp[3]; }
public string GetDuration(AlarmStatistics tmpSt) { //Return "" DateTime BeginTime = default(DateTime); DateTime EndTime = default(DateTime); BeginTime = DateAndTime.TimeValue(tmpSt.strBeginTime); if (tmpSt.strEndTime == "NotEnd") { return("Ongoing"); } else { EndTime = DateAndTime.TimeValue(tmpSt.strEndTime); if ((EndTime - BeginTime).Hours < 0) { return(((EndTime - BeginTime).Hours + 23).ToString("00") + ":" + ((EndTime - BeginTime).Minutes + 59).ToString("00") + ":" + ((EndTime - BeginTime).Seconds + 59).ToString("00")); } else { return(((EndTime - BeginTime).Hours).ToString("00") + ":" + (EndTime - BeginTime).Minutes.ToString("00") + ":" + (EndTime - BeginTime).Seconds.ToString("00")); } } }
public AlarmStatistics GetDevAlarmStatistics(SearchArg arg) { AlarmStatistics alarmStatistics = new AlarmStatistics(); return(alarmStatistics); }