예제 #1
0
        private void sendButton_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.toTextBox.Text) &&
                !string.IsNullOrEmpty(this.msgTextBox.Text))
            {
                var sms = new SMSClient();
                try
                {
                    this.Enabled = false;
                    this.Cursor  = Cursors.WaitCursor;

                    if (!sms.Send(this.toTextBox.Text, this.msgTextBox.Text))
                    {
                        FormManager.Alert("Wystapił bład w trakcie wysyłania SMSa");
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    this.Cursor  = Cursors.Default;
                    this.Enabled = true;
                }
            }
        }
예제 #2
0
        protected bool SendSMS(string number, string message)
        {
            SMSServiceConfiguration config       = new SMSServiceDAO().GetSMSConfig();
            SMSClientConfiguration  clientConfig = new SMSClientConfiguration()
            {
                Username   = config.Username
                , Password = config.Password
                , TestOnly = config.IsTest
                , Sender   = config.Sender
            };
            SMSClient client = new SMSClient(clientConfig);

            return(client.Send(number, message, config.IsFlash));
        }