public DeviceModel GetModemConfig(int id, string initial)
        {
            try
            {
                var data = DBConnService.Select("SELECT id, initial, mode, protocol, comm_port, bit_rate, send_timeout, send_interval, retry_times, " +
                                                "sms_validity, folder, auto_reject_incoming_call, send_reject_incoming_call, message_reject_incoming_call, " +
                                                "request_send_report, auto_delete_new_sms, auto_delete_all_report, is_proses_schedule, is_proses_new_sms, " +
                                                "is_no_prefix, pesan_no_prefix, sms_type, wap_push_url, nomor_cek_pulsa, keterangan, status, waktu_cek_schedule, waktu_cek_pesan_pending, waktu_cek_koneksi, cek_pesan_masuk  From sms_modem " +
                                                "WHERE id = " + id + " AND initial = '" + initial + "'");

                foreach (var row in data)
                {
                    if (row != null)
                    {
                        deviceModel.id                            = (int)row["id"];
                        deviceModel.initial                       = row["initial"].ToString();
                        deviceModel.mode                          = row["mode"].ToString();
                        deviceModel.protocol                      = row["protocol"].ToString();
                        deviceModel.comm_port                     = (int)row["comm_port"];
                        deviceModel.bit_rate                      = (int)row["bit_rate"];
                        deviceModel.send_timeout                  = (int)row["send_timeout"];
                        deviceModel.send_interval                 = (int)row["send_interval"];
                        deviceModel.retry_times                   = (int)row["retry_times"];
                        deviceModel.sms_validity                  = row["sms_validity"].ToString();
                        deviceModel.folder                        = row["folder"].ToString();
                        deviceModel.auto_reject_incoming_call     = bool.Parse(row["auto_reject_incoming_call"].ToString()) ? 1 : 0;
                        deviceModel.send_reject_incoming_call     = bool.Parse(row["send_reject_incoming_call"].ToString()) ? 1 : 0;
                        deviceModel.message_reject_incomming_call = row["message_reject_incoming_call"].ToString();
                        deviceModel.request_send_report           = bool.Parse(row["request_send_report"].ToString()) ? 1 : 0;
                        deviceModel.auto_delete_new_sms           = bool.Parse(row["auto_delete_new_sms"].ToString()) ? 1 : 0;
                        deviceModel.auto_delete_all_report        = bool.Parse(row["auto_delete_all_report"].ToString()) ? 1 : 0;
                        deviceModel.is_proses_schedule            = bool.Parse(row["is_proses_schedule"].ToString()) ? 1 : 0;
                        deviceModel.is_proses_new_sms             = bool.Parse(row["is_proses_new_sms"].ToString()) ? 1 : 0;
                        deviceModel.is_no_prefix                  = bool.Parse(row["is_no_prefix"].ToString()) ? 1 : 0;
                        deviceModel.pesan_no_prefix               = row["pesan_no_prefix"].ToString();
                        deviceModel.sms_type                      = row["sms_type"].ToString();
                        deviceModel.wap_push_url                  = row["wap_push_url"].ToString();
                        deviceModel.nomor_cek_pulsa               = row["nomor_cek_pulsa"].ToString();
                        deviceModel.keterangan                    = row["keterangan"].ToString();
                        deviceModel.status                        = bool.Parse(row["status"].ToString()) ? 1 : 0;
                        deviceModel.waktu_cek_schedule            = (int)row["waktu_cek_schedule"];
                        deviceModel.waktu_cek_pesan_pending       = (int)row["waktu_cek_pesan_pending"];
                        deviceModel.waktu_cek_koneksi             = (int)row["waktu_cek_koneksi"];
                        deviceModel.cek_pesan_masuk               = bool.Parse(row["cek_pesan_masuk"].ToString()) ? 1 : 0;
                    }
                }

                DBConnService.CloseConnection();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            return(deviceModel);
        }
Beispiel #2
0
        public List <MessageModel> CheckMessage2()
        {
            List <MessageModel> models = new List <MessageModel>();

            try
            {
                var data = DBConnService2.Select("SELECT id, message, phone_number, process_at, type, `status` FROM messages " +
                                                 "WHERE status='0' ORDER BY id DESC LIMIT 1");

                foreach (var row in data)
                {
                    if (row != null)
                    {
                        MessageModel model = new MessageModel();

                        model.id      = (int)row["id"];
                        model.initial = "";
                        model.jenis   = row["type"].ToString();
                        model.prefix  = "";
                        model.nama    = "";
                        model.pesan   = row["message"].ToString();
                        model.noTelp  = row["phone_number"].ToString();
                        DateTime.TryParse(row["process_at"].ToString(), out model.waktu);
                        models.Add(model);
                    }
                }

                DBConnService2.CloseConnection();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            return(models);
        }
Beispiel #3
0
        public List <MessageModel> CheckMessage()
        {
            List <MessageModel> models = new List <MessageModel>();

            try
            {
                var data = DBConnService.Select("SELECT id, initial, jenis, prefix, nomor_hp, nama, isi_pesan, waktu FROM sms_pesan " +
                                                "WHERE status='0' ORDER BY id DESC LIMIT 1");

                foreach (var row in data)
                {
                    if (row != null)
                    {
                        MessageModel model = new MessageModel();

                        model.id      = (int)row["id"];
                        model.initial = row["initial"].ToString();
                        model.jenis   = row["jenis"].ToString();
                        model.prefix  = row["prefix"].ToString();
                        model.nama    = row["nama"].ToString();
                        model.pesan   = row["isi_pesan"].ToString();
                        model.noTelp  = row["nomor_hp"].ToString();
                        DateTime.TryParse(row["waktu"].ToString(), out model.waktu);
                        models.Add(model);
                    }
                }

                DBConnService.CloseConnection();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            return(models);
        }