public void Insert(Guid Guid, short EnumX, string Lookup, string Description, string LongDescription)
        {
            var item = new AlertCategoryEnum();

            item.Guid = Guid;

            item.EnumX = EnumX;

            item.Lookup = Lookup;

            item.Description = Description;

            item.LongDescription = LongDescription;


            item.Save(UserName);
        }
        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(); };
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            GridPagerTop.InitializeGridPager(SR.GridPagerAlertSingleItemFound, SR.GridPagerAlertMultipleItemsFound, AlertsGridPanel.AlertGrid, delegate { return(AlertsGridPanel.ResultCount); }, ImageServerConstants.GridViewPagerPosition.Top);
            AlertsGridPanel.Pager = GridPagerTop;
            GridPagerTop.Reset();

            ClearInsertDateButton.OnClientClick = ScriptHelper.ClearDate(InsertDateFilter.ClientID, InsertDateCalendarExtender.ClientID);

            IList <AlertLevelEnum>    levelEnums    = AlertLevelEnum.GetAll();
            IList <AlertCategoryEnum> categoryEnums = AlertCategoryEnum.GetAll();

            int prevSelectedIndex = LevelFilter.SelectedIndex;

            LevelFilter.Items.Clear();
            LevelFilter.Items.Add(new ListItem(SR.Any, string.Empty));
            foreach (AlertLevelEnum ale in levelEnums)
            {
                LevelFilter.Items.Add(new ListItem(ServerEnumDescription.GetLocalizedDescription(ale), ale.Lookup));
            }
            LevelFilter.SelectedIndex = prevSelectedIndex;

            prevSelectedIndex = CategoryFilter.SelectedIndex;
            CategoryFilter.Items.Clear();
            CategoryFilter.Items.Add(new ListItem(SR.Any, string.Empty));
            foreach (AlertCategoryEnum ace in categoryEnums)
            {
                CategoryFilter.Items.Add(new ListItem(ServerEnumDescription.GetLocalizedDescription(ace), ace.Lookup));
            }
            CategoryFilter.SelectedIndex = prevSelectedIndex;

            DeleteAllAlertsButton.Roles =
                AuthorityTokens.Admin.Alert.Delete;
            DeleteAlertButton.Roles =
                AuthorityTokens.Admin.Alert.Delete;

            SetupEventHandlers();
        }
示例#4
0
        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();
            }
        }
        public void Update(Guid Guid, short EnumX, string Lookup, string Description, string LongDescription)
        {
            var item = new AlertCategoryEnum();
            item.MarkOld();
            item.IsLoaded = true;

            item.Guid = Guid;

            item.EnumX = EnumX;

            item.Lookup = Lookup;

            item.Description = Description;

            item.LongDescription = LongDescription;

            item.Save(UserName);
        }