private void button1_Click(object sender, EventArgs e) { ESMSWS.user user = new ESMSWS.user(); ESMSWS.alias alias = new ESMSWS.alias(); user.username = "******"; user.password = "******"; alias.alias1 = "SLCMS"; smsMessage msg = new smsMessage(); msg.sender = alias; msg.message = body.Text; msg.recipients = new string[] { recipient.Text }; EnterpriseSMSWSClient client = new EnterpriseSMSWSClient(); session s = client.createSession(user); int test = client.sendMessages(s, msg); // smsMessage[] deliveryReports=client.getDeliveryReports(s, alias); //if(deliveryReports==null)Console.WriteLine("NULL"); // for (int i = 0; i < deliveryReports.GetLength(1); i++) // { // System.Diagnostics.Debug.WriteLine(deliveryReports[i].message); // } }
public bool SendSMSSriLanka(string mobileNumber, string message) { try { EMMS.user objuser = new EMMS.user(); EMMS.alias alias = new EMMS.alias(); objuser.username = user; objuser.password = password; alias.alias1 = "APL_ENERGY"; smsMessage msg = new smsMessage(); msg.sender = alias; msg.message = message; if (mobileNumber.Contains(",")) { msg.recipients = mobileNumber.Split(',').ToArray(); } else { msg.recipients = new string[] { mobileNumber } }; EnterpriseSMSWSClient client = new EnterpriseSMSWSClient(); session s = client.createSession(objuser); int result = client.sendMessages(s, msg); client.closeSession(s); if (result == 200) { return(true); } else { return(false); } } catch (Exception exp) { return(false); } }
public IActionResult Index() { List <smsMessage> smsLIST = new List <smsMessage>(); using (var connection = new MySqlConnection(conString)) { connection.Open(); MySqlCommand command = new MySqlCommand("SELECT * FROM smsLOG", connection); using (MySqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { smsMessage smsITEM = new smsMessage(); smsITEM.id = reader.GetString(reader.GetOrdinal("sms_id")); smsITEM.message = reader.GetString(reader.GetOrdinal("sms_msg")); smsITEM.date = reader.GetString(reader.GetOrdinal("sms_date")); smsITEM.number = reader.GetString(reader.GetOrdinal("sms_number")); smsLIST.Add(smsITEM); } } Console.WriteLine(smsLIST[0].message); return(View(smsLIST)); } }