4.3.1.12 User Interface Halaman Detail Poliklinik.
User interface ini digunakan oleh administrator untuk menambahkan dan mengubah data poliklinik. Gambar 4.22 merupakan user interface halaman detail
poliklinik.
Gambar 4.22 Halaman Detail Poliklinik
Berikut perintah untuk user interface halaman detail poliklinik:
Imports System.Data
Imports System.Data.SqlClient
Public Class frmDetailPoli
Inherits System.Windows.Forms.Form
Public flag
As Integer Public Sub
Data_Grid Dim
myConn As
SqlConnection Dim
daPoli As
SqlDataAdapter Dim
dsPoli As
DataSet myConn = Database
myConn.Open Dim
sqlselect As String
= Select ID_POLI as [ID Poliklinik],NAMA_POLI as POLIKLINIK from POLIKLINIK order by
ID_POLI daPoli =
New SqlDataAdaptersqlselect, myConn
dsPoli = New
DataSet daPoli.FilldsPoli, POLIKLINIK
dgPoli.DataSource = dsPoli dgPoli.DataMember = POLIKLINIK
dgPoli.ReadOnly = True
myConn.Close End Sub
Untuk menambahkan
data poliklinik
baru, administrator
dapat menggunakan tombol add yang ada. Jika tombol add ini ditekan maka akan
ditampilkan user interface halaman pengelolaan poliklinik. Gambar 4.23 merupakan user interface halaman pengelolaan poliklinik.
Gambar 4.23 Halaman Pengelolaan Poliklinik Berikut perintah untuk user interface halaman pengelolaan poliklinik:
Imports System.Data
Imports System.Data.SqlClient
Public Class frmPoli
Inherits System.Windows.Forms.Form
Public flag
As Integer Private Sub
Clear generate_idPoli
txtNama.Text = txtId.Enabled =
False txtId.Focus
End Sub Public Sub
generate_idPoli Dim
myConn As
SqlConnection Dim
myReader As
SqlDataReader Dim
i As Integer
= 1 Dim
poli_id As String
Dim poli_id2
As String myConn = Database
myConn.Open Dim
sql As String
= Select ID_POLI from POLIKLINIK order by ID_POLI
Dim command
As SqlCommand =
New SqlCommandsql, myConn
myReader = command.ExecuteReader If
myReader.HasRows Then
Try While
myReader.Read poli_id =
CInt MidTrimmyReader.GetString0, 2, 5
If poli_id = i
Then i = i + 1
End If End While
Catch ex
As Exception
MsgBoxTidak ada data, MsgBoxStyle.OKOnly, Info
End Try poli_id2 =
CStr i
If poli_id2.Length = 1
Then poli_id2 = R00 +
CStr poli_id2
txtId.Text = poli_id2 ElseIf
poli_id2.Length = 2 Then
poli_id2 = R0 + CStr
poli_id2 txtId.Text = poli_id2
ElseIf poli_id2.Length = 3
Then poli_id2 = R +
CStr poli_id2
txtId.Text = poli_id2 End If
myReader.Close myConn.Close
Else poli_id2 = R001
txtId.Text = poli_id2 End If
End Sub Public Sub
generate_idPoli1 Dim
myConn As
SqlConnection Dim
myReader As
SqlDataReader Dim
angka, angka2 As Integer
angka2 = 0 Dim
id As String
Dim id1
As String Dim
n As Integer
myConn = Database myConn.Open
Dim sql
As String = Select ID_POLI from POLIKLINIK
Dim command
As SqlCommand =
New SqlCommandsql, myConn
Try myReader = command.ExecuteReader
If myReader.HasRows
Then While
myReader.Read id = myReader.ItemID_POLI
n = Lenid angka =
CInt Midid, 3, n
If angka2 angka
Then angka2 = angka
End If
End While id =
CStr angka2 + 1
id1 = R- + CStr
id txtId.Text = id1
Else : id1 = R-1
txtId.Text = id1 End If
myReader.Close Catch
ex As
Exception MsgBoxTidak ada data, MsgBoxStyle.OKOnly, Info
End Try myConn.Close
End Sub End Class
4.3.1.13 User Interface Laporan