Ejemplo n.º 1
0
        private void BtnSetNotificationPreferences_Click(object sender, System.EventArgs e)
        {
            try
            {
                TxtStatus.Text = "";

                SetNotificationPreferencesCall apicall = new SetNotificationPreferencesCall(Context);
                apicall.ApplicationDeliveryPreferences = new ApplicationDeliveryPreferencesType();
                apicall.ApplicationDeliveryPreferences.ApplicationEnable = (EnableCodeType)Enum.Parse(typeof(EnableCodeType), CboStatus.SelectedItem.ToString());

                if (TxtUrl.Text.Length > 0)
                {
                    apicall.ApplicationDeliveryPreferences.ApplicationURL = TxtUrl.Text;
                }

                NotificationEnableTypeCollection notifications = new NotificationEnableTypeCollection();
                for (int inx = 0; inx < LblEvents.Length; inx++)
                {
                    NotificationEnableType net = new NotificationEnableType();
                    net.EventType   = (NotificationEventTypeCodeType)Enum.Parse(typeof(NotificationEventTypeCodeType), LblEvents[inx].Text);
                    net.EventEnable = (EnableCodeType)Enum.Parse(typeof(EnableCodeType), CboEventStatus[inx].SelectedItem.ToString());
                    notifications.Add(net);
                }

                apicall.SetNotificationPreferences(notifications);

                TxtStatus.Text = apicall.ApiResponse.Ack.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 2
0
        public IHttpActionResult SetNotificationPreferences()
        {
            try
            {
                apiContext = GetApiContext();

                SetNotificationPreferencesCall     call     = new SetNotificationPreferencesCall(apiContext);
                ApplicationDeliveryPreferencesType delivery = new ApplicationDeliveryPreferencesType();
                delivery.AlertEnable                = EnableCodeType.Enable;
                delivery.AlertEmail                 = "mailto://[email protected]";
                delivery.ApplicationEnable          = EnableCodeType.Enable;
                delivery.ApplicationURL             = "XXXXXXX/api/main/GetEbayNotification";
                delivery.AlertEnableSpecified       = true;
                delivery.ApplicationEnableSpecified = true;
                delivery.DeviceType                 = DeviceTypeCodeType.Platform;
                delivery.DeviceTypeSpecified        = true;

                NotificationEnableType notification =
                    new NotificationEnableType
                {
                    EventEnable          = EnableCodeType.Enable,
                    EventEnableSpecified = true,
                    EventType            = NotificationEventTypeCodeType.BidReceived,
                    EventTypeSpecified   = true
                };

                NotificationEnableType notification2 =
                    new NotificationEnableType
                {
                    EventEnable          = EnableCodeType.Enable,
                    EventEnableSpecified = true,
                    EventType            = NotificationEventTypeCodeType.BestOffer,
                    EventTypeSpecified   = true
                };

                NotificationEnableType notification3 =
                    new NotificationEnableType
                {
                    EventEnable          = EnableCodeType.Enable,
                    EventEnableSpecified = true,
                    EventType            = NotificationEventTypeCodeType.AskSellerQuestion,
                    EventTypeSpecified   = true
                };

                call.SetNotificationPreferences(delivery, new NotificationEnableTypeCollection(new[] { notification, notification2, notification3 }));

                return(Ok());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }