Buat program sms server dengan .NET

Saya membuat program ini karena ada yang butuh program sms server sederhana dengan teknologi .NET dengan menggunakan bahasa VB.NET serta menggunakan bantuan component XSMSENgine dan Hape Siemenss C55. Aplikasi ini di gunakan untuk penjadwalan pasien di Rumah Sakit. Jadi Pasien bisa mendaftarkan diri lewat SMS kepada dokter spesialis yang diinginkan. Berikut ini coding untuk koneksi ke hape nya sebagai berikut :

Private Sub cmdStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStart.Click
If cmdStart.Text = “Start” Then
lstMessage.Items.Add(Format(Now, “hh:mm:dd”) & ” – ” & “Open Connection”)
lstMessage.Items.IndexOf(lstMessage.Items.GetEnumerator)

If SMSEngine.DeviceOpen() Then
Timer1.Enabled = True
cmdStart.Text = “Stop”
lblOnline.Text = “ONLINE”
lstMessage.Items.Add(Format(Now, “hh:mm:dd”) & ” – ” & “Device Connected”)
lstMessage.Items.Add(Format(Now, “hh:mm:dd”) & ” – ” & “Ready…”)
lstMessage.Items.IndexOf(lstMessage.Items.GetEnumerator)

Else
Timer1.Enabled = False
cmdStart.Text = “Start”
lblOnline.Text = “OFFLINE”
lstMessage.Items.Add(Format(Now, “hh:mm:dd”) & ” – ” & “Connection Error”)
lstMessage.Items.IndexOf(lstMessage.Items.GetEnumerator)

End If
Else
Timer1.Enabled = False
SMSEngine.DeviceClose()
cmdStart.Text = “Start”
lblOnline.Text = “OFFLINE”
lstMessage.Items.Add(Format(Now, “hh:mm:dd”) & ” – ” & “Device Closed”)
lstMessage.Items.IndexOf(lstMessage.Items.GetEnumerator)
End If
End Sub

Private Sub cmdSetting_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSetting.Click
SMSEngine.Setting()
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Static lChange As Boolean
Dim MessageList As Object
Dim Reader As New XSMSEngine.MessageReader
Dim nIndex As Long
‘Dim chr As Char
‘Dim SMS As Object

MessageList = SMSEngine.ReadMessage(XSMSEngine.enumSMSList.smsNewMessage)

If MessageList.Count > 0 Then
For nIndex = 1 To MessageList.Count
Reader.Value = MessageList(nIndex)

lstMessage.Items.Add(Format(Now, “hh:mm:dd”) & ” – ” & “New Message Arrival From ” & Reader.MessagePhoneNumber & ” ISI sms : ” & Reader.MessageText())
lstMessage.Items.IndexOf(lstMessage.Items.GetEnumerator)

‘Auto Responder
‘If SMSEngine.SendMessage(Reader.MessagePhoneNumber, “Auto Response From X SMS Engine v1-11 [Free Edition]”) = “OK” Then

If UCase(Reader.MessageText()) = UCase(“Info Spesialis”) Then
lstMessage.Items.Add(Format(Now, “hh:mm:dd”) & ” – ” & “Informasi Kode Spesialis”)
lstMessage.Items.IndexOf(lstMessage.Items.GetEnumerator)
SMSEngine.SendMessage(Reader.MessagePhoneNumber, “INFORMASI KODE SPESIALIS” + “JANTUNG=>01” + “SARAF=>02” + “TLG=>03” + “ANAK=>04” + “KNDG=>05” + “GIGI=>06” + “KULIT=>07” + “PARU=>08” + “THT=>09” + “URO=>10”)

