Exemplo n.º 1
0
        /// <summary>
        /// Return true if the subscription name is in the d/b.
        /// </summary>
        /// <param name="subscriptionName">Subscription name to check.</param>
        /// <returns>Returns true if subscription name is in the d/b. False otherwise.</returns>
        public bool IsSubscriptionRegistered(string subscriptionName)
        {
            SubscriptionInfoDataModel sidm = this.sids.SelectBySubscription(subscriptionName);

            if (sidm == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds a subscription with a name and its description
        /// </summary>
        /// <param name="subscription">Name of the subscription.</param>
        /// <param name="description">Descripton of the subscription.</param>
        /// <returns>Returns Success or an error.</returns>
        public PushMessageError AddSubscriptionInfo(string subscription, string description)
        {
            // See if we already have this subscription.
            SubscriptionInfoDataModel sidm = this.sids.SelectBySubscription(subscription);

            if (sidm == null)
            {
                sidm = new SubscriptionInfoDataModel(subscription, description);
                this.sids.Insert(sidm);
                return(PushMessageError.Success);
            }

            // We are allowing the same subscription again. It is ignored.
            return(PushMessageError.Success);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Delete the subscription given its name
        /// Does not clean up the devices that have signed up.
        /// Clean up devices before deleting subscription info.
        /// </summary>
        /// <param name="subscription">Name of the subscription to delete.</param>
        public PushMessageError DeleteSubscriptionInfo(string subscription)
        {
            if (string.IsNullOrEmpty(subscription))
            {
                return(PushMessageError.ErrorSubscriptionNameNotFound);
            }

            // Eetrieve the subscription from the system. We are not cleaning signups here.
            SubscriptionInfoDataModel sidm = this.sids.SelectBySubscription(subscription);

            if (sidm != null)
            {
                this.sids.Delete(sidm);
                return(PushMessageError.Success);
            }
            else
            {
                return(PushMessageError.ErrorInternalError);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Retrieve a subscription from the d/b.
        /// </summary>
        /// <param name="subscription">Name of the subscription to search.</param>
        /// <returns>Return the subscription details: name and descriptions.</returns>
        public SubscriptionInfoDataModel GetSubscriptionInfo(string subscription)
        {
            SubscriptionInfoDataModel sidm = this.sids.SelectBySubscription(subscription);

            return(sidm);
        }