public static Com.Martin.SMS.Data.SMSOutgoing GetOutgoingMessage(String ID) { SMSOutgoing outp = new SMSOutgoing(); try { conn.Open(); MySqlCommand command = conn.CreateCommand(); command.CommandText = "SELECT Id_Output, Waktu_Diproses, Waktu_Kirim, No_Tujuan, Pesan_Teks, Status, Reg_Name, Reg_Type, Id_Input FROM sms_output where ID_OUTPUT=?ID_OUTPUT"; command.Parameters.Clear(); command.Parameters.AddWithValue("ID_OUTPUT", ID); MySqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { if (!reader.IsDBNull(0)) outp.ID = reader.GetString(0); if (!reader.IsDBNull(1)) outp.DateProcess = reader.GetDateTime(1); if (!reader.IsDBNull(2)) outp.DateSent= reader.GetDateTime(2); if (!reader.IsDBNull(3)) outp.DestinationNo = reader.GetString(3); if (!reader.IsDBNull(4)) outp.MessageText = reader.GetString(4); if (!reader.IsDBNull(6)) outp.RegisterName = reader.GetString(6); if (!reader.IsDBNull(7)) outp.RegisterType = reader.GetString(7); if (!reader.IsDBNull(8)) outp.SMSRequest = GetIncomingMessage(reader.GetString(8)); } reader.Close(); } finally { conn.Close(); } return outp; }
public static List<Com.Martin.SMS.Data.SMSOutgoing> GetOutgoingSMSList() { List<Com.Martin.SMS.Data.SMSOutgoing> lst = new List<SMSOutgoing>(); try { conn.Open(); MySqlCommand command = conn.CreateCommand(); command.CommandText = "SELECT Id_Output , Waktu_Diproses, Waktu_Kirim, No_Tujuan, Pesan_Teks, Reg_Name, Reg_Type, Id_Input FROM sms_output s where status='NOK' limit 5 offset 0"; command.Parameters.Clear(); MySqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { SMSOutgoing outSMS = new SMSOutgoing(); if (!reader.IsDBNull(0)) outSMS.ID = reader.GetString("Id_Output"); if (!reader.IsDBNull(1)) outSMS.DateProcess = reader.GetDateTime("Waktu_Diproses"); if (!reader.IsDBNull(2)) outSMS.DateSent = reader.GetDateTime("Waktu_Kirim"); if (!reader.IsDBNull(3)) outSMS.DestinationNo = reader.GetString("No_Tujuan"); if (!reader.IsDBNull(4)) outSMS.MessageText = reader.GetString("Pesan_Teks"); if (!reader.IsDBNull(5)) outSMS.RegisterName = reader.GetString("Reg_Name"); if (!reader.IsDBNull(6)) outSMS.RegisterType = reader.GetString("Reg_Type"); if (!reader.IsDBNull(7)) outSMS.SMSRequest.ID = reader.GetString("Id_Input"); lst.Add(outSMS); } reader.Close(); } catch (System.Exception ex) { } finally { conn.Close(); } return lst; }
public static void SaveOutgoingMessage(Com.Martin.SMS.Data.SMSOutgoing Outgoing) { }