Пример #1
0
        private void btnSendEmail_Click(object sender, EventArgs e)
        {
            try
            {
                btnSendEmail.Enabled = false;
                string error = string.Empty;

                string msg = txtMessage.Text.Trim();


                if (string.IsNullOrEmpty(txtTo.Text.Trim()))
                {
                    error += "Required : To" + Environment.NewLine;
                }

                if (string.IsNullOrEmpty(msg))
                {
                    error += "Cannot send empty message..";
                }


                if (!string.IsNullOrEmpty(error))
                {
                    ENUtils.ShowMessage(error);
                    return;
                }

                EuroSMS sms = new EuroSMS();


                string[] toNumbers = txtTo.Text.Split(',').Where(c => c != string.Empty).Distinct().ToArray <string>();



                Thread smsThread = new Thread(delegate()
                {
                    SendSMS(sms, toNumbers, msg);


                    if (SMSBunchMessages == true)
                    {
                        SendSMSBunch();
                        SMSBunchMessages = false;
                        //txtMessage.ReadOnly = false;
                    }
                });

                smsThread.Start();



                General.SaveSentSMS(msg, txtTo.Text.ToStr());


                if (AppVars.objPolicyConfiguration.DisablePopupNotifications.ToBool() == false)
                {
                    RadDesktopAlert alert = new RadDesktopAlert();
                    alert.CaptionText = "message sent successfully";

                    alert.ContentText  = msg;
                    alert.ContentImage = Resources.Resource1.email;
                    alert.Show();
                }

                this.Close();
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
            finally
            {
                btnSendEmail.Enabled = true;
            }
        }