public void sms_queue_init() { SMSQ getQueued = Json.Get(); if (getQueued == null) { return; } if (getQueued.count == 0) { return; } foreach (SMSQueues objSMS in getQueued.data) { Console.WriteLine("{0} SMS Processing... " + objSMS.mobile); Queued queue = new Queued() { company_uid = 0, mobile = objSMS.mobile, message = objSMS.message, status = 1 }; bool result = Notification.Send(queue); if (result) { Logs(200, string.Format("{0} | Message Sent to {1}", objSMS.Id, objSMS.mobile)); System.Threading.Thread.Sleep(1500); JSON_Response json_r = Json.Update(objSMS.Id); //if (json_r.status == 200) //{ // System.Threading.Thread.Sleep(100); // string message = "NOTE: Please do not reply to dis mobile#. Unfortunately, we are unable to respond to inquiries sent to dis mobile#."; // queue = new Queued() // { // company_uid = 0, // mobile = objSMS.mobile, // message = message, // status = 1 // }; // result = Notification.Send(queue); // Logs(200, string.Format("Message part 2 sent to {0}", objSMS.mobile)); //} string status = json_r.status == 200 ? "Successful." : "Not successful."; Console.WriteLine(status); } } }
public static SMSQ Get() { string url = ApiUrl + "/api/v1/sms/get"; SMSQ smsq = new SMSQ(); try { WebClient client = new WebClient(); string value = client.DownloadString(url); smsq = JsonConvert.DeserializeObject <SMSQ>(value); } catch (Exception ex) { } return(smsq); }