Exemplo n.º 1
0
        public static PR SendSMS(string Number, string Message, string CountryCode = null, bool Force = false)
        {
            if (!Force && !Application.Configurations.SMSConfiguration.SMSEnabled)
            {
                return(new PR(PS.Success));
            }
            if (CountryCode == null)
            {
                CountryCode = Application.Configurations.SMSConfiguration.DefaultCountryCode;
            }

            Number  = PhoneNumbers.EnsureCountryCode(Number, CountryCode);
            Message = Unicode.ConvertToUnicode(Message);

            switch (Application.Configurations.SMSConfiguration.Provider)
            {
            case SMSProviders.PostToUrl:
                return(SendByPostToUrl(Number, Message));

            case SMSProviders.GetUrl:
                return(SendByGetUrl(Number, Message));

            case SMSProviders.GetUrl2:
                return(SendByGetUrl2(Number, Message));

            default:
                return(new PR(PS.Warning));
            }
        }