Beispiel #1
0
        private void SendMessage(string no, string msg)
        {
            System.Threading.Thread.Sleep(2000);
            SmsSubmitPdu pdu = new SmsSubmitPdu(msg, no, "");

            CommSetting.comm.SendMessage(pdu);
        }
Beispiel #2
0
        public void SendMessage(ISmsDetails Item)
        {
            try
            {
                SmsSubmitPdu sender = new SmsSubmitPdu(Item.Message, Item.Recipient);
                _server.SendMessage(sender);

                OnMessageSent.CrossInvoke(this, new MessageSentEventArgs()
                {
                    guid          = Guid.NewGuid(),
                    MessageDetail = Item,
                    SentDate      = DateTime.Now
                });
            }
            catch (Exception ex)
            {
                OnMessageSendingFailed.CrossInvoke(this, new MessageSendingFailedEventArgs()
                {
                    DateSent    = DateTime.Now,
                    ErrorCode   = Guid.NewGuid().ToString(),
                    ErrorNumber = ex.HResult,
                    Message     = ex.InnerException.Message ?? ex.Message
                });
            }
        }
Beispiel #3
0
        /* Call this method to send a message */
        /// <summary>
        /// Method for sending message basing on phone number and sms message
        /// <summary/>
        /// <param name="cellNumber">
        /// A string of the phone number to send the message to
        /// <param/>
        /// <param name="smsMessage">
        /// A string of the text Message to send to the phone number
        /// <param/>
        public void SendMessage(string cellNumber, string smsMessage)
        {
            SmsSubmitPdu pdu;

            string CellNumber = cellNumber.ToString();
            string SMSMessage = smsMessage.ToString();

            try
            {
                if (CommSetting.comm.IsConnected() == true)
                {
                    try
                    {
                        pdu = new SmsSubmitPdu(SMSMessage, CellNumber, "");
                        CommSetting.comm.SendMessage(pdu);
                    }
                    catch (Exception e)
                    {
                        /* Message showing error to send the message */
                        //Console.WriteLine("Failed to send Message: " + e.Message);
                        CommSetting.comm.Close();
                    }
                }
                else
                {
                    /* Message to show that no GSM device is connected */
                    //Console.WriteLine("No GSM device connected");
                }
            }
            catch (Exception e)
            {
                /*Message to show that there is a connection error */
                //Console.WriteLine("There was a connected error, try and check your connection. " + e.Message);
            }
        }
        private void SendInvalidCustomerNotice(string sSMSSender, string sMesssage)
        {
            try
            {
                if (sSMSSender.Length > 11 || sSMSSender.Length == 11)
                {
                    sSMSSender = sSMSSender.Replace("+880", "0");
                }

                else
                {
                    return;
                }
                string PushMessage = "";
                PushMessage = sMesssage;
                SmsSubmitPdu pdu;
                pdu = new SmsSubmitPdu(sMesssage, sSMSSender.Trim(), "");
                //CommSettingBAL.Comm.SendMessage(pdu);
                ModemCommunication.gsObj.SendMessage(pdu);
                return;
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #5
0
        public Boolean send_message(string number, string message)
        {
            Boolean ok = false;

            try
            {
                Cursor.Current = Cursors.WaitCursor;
                try
                {
                    SmsSubmitPdu pdu;
                    byte         dcs = (byte)DataCodingScheme.GeneralCoding.Alpha7BitDefault;
                    pdu = new SmsSubmitPdu(message, Convert.ToString(number), dcs);

                    Thread.Sleep(3000);
                    comm.SendMessage(pdu);
                    ok = true;
                }
                catch (Exception ex)
                {
                    lbl_status.Invoke(new Action(() =>
                    {
                        lbl_status.Text = "Func :send_message [2nd level]" + ex.Message;
                    }));
                }
            }
            catch (Exception ex)
            {
                lbl_status.Invoke(new Action(() =>
                {
                    lbl_status.Text = "Func :send_message [1st level]" + ex.Message;
                }));
            }
            return(ok);
        }
        private void ConfirmationPushtoSender(string sSMSSender, string message)
        {
            try
            {
                string Fullmessage = string.Empty;
                if (sSMSSender.Length > 11 || sSMSSender.Length == 11)
                {
                    sSMSSender = sSMSSender.Replace("+880", "0");
                }
                else
                {
                    return;
                }
                SmsSubmitPdu pdu;
                pdu = new SmsSubmitPdu(message, sSMSSender.Trim(), "");
                ModemCommunication.gsObj.SendMessage(pdu);

                DataSqlQuery aDaCommonquery = new DataSqlQuery();
                aDaCommonquery.TradeConfirmedStatusUpdate(sSMSSender.Trim());
                SendMessageloadConsolApplicationtDesign("0", sSMSSender, message);
            }
            catch (Exception)
            {
                throw;
            }
        }
        private void MoneyTrans_ConfirmationPushtoSender(string sSMSSender, string Message, int SMSID)
        {
            try
            {
                if (sSMSSender.Length > 11 || sSMSSender.Length == 11)
                {
                    sSMSSender = sSMSSender.Replace("+880", "0");
                }

                else
                {
                    return;
                }
                // Send an SMS message
                SmsSubmitPdu pdu;
                // The straightforward version

                pdu = new SmsSubmitPdu(Message, sSMSSender.Trim(), ""); // "" indicate SMSC No
                ModemCommunication.gsObj.SendMessage(pdu);
                //string CurrentDateTime = String.Format("{0:dd-MMM-yyyy HH:mm:ss tt}", System.DateTime.Now);
                DataSqlQuery oDACommonQuery = new DataSqlQuery();
                oDACommonQuery.MoneyTransSMS_StatusUpdate(SMSID);
            }
            catch (Exception exc)
            {
                //MessageBox.Show(exc.Message);
            }
        }
Beispiel #8
0
        public bool sendSMS(string CELL_Number, string SMS_Message)
        {
            bool status = false;

            try
            {
                if (comm != null)
                {
                    Cursor.Current = Cursors.WaitCursor;

                    pdu1 = new SmsSubmitPdu(SMS_Message, CELL_Number, "");

                    comm.SendMessage(pdu1);

                    Cursor.Current = Cursors.Default;

                    //MessageBox.Show("M E S S A G E - S E N T", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    status = true;
                }
            }
            catch (Exception E5)
            {
                //MessageBox.Show("Error Sending SMS To Destination Address\r\n\n Connection Has Been Terminated !!!\r\n\n", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //comm.Close();
                status = false;
            }
            return(status);
        }
Beispiel #9
0
 private bool SendSMS(string Number, string Content, byte dcs)
 {
     try
     {
         SmsSubmitPdu sms      = new SmsSubmitPdu(Content, Number, dcs);
         string       pdu      = sms.ToString(false);
         string       response = ExecuteCommands("AT+CMGS=" + sms.ActualLength.ToString() + "", 1000);
         if (!CheckNEXT(response))
         {
             LoggingData.WriteLog("Send SMS failed. GSM Modem does not respond to commands");
             return(false);
         }
         response = ExecuteCommands(pdu + char.ConvertFromUtf32(26), 10000);
         if (!CheckOK(response))
         {
             LoggingData.WriteLog("Send SMS failed. GSM Modem does not respond to commands");
             return(false);
         }
         ;
         return(true);
     }
     catch (Exception ex)
     {
         LoggingData.WriteLog(ex);
         return(false);
     }
 }
        public bool Sendsms(String msg, String contact)
        {
            bool bol = false;

            try
            {
                //var phoneNumber = contact;
                var phoneNumber = "+923138251224";
                var pdu         = new SmsSubmitPdu(msg, contact, string.Empty);
                //SmsSubmitPdu pdu;
                //byte msg = (byte)DataCodingScheme.DataCoding.Alpha7BitDefault;
                //pdu = new SmsSubmitPdu(txtAddress.Text, txtContact.Text, msg);
                int time = 3;
                for (int i = 0; i < time; i++)
                {
                    gsmcom.SendMessage(pdu);
                }

                return(true);
            }
            catch (Exception)
            {
                MessageBox.Show("modem is not available");
                return(false);
            }
            return(true);
        }
        private void btnSend_Click(object sender, EventArgs e)
        {
            Operation code = new Operation();

            try
            {
                txtDonorId.Text   = "0343";
                txtDonorName.Text = "Hello there";
                txtNumber.Text    = "09226663075";
                Cursor.Current    = Cursors.WaitCursor;
                txtMessage.Text   = "Respected " + txtDonorName.Text + ", Welcome to Clapp Trust. Your donor ID is " + txtDonorId.Text + ". Our online system will send you SMS whenever your donation is received.";
                try
                {
                    SmsSubmitPdu pdu;
                    byte         dcs = (byte)DataCodingScheme.GeneralCoding.Alpha7BitDefault;
                    pdu = new SmsSubmitPdu(txtMessage.Text, Convert.ToString(txtNumber.Text), dcs);
                    int times = 1;
                    for (int i = 0; i < times; i++)
                    {
                        comm.SendMessage(pdu);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Modem is not available");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception ex :" + ex.Message);
            }
        }
Beispiel #12
0
        private void reSendMess(DataGridView tbl, string clmName, string clmConTentMess, string clmNbPhone, string loaihopthu)
        {
            DataGridViewSelectedRowCollection selectedRows = tbl.SelectedRows;

            if (selectedRows.Count == 1)
            {
                DataGridViewRow row = selectedRows[0];
                // danh dau tinh trang
                int    j      = 0;
                string hopthu = "";
                try
                {
                    SmsSubmitPdu pdu = new SmsSubmitPdu(row.Cells[clmConTentMess].Value.ToString(), row.Cells[clmNbPhone].Value.ToString(), "");
                    j      = 1;
                    hopthu = loaihopthu;
                    common.Constants.comm.SendMessage(pdu);
                }
                catch (Exception)
                {
                    j      = 0;
                    hopthu = "";
                    MessageBox.Show("Send Message Failed");
                }

                bool result = HopThuDiDAO.updateStatusReSentMess(j, hopthu, row.Cells[clmName].Value.ToString());
            }
            else if (selectedRows.Count > 1)
            {
                MessageBox.Show("Ban chi duoc chon 1 tin nhan de gui lai .");
            }
            else
            {
                MessageBox.Show("Ban phai chon tin nhan de gui lai");
            }
        }
Beispiel #13
0
        public void Send(string message, string nr)
        {
            SmsSubmitPdu pdu = new SmsSubmitPdu(message, nr, "");

            try
            {
                if (!comm.IsOpen())
                {
                    comm.Open();
                }

                if (!comm.IsConnected())
                {
                    Singleton.Show_MessageBox("błąd portu");
                    return;
                }

                /*if (comm.GetPinStatus() != PinStatus.Ready) {
                 *  comm.EnterPin(PIN);
                 *  Thread.Sleep(1000);
                 * }*/

                comm.SendMessage(pdu);
                Thread.Sleep(1000);
            }
            catch (Exception ex)
            {
                Singleton.Show_MessageBox(ex.Message);
                return;
            }
            //Singleton.Show_MessageBox("wysyłam " + message + "na numer: " + nr);
        }
Beispiel #14
0
 private void ShowMessage(SmsPdu pdu)
 {
     if (pdu is SmsSubmitPdu)
     {
         // Stored (sent/unsent) message
         SmsSubmitPdu data = (SmsSubmitPdu)pdu;
         Output("SENT/UNSENT MESSAGE");
         Output("Recipient: " + data.DestinationAddress);
         Output("Message text: " + data.UserDataText);
         Output("-------------------------------------------------------------------");
         return;
     }
     if (pdu is SmsDeliverPdu)
     {
         // Received message
         SmsDeliverPdu data = (SmsDeliverPdu)pdu;
         Output("Mensaje Recibido");
         Output("Emisor: " + data.OriginatingAddress);
         Output("Hora de envio: " + data.SCTimestamp.ToString());
         Output("Texto del mensaje: " + data.UserDataText);
         Output("-------------------------------------------------------------------");
         try
         {
             var request  = (HttpWebRequest)WebRequest.Create(Constants.getServer() + "/api/v1/sms/create");
             var postData = MessageToJson(data.SCTimestamp.ToString(), data.OriginatingAddress, data.UserDataText, DateTime.Now.Ticks.ToString());
             var data2    = Encoding.UTF8.GetBytes(postData);
             request.Method        = "POST";
             request.ContentType   = "application/json";
             request.ContentLength = data2.Length;
             using (var stream = request.GetRequestStream())
             {
                 stream.Write(data2, 0, data2.Length);
             }
             var response       = (HttpWebResponse)request.GetResponse();
             var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
             response.Close();
         }
         catch (System.Net.WebException wx)
         {
             MessageBox.Show(wx.Message);
         }
         CommSetting.comm.DeleteMessages(DeleteScope.All, PhoneStorageType.Sim);
         return;
     }
     if (pdu is SmsStatusReportPdu)
     {
         // Status report
         SmsStatusReportPdu data = (SmsStatusReportPdu)pdu;
         Output("STATUS REPORT");
         Output("Recipient: " + data.RecipientAddress);
         Output("Status: " + data.Status.ToString());
         Output("Timestamp: " + data.DischargeTime.ToString());
         Output("Message ref: " + data.MessageReference.ToString());
         Output("-------------------------------------------------------------------");
         return;
     }
     Output("Unknown message type: " + pdu.GetType().ToString());
 }
Beispiel #15
0
        private void btnSendMessage_Click(object sender, System.EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            try
            {
                // Send an SMS message
                SmsSubmitPdu pdu;
                bool         alert   = chkAlert.Checked;
                bool         unicode = chkUnicode.Checked;

                if (!alert && !unicode)
                {
                    // The straightforward version
                    pdu = new SmsSubmitPdu(txt_message.Text, txt_destination_numbers.Text, "");                     // "" indicate SMSC No
                }
                else
                {
                    // The extended version with dcs
                    byte dcs;
                    if (!alert && unicode)
                    {
                        dcs = DataCodingScheme.NoClass_16Bit;
                    }
                    else if (alert && !unicode)
                    {
                        dcs = DataCodingScheme.Class0_7Bit;
                    }
                    else if (alert && unicode)
                    {
                        dcs = DataCodingScheme.Class0_16Bit;
                    }
                    else
                    {
                        dcs = DataCodingScheme.NoClass_7Bit;                         // should never occur here
                    }
                    pdu = new SmsSubmitPdu(txt_message.Text, txt_destination_numbers.Text, "", dcs);
                }

                // Send the same message multiple times if this is set
                int times = chkMultipleTimes.Checked ? int.Parse(txtSendTimes.Text) : 1;

                // Send the message the specified number of times
                for (int i = 0; i < times; i++)
                {
                    CommSetting.comm.SendMessage(pdu);
                    Output("Message {0} of {1} sent.", i + 1, times);
                    Output("");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            Cursor.Current = Cursors.Default;
        }
Beispiel #16
0
        private Dictionary <string, string> MessageDetails(SmsPdu pdu)
        {
            Dictionary <string, string> messageDetails = new Dictionary <string, string>();

            if (pdu is SmsSubmitPdu)
            {
                // Stored (sent/unsent) message
                SmsSubmitPdu data = (SmsSubmitPdu)pdu;

                string recipient = data.DestinationAddress.ToString();
                string message   = data.UserDataText.ToString();

                messageDetails.Add("recipient", recipient);
                messageDetails.Add("message", message);

                return(messageDetails);
            }
            else if (pdu is SmsDeliverPdu)
            {
                // Received message
                SmsDeliverPdu data = (SmsDeliverPdu)pdu;

                string sender    = data.OriginatingAddress.ToString();
                string timeStamp = data.SCTimestamp.ToString();
                string message   = data.UserDataText.ToString();

                messageDetails.Add("sender", sender);
                messageDetails.Add("timeStamp", timeStamp);
                messageDetails.Add("message", message);

                return(messageDetails);
            }
            else if (pdu is SmsStatusReportPdu)
            {
                // Status report
                SmsStatusReportPdu data = (SmsStatusReportPdu)pdu;

                string recipient  = data.RecipientAddress;
                string status     = data.Status.ToString();
                string timeStamp  = data.DischargeTime.ToString();
                string messageRef = data.MessageReference.ToString();

                messageDetails.Add("recipient", recipient);
                messageDetails.Add("status", status);
                messageDetails.Add("timeStamp", timeStamp);
                messageDetails.Add("messageRef", messageRef);

                return(messageDetails);
            }

            else
            {
                return(messageDetails);
            }
            /* Error Message showing unknown message type */
            //Console.WriteLine("Unknown message type: " + pdu.GetType().ToString());
        }
Beispiel #17
0
        public bool sendlongMsg(string num, string msg)
        {
            Cursor.Current = Cursors.WaitCursor;
            bool Retourne = false;

            try
            {
                // Send an SMS message

                string message = msg;
                if (msg.Length >= 140)
                {
                    double t = message.Length / 140;
                    double f = Math.Round(t);
                    int    k = int.Parse(f.ToString()) + 1;
                    pdus = new OutgoingSmsPdu[k];
                    string ps  = message.Substring(0, 140);
                    int    dep = 0;

                    for (int i = 0; i < k; i++)
                    {
                        pdu     = new SmsSubmitPdu(ps, num);
                        pdus[i] = pdu;
                        dep     = dep + ps.Length;

                        if ((message.Length - dep) <= 140 && (message.Length - dep) > 2)
                        {
                            ps = message.Substring(ps.Length, message.Length - 1 - dep);
                        }
                        else if ((message.Length - dep) >= 139)
                        {
                            ps = message.Substring(dep, 140);
                        }
                    }

                    if (!pubCon.comm.IsOpen())
                    {
                        comm.Open();
                    }
                    pubCon.comm.SendMessages(pdus);
                    MessageBox.Show("Message envoye avec succes !!!!");
                    Retourne = true;
                }

                // Send the same message multiple times if this is set
            }

            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message);
                Retourne = false;
            }

            Cursor.Current = Cursors.Default;

            return(Retourne);
        }
        public async Task SendMessageASync(string textmessage, string destinationnumber, bool alert, bool unicode,
                                           int times)
        {
            // Send an SMS message
            SmsSubmitPdu pdu;


            if (!alert && !unicode)
            {
                // The straightforward version
                pdu = new SmsSubmitPdu
                          (textmessage, destinationnumber, "");
            }
            else
            {
                // The extended version with dcs
                byte dcs;
                if (!alert && unicode)
                {
                    dcs = DataCodingScheme.NoClass_16Bit;
                }
                else if (alert && !unicode)
                {
                    dcs = DataCodingScheme.Class0_7Bit;
                }
                else if (alert && unicode)
                {
                    dcs = DataCodingScheme.Class0_16Bit;
                }
                else
                {
                    dcs = DataCodingScheme.NoClass_7Bit;
                }

                pdu = new SmsSubmitPdu
                          (textmessage, destinationnumber, "", dcs);
            }

            await Task.Run(() =>
            {
                while (times > 0)
                {
                    try
                    {
                        Model.SendMessage(pdu);
                        times--;
                    }
                    catch (CommException)
                    {
                    }
                    catch (Exception)
                    {
                    }
                }
            });
        }
Beispiel #19
0
        private void UpdatePduString()
        {
            var pdu = new SmsSubmitPdu(smsMessageTextBox.Text, smsMessagePhoneNumberTextBox.Text);
            var pid = (int)Enum.Parse(typeof(ProtocolIdentifier), pidComboBox.SelectedValue.ToString());
            var dcs = (int)Enum.Parse(typeof(DataCodingScheme), dcsComboBox.SelectedValue.ToString());

            pdu.ProtocolID          = (byte)pid;
            pdu.DataCodingScheme    = (byte)dcs;
            pdu.RequestStatusReport = requestStatusReportCheckBox.Checked;
            pduLengthLabel.Text     = pdu.ActualLength.ToString();
            pduTextBox.Text         = pdu.ToString();
        }
Beispiel #20
0
        public void SendSMS(string CELL_Number, string SMS_Message)
        {
            SmsSubmitPdu pdu1;

            if (comm.IsConnected() == true)
            {
                pdu1 = new SmsSubmitPdu(SMS_Message, CELL_Number, "");

                comm.SendMessage(pdu1);
                comm.Close();
            }
        }
Beispiel #21
0
 private void btnKirim_Click(object sender, EventArgs e)
 {
     try
     {
         SmsSubmitPdu pdu;
         pdu = new SmsSubmitPdu(rchPesan.Text, txtHP.Text, "");
         comm.SendMessage(pdu);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Beispiel #22
0
 public static void SendMessage(GsmCommMain comm, string phonenumber, string text)
 {
     try
     {
         _logger.Info($"Sending SMS to {phonenumber}");
         byte         dcs = (byte)DataCodingScheme.GeneralCoding.Alpha16Bit;
         SmsSubmitPdu pdu = new SmsSubmitPdu(text, phonenumber, dcs);
         comm.SendMessage(pdu);
     }
     catch (Exception ex)
     {
         _logger.Fatal($"Error while sending SMS to {phonenumber}: {ex.Message} ({ex.GetType()})");
     }
 }
        private void BulkSend()
        {
            if (commMain != null && commMain.IsConnected())
            {
                int counterNumber = 0;
                try
                {
                    foreach (DataGridView item in dataGridView_ClientList.Rows)
                    {
                        string       cpNumber = dataGridView_ClientList.SelectedRows[0].Cells[4].Value.ToString();
                        SmsSubmitPdu pdu;
                        int          count    = 0;
                        int          countPos = 0;

                        foreach (char c in tb_message.Text)
                        {
                            count++;
                            if (count >= 150)
                            {
                                string firstFivChar = new string(tb_message.Text.Substring(countPos, count).ToArray());
                                pdu = new SmsSubmitPdu(firstFivChar, cpNumber, string.Empty);
                                commMain.SendMessage(pdu);
                                countPos = countPos + 150;
                                count    = count - count;
                            }
                        }

                        if (count <= 150)
                        {
                            string lastText = new string(tb_message.Text.Substring(countPos, count).ToArray());
                            pdu = new SmsSubmitPdu(lastText, cpNumber, "");
                            commMain.SendMessage(pdu);
                            countPos = countPos + 150;
                            count    = count - count;
                        }

                        counterNumber++;
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Please check if simcard properly loaded. Please check if simcard have load.");
                }
            }
            else
            {
                MessageBox.Show("Please connect the Modem first");
            }
        }
Beispiel #24
0
 /// <summary>
 /// Sends an SMS message.
 /// </summary>
 /// <param name="message">The message to send.</param>
 /// <param name="destination">The destination (phone number) to which the message should be sent.</param>
 public void SendMessage(string message, string destination)
 {
     lock (this)
     {
         if (!this.disposed)
         {
             SmsSubmitPdu smsSubmitPdu = new SmsSubmitPdu(message, destination);
             this.comm.SendMessage(smsSubmitPdu);
         }
         else
         {
             throw new ObjectDisposedException("SmsSender");
         }
     }
 }
        private void DayendTradeConfirmationPushtosender(string Custcode, string sSMSSender, string Message)
        {
            try
            {
                string Fullmessage = string.Empty;
                if (sSMSSender.Length > 11 || sSMSSender.Length == 11)
                {
                    sSMSSender = sSMSSender.Replace("+880", "0");
                }

                else
                {
                    return;
                }
                // Send an SMS message
                SmsSubmitPdu pdu;
                // The straightforward version

                if (Message.Length > 160)
                {
                    Message = SplitStringAt(160, Message);
                    string[] word = Message.Split('|');
                    Message = word[0];

                    pdu = new SmsSubmitPdu(Message, sSMSSender.Trim(), "");// "" indicate SMSC No
                    ModemCommunication.SendMessage(pdu);
                    SendMessageloadConsolApplicationtDesign(Custcode, sSMSSender, Message);

                    Message = word[1];
                    pdu     = new SmsSubmitPdu(Message, sSMSSender.Trim(), ""); // "" indicate SMSC No
                    ModemCommunication.SendMessage(pdu);
                    SendMessageloadConsolApplicationtDesign(Custcode, sSMSSender, Message);
                }
                else
                {
                    pdu = new SmsSubmitPdu(Message, sSMSSender.Trim(), "");
                    ModemCommunication.SendMessage(pdu);
                    SendMessageloadConsolApplicationtDesign(Custcode, sSMSSender, Message);
                }
                DataSqlQuery oDACommonQuery = new DataSqlQuery();
                oDACommonQuery.DayendTradeConfirmedStatusUpdate(sSMSSender.Trim());
            }
            catch (Exception)
            {
                //MessageBox.Show(exc.Message);
                throw;
            }
        }
Beispiel #26
0
        private static bool send_gsm(string phoneNumber, string message)
        {
            bool unicode = true;
            bool alert   = false;

            if (((_GsmComm == null || !_GsmComm.IsOpen()) && !_connect2gsm()) || string.IsNullOrEmpty(message))
            {
                return(false);
            }

            try
            {
                SmsSubmitPdu pdu;

                if (!alert && !unicode)
                {
                    pdu = new SmsSubmitPdu(message, phoneNumber, "");
                }
                else
                {
                    byte dcs;

                    if (!alert && unicode)
                    {
                        dcs = DataCodingScheme.NoClass_16Bit;
                    }
                    else if (alert && !unicode)
                    {
                        dcs = DataCodingScheme.Class0_7Bit;
                    }
                    else if (alert && unicode)
                    {
                        dcs = DataCodingScheme.Class0_16Bit;
                    }
                    else
                    {
                        dcs = DataCodingScheme.NoClass_7Bit;
                    }

                    pdu = new SmsSubmitPdu(message, phoneNumber, "", dcs);

                    _GsmComm.SendMessage(pdu);
                }
            }
            catch (Exception ex) { return(false); }

            return(true);
        }
Beispiel #27
0
        private void OnPhoneConnectionChange(bool connected)
        {
            lbl_phone_status.Text = "CONEXION CON MODEM EXITOSA";
            CommSetting.comm.DeleteMessages(DeleteScope.All, PhoneStorageType.Sim);
            SmsSubmitPdu pdu;

            try
            {
                pdu = new SmsSubmitPdu("Se inicio el servidor de SMS", Constants.getPhoneToNotify(), "");
                CommSetting.comm.SendMessage(pdu);
            }
            catch
            {
                MessageBox.Show("No hay saldo recargue la línea");
            }
        }
Beispiel #28
0
 public void SendMessage(string message, string cellphonenumber)
 {
     try
     {
         // Send an SMS message
         SmsSubmitPdu pdu;
         // Send message in the default format
         pdu = new SmsSubmitPdu(message, cellphonenumber);
         comm.SendMessage(pdu);
         UpdateLog("Sent", "Dashboard Messages", cellphonenumberTxtbx.Text, message);
     }
     catch (Exception)
     {
         UpdateLog("Failed", "Sending Failed", cellphonenumberTxtbx.Text, message);
     }
 }
Beispiel #29
0
        public bool sendMessage(string num, string msg)
        {
            SmsSubmitPdu pdu = null;

            try
            {
                pdu = new SmsSubmitPdu(msg, num, "");
                comm.SendMessage(pdu);
            }
            catch (Exception ex)
            {
                ex.ToString();
                return(false);
            }
            return(true);
        }
Beispiel #30
0
 public void SendSMS(string port, string nomer, string message)
 {
     try
     {
         GsmCommMain  comm;
         SmsSubmitPdu pdu;
         comm = new GsmCommMain(Convert.ToInt32(port), 115200);
         comm.Open();
         pdu = new SmsSubmitPdu(message, nomer, "");
         comm.SendMessage(pdu);
         comm.Close();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message.ToString());
     }
 }