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 #2
0
       public string Execute_ActionAgainstReceivedMessage()
       {
           //int totalSmsReceived = 0;
           string FullMessageshow = string.Empty;           
           List<SmsPdu> smsObjs=new List<SmsPdu>();
           try
           {
               smsObjs = ModemCommunication.ReadMessage();
               foreach (var smsObj in smsObjs)
               {
                   // INSERT TO THE DATABASE FULLTEXT AND SHORTTEXT
                    
                   var dpdu = (SmsDeliverPdu)smsObj;
                   string[] regCust_Code = GetCustCodeFromPhoneNo(dpdu.OriginatingAddress).ToArray();
                   var RegCustCode = string.Join(",", regCust_Code);                   
                   String ReceivedTime = string.Empty;
                   string EntryTime = string.Empty;
                   string SMSSender = string.Empty;
                   string Short_Code = dpdu.UserDataText;
                   string FullMessage = dpdu.UserDataText;

                   FullMessageshow = dpdu.OriginatingAddress + " - " + FullMessage;                  
                   if (RegCustCode == "")
                   {
                       RegCustCode = "NULL";
                   }
                   Smsload.SMSText = FullMessage;
                   SMSSender = dpdu.OriginatingAddress;
                   ReceivedTime = dpdu.SCTimestamp.ToString();
                   ReceivedTime = String.Format("{0:dd-MMM-yyyy HH:mm:ss tt}", ReceivedTime);
                   EntryTime = String.Format("{0:dd-MMM-yyyy HH:mm:ss tt}", System.DateTime.Now);
                   objDataSqlQuery.InsertReceiveSMS(RegCustCode, SMSSender, Short_Code, FullMessage, ReceivedTime, "0", EntryTime);


                   ReceiveSMSParser prs = new ReceiveSMSParser(smsObj);
                   ParsedSMS prsSMSObj = prs.GetParsedSMSObject();
                   List<Database_Details> dbActions = prsSMSObj.DatabaseDetais;
                   if (prsSMSObj.DatabaseDetais.Where(t => t.Action == Database_Action.Add).ToList().Count > 0)
                   {
                       List<string> values = GetInsertStateMent(prsSMSObj);
                       try
                       {
                           aDbConnection.ConnectDatabase_SMSSender();
                           aDbConnection.StartTransaction_SMSSender();
                           foreach (string eachStatement in values)
                           {
                              aDbConnection.ExecuteNonQuery_SMSSender(eachStatement);
                           }
                           aDbConnection.Commit_SMSSender();
                       }
                       catch (Exception ex)
                       {
                           aDbConnection.Rollback_SMSSender();
                       }
                       finally
                       {
                           aDbConnection.CloseDatabase_SMSSender();
                       }
                   }
                   else if (prsSMSObj.DatabaseDetais.Where(t => t.Action == Database_Action.Update).ToList().Count > 0)
                   {

                   }
                   else if (prsSMSObj.DatabaseDetais.Where(t => t.Action == Database_Action.Delete).ToList().Count > 0)
                   {

                   }

               }
           }
           catch (Exception ex)
           {
               //Console.WriteLine(ex.ToString());
               throw ex;
           }
           return FullMessageshow ; //= FullMessage;         
       }