void DeleteAllConfirmDialog_Confirmed(object data) { AlertsGridPanel.RefreshCurrentPage(); AlertController controller = new AlertController(); AlertItemCollection items = AlertsGridPanel.AlertItems; bool successful = false; for (int i = 0; i < items.Count; i++) { successful = controller.DeleteAlert(items[i].TheAlertItem); if (!successful) break; } if (successful) { Platform.Log(LogLevel.Info, "All Alert items deleted by user."); } else { Platform.Log(LogLevel.Error, "PreResetConfirmDialog_Confirmed: Unable to delete all Alert items."); MessageBox.Message = ErrorMessages.AlertDeleteFailed; MessageBox.MessageType = MessageBox.MessageTypeEnum.ERROR; MessageBox.Show(); } OnAllAlertsDeleted(); }
protected void Page_Load(object sender, EventArgs e) { AlertController controller = new AlertController(); AlertSelectCriteria criteria = new AlertSelectCriteria(); criteria.AlertLevelEnum.EqualTo(AlertLevelEnum.Critical); criteria.InsertTime.SortDesc(1); AlertsCount.Text = controller.GetAlertsCount(criteria).ToString(); alerts = controller.GetAlerts(criteria); if (alerts.Count > 0) { int rows = 0; foreach (Alert alert in alerts) { TableRow alertRow = new TableRow(); alertRow.Attributes.Add("class", "AlertTableCell"); TableCell component = new TableCell(); TableCell source = new TableCell(); TableCell description = new TableCell(); description.Wrap = false; component.Text = alert.Component; component.Wrap = false; source.Text = alert.Source; source.Wrap = false; string content = alert.Content.GetElementsByTagName("Message").Item(0).InnerText; description.Text = content.Length < 50 ? content : content.Substring(0, 50); description.Text += " ..."; description.Wrap = false; alertRow.Cells.Add(component); alertRow.Cells.Add(source); alertRow.Cells.Add(description); AlertTable.Rows.Add(alertRow); rows++; if (rows == 5) break; } } }