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 bool Send(Queued queued) { string dt = date_time_format(date_time_now()); string message = Encryption.Do(queued.message); string sql_string = "INSERT INTO ptxt_queued (Company_uid, UserId, UserIp, ToNumber, ToMessage, Status, updated_at, created_at) VALUES " + "(" + queued.company_uid + ", '" + queued.mobile + "', 'N/A', '" + queued.mobile + "', '" + message + "', " + queued.status + ", DATE_FORMAT('" + dt + "','%Y-%m-%d %H:%i:%s'), " + "DATE_FORMAT('" + dt + "','%Y-%m-%d %H:%i:%s'));"; bool r = MySqlQuery.execute(sql_string); return(r); }
private void sms_queue_command_init() { var sw = Stopwatch.StartNew(); List <Cache> requests = get_request(); foreach (Cache cache in requests) { CMDTransaction cmd = Json.Send(cache.from, cache.command); if (EnableReceiverOnly) { Logs(200, string.Format("Response: {0} -> {1}", cmd.account, cmd.message)); bool delete_cache = MySqlQuery.execute("DELETE FROM ptxt_cache WHERE Id = " + cache.Id + ";"); } else { Queued queue = new Queued() { company_uid = cache.company_uid, mobile = cmd.account, message = cmd.message, status = 1 }; bool save_notification = Notification.Send(queue); bool delete_cache = MySqlQuery.execute("DELETE FROM ptxt_cache WHERE Id = " + cache.Id + ";"); total_process++; sw.Stop(); decimal total_time_in_seconds = sw.ElapsedMilliseconds / 60; Console.WriteLine("Batch: {0} and Time Executed {1} seconds", total_process, total_time_in_seconds); Logs(200, string.Format("Batch: {0} and Time Executed {1} seconds", total_process, total_time_in_seconds)); } } //Logs(200, "Running...."); }