コード例 #1
0
        protected void SetupEventHandlers()
        {
            AlertsGridPanel.DataSourceCreated += delegate(AlertDataSource source)
            {
                if (!String.IsNullOrEmpty(ComponentFilter.Text))
                {
                    source.Component = SearchHelper.LeadingAndTrailingWildCard(ComponentFilter.Text);
                }
                if (LevelFilter.SelectedIndex > 0)
                {
                    source.Level = AlertLevelEnum.GetEnum(LevelFilter.SelectedValue);
                }
                if (CategoryFilter.SelectedIndex > 0)
                {
                    source.Category = AlertCategoryEnum.GetEnum(CategoryFilter.SelectedValue);
                }
                source.DateFormats = InsertDateCalendarExtender.Format;
                if (!String.IsNullOrEmpty(InsertDateFilter.Text))
                {
                    source.InsertTime = InsertDateFilter.Text;
                }
            };

            DeleteConfirmationBox.Confirmed += delegate(object data)
            {
                if (data == null)
                {
                    return;
                }

                ArrayList keys = (ArrayList)data;

                for (int i = 0; i < keys.Count; i++)
                {
                    _theController.DeleteAlertItem(keys[i] as ServerEntityKey);
                }

                OnAlertDeleted();
            };

            DeleteAllConfirmationBox.Confirmed += DeleteAllConfirmDialog_Confirmed;

            // TODO: We should do this in GridPager.InitializeGridPager()
            AlertsGridPanel.TheGrid.DataBound += delegate { GridPagerTop.Refresh(); };
        }
コード例 #2
0
ファイル: DefaultAlertSink.cs プロジェクト: yjsyyyjszf/CC13.2
        private static void WriteToDatabase(ImageServer.Common.Alert alert)
        {
            XmlDocument doc = CreateXmlContent(alert);

            AlertUpdateColumns columns = new AlertUpdateColumns();

            columns.AlertCategoryEnum = AlertCategoryEnum.GetEnum(alert.Category.ToString());
            columns.AlertLevelEnum    = AlertLevelEnum.GetEnum(alert.Level.ToString());
            columns.Component         = alert.Source.Name;
            columns.Content           = doc;
            columns.InsertTime        = Platform.Time;
            columns.Source            = alert.Source.Host;
            columns.TypeCode          = alert.Code;

            IPersistentStore store = PersistentStoreRegistry.GetDefaultStore();

            using (IUpdateContext ctx = store.OpenUpdateContext(UpdateContextSyncMode.Flush))
            {
                IAlertEntityBroker alertBroker = ctx.GetBroker <IAlertEntityBroker>();
                alertBroker.Insert(columns);
                ctx.Commit();
            }
        }