Exemplo n.º 1
0
        private static void SendMessages()
        {
            BulkSMS_API api = new BulkSMS_API(sAPIBaseURL, sAPITokenId, sSecret);

            List <Message> messages = new List <Message>
            {
                new Message {
                    to = "+440123456789", body = "Just testing 1"
                },
                new Message {
                    to = "+440123456789", body = "Just testing 2"
                }
            };

            api.Send(messages);
        }
Exemplo n.º 2
0
        private void BulkSMS_Send(object sender, EventArgs e)
        {
            if (BulkSMS_MessagesToSend.Rows.Count == 0)
            {
                MessageBox.Show("No messages.");
                return;
            }

            List <BulkSMS.Message> MessagesToSend = new List <BulkSMS.Message>();

            foreach (DataGridViewRow dr in BulkSMS_MessagesToSend.Rows)
            {
                if (!String.IsNullOrEmpty((string)dr.Cells["TelephoneNumber"].Value))
                {
                    MessagesToSend.Add(
                        new BulkSMS.Message
                    {
                        to   = (string)dr.Cells["TelephoneNumber"].Value,
                        body = (string)dr.Cells["Message"].Value
                    }
                        );
                }
            }

            try
            {
                int i = 0;
                i++;
                api.Send(MessagesToSend);
                UpdateCredits();
            }
            catch (BulkSMSException bx)
            {
                MessageBox.Show(
                    bx.Message +
                    Environment.NewLine +
                    Environment.NewLine +
                    bx.BulkSmsError.title);
            }
        }