Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
            }
        }