Esempio n. 1
0
        /// <summary>
        /// Caricamento dati dell'evento
        /// </summary>
        /// <param name="e"></param>
        private void FetchEvent(DataGridItem item)
        {
            int eventId = this.GetEventId(item);

            Publisher.Proxy.EventInfo eventInfo = null;

            if (eventId > 0)
            {
                // Caricamento dati evento selezionato
                eventInfo = this.GetEvent(eventId);
            }

            // Caricamento tipi oggetto
            this.FetchObjectTypes(item);

            if (eventId > 0)
            {
                // Selezione tipo oggetto
                DropDownList cboObjectTypes = this.GetObjectTypesDropDown(item);
                cboObjectTypes.SelectedValue = eventInfo.ObjectType;
            }

            // Caricamento profili oggetto
            this.FetchObjectTemplates(item);

            if (eventId > 0)
            {
                // Selezione profilo oggetto
                DropDownList cboObjectTemplates = this.GetObjectTemplatesDropDown(item);
                cboObjectTemplates.SelectedValue = eventInfo.ObjectTemplateName;
            }


            // Caricamento log oggetto
            this.FetchObjectLogs(item);

            if (eventId > 0)
            {
                // Selezione log
                DropDownList cboLogEvents = this.GetObjectLogsDropDown(item);
                cboLogEvents.SelectedValue = eventInfo.EventName;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Repeirmento della descrizione dell'evento
        /// </summary>
        /// <param name="eventInfo"></param>
        /// <returns></returns>
        protected string GetEventDescription(Publisher.Proxy.EventInfo eventInfo)
        {
            string eventDescription = eventInfo.EventName;

            LogItemInfo[] events = this.GetLogItemsPerObjectType(eventInfo.ObjectType);

            LogItemInfo log = events.Where(e => e.Codice.ToLowerInvariant().Trim() == eventInfo.EventName.ToLowerInvariant().Trim()).FirstOrDefault();

            if (log != null)
            {
                eventDescription = log.Descrizione;
            }
            else
            {
                ShowErrorMessage(String.Format("Attenzione l'evento {0} non è piu configurato nel log manager, riabilitarlo o rimuovere l'evento monitorato", eventDescription));
            }

            return(eventDescription);
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        private void PerformActionDeleteEvent(DataGridCommandEventArgs e)
        {
            Publisher.Proxy.EventInfo eventInfo = this.GetEvent(this.GetEventId(e.Item));

            using (Publisher.Proxy.PublisherWebService ws = PublisherServiceFactory.Create())
            {
                eventInfo = ws.RemoveEvent(eventInfo);
            }

            this.SelectedChannel = this.GetChannel(this.SelectedChannel.Id);

            // Reperimento id del canale di pubblicazione selezionato
            //int idChannel = this.GetChannelId(this.grdChannels.SelectedItem);

            this.grdEvents.CurrentPageIndex = 0;
            this.grdEvents.EditItemIndex    = -1;
            this.grdEvents.SelectedIndex    = -1;

            this.FetchEvents(this.SelectedChannel.Id);
        }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        private void PerformActionUpdateEvent(DataGridCommandEventArgs e)
        {
            int eventId = this.GetEventId(e.Item);

            Publisher.Proxy.EventInfo eventInfo = null;

            if (eventId > 0)
            {
                // Reperimento evento
                eventInfo = this.SelectedChannel.Events.Where(itm => itm.Id == eventId).First();
            }
            else
            {
                // Nuovo evento
                eventInfo = new Publisher.Proxy.EventInfo {
                    IdChannel = this.SelectedChannel.Id
                };
            }

            eventInfo.ObjectType         = this.GetObjectTypesDropDown(e.Item).SelectedValue;
            eventInfo.ObjectTemplateName = this.GetObjectTemplatesDropDown(e.Item).SelectedValue;
            eventInfo.EventName          = this.GetObjectLogsDropDown(e.Item).SelectedValue;

            if (eventInfo.ObjectType == ObjectTypes.DOCUMENTO)
            {
                CheckBox chkLoadFile = (CheckBox)e.Item.FindControl("chkLoadFile");
                eventInfo.LoadFileIfDocumentType = chkLoadFile.Checked;
            }

            // Aggiornamento dati
            using (Publisher.Proxy.PublisherWebService ws = PublisherServiceFactory.Create())
                eventInfo = ws.SaveEvent(eventInfo);

            this.SelectedChannel = this.GetChannel(this.SelectedChannel.Id);

            // Aggiornamento eventi

            this.grdEvents.EditItemIndex = -1;
            this.grdEvents.SelectedIndex = -1;

            // Caricamento eventi
            this.FetchEvents(this.SelectedChannel.Id);


            //int idChannel = this.GetChannelId(this.grdChannels.SelectedItem);

            //int eventId = this.GetEventId(e.Item);

            //Publisher.Proxy.EventInfo eventInfo = null;

            //if (eventId > 0)
            //{
            //    // Reperimento evento
            //    eventInfo = this.GetEvent(this.GetEventId(e.Item));
            //}
            //else
            //{
            //    // Nuovo evento
            //    eventInfo = new Publisher.Proxy.EventInfo { IdChannel = idChannel };
            //}

            //eventInfo.ObjectType = this.GetObjectTypesDropDown(e.Item).SelectedValue;
            //eventInfo.ObjectTemplateName = this.GetObjectTemplatesDropDown(e.Item).SelectedValue;
            //eventInfo.EventName = this.GetObjectLogsDropDown(e.Item).SelectedValue;

            //if (eventInfo.ObjectType == ObjectTypes.DOCUMENTO)
            //{
            //    CheckBox chkLoadFile = (CheckBox) e.Item.FindControl("chkLoadFile");
            //    eventInfo.LoadFileIfDocumentType = chkLoadFile.Checked;
            //}

            //// Aggiornamento dati
            //using (Publisher.Proxy.PublisherWebService ws = PublisherServiceFactory.Create())
            //    eventInfo = ws.SaveEvent(eventInfo);

            //// Aggiornamento eventi



            //this.grdEvents.EditItemIndex = -1;
            //this.grdEvents.SelectedIndex = -1;

            //// Caricamento eventi
            //this.FetchEvents(idChannel);
        }
Esempio n. 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grdEvents_ItemCommand(object sender, DataGridCommandEventArgs e)
        {
            int id;

            Int32.TryParse(((Label)e.Item.FindControl("lblId")).Text, out id);

            int idInstance;

            Int32.TryParse(((Label)e.Item.FindControl("lblIdInstance")).Text, out idInstance);

            if (e.CommandName == "Select")
            {
                this.grdEvents.EditItemIndex = e.Item.ItemIndex;

                this.FetchEvents(idInstance);
            }
            else if (e.CommandName == "Delete")
            {
                using (Publisher.Proxy.PublisherWebService ws = new Publisher.Proxy.PublisherWebService())
                {
                    ws.Url = Properties.Settings.Default.PublisherWebServices;

                    Publisher.Proxy.EventInfo ev = ws.GetEvent(id);
                    ev = ws.RemoveEvent(ev);

                    this.grdEvents.EditItemIndex = -1;
                    this.FetchEvents(idInstance);
                }
            }
            else if (e.CommandName == "Update")
            {
                using (Publisher.Proxy.PublisherWebService ws = new Publisher.Proxy.PublisherWebService())
                {
                    ws.Url = Properties.Settings.Default.PublisherWebServices;

                    Publisher.Proxy.EventInfo ev = null;

                    if (id != 0)
                    {
                        ev = ws.GetEvent(id);
                    }
                    else
                    {
                        Int32.TryParse(((Label)this.grdInstances.SelectedItem.FindControl("lblId")).Text, out idInstance);

                        ev = new Proxy.EventInfo
                        {
                            IdChannel = idInstance
                        };
                    }

                    ev.ObjectType             = ((TextBox)e.Item.FindControl("txtObjectType")).Text;
                    ev.ObjectTemplateName     = ((TextBox)e.Item.FindControl("txtObjectTemplateName")).Text;
                    ev.EventName              = ((TextBox)e.Item.FindControl("txtEventName")).Text;
                    ev.DataMapperFullClass    = ((TextBox)e.Item.FindControl("txtDataMapper")).Text;
                    ev.LoadFileIfDocumentType = ((CheckBox)e.Item.FindControl("chkLoadFile")).Checked;

                    ev = ws.SaveEvent(ev);

                    this.grdEvents.EditItemIndex = -1;
                    this.FetchEvents(idInstance);
                }
            }
            else if (e.CommandName == "Cancel")
            {
                this.grdEvents.EditItemIndex = -1;
                this.FetchEvents(idInstance);
            }
        }