예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        private void PerformActionDeleteChannel(DataGridCommandEventArgs e)
        {
            this.SelectedChannel = null;

            using (Publisher.Proxy.PublisherWebService ws = PublisherServiceFactory.Create())
            {
                Publisher.Proxy.ChannelRefInfo instance = ws.GetChannel(this.GetChannelId(e.Item));

                ws.RemoveChannel(instance);

                this.grdChannels.CurrentPageIndex = 0;
                this.grdChannels.EditItemIndex    = -1;
                this.Fetch();

                this.PerformActionCloseEvents();
            }
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grdInstances_ItemCommand(object sender, DataGridCommandEventArgs e)
        {
            int id;

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

            if (e.CommandName == "Select")
            {
                using (Publisher.Proxy.PublisherWebService ws = new Publisher.Proxy.PublisherWebService())
                {
                    ws.Url = Properties.Settings.Default.PublisherWebServices;

                    this.grdInstances.EditItemIndex = e.Item.ItemIndex;
                    this.Fetch();

                    this.FetchSubscribers(this.grdInstances.Items[this.grdInstances.EditItemIndex]);

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

                    Publisher.Proxy.ChannelRefInfo instance = ws.GetChannel(id);

                    ws.StartChannel(instance);

                    this.grdInstances.EditItemIndex = -1;
                    this.Fetch();

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

                    Publisher.Proxy.ChannelRefInfo instance = ws.GetChannel(id);

                    ws.StopChannel(instance);

                    this.grdInstances.EditItemIndex = -1;
                    this.Fetch();

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

                    Publisher.Proxy.ChannelRefInfo instance = null;

                    if (id != 0)
                    {
                        instance = ws.GetChannel(id);
                    }
                    else
                    {
                        instance = new Proxy.ChannelRefInfo
                        {
                            Admin = new Proxy.AdminInfo
                            {
                                Id = this.IdAdmin
                            }
                        };
                    }

                    instance.SubscriberServiceUrl = Properties.Settings.Default.SubscriberWebServices;
                    instance.ChannelName          = ((DropDownList)e.Item.FindControl("cboSubscribers")).SelectedItem.Text;

                    TextBox txtExecutionInterval = (TextBox)e.Item.FindControl("txtExecutionInterval");
                    if (txtExecutionInterval != null)
                    {
                        int interval;
                        Int32.TryParse(txtExecutionInterval.Text, out interval);

                        instance.ExecutionConfiguration = new Proxy.JobExecutionConfigurations
                        {
                            IntervalType   = Proxy.IntervalTypesEnum.BySecond,
                            ExecutionTicks = TimeSpan.FromSeconds(interval).Ticks.ToString()
                        };
                    }

                    TextBox txtStartLogDate = (TextBox)e.Item.FindControl("txtStartLogDate");
                    if (txtStartLogDate != null)
                    {
                        DateTime startLogDate;
                        DateTime.TryParse(txtStartLogDate.Text, out startLogDate);
                        instance.StartLogDate = startLogDate;
                    }

                    instance = ws.SaveChannel(instance);

                    this.grdInstances.EditItemIndex = -1;
                    this.Fetch();

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

                    if (id != 0)
                    {
                        Publisher.Proxy.ChannelRefInfo instance = ws.GetChannel(id);

                        ws.RemoveChannel(instance);

                        this.grdInstances.EditItemIndex = -1;
                        this.Fetch();

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

                this.grdEvents.EditItemIndex = -1;
                this.FetchEvents(id);
            }
            else if (e.CommandName == "GoToSubscriber")
            {
                Label lblSubscriberServiceUrl = (Label)e.Item.FindControl("lblSubscriberServiceUrl");

                if (lblSubscriberServiceUrl != null)
                {
                    Response.Redirect(string.Format("Subscribers.aspx?subscriberUrl={0}&idAdmin={1}&caller=Publishers.aspx",
                                                    lblSubscriberServiceUrl.Text, this.IdAdmin), false);
                }
            }
        }