i build a simple application for sending message using gsmcomm library and C#. when i sent message through a modem i store it to oracle database SENTMESSAGE table. I provide a table when sending message failed namely FAILEDMESSAGE table (ID, DATE, TIME, PHONENUMBER, MESSAGE), but i still didn't understand how implemented it.
Anyone can suggest me how to differentiate between sending a message succeeded and failed in gsmcomm library?
this is my code for sending a message :
private void btnSentSMS_Click(object sender, EventArgs e)
{
var msg = txtMessage.Text;
var phoneNumber = txtNumber.Text;
var pdu = new SmsSubmitPdu(msg, phoneNumber, string.Empty);
comm.SendMessage(pdu);
MessageBox.Show("sms sent");
//STORE SEND SMS TO DATABASE
OracleCommand cmd = new OracleCommand();
cmd.CommandText = @"INSERT INTO SENTMESSAGE (ID, DATE, TIME, PHONENUMBER, MESSAGE) VALUES
(SQ_SENTMESSAGE.NEXTVAL, '" + DateTime.Now + "', TO_DATE('" + DateTime.Now + "', 'dd/MM/yyyy hh24:mi:ss'), '"
+ phoneNumber + "', '" + msg + "')";
cmd.Connection = koneksi_manual.con;
koneksi_manual.con.Open();// <= Open connection before executing the command.
cmd.ExecuteNonQuery();
koneksi_manual.con.Close(); //closing connection
}
SemdMessage Method like: