Esempio n. 1
0
        public static Com.Martin.SMS.Data.SMSIncoming SaveIncomingMessage(String Sender, String Receiver, String Message) {
            SMSIncoming incoming = new SMSIncoming();
            incoming.ID = CreateIdNumber(TypeSMS.Input);
            incoming.DateReceive = DateTime.Now;
            incoming.Sender = Sender;
            incoming.MessageText = Message;
            try
            {
                conn.Open();
                MySqlCommand command = conn.CreateCommand();
                //if (incoming.ID == "")
                //{
                    command.CommandText = "insert into SMS_INPUT (Id_Input, Tanggal_Terima,No_Pengirim,Pesan_Teks,Status) values ";
                    command.CommandText += "(?Id_Input, ?Tanggal_Terima,?No_Pengirim,?Pesan_Teks,?Status)";
                //}
                //else
                //{
                //    command.CommandText = "Update SMS_INPUT set ";
                //    command.CommandText += "Tanggal_Terima = ?Tanggal_Terima, ";
                //    command.CommandText += "No_Pengirim = ?No_Pengirim , ";
                //    command.CommandText += "Pesan_Teks = ?Pesan_Teks , ";
                //    command.CommandText += "Status = ?Status ";
                //    command.CommandText += "where ID_INPUT = ?ID_INPUT ";
                //}
                    
                command.Parameters.Clear();
                command.Parameters.AddWithValue("ID_INPUT", incoming.ID);
                command.Parameters.AddWithValue("Tanggal_Terima", DateTime.Now.ToString("yyyy-MM-dd"));
                command.Parameters.AddWithValue("No_Pengirim", incoming.Sender);
                command.Parameters.AddWithValue("Pesan_Teks", incoming.MessageText);
                command.Parameters.AddWithValue("Status", "OK");
                int rows = command.ExecuteNonQuery();

            }
            finally
            {
                conn.Close();
            }
            return incoming;
        }
Esempio n. 2
0
        public static Com.Martin.SMS.Data.SMSIncoming GetIncomingMessage(String ID) {

            SMSIncoming inc = new SMSIncoming();
            try
            {
                conn.Open();
                MySqlCommand command = conn.CreateCommand();
                command.CommandText = "SELECT Id_Input, Tanggal_Terima, No_Pengirim, Pesan_Teks, Status FROM sms_input where ID_INPUT=?ID_INPUT";
                command.Parameters.Clear();
                command.Parameters.AddWithValue("ID_INPUT", ID);

                MySqlDataReader reader = command.ExecuteReader();
                if (reader.Read())
                {
                    
                    if (!reader.IsDBNull(0))
                        inc.ID = reader.GetString(0);
                    if (!reader.IsDBNull(1))
                        inc.DateReceive = reader.GetDateTime(1);
                    if (!reader.IsDBNull(2))
                        inc.Sender = reader.GetString(2);
                    if (!reader.IsDBNull(3))
                        inc.MessageText = reader.GetString(3);
                }
                reader.Close();
            }
            finally
            {                
                conn.Close();
            }

            return inc;
        }
Esempio n. 3
0
 public static Com.Martin.SMS.Data.SMSIncoming ProcessRequest(Com.Martin.SMS.Data.SMSIncoming Request)
 {
     return(Request);
 }