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); } }
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; } }
/* * // Messages... * list.Add(}); * list.Add(new NotificationEnableType { EventType = NotificationEventTypeCodeType.MyMessageseBayMessage, EventEnable = EnableCodeType.Enable }); * list.Add(new NotificationEnableType { EventType = NotificationEventTypeCodeType.MyMessagesM2MMessage, EventEnable = EnableCodeType.Enable }); * * // Feedback * list.Add(new NotificationEnableType { EventType = NotificationEventTypeCodeType.FeedbackReceived, EventEnable = EnableCodeType.Enable }); * // FeedbackStarChanged * * // Sales * * list.Add(new NotificationEnableType { EventType = NotificationEventTypeCodeType.AuctionCheckoutComplete, EventEnable = EnableCodeType.Enable }); * list.Add(new NotificationEnableType { EventType = NotificationEventTypeCodeType.BestOffer, EventEnable = EnableCodeType.Enable }); * list.Add(new NotificationEnableType { EventType = NotificationEventTypeCodeType.BidReceived, EventEnable = EnableCodeType.Enable }); * list.Add(new NotificationEnableType { EventType = NotificationEventTypeCodeType.FixedPriceTransaction, EventEnable = EnableCodeType.Enable }); * // ItemSold == Only shown when a purchase happens and it ends the listing. The FixedPriceTransaction also occurs. * list.Add(new NotificationEnableType { EventType = NotificationEventTypeCodeType.ItemMarkedPaid, EventEnable = EnableCodeType.Enable }); * * * // Listings Ended * list.Add(new NotificationEnableType { EventType = NotificationEventTypeCodeType.ItemSuspended, EventEnable = EnableCodeType.Enable }); * list.Add(new NotificationEnableType { EventType = NotificationEventTypeCodeType.ItemClosed, EventEnable = EnableCodeType.Enable }); * list.Add(new NotificationEnableType { EventType = NotificationEventTypeCodeType.ItemUnsold, EventEnable = EnableCodeType.Enable }); * * * // Request Totals * list.Add(new NotificationEnableType { EventType = NotificationEventTypeCodeType.CheckoutBuyerRequestsTotal, EventEnable = EnableCodeType.Enable }); * * // Disputes * list.Add(new NotificationEnableType { EventType = NotificationEventTypeCodeType.BuyerResponseDispute, EventEnable = EnableCodeType.Enable }); * // INRBuyerClosedDispute * // INRBuyerOpenedDispute * // INRBuyerRespondedToDispute * // * * // WTF * list.Add(new NotificationEnableType { EventType = NotificationEventTypeCodeType.TokenRevocation, EventEnable = EnableCodeType.Enable }); * list.Add(new NotificationEnableType { EventType = NotificationEventTypeCodeType.UserIDChanged, EventEnable = EnableCodeType.Enable }); */ protected override void ExecuteInternal() { ApiContext apiContext = this.ApiContext; SetNotificationPreferencesCall apiCall = new SetNotificationPreferencesCall(apiContext); // Application Delivery Preferences { ApplicationDeliveryPreferencesType applicationDeliveryPreferences = new ApplicationDeliveryPreferencesType(); applicationDeliveryPreferences.ApplicationEnable = EnableCodeType.Enable; applicationDeliveryPreferences.DeviceType = DeviceTypeCodeType.ClientAlerts; applicationDeliveryPreferences.AlertEnable = EnableCodeType.Disable; apiCall.ApplicationDeliveryPreferences = applicationDeliveryPreferences; } // UserDeliveryPreferenceList { apiCall.UserDeliveryPreferenceList = new NotificationEnableTypeCollection(); foreach (NotificationPreference item in this.NotificationPreferences) { if (item.Dirty) { NotificationEnableType enableType = new NotificationEnableType() { EventType = item.EventType, EventEnable = item.Enabled ? EnableCodeType.Enable : EnableCodeType.Disable }; apiCall.UserDeliveryPreferenceList.Add(enableType); } } } apiCall.Execute(); foreach (NotificationPreference item in this.NotificationPreferences) { item.Dirty = false; } }
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); } }