예제 #1
0
        public static bool SendMessage(string number, string message)
        {
            if (!Enabled())
            {
                return(false);
            }

            SmsProvider provider = null;

            if (ClickatellProvider.Enable())
            {
                provider = ClickatellProvider;
            }

            if (provider == null && TwilioProvider.Enable())
            {
                provider = TwilioProvider;
            }

            if (SmscProvider.Enable() &&
                (provider == null ||
                 SmscProvider.SuitableNumber(number)))
            {
                provider = SmscProvider;
            }

            if (provider == null)
            {
                return(false);
            }

            return(provider.SendMessage(number, message));
        }
예제 #2
0
        public static bool SendMessage(string number, string message)
        {
            if (!Enabled())
            {
                return(false);
            }

            SmsProvider provider = null;

            if (ClickatellProvider.Enable())
            {
                provider = ClickatellProvider;
            }

            string smsUsa;

            if (ClickatellUSAProvider.Enable() &&
                !string.IsNullOrEmpty(smsUsa = KeyStorage.Get("clickatellUSA")) && Regex.IsMatch(number, smsUsa))
            {
                provider = ClickatellUSAProvider;
            }

            if (provider == null && TwilioProvider.Enable())
            {
                provider = TwilioProvider;
            }

            if (provider == null && TwilioSaaSProvider.Enable())
            {
                provider = TwilioSaaSProvider;
            }

            if (SmscProvider.Enable() &&
                (provider == null ||
                 SmscProvider.SuitableNumber(number)))
            {
                provider = SmscProvider;
            }

            if (provider == null)
            {
                return(false);
            }

            return(provider.SendMessage(number, message));
        }