コード例 #1
0
        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);
        }
コード例 #2
0
        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....");
        }