‘ ambil kode spesialis
ElseIf UCase(Reader.MessageText()) = UCase(“Info Dokter Spesialis#01”) Or UCase(Reader.MessageText()) = UCase(“01”) Then

kodedok = Mid(Reader.MessageText(), 23, 2)
lstMessage.Items.Add(Format(Now, “hh:mm:dd”) & ” – ” & “Informasi Dokter Spesialis”)
lstMessage.Items.IndexOf(lstMessage.Items.GetEnumerator)
carispesialis()

For i = 0 To dgSpe.RowCount – 2
nmdokspe = dgSpe.Item(0, i).Value.ToString
kodespe = dgSpe.Item(1, i).Value.ToString
SMSEngine.SendMessage(Reader.MessagePhoneNumber, nmdokspe + ” ” + kodespe)
Next

‘praktek
ElseIf ((UCase(Reader.MessageText())).IndexOf(“P”)) = 0 Then
lstMessage.Items.Add(Format(Now, “hh:mm:dd”) & ” – ” & “Informasi Praktek Dokter”)
lstMessage.Items.IndexOf(lstMessage.Items.GetEnumerator)
strjadwaldok = Mid(Reader.MessageText(), 9, 6)
infojadwaldok()

For i = 0 To dgSpe.RowCount – 2
jdwl_nama = dgSpe.Item(0, i).Value.ToString
jdwl_hari = dgSpe.Item(1, i).Value.ToString
jdwl_mulai = dgSpe.Item(2, i).Value.ToString
jdwl_fin = dgSpe.Item(3, i).Value.ToString

SMSEngine.SendMessage(Reader.MessagePhoneNumber, jdwl_nama + ” ” + jdwl_hari + ” ” + jdwl_mulai + ” ” + jdwl_fin)
Next

‘jadwal
ElseIf ((UCase(Reader.MessageText())).IndexOf(“J”)) = 0 Then
IDPAS = Mid(Reader.MessageText(), 8, 9)
kodedok = Mid(Reader.MessageText(), 18, 6)
tgl = Mid(Reader.MessageText(), 25, 10)

cariPasien()
caridokter()

lstMessage.Items.Add(Format(Now, “hh:mm:dd”) & ” – ” & “Penjadwalan”)
lstMessage.Items.IndexOf(lstMessage.Items.GetEnumerator)
‘SMSEngine.SendMessage(Reader.MessagePhoneNumber, CStr(idpasien) + ” ” + CStr(kodedok))

If klsktrl.dml(“INSERT INTO TT_PENJADWALAN VALUES(‘” & jdwlsms & ” ‘,'” _
& IDPAS & “‘,'” _
& nmpasien & “‘,'” _
& almtPasien & “‘,'” _
& TelpPasien & “‘,'” _
& kodedok & “‘,'” _
& tgl & “‘,'” _
& “Blm Dtng” & “‘,'” _
& “blm ada” & “‘,'” _
& “130” & “‘,'” _
& tgl & “‘,'” _
& “ika” & “‘,'” _
& “Janji/SMS” & “‘)”) = True Then
SMSEngine.SendMessage(Reader.MessagePhoneNumber, “Jadwal Anda Tgl :” + tgl + “#” + “Dokter :” + nmdok + “#” + “ID Pasien :” + IDPAS + “#” + “Nama :” + nmpasien + “#” + “Janji/SMS”)
MessageBox.Show(“Data Pasien SMS telah tersimpan”)
MessageBox.Show(“SMS Penjadwalan telah terkirim ke Pasien”)
Else
MessageBox.Show(“SMS Penjadwalan Belum terkirim ke Pasien”)
End If

Else
lstMessage.Items.Add(Format(Now, “hh:mm:dd”) & ” – ” & “Message Sent [Auto Response]”)
lstMessage.Items.IndexOf(lstMessage.Items.GetEnumerator)
SMSEngine.SendMessage(Reader.MessagePhoneNumber, “Format SMS Anda salah”)
End If

‘Hapus SMS Masuk
SMSEngine.RemoveMessage(Reader.MessageID)
lstMessage.Items.Add(Format(Now, “hh:mm:dd”) & ” – ” & “Message Removed”)
lstMessage.Items.IndexOf(lstMessage.Items.GetEnumerator)
lstMessage.Items.Add(Format(Now, “hh:mm:dd”) & ” – ” & “Ready…”)
lstMessage.Items.IndexOf(lstMessage.Items.GetEnumerator)
Next
End If

If lChange Then
lChange = False
lblOnline.ForeColor = Color.Red
Else
lChange = True
lblOnline.ForeColor = Color.Black
End If

End Sub

7 Tanggapan

  1. wah,,bagus mas postingnya..

  2. pesen progamnya gratis mas?

    • Bisa di konsultasikan disini mas program nya…

      • saya udah bisa cara kirim dan terima sms kemudian disimpan ke database,, rencananya saya mau buat sms autoresponder dengan keyword tertentu,, tapi masih bingung cara maenin querynya,, saya menggunakan vb.net 2010,, db access 2007,,& component activexperts sms,, tolong dibantu ya mas🙂

      • butuh program untuk bisa kirim baca sms dan ussd modempool, bisa bantu.

      • Bisa mas

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: