ภาคผนวก ก. Source Code

Size: px
Start display at page:

Download "ภาคผนวก ก. Source Code"

Transcription

1 ภาคผนวก

2 ภาคผนวก ก. Source Code 154

3 155 Source Code ช อ Empbook Option Explicit On Option Strict On Imports System.data Imports System.Data.OleDb Public Class Empbook Dim Book_status As Integer = 1 'ęğŀşľłŀăăő ŽŐŞ1= ĂŐ 2 = ŽŐŞ Private Sub Empbook_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Conndata() ' řăňăłconndata showtypebook() showsuplier() showbook() Cleardata() cmbsup.text = "řąőĺł ĿďŚğŞðŻŀĚŞůŀĂ " cmbtype.text = "řąőĺłćăľř ğěşŀðęőĺ " Private Sub Conndata() With Conn If.State = ConnectionState.Open Then.Close().ConnectionString = StrConn.Open() Private Sub Cleardata() txtbookid.text = "" txtbookisbn.text = "" txtbookname.text = "" txtbookdetail.text = "" txtbookauther.text = "" txtbookpublisher.text = "" txtbooktitle.text = "" txtbooksub.text = "" txtpricerent.text = "" cmbsup.text = "řąőĺł ĿďŚğŞðŻŀĚŞůŀĂ " cmbtype.text = "řąőĺłćăľř ğěşŀðęőĺ " ' Śę¾ÐŽůŀĆăľř ğěşŀðęőĺ Private Sub showtypebook() Dim sqlbooktype As String sqlbooktype = "SELECT * FROM tb_booktype" da = New OleDbDataAdapter(sqlbookType, Conn) da.fill(ds, "tb_booktype") With cmbtype.datasource = ds.tables("tb_booktype").displaymember = "Bt_name".ValueMember = "Bt_id"

4 156.DataBindings.Add("SelectedValue", ds, "tb_booktype.bt_id") ds.tables.clear() ' Śę¾ÐŠŰĹ Ŕą ĿďŚğŞðŻŀĚŞůŀĂ Private Sub showsuplier() Dim sqlbooktype As String sqlbooktype = "SELECT * FROM tb_supplier" da = New OleDbDataAdapter(sqlbookType, Conn) da.fill(ds, "tb_supplier") With cmbsup.datasource = ds.tables("tb_supplier").displaymember = "Sup_name".ValueMember = "Sup_id".DataBindings.Add("SelectedValue", ds, "tb_supplier.sup_id") ds.tables.clear() Private Sub showbook() Dim sqlbook As String Dim cs As New DataGridViewCellStyle sqlbook = "SELECT tb_book.book_id,tb_book.book_isbn,tb_book.book_name,tb_book.book_author,tb_book.book_detail," sqlbook &= "tb_book.book_publisher,tb_book.book_title,tb_book.book_sub,tb_book.price_rent,tb_booktype.bt_name,t b_supplier.sup_name FROM tb_book,tb_booktype,tb_supplier WHERE( tb_book.bt_id = tb_booktype.bt_id )and ( tb_book.sup_id = tb_supplier.sup_id )" da = New OleDbDataAdapter(sqlBook, Conn) da.fill(ds, "Book") With grdbook.readonly = True.DataSource = ds.tables("book") cs.font = New Font("Ms Sans Serif", 10, FontStyle.Bold) With grdbook.columnheadersdefaultcellstyle = cs.columns(0).headertext = "ăěŀęěşŀðęőĺ ".Columns(1).HeaderText = "řąšřăňăłěşŀðęőĺ ".Columns(2).HeaderText = "ýőůĺěşŀðęőĺ ".Columns(3).HeaderText = "ăŀăąľřĺňă¾ěşŀðęőĺ ".Columns(4).HeaderText = "ýőůĺćŕűś ůð ".Columns(5).HeaderText = "ężŀşŀłčń čź ".Columns(6).HeaderText = " ŀžğňů ".Columns(7).HeaderText = "řąů ğňů ".Columns(8).HeaderText = "ăŀžŀřýůŀ".columns(9).headertext = "Ćăľř ğěşŀðęőĺ "

5 157.Columns(10).HeaderText = " ĿďŚğŞðŻŀĚŞůŀĂ ".Columns(0).Width = 110.Columns(1).Width = 120.Columns(2).Width = 130.Columns(3).Width = 130.Columns(4).Width = 130.Columns(5).Width = 130.Columns(6).Width = 50.Columns(7).Width = 50.Columns(8).Width = 80.Columns(9).Width = 130.Columns(10).Width = 130 ds.tables.clear() Private Sub cmdadd_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdadd.click Dim sqladd As String Dim sqlcheck As String If txtbookid.text = "" Then MessageBox.Show("łăő¼ŀłăĹłăĚĿęĚŞĿÐęŐĹ¾ŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtbookid.focus() If txtbookisbn.text = "" Then MessageBox.Show("łăő¼ŀłăĹłřąŠřăŇó̪ĿÐęŐĹ¾ŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtbookisbn.focus() If txtbookname.text = "" Then MessageBox.Show("łăő¼ŀłăĹłýŐůĹĚŞĿÐęŐĹ¾ŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtbookname.focus() If txtbookdetail.text = "" Then MessageBox.Show("łăő¼ŀłăĹłăŀĂąľřĹŇĂ¾ĚŞĿÐęŐĹ¾ŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtbookdetail.focus() If txtbookauther.text = "" Then MessageBox.Show("łăő¼ŀłăĹłýŐůĹćŔŰŚ ůð¾űďăžůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtbookauther.focus() If txtbookpublisher.text = "" Then MessageBox.Show("łăő¼ŀłăĹłýŐůĹęŻŀŞĿłčń čź¾űďăžůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtbookpublisher.focus()

6 158 If txtbooktitle.text = "" Then MessageBox.Show("łăő¼ŀłăĹł ŀžěşŀðęőĺ¾űďăžůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtbooktitle.focus() If txtbooksub.text = "" Then MessageBox.Show("łăő¼ŀłăĹłřąů ğňůěşŀðęőĺ¾űďăžůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtbooksub.focus() If txtpricerent.text = "" Then MessageBox.Show("łăő¼ŀłăĹłăŀŽŀřýůŀĚŞĿÐęŐĹ¾ŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtpricerent.focus() sqlcheck = "SELECT Book_id FROM tb_book WHERE (Book_id='" & CStr(txtBookID.Text) & "') ".CommandText = sqlcheck dr =.ExecuteReader() dr.read() If dr.hasrows = True Then MessageBox.Show("ţ ůęŀ ŀăğřčńů ŠŰĹ ŔąĚŞĿÐęŐĹţ¾ŰřŞŐůĹÐðŀł ŇăĚĿęĚŞĿÐęŐĹŞŇŰŚąŰď ", "ŠŰĹ Ŕąćń¾ćąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) txtbookid.text = "" txtbookid.focus() dr.close() If MessageBox.Show("Žő¼ ŰĹÐłŀăřčńů ŠŰĹ ŔąŢýůĚăŐĹţ ů ", "ŽŻŀĂŐŞĂĿŞ ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then Try sqladd = "INSERT INTO tb_book(book_id,book_isbn,book_name,book_author,book_detail,book_publisher,book_title,book_sub,pri ce_rent,book_status,bt_id,sup_id)values(" sqladd &= " '" & txtbookid.text & "'," sqladd &= " '" & txtbookisbn.text & "'," sqladd &= " '" & txtbookname.text & "'," sqladd &= " '" & txtbookdetail.text & "'," sqladd &= " '" & txtbookauther.text & "'," sqladd &= " '" & txtbookpublisher.text & "'," sqladd &= " " & txtbooktitle.text & "," sqladd &= " " & txtbooksub.text & ", " sqladd &= " " & txtpricerent.text & ", " sqladd &= " " & Book_status & ", " sqladd &= " '" & CStr(cmbType.SelectedValue) & "'," sqladd &= " '" & CStr(cmbSup.SelectedValue) & "' )" Conndata()

7 159.CommandText = sqladd.executenonquery() Catch ErrortoAdd As Exception MessageBox.Show("ţ ůęŀ ŀăğřčńů ŠŰĹ Ŕąţ¾ŰřŞŐůĹÐðŀł " & ErrortoAdd.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) txtbookid.focus() txtbookid.selectall() Finally Conn.Close() End Try MessageBox.Show("řčńů ŠŰĹ ŔąĚŞĿÐęŐĹřăŇĂşăŰĹĂŚąŰď ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) Cleardata() showbook() Private Sub cmdedit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdedit.click Dim sqledit As String If txtbookid.text = "" Then MessageBox.Show("łăő¼ŀłăĹłăĚĿęĚŞĿÐęŐĹ¾ŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtbookid.focus() If txtbookisbn.text = "" Then MessageBox.Show("łăő¼ŀłăĹłřąŠřăŇó̪ĿÐęŐĹ¾ŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtbookisbn.focus() If txtbookname.text = "" Then MessageBox.Show("łăő¼ŀłăĹłýŐůĹĚŞĿÐęŐĹ¾ŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtbookname.focus() If txtbookdetail.text = "" Then MessageBox.Show("łăő¼ŀłăĹłăŀĂąľřĹŇĂ¾ĚŞĿÐęŐĹ¾ŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtbookdetail.focus() If txtbookauther.text = "" Then MessageBox.Show("łăő¼ŀłăĹłýŐůĹćŔŰŚ ůð¾űďăžůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtbookauther.focus()

8 160 If txtbookpublisher.text = "" Then MessageBox.Show("łăő¼ŀłăĹłýŐůĹęŻŀŞĿłčń čź¾űďăžůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtbookpublisher.focus() If txtbooktitle.text = "" Then MessageBox.Show("łăő¼ŀłăĹł ŀžěşŀðęőĺ¾űďăžůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtbooktitle.focus() If txtbooksub.text = "" Then MessageBox.Show("łăő¼ŀłăĹłřąů ğňůěşŀðęőĺ¾űďăžůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtbooksub.focus() If txtpricerent.text = "" Then MessageBox.Show("łăő¼ŀłăĹłăŀŽŀřýůŀĚŞĿÐęŐĹ¾ŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtpricerent.focus() If MessageBox.Show("Žő¼ ŰĹÐłŀ㌳ŰţŠŠŰĹ ŔąŢýůĚăŐĹţ ů ", "ŽŻŀĂŐŞĂĿŞ ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then Try sqledit = "UPDATE tb_book " sqledit &= " SET Book_isbn='" & txtbookisbn.text & "'," sqledit &= " Book_name='" & txtbookname.text & "'," sqledit &= " Book_Author='" & txtbookauther.text & "'," sqledit &= " Book_detail='" & txtbookdetail.text & "'," sqledit &= " Book_Publisher='" & txtbookpublisher.text & "'," sqledit &= " Book_Title=" & txtbooktitle.text & "," sqledit &= " Book_sub=" & txtbooksub.text & "," sqledit &= " Price_rent=" & txtpricerent.text & "," sqledit &= " Bt_id='" & CStr(cmbType.SelectedValue) & "'," sqledit &= " Sup_id='" & CStr(cmbSup.SelectedValue) & "' " sqledit &= "WHERE (Book_id='" & txtbookid.text & "' )".CommandText = sqledit.executenonquery() Catch ErrorToUpdate As Exception MessageBox.Show("ţ ůęŀ ŀăğśłűţššűĺ Ŕąţ¾ŰřŞŐůĹÐðŀł " & ErrorToUpdate.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally Conn.Close() End Try MessageBox.Show("ŚłŰţŠŠŰĹ ŔąĚŞĿÐęŐĹřăŇĂşăŰĹĂŚąŰď ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK,

9 161 MessageBoxIcon.Information) Cleardata() showbook() Private Sub cmddelete_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmddelete.click Dim sqldelete As String Dim tmprowsaffected As Short If MessageBox.Show("Žő¼ ŰĹÐłŀăąşŠŰĹ ŔąŢýůĚăŐĹţ ů ", "ŽŻŀĂŐŞĂĿŞ ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then Try sqldelete = "DELETE FROM tb_book " sqldelete &= "WHERE (Book_id='" & txtbookid.text & "')" Conndata().CommandText = sqldelete tmprowsaffected = CShort(.ExecuteNonQuery()) If tmprowsaffected = 0 Then MessageBox.Show("ţ ů ŇăĚĿęĚŞĿÐęŐĹğŇůŽő¼ ŰĹÐłŀăąş ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) txtbookid.focus() Catch ErrorToDelete As Exception MessageBox.Show("ţ ůęŀ ŀăğąşšűĺ Ŕąţ¾ŰřŞŐůĹÐðŀł " & ErrorToDelete.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) txtbookid.focus() Finally Conn.Close() End Try MessageBox.Show("ąşŠŰĹ ŔąĆăľř ğěşŀðęőĺřăňăşăűĺăśąűď ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) Cleardata() showbook() Private Sub cmdclear_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdclear.click Cleardata() Private Sub cmdexit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdexit.click Me.Close()

10 162 Private Sub txtbookid_keypress(byval sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtbookid.keypress If (e.keychar < Chr(48) Or e.keychar > Chr(57)) And e.keychar <> Chr(8) Then e.handled = True Private Sub txtbookisbn_keypress(byval sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtbookisbn.keypress If (e.keychar < Chr(48) Or e.keychar > Chr(57)) And e.keychar <> Chr(8) Then e.handled = True Private Sub txtbooktitle_keypress(byval sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtbooktitle.keypress If (e.keychar < Chr(48) Or e.keychar > Chr(57)) And e.keychar <> Chr(8) Then e.handled = True Private Sub txtbooksub_keypress(byval sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtbooksub.keypress If (e.keychar < Chr(48) Or e.keychar > Chr(57)) And e.keychar <> Chr(8) Then e.handled = True Private Sub txtpricerent_keypress(byval sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtpricerent.keypress If (e.keychar < Chr(48) Or e.keychar > Chr(57)) And e.keychar <> Chr(8) Then e.handled = True Private Sub grdbook_cellcontentclick(byval sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles grdbook.cellcontentclick cmbtype.text = "" cmbsup.text = "" If e.rowindex = grdbook.rows.count - 1 Then txtbookid.enabled = False With grdbook txtbookid.text =.Rows.Item(e.RowIndex).Cells(0).Value.ToString() txtbookisbn.text =.Rows.Item(e.RowIndex).Cells(1).Value.ToString() txtbookname.text =.Rows.Item(e.RowIndex).Cells(2).Value.ToString() txtbookdetail.text =.Rows.Item(e.RowIndex).Cells(3).Value.ToString() txtbookauther.text =.Rows.Item(e.RowIndex).Cells(4).Value.ToString() txtbookpublisher.text =.Rows.Item(e.RowIndex).Cells(5).Value.ToString() txtbooktitle.text =.Rows.Item(e.RowIndex).Cells(6).Value.ToString() txtbooksub.text =.Rows.Item(e.RowIndex).Cells(7).Value.ToString() txtpricerent.text =.Rows.Item(e.RowIndex).Cells(8).Value.ToString() cmbtype.selectedtext =.Rows.Item(e.RowIndex).Cells(9).Value.ToString cmbsup.selectedtext =.Rows.Item(e.RowIndex).Cells(10).Value.ToString

11 163 End Class Source Code ช อ Empemployee Option Explicit On Option Strict On Imports System.data Imports System.Data.OleDb Public Class Empemployee Dim Sex As String Dim cs As New DataGridViewCellStyle Private Sub Empemployee_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Conndata() GenerateID() showemployee() txtemid.enabled = False

12 164 ' ń¾ ůĺ²ŀşšűĺ Ŕą Private Sub Conndata() With Conn If.State = ConnectionState.Open Then.Close().ConnectionString = StrConn.Open() 'Generate ăěŀęćăľř ğęńşžűŀ Private Sub GenerateID() Dim sqlgenerateid As String Dim tmpid As Integer Dim lastid As String dr.close() sqlgenerateid = "SELECT TOP 1 Li_id FROM tb_employee ORDER BY Li_id DESC" Conndata().CommandText = sqlgenerateid dr =.ExecuteReader dr.read() If dr.hasrows = True Then lastid = CStr(dr(0).ToString.Trim) tmpid = CInt(Microsoft.VisualBasic.Right(lastId, 6)) tmpid = tmpid + 1 lastid = tmpid.tostring("000000") txtemid.text = CStr(lastId) Else lastid = "000001" txtemid.text = CStr(lastId).ToString dr.close() Private Sub showemployee() Dim sqlemployee As String = "" sqlemployee = "SELECT Li_id,Li_name,Address,cardID,Sex,Telephone,Liuser,Lipassword FROM tb_employee" da = New OleDbDataAdapter(sqlEmployee, Conn) da.fill(ds, "tb_employee") With grdemployee.readonly = True.DataSource = ds.tables("tb_employee") cs.font = New Font("Ms Sans Serif ", 10, FontStyle.Bold)

13 165 With grdemployee.columnheadersdefaultcellstyle = cs.columns(0).headertext = "ăěŀęčşŀłðŀş".columns(1).headertext = "ýőůĺčşŀłðŀş ".Columns(2).HeaderText = "ğňůĺăŕů ".Columns(3).HeaderText = "řąšćăľðżŀ ĿďĆăľýŀýŞ".Columns(4).HeaderText = "řčđ".columns(5).headertext = "řşĺăźśğăđŀčğź ".Columns(6).HeaderText = "ýőůĺřšűŀăľşş ".Columns(7).HeaderText = "ăěŀęćůŀş ".Columns(0).Width = 95.Columns(1).Width = 98.Columns(2).Width = 105.Columns(3).Width = 150.Columns(4).Width = 40.Columns(5).Width = 100.Columns(6).Width = 85.Columns(7).Width = 70 ds.tables.clear() Private Sub cleardata() txtemname.text = "" txtemaddress.text = "" txtemcardid.text = "" txtphone.text = "" txtemusername.text = "" txtempassword.text = "" txtemid.enabled = False rdsex1.checked = False rdsex2.checked = False Private Sub cmdadd_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdadd.click Adddata() Private Sub Adddata() Dim stradd As String If txtemname.text = "" Then MessageBox.Show("łăő¼ŀłăĹłýŐůĹčŞĿłÐŀ޾ŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtemname.focus() If txtemaddress.text = "" Then MessageBox.Show("łăő¼ŀłăĹłğŇůĹĂŔů¾ŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtemaddress.focus()

14 166 If txtemcardid.text = "" Then MessageBox.Show("łăő¼ŀłăĹłřąŠĆăľðŻŀ Ŀď¾ŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtemcardid.focus() If rdsex1.checked = True Then Sex = "ýŀă " If rdsex2.checked = True Then Sex = "Ě ńð" If txtphone.text = "" Then MessageBox.Show("łăő¼ŀłăĹłřşĹăźśğăĐĿčğź¾ŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtphone.focus() If txtemusername.text = "" Then MessageBox.Show("łăő¼ŀłăĹłýŐůĹřŠŰŀăľşş¾ŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtemusername.focus() If txtempassword.text = "" Then MessageBox.Show("łăő¼ŀłăĹłăĚĿęćůŀ޾ŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtempassword.focus() If MessageBox.Show("Žő¼ ŰĹÐłŀăřčńů ŠŰĹ Ŕąę ŀýńłţýůěăőĺţ ů ", "ŽŻŀĂŐŞĂĿŞ ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then Try stradd = " INSERT INTO tb_employee(li_id,li_name,address,cardid,sex,telephone,liuser,lipassword) Values (" stradd &= " '" & txtemid.text & "'," stradd &= " '" & txtemname.text & "'," stradd &= " '" & txtemaddress.text & "'," stradd &= " '" & txtemcardid.text & "'," stradd &= " '" & Sex & "'," stradd &= " '" & txtphone.text & "'," stradd &= " '" & txtemusername.text & "'," stradd &= " '" & txtempassword.text & "' ) " 'Conndata().CommandText = stradd.executenonquery() Catch ErrortoAdd As Exception MessageBox.Show("ţ ůęŀ ŀăğřčńů ŠŰĹ Ŕąţ¾Ű řşőůĺððŀł " & ErrortoAdd.Message, "ŠŰĹćń¾čąŀ¾ ",

15 167 MessageBoxButtons.OK, MessageBoxIcon.Error) txtemid.focus() Finally Conn.Close() End Try MessageBox.Show("řčńů ŠŰĹ ŔąčŞĿłÐŀŞřăŇĂşăŰĹĂŚąŰď ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) cleardata() showemployee() GenerateID() Private Sub cmdedit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdedit.click Dim sqledit As String If txtemname.text = "" And txtemaddress.text = "" And txtemcardid.text = "" And txtphone.text = "" And txtemusername.text = "" And txtempassword.text = "" Then MessageBox.Show("łăő¼ŀłăĹłŠŰĹ ŔąŢĚŰŽăş¾ŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) If rdsex1.checked = False And rdsex2.checked = False Then MessageBox.Show("łăő¼ŀřąŐĹłřčĐ¾ŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) If rdsex1.checked = True Then Sex = "ýŀă " If rdsex2.checked = True Then Sex = "Ě ńð" If MessageBox.Show("Žő¼ ŰĹÐłŀ㌳ŰţŠŠŰĹ ŔąŢýůĚăŐĹţ ů ", "ŽŻŀĂŐŞĂĿŞ ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then Try sqledit = "UPDATE tb_employee " sqledit &= "SET Li_name='" & txtemname.text & "'," sqledit &= " Address='" & txtemaddress.text & "'," sqledit &= " cardid='" & txtemcardid.text & "'," sqledit &= " Sex='" & Sex & "'," sqledit &= " Telephone='" & txtphone.text & "'," sqledit &= " Liuser='" & txtemusername.text & "'," sqledit &= " Lipassword='" & txtempassword.text & "'" sqledit &= "WHERE (Li_id='" & txtemid.text & "' )".CommandText = sqledit.executenonquery() Catch ErrorToUpdate As Exception

16 168 MessageBox.Show("ţ ůęŀ ŀăğśłűţššűĺ Ŕąţ¾ŰřŞŐůĹÐðŀł " & ErrorToUpdate.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally Conn.Close() End Try MessageBox.Show("ŚłŰţŠŠŰĹ ŔąčŞĿłÐŀŞřăŇĂşăŰĹĂŚąŰď ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) cleardata() showemployee() txtemid.enabled = False GenerateID() Private Sub cmddelete_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmddelete.click Dim sqldelete As String Dim tmprowsaffected As Short If MessageBox.Show("Žő¼ ŰĹÐłŀăąşŠŰĹ ŔąŢýůĚăŐĹţ ů ", "ŽŻŀĂŐŞĂĿŞ ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then Try sqldelete = "DELETE FROM tb_employee " sqldelete &= "WHERE (Li_id='" & txtemid.text & "')" 'Conndata().CommandText = sqldelete tmprowsaffected = CShort(.ExecuteNonQuery()) If tmprowsaffected = 0 Then MessageBox.Show("ţ ů ŇăĚĿęčŞĿłÐŀŞğŇůŽő¼ ŰĹÐłŀăąş ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) txtemid.focus() Catch ErrorToDelete As Exception MessageBox.Show("ţ ůęŀ ŀăğąşšűĺ Ŕąţ¾ŰřŞŐůĹÐðŀł " & ErrorToDelete.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) txtemid.focus() Finally Conn.Close() End Try MessageBox.Show("ąşŠŰĹ ŔąčŞĿłÐŀŞřăŇĂşăŰĹĂŚąŰď ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) cleardata() showemployee() txtemid.enabled = False GenerateID()

17 169 Private Sub cmdclear_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdclear.click cleardata() GenerateID() Private Sub cmdexit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdexit.click Me.Close() Private Sub txtemcardid_keypress(byval sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtemcardid.keypress If (e.keychar < Chr(48) Or e.keychar > Chr(57)) And e.keychar <> Chr(8) Then e.handled = True Private Sub txtphone_keypress(byval sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtphone.keypress If (e.keychar < Chr(48) Or e.keychar > Chr(57)) And e.keychar <> Chr(8) Then e.handled = True Private Sub grdemployee_cellcontentclick(byval sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles grdemployee.cellcontentclick Dim Sexx As String If e.rowindex = grdemployee.rows.count - 1 Then txtemid.enabled = False With grdemployee txtemid.text =.Rows.Item(e.RowIndex).Cells(0).Value.ToString() txtemname.text =.Rows.Item(e.RowIndex).Cells(1).Value.ToString() txtemaddress.text =.Rows.Item(e.RowIndex).Cells(2).Value.ToString() txtemcardid.text =.Rows.Item(e.RowIndex).Cells(3).Value.ToString() Sexx =.Rows.Item(e.RowIndex).Cells(4).Value.ToString() txtphone.text =.Rows.Item(e.RowIndex).Cells(5).Value.ToString() txtemusername.text =.Rows.Item(e.RowIndex).Cells(6).Value.ToString() txtempassword.text =.Rows.Item(e.RowIndex).Cells(7).Value.ToString() If Sexx = "ýŀă " Then rdsex1.checked = True If Sexx = "Ě ńð" Then rdsex2.checked = True End Class

18 170 Source Code ช อ Empmember Option Explicit On Option Strict On Imports System.data Imports System.Data.OleDb Public Class Empmember Dim Sex As String = "" Private Sub Empmember_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load GenerateID() showmember() txtmemid.enabled = False Private Sub Conndata() With Conn If.State = ConnectionState.Open Then.Close().ConnectionString = StrConn.Open() Private Sub GenerateID() Dim sqlgenerateid As String Dim tmpid As Integer Dim lastid As String dr.close() sqlgenerateid = "SELECT TOP 1 Mem_id FROM tb_member ORDER BY Mem_id DESC" Conndata().CommandText = sqlgenerateid dr =.ExecuteReader dr.read() If dr.hasrows = True Then lastid = CStr(dr(0).ToString.Trim) tmpid = CInt(Microsoft.VisualBasic.Right(lastId, 6)) tmpid = tmpid + 1 lastid = tmpid.tostring("000000") txtmemid.text = CStr(lastId) Else lastid = "000001" txtmemid.text = CStr(lastId) dr.close()

19 171 Private Sub showmember() Dim sqlmember As String Dim cs As New DataGridViewCellStyle sqlmember = "SELECT Mem_id,Mem_name,Sex,card_ID,Address,Phone FROM tb_member" da = New OleDbDataAdapter(sqlMember, Conn) da.fill(ds, "tb_member") With grdmember.readonly = True.DataSource = ds.tables("tb_member") cs.font = New Font("Ms Sans Serif ", 10, FontStyle.Bold) With grdmember.columns(0).headertext = "ăěŀęę ŀýńł".columns(1).headertext = "ýőůĺ -ęłőą".columns(2).headertext = "řčđ".columns(3).headertext = "řąšćăľðżŀ ĿďĆăľýŀýŞ".Columns(4).HeaderText = "ğňůĺăŕů ".Columns(5).HeaderText = "řşĺăźśğăđŀčğź ".Columns(0).Width = 100.Columns(1).Width = 130.Columns(2).Width = 50.Columns(3).Width = 170.Columns(4).Width = 172.Columns(5).Width = 120 ds.tables.clear() Private Sub cleardata() txtmemid.text = "" txtfname.text = "" txtcardid.text = "" txtaddress.text = "" txtphone.text = "" rdsex1.checked = False rdsex2.checked = False txtmemid.enabled = False Private Sub cmdadd_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdadd.click Adddata() Private Sub Adddata() Dim stradd As String If txtfname.text = "" Then MessageBox.Show("łăő¼ŀłăĹłýŐůĹę ŀýńł¾űďăžůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtfname.focus()

20 172 If rdsex1.checked = True Then Sex = "ýŀă " If rdsex2.checked = True Then Sex = "Ě ńð" If txtcardid.text = "" Then MessageBox.Show("łăő¼ŀłăĹłğŇůĹĂŔů¾ŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtcardid.focus() If txtaddress.text = "" Then MessageBox.Show("łăő¼ŀłăĹłřąŠĆăľðŻŀ ĿďĆăľýŀý޾ŰďĂŽůľ¾ŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtaddress.focus() If txtphone.text = "" Then MessageBox.Show("łăő¼ŀłăĹłĚ ŀăřąšśğăđŀčğź¾űďăžůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtphone.focus() If MessageBox.Show("Žő¼ ŰĹÐłŀăřčńů ŠŰĹ Ŕąę ŀýńłţýůěăőĺţ ů ", "ŽŻŀĂŐŞĂĿŞ ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then Try stradd = " INSERT INTO tb_member(mem_id,mem_name,sex,card_id,address,phone) Values (" stradd &= " '" & CStr(Trim(txtMemID.Text)) & "'," stradd &= " '" & txtfname.text & "'," stradd &= " '" & Sex & "'," stradd &= " '" & txtcardid.text & "'," stradd &= " '" & CStr(Trim(txtAddress.Text)) & "'," stradd &= " '" & txtphone.text & "' ) " 'Conndata().CommandText = stradd.executenonquery() Catch ErrortoAdd As Exception MessageBox.Show("ţ ůęŀ ŀăğřčńů ŠŰĹ Ŕąţ¾Ű řşőůĺððŀł " & ErrortoAdd.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) txtmemid.focus() Finally Conn.Close() End Try

21 173 MessageBox.Show("řčńů ŠŰĹ Ŕąę ŀýńłřăňăşăűĺăśąűď ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) cleardata() showmember() GenerateID() Private Sub cmdedit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdedit.click ' ŚłŰţŠŠŰĹ Ŕąę ŀýńł Dim sqledit As String If rdsex1.checked = True Then Sex = "ýŀă " If rdsex2.checked = True Then Sex = "Ě ńð" If MessageBox.Show("Žő¼ ŰĹÐłŀ㌳ŰţŠŠŰĹ ŔąŢýůĚăŐĹţ ů ", "ŽŻŀĂŐŞĂĿŞ ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then Try sqledit = "UPDATE tb_member " sqledit &= "SET Mem_name='" & txtfname.text & "'," sqledit &= " Sex='" & Sex & "'," sqledit &= " card_id='" & txtcardid.text & "'," sqledit &= " Address='" & txtaddress.text & "'," sqledit &= " Phone='" & txtphone.text & "' " sqledit &= "WHERE (Mem_id='" & txtmemid.text & "' )".CommandText = sqledit.executenonquery() Catch ErrorToUpdate As Exception MessageBox.Show("ţ ůęŀ ŀăğśłűţššűĺ Ŕąţ¾ŰřŞŐůĹÐðŀł " & ErrorToUpdate.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally Conn.Close() End Try MessageBox.Show("ŚłŰţŠŠŰĹ Ŕąę ŀýńłřăňăşăűĺăśąűď ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) cleardata() showmember() txtmemid.enabled = False GenerateID() Private Sub cmddelete_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmddelete.click

22 174 ' ąşšűĺ Ŕąę ŀýńł Dim sqldelete As String Dim tmprowsaffected As Short If MessageBox.Show("Žő¼ ŰĹÐłŀăąşŠŰĹ ŔąŢýůĚăŐĹţ ů ", "ŽŻŀĂŐŞĂĿŞ ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then Try sqldelete = "DELETE FROM tb_member " sqldelete &= "WHERE (Mem_id='" & txtmemid.text & "')" Conndata().CommandText = sqldelete tmprowsaffected = CShort(.ExecuteNonQuery()) If tmprowsaffected = 0 Then MessageBox.Show("ţ ů ŇřąŠĆăľðŻŀ ĿďğŇůŽő¼ ŰĹÐłŀăąş ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) txtmemid.focus() Catch ErrorToDelete As Exception MessageBox.Show("ţ ůęŀ ŀăğąşšűĺ Ŕąţ¾Ű řşőůĺððŀł " & ErrorToDelete.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally Conn.Close() End Try MessageBox.Show("ąşŠŰĹ Ŕąę ŀýńłřăňăşăűĺăśąűď ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) cleardata() showmember() txtmemid.enabled = False GenerateID() Private Sub cmdclear_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdclear.click cleardata() GenerateID() Private Sub cmdexit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdexit.click Me.Close() Private Sub txtphone_keydown(byval sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtaddress.keydown If e.keycode = Keys.Enter Then Adddata()

23 175 Private Sub txtcardid_keypress(byval sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtcardid.keypress If (e.keychar < Chr(48) Or e.keychar > Chr(57)) And e.keychar <> Chr(8) Then e.handled = True Private Sub txtphone_keypress1(byval sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtphone.keypress If (e.keychar < Chr(48) Or e.keychar > Chr(57)) And e.keychar <> Chr(8) Then e.handled = True Private Sub grdmember_cellcontentclick(byval sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles grdmember.cellcontentclick Dim Sexx As String If e.rowindex = grdmember.rows.count - 1 Then txtmemid.enabled = False With grdmember txtmemid.text =.Rows.Item(e.RowIndex).Cells(0).Value.ToString() txtfname.text =.Rows.Item(e.RowIndex).Cells(1).Value.ToString() Sexx =.Rows.Item(e.RowIndex).Cells(2).Value.ToString() txtcardid.text =.Rows.Item(e.RowIndex).Cells(3).Value.ToString() txtaddress.text =.Rows.Item(e.RowIndex).Cells(4).Value.ToString() txtphone.text =.Rows.Item(e.RowIndex).Cells(5).Value.ToString() ' txtfname.text =.Rows.Item(e.RowIndex).Cells(5).Value.ToString() If Sexx = "ýŀă " Then rdsex1.checked = True If Sexx = "Ě ńð" Then rdsex2.checked = True End Class Source Code ช อ Emporder Option Explicit On Option Strict On Imports System.data Imports System.Data.OleDb Public Class Emporder

24 176 Dim cs As New DataGridViewCellStyle Dim Full_name As String ' ýőůĺčşŀłðŀş Dim EmpID As String ' ăěŀęčşŀłðŀş Dim sup_id As String ' ăěŀę ĿďŚğŞðŻŀĚŞůŀĂ Dim mydinamic() As Integer Dim Sizes As Integer Dim i As Integer Dim j As Integer Dim book_status As Integer = 1 Dim price_status As Integer = 1 Dim booknum As Integer 'ðżŀşďşěşŀðęőĺğŀűðě ¾ Dim sumprice As Integer 'ðżŀşďşřðńşğŀűðě ¾ Dim tmp1 As String = "" Dim tmp2 As String = "" Dim tmp3 As String = "" Private Sub Emporder_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Conndata() GenerateID() showname() showgridview() 'showorder() showsuplier() cmbsuplier.text = "řąőĺł ĿďŚğŞðŻŀĚŞůŀĂ " txtempname.enabled = False txtorderid.enabled = False dtpdate.enabled = False txtsumbook.enabled = False txtsumprice.enabled = False Private Sub Conndata() With Conn If.State = ConnectionState.Open Then.Close().ConnectionString = StrConn.Open() Private Sub GenerateID() Dim sqlorder As String Dim tmpid As Integer Dim lastid As String = "" sqlorder = "SELECT TOP 1 Order_id FROM tb_order ORDER BY Order_id DESC" Conndata()

25 177.CommandText = sqlorder dr =.ExecuteReader dr.read() If dr.hasrows Then lastid = CStr(dr(0).ToString.Trim) tmpid = CInt(Microsoft.VisualBasic.Right(lastId, 6)) tmpid = tmpid + 1 lastid = tmpid.tostring("000000") txtorderid.text = CStr(lastId) Else lastid = "000001" txtorderid.text = CStr(lastId) dr.close() Private Sub showname() Dim sqlname As String sqlname = "SELECT Li_id,Li_name FROM tb_employee WHERE (Liuser='" & CStr(U_name) & "')".CommandText = sqlname dr =.ExecuteReader() dr.read() EmpID = CStr(dr.Item("Li_id")) Full_name = CStr(dr.Item("Li_name")) txtempname.text = Full_name Private Sub showgridview() Dim cs As New DataGridViewCellStyle cs.font = New Font("Ms Sans Serif ", 10, FontStyle.Bold) With grdorder.columnheadersdefaultcellstyle = cs.columns.add(cstr(0), "ăěŀęęŀůðþőűĺ ").Columns.Add(CStr(1), "ýőůĺěşŀðęőĺ ").Columns.Add(CStr(2), "ðżŀşďş").columns.add(cstr(3), "ăŀžŀ ůĺřąů ").Columns.Add(CStr(4), "ęŀůðþőűĺś¾ă ").Columns(0).Width = 150.Columns(1).Width = 150.Columns(2).Width = 150.Columns(3).Width = 150.Columns(4).Width = 142

26 178 'Private Sub showorder() ' Dim sqlorder As String = "" ' sqlorder = "SELECT Order_Id,book_name,book_num,book_price FROM tb_orderdetail " ' da = New OleDbDataAdapter(sqlOrder, Conn) ' da.fill(ds, "tb_orderdetail") ' With grdorderdetail '.ReadOnly = True '.DataSource = ds.tables("tb_orderdetail") ' ' cs.font = New Font("Ms Sans Serif ", 10, FontStyle.Bold) ' ' ' ' ' ' With grdorderdetail.columnheadersdefaultcellstyle = cs.columns(0).headertext = "ăěŀęęŀůðþőűĺ ".Columns(1).HeaderText = "ýőůĺěşŀðęőĺ ".Columns(2).HeaderText = "ðżŀşďş".columns(3).headertext = "ăŀžŀ ůĺřąů " '.Columns(0).Width = 100 '.Columns(1).Width = 100 '.Columns(2).Width = 100 '.Columns(3).Width = 120 ' ' ds.tables.clear() ' Private Sub showsuplier() Dim sqlsuplier As String sqlsuplier = "SELECT * FROM tb_supplier" da = New OleDbDataAdapter(sqlSuplier, Conn) da.fill(ds, "tb_supplier") With cmbsuplier.datasource = ds.tables("tb_supplier").displaymember = "Sup_name".ValueMember = "Sup_id".DataBindings.Add("SelectedValue", ds, "tb_supplier.sup_id") ds.tables.clear() Private Sub cmdok_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdok.click sup_id = CStr(cmbSuplier.SelectedValue) showbook(sup_id) Private Sub showbook(byval supname As String) Dim sqlbook As String sqlbook = "SELECT book_name FROM tb_book WHERE Sup_id='" & supname & "' "

27 179 da = New OleDbDataAdapter(sqlBook, Conn) da.fill(ds, "tb_book") With grdbook.readonly = True.DataSource = ds.tables("tb_book") cs.font = New Font("Ms Sans Serif ", 10, FontStyle.Bold) With grdbook.columnheadersdefaultcellstyle = cs.columns(0).headertext = "ýőůĺěşŀðęőĺ ".Columns(0).Width = 155 ds.tables.clear() Private Sub cleardata() txtbookname.text = "" txtbooknum.text = "" txtbookprice.text = "" txtbookname.enabled = True ' cmbsuplier.text = "řąőĺł ĿďŚğŞðŻŀĚŞůŀĂ " ' Me.grdbook.DataSource = Nothing Private Sub cleardata2() Me.grdOrder.Rows.Clear() booknum = 0 sumprice = 0 txtsumbook.text = "" txtsumprice.text = "" Private Sub cmdadd_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdadd.click Addgrid() Private Sub Addgrid() Dim book_name As String Dim book_num As Integer Dim book_price As Integer Dim sum_book As Integer Dim summoney As Integer Dim priceorder As Integer ReDim Preserve mydinamic(sizes - 1) If txtbookname.text = "" Then MessageBox.Show("łăő¼ŀýŐůĹĚŞĿÐęŐĹŢĚŰĞŔł ŰĹоŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error)

28 180 txtbookname.text = "" txtbookname.focus() If txtbooknum.text = "" Then MessageBox.Show("łăő¼ŀðŻŀŞďŞĚŞĿÐęŐĹŢĚŰĞŔł ŰĹоŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) txtbooknum.text = "" txtbooknum.focus() If txtbookprice.text = "" Then MessageBox.Show("łăő¼ŀăŀŽŀ ůĺřąů ŢĚŰĞŔł ŰĹоŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) txtbookprice.text = "" txtbookprice.focus() book_name = Trim(txtbookname.Text) book_num = CInt(txtbooknum.Text) book_price = CInt(txtbookprice.Text) summoney = CInt(book_num) * CInt(book_price) ' ðżŀşďşřðńş sum_book = sum_book + book_num priceorder = priceorder + summoney For i = 0 To mydinamic.getlowerbound(0) If book_num < 1 Then MessageBox.Show("łăő¼ŀłăĹłðŻŀŞďŞŢĚŰĞŔł ŰĹоŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtbooknum.text = "" 'řčńů ŠŰĹ ŔąąÐŢŞ ŀăŀð Me.grdOrder.Rows.Add(Me.txtorderID.Text, book_name, book_num, book_price, Full_name) dr.close() Next booknum = booknum + sum_book sumprice = sumprice + priceorder txtsumbook.text = CStr(bookNum) txtsumprice.text = CStr(sumprice) 'booknum = 0 'sumprice = 0 cleardata() Private Sub cmdcancel1_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdcancel1.click

29 181 cleardata() Private Sub cmdsave_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdsave.click Dim sqladd1 As String Dim sqladd2 As String Dim Dates As String Dates = dtpdate.value.tostring("dd/mm/yyyy") If MessageBox.Show("Žő¼ ŰĹÐłŀăşĿŞğňłŠŰĹ ŔąłŀăęĿůÐÞŐŰĹŢýůĚăŐĹţ ů ", "ŽŻŀĂŐŞĂĿŞ ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) = Windows.Forms.DialogResult.Yes Then If txtsumbook.text = "" And txtsumprice.text = "" Then MessageBox.Show("łăő¼ŀęĿůÐÞŐŰĹęńŞŽŰŀ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) Try sqladd1 = "INSERT INTO tb_order(order_id,li_id,sup_id,order_net,order_pricenet,order_date,status,price_status)values(" sqladd1 &= " '" & txtorderid.text & "'," sqladd1 &= " '" & EmpID & "'," sqladd1 &= " '" & sup_id & "'," sqladd1 &= " " & booknum & "," sqladd1 &= " " & sumprice & "," sqladd1 &= " '" & Dates & "'," sqladd1 &= " " & book_status & "," sqladd1 &= " " & price_status & " )" Conndata().CommandText = sqladd1.executenonquery() For j = 0 To Me.grdOrder.Rows.Count - 1 tmp1 = CStr(grdOrder.Rows.Item(j).Cells(1).Value) tmp2 = CStr(grdOrder.Rows.Item(j).Cells(2).Value) tmp3 = CStr(grdOrder.Rows.Item(j).Cells(3).Value) If (tmp1 = "") And (tmp2 = "") And (tmp3 = "") Then Exit Try sqladd2 = "INSERT INTO tb_orderdetail(order_id,book_name,book_num,book_price)values(" sqladd2 &= " '" & txtorderid.text & "'," sqladd2 &= " '" & tmp1 & "'," sqladd2 &= " " & tmp2 & "," sqladd2 &= " " & tmp3 & ")"

30 182.CommandText = sqladd2.executenonquery() Next Catch ErrortoAdd As Exception MessageBox.Show("ţ ůęŀ ŀăğřčńů ŠŰĹ Ŕąţ¾ŰřŞŐůĹÐðŀł " & ErrortoAdd.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally Conn.Close() End Try MessageBox.Show("řčńů ŠŰĹ ŔąłŀăęĿůÐÞŐŰĹĚŞĿÐęŐĹřăŇĂşăŰĹĂŚąŰď ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) booknum = 0 sumprice = 0 cleardata2() GenerateID() ' showorder() Private Sub cmdcancel2_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdcancel2.click cleardata2() Private Sub cmdexit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdexit.click Me.Close() Private Sub txtbooknum_keypress(byval sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtbooknum.keypress If (e.keychar < Chr(48) Or e.keychar > Chr(57)) And e.keychar <> Chr(8) Then e.handled = True Private Sub txtbookprice_keypress(byval sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtbookprice.keypress If (e.keychar < Chr(48) Or e.keychar > Chr(57)) And e.keychar <> Chr(8) Then e.handled = True Private Sub grdbook_cellcontentclick(byval sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles grdbook.cellcontentclick If e.rowindex = grdbook.rows.count - 1 Then With grdbook txtbookname.text =.Rows.Item(e.RowIndex).Cells(0).Value.ToString() txtbookname.enabled = False End Class

31 183 Source Code ช อ Emporderdetail Option Explicit On Option Strict On Imports System.data Imports System.Data.OleDb Public Class Emporderdetail Private Sub Emporderdetail_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Conndata() showorder() Private Sub Conndata() With Conn If.State = ConnectionState.Open Then.Close().ConnectionString = StrConn.Open() Private Sub showorder() Dim sqlorder As String = "" Dim cs As New DataGridViewCellStyle sqlorder = "SELECT tb_orderdetail.order_id,tb_supplier.sup_name,tb_orderdetail.book_name,tb_orderdetail.book_num,tb_orderd etail.book_price,tb_order.order_pricenet,tb_order.order_date FROM tb_orderdetail,tb_order,tb_supplier WHERE tb_orderdetail.order_id=tb_order.order_id AND tb_order.sup_id=tb_supplier.sup_id " da = New OleDbDataAdapter(sqlOrder, Conn) da.fill(ds, "tb_orderdetail") With grdorderdetail.readonly = True.DataSource = ds.tables("tb_orderdetail") cs.font = New Font("Ms Sans Serif ", 10, FontStyle.Bold) With grdorderdetail.columnheadersdefaultcellstyle = cs.columns(0).headertext = "ăěŀęęŀůðþőűĺ ".Columns(1).HeaderText = "ýőůĺ ĿďŚğŞðŻŀĚŞůŀĂ ".Columns(2).HeaderText = "ýőůĺěşŀðęőĺ ".Columns(3).HeaderText = "ðżŀşďş".columns(4).headertext = "ăŀžŀ ůĺřąů ".Columns(5).HeaderText = "ăŀžŀăď ".Columns(6).HeaderText = "ďŀşğňůęŀůðþőűĺ "

32 184.Columns(0).Width = 100.Columns(1).Width = 140.Columns(2).Width = 100.Columns(3).Width = 65.Columns(4).Width = 100.Columns(5).Width = 100.Columns(6).Width = 90 ds.tables.clear() Private Sub cmdexit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdexit.click Me.Close() End Class Source Code ช อ Emppay Option Explicit On Option Strict On Imports System.data Imports System.Data.OleDb Public Class Emppay Dim cs As New DataGridViewCellStyle Dim Full_name As String ' ýőůĺčşŀłðŀş Dim EmpID As String ' ăěŀęčşŀłðŀş Dim orderid As String Dim i As Integer Dim tmp1 As String = "" Dim tmp2 As String = "" Dim status1 As Integer = 2 Dim status2 As Integer = 1 Dim Order_Net As Integer Private Sub Emppay_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Conndata() GenerateID() showname() showorder1() showorder2(orderid) dtpdate.enabled = False txtempname.enabled = False txtpayid.enabled = False Private Sub Conndata() With Conn If.State = ConnectionState.Open Then.Close().ConnectionString = StrConn.Open()

33 185 Private Sub GenerateID() Dim sqlorder As String Dim tmpid As Integer Dim lastid As String = "" sqlorder = "SELECT TOP 1 pay_id FROM tb_pay ORDER BY pay_id DESC" Conndata().CommandText = sqlorder dr =.ExecuteReader dr.read() If dr.hasrows Then lastid = CStr(dr(0).ToString.Trim) tmpid = CInt(Microsoft.VisualBasic.Right(lastId, 6)) tmpid = tmpid + 1 lastid = tmpid.tostring("000000") txtpayid.text = CStr(lastId) Else lastid = "000001" txtpayid.text = CStr(lastId) dr.close() Private Sub showname() Dim sqlname As String sqlname = "SELECT Li_id,Li_name FROM tb_employee WHERE (Liuser='" & CStr(U_name) & "')".CommandText = sqlname dr =.ExecuteReader() dr.read() EmpID = CStr(dr.Item("Li_id")) Full_name = CStr(dr.Item("Li_name")) txtempname.text = Full_name Private Sub showorder1() Dim sqlorder As String sqlorder = "SELECT tb_order.order_id,tb_order.order_net,tb_order.order_pricenet,tb_order.order_date FROM tb_order WHERE tb_order.price_status=" & status2 & " "

34 186 da = New OleDbDataAdapter(sqlOrder, Conn) da.fill(ds, "tb_order") With grdorder1.readonly = True.DataSource = ds.tables("tb_order") cs.font = New Font("Ms Sans Serif ", 10, FontStyle.Bold) With grdorder1.columnheadersdefaultcellstyle = cs.columns(0).headertext = "ăěŀęęŀůðþőűĺ ".Columns(1).HeaderText = "ðżŀşďşğŀűðě ¾ ".Columns(2).HeaderText = "ăŀžŀăď ".Columns(3).HeaderText = "ďŀşğňůęŀůðþőűĺ ".Columns(0).Width = 200.Columns(1).Width = 200.Columns(2).Width = 200.Columns(3).Width = 145 ds.tables.clear() Private Sub grdorder1_cellcontentclick(byval sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles grdorder1.cellcontentclick If e.rowindex = grdorder1.rows.count - 1 Then With grdorder1 orderid =.Rows.Item(e.RowIndex).Cells(0).Value.ToString() Order_Net = CInt(.Rows.Item(e.RowIndex).Cells(1).Value.ToString()) showorder2(orderid) Private Sub showorder2(byval ID As String) Dim sqlorder As String sqlorder = "SELECT tb_orderdetail.order_id,tb_orderdetail.book_name,tb_orderdetail.book_num,tb_orderdetail.book_price FROM tb_orderdetail WHERE tb_orderdetail.order_id='" & ID & "' " da = New OleDbDataAdapter(sqlOrder, Conn) da.fill(ds, "tb_orderdetail") With grdorder2.readonly = True.DataSource = ds.tables("tb_orderdetail") cs.font = New Font("Ms Sans Serif ", 10, FontStyle.Bold) With grdorder2

35 187.ColumnHeadersDefaultCellStyle = cs.columns(0).headertext = "ăěŀęęŀůðþőűĺ ".Columns(1).HeaderText = "ýőůĺěşŀðęőĺ ".Columns(2).HeaderText = "ðżŀşďş".columns(3).headertext = "ăŀžŀ ůĺřąů ".Columns(0).Width = 200.Columns(1).Width = 200.Columns(2).Width = 200.Columns(3).Width = 145 ds.tables.clear() Private Sub cmdsave_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdsave.click Adddata() Private Sub Adddata() Dim sqladd1 As String Dim sqladd2 As String Dim sqledit As String Dim Dates As String Dates = dtpdate.value.tostring("dd/mm/yyyy") If MessageBox.Show("Žő¼ ŰĹÐłŀăşĿŞğňłŠŰĹ ŔąłŀăęĿůÐÞŐŰĹŢýůĚăŐĹţ ů ", "ŽŻŀĂŐŞĂĿŞ ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) = Windows.Forms.DialogResult.Yes Then Try sqladd1 = "INSERT INTO tb_pay(pay_id,li_id,order_net,pay_date)values(" sqladd1 &= " '" & txtpayid.text & "'," sqladd1 &= " '" & EmpID & "'," sqladd1 &= " " & Order_Net & "," sqladd1 &= " '" & Dates & "' )" Conndata().CommandText = sqladd1.executenonquery() For i = 0 To Me.grdOrder2.Rows.Count - 1 tmp1 = CStr(grdOrder2.Rows.Item(i).Cells(1).Value) tmp2 = CStr(grdOrder2.Rows.Item(i).Cells(2).Value) If (tmp1 = "") And (tmp2 = "") Then Exit Try sqladd2 = "INSERT INTO tb_paydetail(pay_id,book_name,book_num)values(" sqladd2 &= " '" & txtpayid.text & "'," sqladd2 &= " '" & tmp1 & "',"

36 188 sqladd2 &= " " & tmp2 & ")".CommandText = sqladd2.executenonquery() Next Catch ErrortoAdd As Exception MessageBox.Show("ţ ůęŀ ŀăğřčńů ŠŰĹ Ŕąţ¾ŰřŞŐůĹÐðŀł " & ErrortoAdd.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally Conn.Close() End Try Try sqledit = "UPDATE tb_order " sqledit &= "SET price_status=" & status1 & " " sqledit &= "WHERE (Order_Id='" & orderid & "' )" Conndata().CommandText = sqledit.executenonquery() Catch ErrortoAdd As Exception MessageBox.Show("ţ ůęŀ ŀăğśłűţššűĺ Ŕąţ¾ŰřŞŐůĹÐðŀł " & ErrortoAdd.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally Conn.Close() End Try MessageBox.Show("řčńů ŠŰĹ ŔąłŀăăĿşĚŞĿÐęŐĹřăŇĂşăŰĹĂŚąŰď ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) GenerateID() showorder1() ' showrec() cleardata2() Private Sub cmdcancel_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdcancel.click cleardata2() Private Sub cleardata2() Me.grdOrder2.DataSource = Nothing

37 189 Private Sub txtorderid_keypress(byval sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) If (e.keychar < Chr(48) Or e.keychar > Chr(57)) And e.keychar <> Chr(8) Then e.handled = True Private Sub cmdexit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdexit.click Me.Close() End Class Source Code ช อ Emppaydetail Option Explicit On Option Strict On Imports System.data Imports System.Data.OleDb Public Class Emppaydetail Private Sub Emppaydetail_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Conndata() showrec() Private Sub Conndata() With Conn If.State = ConnectionState.Open Then.Close().ConnectionString = StrConn.Open() Private Sub showrec() Dim sqlrec As String Dim cs As New DataGridViewCellStyle sqlrec = "SELECT tb_pay.pay_id,tb_employee.li_name,tb_paydetail.book_name,tb_paydetail.book_num,tb_pay.pay_date FROM tb_pay,tb_employee,tb_paydetail WHERE tb_pay.li_id=tb_employee.li_id AND tb_paydetail.pay_id=tb_paydetail.pay_id " da = New OleDbDataAdapter(sqlRec, Conn) da.fill(ds, "tb_receive_bookdetail") With grdrecdetail.readonly = True.DataSource = ds.tables("tb_receive_bookdetail")

38 190 cs.font = New Font("Ms Sans Serif ", 10, FontStyle.Bold) With grdrecdetail.columnheadersdefaultcellstyle = cs.columns(0).headertext = "ăěŀęðůŀăýżŀăľ ".Columns(1).HeaderText = "ýőůĺćŕűăŀş ".Columns(2).HeaderText = "ýőůĺěşŀðęőĺ ".Columns(3).HeaderText = "ðżŀşďş".columns(4).headertext = "ďŀşğňů ".Columns(0).Width = 150.Columns(1).Width = 150.Columns(2).Width = 150.Columns(3).Width = 95.Columns(4).Width = 150 ds.tables.clear() Private Sub cmdexit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdexit.click Me.Close() End Class Source Code ช อ Empreceive Option Explicit On Option Strict On Imports System.data Imports System.Data.OleDb Public Class Empreceive Dim cs As New DataGridViewCellStyle Dim Full_name As String ' ýőůĺčşŀłðŀş Dim EmpID As String ' ăěŀęčşŀłðŀş Dim orderid As String Dim i As Integer Dim tmp1 As String = "" Dim tmp2 As String = "" Dim status1 As Integer = 2 Dim status2 As Integer = 1 Dim Order_Net As Integer Private Sub Empreceive_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Conndata() GenerateID()

39 191 showname() showorder1() showorder2(orderid) dtpdate.enabled = False txtempname.enabled = False txtreid.enabled = False Private Sub Conndata() With Conn If.State = ConnectionState.Open Then.Close().ConnectionString = StrConn.Open() Private Sub GenerateID() Dim sqlorder As String Dim tmpid As Integer Dim lastid As String = "" sqlorder = "SELECT TOP 1 Re_ID FROM tb_receive_book ORDER BY Re_ID DESC" Conndata().CommandText = sqlorder dr =.ExecuteReader dr.read() If dr.hasrows Then lastid = CStr(dr(0).ToString.Trim) tmpid = CInt(Microsoft.VisualBasic.Right(lastId, 6)) tmpid = tmpid + 1 lastid = tmpid.tostring("000000") txtreid.text = CStr(lastId) Else lastid = "000001" txtreid.text = CStr(lastId) dr.close() Private Sub showname() Dim sqlname As String sqlname = "SELECT Li_id,Li_name FROM tb_employee WHERE (Liuser='" & CStr(U_name) & "')".CommandText = sqlname dr =.ExecuteReader() dr.read()

40 192 EmpID = CStr(dr.Item("Li_id")) Full_name = CStr(dr.Item("Li_name")) txtempname.text = Full_name Private Sub showorder1() Dim sqlorder As String sqlorder = "SELECT tb_order.order_id,tb_order.order_net,tb_order.order_pricenet,tb_order.order_date FROM tb_order WHERE tb_order.status=" & status2 & " " da = New OleDbDataAdapter(sqlOrder, Conn) da.fill(ds, "tb_order") With grdorder1.readonly = True.DataSource = ds.tables("tb_order") cs.font = New Font("Ms Sans Serif ", 10, FontStyle.Bold) With grdorder1.columnheadersdefaultcellstyle = cs.columns(0).headertext = "ăěŀęęŀůðþőűĺ ".Columns(1).HeaderText = "ðżŀşďşğŀűðě ¾ ".Columns(2).HeaderText = "ăŀžŀăď ".Columns(3).HeaderText = "ďŀşğňůęŀůðþőűĺ ".Columns(0).Width = 200.Columns(1).Width = 200.Columns(2).Width = 200.Columns(3).Width = 145 ds.tables.clear() Private Sub grdorder1_cellcontentclick(byval sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles grdorder1.cellcontentclick If e.rowindex = grdorder1.rows.count - 1 Then With grdorder1 orderid =.Rows.Item(e.RowIndex).Cells(0).Value.ToString() Order_Net = CInt(.Rows.Item(e.RowIndex).Cells(1).Value.ToString()) showorder2(orderid) Private Sub showorder2(byval ID As String) Dim sqlorder As String sqlorder = "SELECT

41 193 tb_orderdetail.order_id,tb_orderdetail.book_name,tb_orderdetail.book_num,tb_orderdetail.book_price FROM tb_orderdetail WHERE tb_orderdetail.order_id='" & ID & "' " da = New OleDbDataAdapter(sqlOrder, Conn) da.fill(ds, "tb_orderdetail") With grdorder2.readonly = True.DataSource = ds.tables("tb_orderdetail") cs.font = New Font("Ms Sans Serif ", 10, FontStyle.Bold) With grdorder2.columnheadersdefaultcellstyle = cs.columns(0).headertext = "ăěŀęęŀůðþőűĺ ".Columns(1).HeaderText = "ýőůĺěşŀðęőĺ ".Columns(2).HeaderText = "ðżŀşďş".columns(3).headertext = "ăŀžŀ ůĺřąů ".Columns(0).Width = 200.Columns(1).Width = 200.Columns(2).Width = 200.Columns(3).Width = 145 ds.tables.clear() Private Sub cmdsave_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdsave.click Adddata() Private Sub Adddata() Dim sqladd1 As String Dim sqladd2 As String Dim sqledit As String Dim Dates As String Dates = dtpdate.value.tostring("dd/mm/yyyy") If MessageBox.Show("Žő¼ ŰĹÐłŀăşĿŞğňłŠŰĹ ŔąłŀăęĿůÐÞŐŰĹŢýůĚăŐĹţ ů ", "ŽŻŀĂŐŞĂĿŞ ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) = Windows.Forms.DialogResult.Yes Then Try sqladd1 = "INSERT INTO tb_receive_book(re_id,li_id,order_net,re_date)values(" sqladd1 &= " '" & txtreid.text & "'," sqladd1 &= " '" & EmpID & "'," sqladd1 &= " " & Order_Net & "," sqladd1 &= " '" & Dates & "' )" Conndata().CommandText = sqladd1

42 194.ExecuteNonQuery() For i = 0 To Me.grdOrder2.Rows.Count - 1 tmp1 = CStr(grdOrder2.Rows.Item(i).Cells(1).Value) tmp2 = CStr(grdOrder2.Rows.Item(i).Cells(2).Value) If (tmp1 = "") And (tmp2 = "") Then Exit Try sqladd2 = "INSERT INTO tb_receive_bookdetail(re_id,book_name,book_num)values(" sqladd2 &= " '" & txtreid.text & "'," sqladd2 &= " '" & tmp1 & "'," sqladd2 &= " " & tmp2 & ")".CommandText = sqladd2.executenonquery() Next Catch ErrortoAdd As Exception MessageBox.Show("ţ ůęŀ ŀăğřčńů ŠŰĹ Ŕąţ¾ŰřŞŐůĹÐðŀł " & ErrortoAdd.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally Conn.Close() End Try Try sqledit = "UPDATE tb_order " sqledit &= "SET status=" & status1 & " " sqledit &= "WHERE (Order_Id='" & orderid & "' )" Conndata().CommandText = sqledit.executenonquery() Catch ErrortoAdd As Exception MessageBox.Show("ţ ůęŀ ŀăğśłűţššűĺ Ŕąţ¾ŰřŞŐůĹÐðŀł " & ErrortoAdd.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally Conn.Close() End Try MessageBox.Show("řčńů ŠŰĹ ŔąłŀăăĿşĚŞĿÐęŐĹřăŇĂşăŰĹĂŚąŰď ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK,

43 195 MessageBoxIcon.Information) GenerateID() showorder1() ' showrec() cleardata2() Private Sub cmdcancel_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdcancel.click cleardata2() Private Sub cleardata2() Me.grdOrder2.DataSource = Nothing Private Sub txtorderid_keypress(byval sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) If (e.keychar < Chr(48) Or e.keychar > Chr(57)) And e.keychar <> Chr(8) Then e.handled = True Private Sub cmdexit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdexit.click Me.Close() End Class Source Code ช อ Empreceivedetail Option Explicit On Option Strict On Imports System.data Imports System.Data.OleDb Public Class Empreceivedetail Private Sub Empreceivedetail_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Conndata() showrec() Private Sub Conndata() With Conn If.State = ConnectionState.Open Then.Close().ConnectionString = StrConn.Open() Private Sub showrec() Dim sqlrec As String

44 196 Dim cs As New DataGridViewCellStyle sqlrec = "SELECT tb_receive_book.re_id,tb_employee.li_name,tb_receive_bookdetail.book_name,tb_receive_bookdetail.book _num,tb_receive_book.re_date FROM tb_receive_book,tb_employee,tb_receive_bookdetail WHERE tb_receive_book.li_id=tb_employee.li_id AND tb_receive_book.re_id=tb_receive_bookdetail.re_id " da = New OleDbDataAdapter(sqlRec, Conn) da.fill(ds, "tb_receive_bookdetail") With grdrecdetail.readonly = True.DataSource = ds.tables("tb_receive_bookdetail") cs.font = New Font("Ms Sans Serif ", 10, FontStyle.Bold) With grdrecdetail.columnheadersdefaultcellstyle = cs.columns(0).headertext = "ăěŀęăŀşęńşžűŀ ".Columns(1).HeaderText = "ýőůĺćŕűăŀş ".Columns(2).HeaderText = "ýőůĺěşŀðęőĺ ".Columns(3).HeaderText = "ðżŀşďş".columns(4).headertext = "ďŀşğňů ".Columns(0).Width = 150.Columns(1).Width = 150.Columns(2).Width = 150.Columns(3).Width = 95.Columns(4).Width = 150 ds.tables.clear() Private Sub cmdexit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdexit.click Me.Close() End Class Source Code ช อ Emprentbook Option Explicit On Option Strict On Imports System.data Imports System.Data.OleDb Public Class Emprentbook Dim Full_name As String ' ýőůĺčşŀłðŀş Dim EmpID As String 'ăěŀęčşŀłðŀş

45 197 Dim cs As New DataGridViewCellStyle Dim mydinamic() As Integer Dim Sizes As Integer Dim tmp1 As String = "" Dim tmp2 As String = "" Dim tmp3 As String = "" Dim i As Integer Dim j As Integer Dim k As Integer Dim Book_id As String ' ăěŀęěşŀðęőĺ Dim Book_num As Integer = 1 Dim sum_book As Integer ' ðżŀşďşěşŀðęőĺğŀűðě ¾ğŇůĂŐ Dim Book_isbn As String Dim Book_name As String ' ýőůĺěşŀðęőĺ Dim Price_rent As Integer ' ăŀžŀřýůŀ Dim status As Integer Dim status1 As Integer = 2 Dim status_name As String = "" Dim booknum As Integer = 1 'ðżŀşďşăď ĚŞĿÐęŐĹğŇůĂŐ Dim sumprice As Single Dim SumMoney As Integer = 0 ' ðżŀşďşřðńşăď Dim PriceRent As Integer = 0 ' ðżŀşďşřðńşăď ğŀűðě ¾ Private Sub Emprentbook_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Conndata() GenerateID() showname() showgridview() DTPRent.Enabled = False txtempname.enabled = False txtrentid.enabled = False Private Sub Conndata() With Conn If.State = ConnectionState.Open Then.Close().ConnectionString = StrConn.Open() 'Generate řąšğňůłŀăšŀăęńşžűŀ Private Sub GenerateID() Dim sqlorder As String Dim tmpid As Integer Dim lastid As String = "" sqlorder = "SELECT TOP 1 bor_id FROM tb_bookborrowing ORDER BY bor_id DESC" Conndata()

46 198.CommandText = sqlorder dr =.ExecuteReader dr.read() If dr.hasrows Then lastid = CStr(dr(0).ToString.Trim) tmpid = CInt(Microsoft.VisualBasic.Right(lastId, 6)) tmpid = tmpid + 1 lastid = tmpid.tostring("000000") txtrentid.text = CStr(lastId) Else lastid = "000001" txtrentid.text = CStr(lastId) dr.close() Private Sub showname() Dim sqlname As String sqlname = "SELECT Li_id,Li_name FROM tb_employee WHERE (Liuser='" & CStr(U_name) & "')".CommandText = sqlname dr =.ExecuteReader() dr.read() EmpID = CStr(dr.Item("Li_id")) Full_Name = CStr(dr.Item("Li_name")) txtempname.text = Full_name Private Sub showgridview() Dim cs As New DataGridViewCellStyle cs.font = New Font("Ms Sans Serif ", 10, FontStyle.Bold) With grdbook.columnheadersdefaultcellstyle = cs.columns.add(cstr(0), "ăěŀęěşŀðęőĺ ").Columns.Add(CStr(1), "řąšřăňăłěşŀðęőĺ ").Columns.Add(CStr(2), "ýőůĺěşŀðęőĺ ").Columns.Add(CStr(3), "ðżŀşďşğňůăő ").Columns.Add(CStr(4), "ăŀžŀřýůŀ").columns.add(cstr(5), "ęğŀşľłŀăăő ").Columns(0).Width = 110.Columns(1).Width = 110.Columns(2).Width = 150.Columns(3).Width = 90.Columns(4).Width = 100

47 199.Columns(5).Width = 100 Private Sub txtbookid_keypress(byval sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtbookid.keypress If (e.keychar < Chr(48) Or e.keychar > Chr(57)) And e.keychar <> Chr(8) Then e.handled = True Private Sub txtbooknum_keypress(byval sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) If (e.keychar < Chr(48) Or e.keychar > Chr(57)) And e.keychar <> Chr(8) Then e.handled = True Private Sub cmdadd_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdadd.click Addgrid() Private Sub Addgrid() Dim strsql As String Dim Book_status As Integer ReDim Preserve mydinamic(sizes - 1) If txtbookid.text = "" Then MessageBox.Show("łăő¼ŀłăĹłăĚĿęĚŞĿÐęŐĹ¾ŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) txtbookid.focus() 'If txtbooknum.text = "" Then ' MessageBox.Show("łăő¼ŀðŻŀŞďŞĚŞĿÐęŐĹŢĚŰĞŔł ŰĹоŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) ' txtbooknum.text = "" ' txtbooknum.focus() ' ' strsql = " SELECT Book_status FROM tb_book WHERE (Book_id='" & Trim(txtBookID.Text) & "')" Conndata().CommandText = strsql dr =.ExecuteReader() dr.read() Book_status = CInt(dr.Item("Book_status")) If Book_status = 2 Then MessageBox.Show("ĚŞĿÐęŐĹĹĂŔůŢŞęĞŀŞľĞŔłĂŐ ţ ůęŀ ŀăğăő ĹŞŞŇŰţ¾Ű ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error)

48 200 txtbookid.text = "" 'txtbooknum.text = "" txtbookid.focus() dr.close() strsql = " SELECT Book_isbn,Book_name,Price_rent,Book_status FROM tb_book WHERE (Book_id='" & Trim(txtBookID.Text) & "')" Conndata().CommandText = strsql dr =.ExecuteReader() dr.read() If dr.hasrows = False Then MessageBox.Show("ţ ů ŇăĚĿęĚŞĿÐęŐĹğŇů ŰĹÐłŀăĂŐ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) txtbookid.text = "" 'txtbooknum.text = "" txtbookid.focus() dr.close() For i = 0 To mydinamic.getlowerbound(0) Book_id = Trim(txtBookID.Text) 'Book_num = CInt(txtbooknum.Text) 'If Book_num > 1 Then ' MessageBox.Show("łăő¼ŀłăĹłðŻŀŞďŞŢĚŰĞŔł ŰĹоŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Warning) ' txtbooknum.text = "" ' ' Book_isbn = CStr(dr.Item("Book_isbn")) Book_name = CStr(dr.Item("Book_name")) Price_rent = CInt(dr.Item("Price_rent")) status = CInt(dr.Item("Book_status")) SumMoney = CInt(Book_num) * CInt(Price_rent) ' ðżŀşďşřðńş If status = 1 Then status_name = "ĹĂŔůşŞýĿŰŞ " If status = 2 Then status_name = "ĞŔłĂŐ " For j = 0 To Me.grdBook.Rows.Count - 1 ' ăďðęĺşăěŀęęńşžűŀğňůřčńů ÞŻŰŀłĿŞĚăŐĹţ ů tmp1 = CStr(grdBook.Rows.Item(j).Cells(0).Value) 'ăěŀęěşŀðęőĺ

49 201 If tmp1 = CStr(Book_id) Then MessageBox.Show("ţ ůęŀ ŀăğřčńů ţ¾űřşőůĺððŀłăěŀęěşŀðęőĺþżűŀłŀş ", "ćąłŀă ăďðęĺş ", MessageBoxButtons.OK, MessageBoxIcon.Error) txtbookid.text = "" 'txtbooknum.text = "" txtbookid.focus() dr.close() sum_book = sum_book + Book_num ' ðżŀşďşěşŀðęőĺğŀűðě ¾ PriceRent = PriceRent + SumMoney ' ðżŀşďşřðńşğŀűðě ¾ Next 'řčńů ŠŰĹ ŔąąÐŢŞ ŀăŀð Me.grdBook.Rows.Add(Me.txtBookID.Text, Book_isbn, Book_name, Book_num, Price_rent, status_name.tostring) dr.close() Next txtsummoney.text = PriceRent.ToString("#,##0.00") txtsummoney.enabled = False txtsumbook.text = CStr(sum_book) txtsumbook.enabled = False txtbookid.text = "" 'txtbooknum.text = "" booknum = sum_book sumprice = PriceRent sum_book = 0 PriceRent = 0 Private Sub cmdsubmit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdsubmit.click Adddata() Private Sub Adddata() Dim sqladd1 As String Dim sqladd2 As String Dim sqledit As String Dim FlagUser As Integer Dim MemID As String = " " ' ţ ůřćůşę ŀýńł Dim Dates As String Dim Datesent As String Dates = DTPRent.Value.ToString("dd/MM/yyyy") Datesent = CStr(DTPRent.Value.AddDays(5).ToString("dd/MM/yyyy")) If ChB1.Checked = True Then FlagUser = 1 If ChB2.Checked = True Then FlagUser = 2

50 202 If MessageBox.Show("Žő¼ ŰĹÐłŀăşĿŞğňłŠŰĹ ŔąłŀăĂŐ ŢýůĚăŐĹţ ů ", "ŽŻŀĂŐŞĂĿŞ ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then If ChB1.Checked = False And ChB2.Checked = False Then MessageBox.Show("łăő¼ŀřąŐĹłĆăľř ğę ŀýńł¾űďăžůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) If FlagUser = 1 Then Try sqladd1 = "INSERT INTO tb_bookborrowing(bor_id,li_id,mem_id,num_book,price_rent,date_borrow,date_return)values(" sqladd1 &= " '" & txtrentid.text & "'," sqladd1 &= " '" & EmpID & "'," sqladd1 &= " '" & txtmemid.text & "'," sqladd1 &= " " & booknum & "," sqladd1 &= " " & sumprice & "," sqladd1 &= " '" & Dates & "'," sqladd1 &= " '" & Datesent & " ')" Conndata().CommandText = sqladd1.executenonquery() For j = 0 To Me.grdBook.Rows.Count - 1 tmp1 = CStr(grdBook.Rows.Item(j).Cells(0).Value) tmp2 = CStr(grdBook.Rows.Item(j).Cells(3).Value) If (tmp1 = "") And (tmp2 = "") Then Exit Try sqladd2 = "INSERT INTO tb_bookborrowingdetail(bor_id,book_id,book_num,date_sent)values(" sqladd2 &= " '" & txtrentid.text & "'," sqladd2 &= " " & tmp1 & "," sqladd2 &= " " & tmp2 & "," sqladd2 &= " '" & Datesent & "')".CommandText = sqladd2.executenonquery() Next Catch ErrortoAdd As Exception MessageBox.Show("ţ ůęŀ ŀăğřčńů ŠŰĹ Ŕąţ¾ŰřŞŐůĹÐðŀł " & ErrortoAdd.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally

51 203 Conn.Close() End Try Try For j = 0 To Me.grdBook.Rows.Count - 1 tmp1 = CStr(grdBook.Rows.Item(j).Cells(0).Value) If tmp1 = "" Then Exit Try sqledit = "UPDATE tb_book " sqledit &= "SET Book_status=" & status1 & " " sqledit &= "WHERE (Book_id ='" & tmp1 & "' )" Conndata().CommandText = sqledit.executenonquery() Next Catch ErrorToDelete As Exception MessageBox.Show("ţ ůęŀ ŀăğřćąňůăşęğŀşľěşŀðęőĺţ¾űřşőůĺððŀł " & ErrorToDelete.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally Conn.Close() End Try MessageBox.Show("şĿŞğňłŠŰĹ ŔąłŀăĂŐ ĚŞĿÐęŐĹřăŇĂşăŰĹĂŚąŰď ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) If FlagUser = 2 Then Try sqladd1 = "INSERT INTO tb_bookborrowing(bor_id,li_id,mem_id,num_book,price_rent,date_borrow,date_return)values(" sqladd1 &= " '" & txtrentid.text & "'," sqladd1 &= " '" & EmpID & "'," sqladd1 &= " '" & MemID & "'," sqladd1 &= " " & booknum & "," sqladd1 &= " " & sumprice & "," sqladd1 &= " '" & Dates & "'," sqladd1 &= " '" & Datesent & " ')" Conndata().CommandText = sqladd1.executenonquery()

52 204 For j = 0 To Me.grdBook.Rows.Count - 1 tmp1 = CStr(grdBook.Rows.Item(j).Cells(0).Value) tmp2 = CStr(grdBook.Rows.Item(j).Cells(3).Value) If (tmp1 = "") And (tmp2 = "") Then Exit Try sqladd2 = "INSERT INTO tb_bookborrowingdetail(bor_id,book_id,book_num,date_sent)values(" sqladd2 &= " '" & txtrentid.text & "'," sqladd2 &= " " & tmp1 & "," sqladd2 &= " " & tmp2 & "," sqladd2 &= " '" & Datesent & "')".CommandText = sqladd2.executenonquery() Next Catch ErrortoAdd As Exception MessageBox.Show("ţ ůęŀ ŀăğřčńů ŠŰĹ Ŕąţ¾ŰřŞŐůĹÐðŀł " & ErrortoAdd.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally Conn.Close() End Try Try For j = 0 To Me.grdBook.Rows.Count - 1 tmp1 = CStr(grdBook.Rows.Item(j).Cells(0).Value) If tmp1 = "" Then Exit Try sqledit = "UPDATE tb_book " sqledit &= "SET Book_status=" & status1 & " " sqledit &= "WHERE (Book_id ='" & tmp1 & "' )" Conndata().CommandText = sqledit.executenonquery() Next Catch ErrorToDelete As Exception MessageBox.Show("ţ ůęŀ ŀăğřćąňůăşęğŀşľěşŀðęőĺţ¾űřşőůĺððŀł " & ErrorToDelete.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally Conn.Close()

53 205 End Try MessageBox.Show("şĿŞğňłŠŰĹ ŔąłŀăĂŐ ĚŞĿÐęŐĹřăŇĂşăŰĹĂŚąŰď ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) Me.grdBook.Rows.Clear() txtsummoney.text = "" txtsumbook.text = "" cleardata() GenerateID() sum_book = 0 PriceRent = 0 Private Sub cmdcancel1_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdcancel1.click cleardata() Private Sub cmdcancel2_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdcancel2.click Me.grdBook.Rows.Clear() txtsummoney.text = "" txtsumbook.text = "" Private Sub cmdexit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdexit.click Me.Close() Private Sub cleardata() txtmemid.text = "" ChB1.Checked = False ChB2.Checked = False ChB1.Enabled = True ChB2.Enabled = True Private Sub ChB1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChB1.CheckedChanged If ChB1.Checked = True Then ChB2.Enabled = False If ChB1.Checked = False Then ChB2.Enabled = True Private Sub ChB2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChB2.CheckedChanged If ChB2.Checked = True Then txtmemid.enabled = False ChB1.Enabled = False If ChB2.Checked = False Then

54 206 txtmemid.enabled = True ChB1.Enabled = True Private Sub txtbooknum_keydown(byval sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) If e.keycode = Keys.Enter Then Addgrid() End Class Source Code ช อ Emprentdetail Option Explicit On Option Strict On Imports System.data Imports System.Data.OleDb Public Class Emprentdetail Dim cs As New DataGridViewCellStyle Private Sub Emprentdetail_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Conndata() RD1.Checked = False Rd2.Checked = False Private Sub Conndata() With Conn If.State = ConnectionState.Open Then.Close().ConnectionString = StrConn.Open() Private Sub showrent1() Dim sqlshowrent As String sqlshowrent = "SELECT tb_bookborrowing.bor_id,tb_member.mem_name,tb_employee.li_name,tb_book.book_name,tb_bookborro wingdetail.book_num,tb_bookborrowing.date_borrow,tb_bookborrowing.date_return FROM tb_bookborrowing,tb_bookborrowingdetail,tb_employee,tb_book,tb_member " sqlshowrent &= "WHERE tb_bookborrowing.bor_id=tb_bookborrowingdetail.bor_id And tb_bookborrowing.li_id=tb_employee.li_id And tb_bookborrowingdetail.book_id=tb_book.book_id And tb_bookborrowing.mem_id=tb_member.mem_id " da = New OleDbDataAdapter(sqlShowrent, Conn) da.fill(ds, "tb_bookborrowing") With grdrent

55 207.ReadOnly = True.DataSource = ds.tables("tb_bookborrowing") cs.font = New Font("Ms Sans Serif ", 10, FontStyle.Bold) With grdrent.columnheadersdefaultcellstyle = cs.columns(0).headertext = "ăěŀęłŀăăő ".Columns(1).HeaderText = "ýőůĺę ŀýńł ".Columns(2).HeaderText = "ýőůĺčşŀłðŀş ".Columns(3).HeaderText = "ýőůĺěşŀðęőĺ ".Columns(4).HeaderText = "ðżŀşďş".columns(5).headertext = "ďŀşğňůăő ".Columns(6).HeaderText = "ďŀşğňůžőş ".Columns(0).Width = 130.Columns(1).Width = 140.Columns(2).Width = 140.Columns(3).Width = 140.Columns(4).Width = 120.Columns(5).Width = 120.Columns(6).Width = 115 ds.tables.clear() Private Sub showrent2() Dim sqlshowrent As String Dim cardid As String = " " sqlshowrent = "SELECT tb_bookborrowing.bor_id,tb_bookborrowing.mem_id,tb_employee.li_name,tb_book.book_name,tb_bookbo rrowingdetail.book_num,tb_bookborrowing.date_borrow,tb_bookborrowing.date_return FROM tb_bookborrowing,tb_bookborrowingdetail,tb_employee,tb_book " sqlshowrent &= "WHERE tb_bookborrowing.bor_id=tb_bookborrowingdetail.bor_id And tb_bookborrowing.li_id=tb_employee.li_id And tb_bookborrowingdetail.book_id=tb_book.book_id And tb_bookborrowing.mem_id='" & cardid & "' " da = New OleDbDataAdapter(sqlShowrent, Conn) da.fill(ds, "tb_bookborrowing") With grdrent.readonly = True.DataSource = ds.tables("tb_bookborrowing") cs.font = New Font("Ms Sans Serif ", 10, FontStyle.Bold) With grdrent.columnheadersdefaultcellstyle = cs.columns(0).headertext = "ăěŀęłŀăăő ".Columns(1).HeaderText = "ăěŀęę ŀýńł".columns(2).headertext = "ýőůĺčşŀłðŀş ".Columns(3).HeaderText = "ýőůĺěşŀðęőĺ ".Columns(4).HeaderText = "ðżŀşďş".columns(5).headertext = "ďŀşğňůăő "

56 208.Columns(6).HeaderText = "ďŀşğňůžőş ".Columns(0).Width = 130.Columns(1).Width = 140.Columns(2).Width = 140.Columns(3).Width = 140.Columns(4).Width = 120.Columns(5).Width = 120.Columns(6).Width = 115 ds.tables.clear() Private Sub cmdadd_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdadd.click If RD1.Checked = True Then showrent1() If RD2.Checked = True Then showrent2() Private Sub cmdexit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdexit.click Me.Close() End Class Source Code ช อ Empsentbook Option Explicit On Option Strict On Imports System.data Imports System.Data.OleDb Public Class Empsentbook Dim Full_name As String ' ýőůĺčşŀłðŀş Dim EmpID As String 'ăěŀęčşŀłðŀş Dim cs As New DataGridViewCellStyle Dim mydinamic() As Integer Dim Sizes As Integer Dim sent_id As String Dim book_id As String Dim book_num As Integer = 1 Dim sumdate As Integer Dim Price_sent As Integer = 0

57 209 Dim tmp1 As String Dim tmp2 As String Dim i As Integer Dim j As Integer Dim status As Integer = 1 Dim bor_id As String Dim price As Integer = 5 ' ŽůŀĆăĿş Dim sum_book As Integer Dim SumMoney As Integer = 0 ' ðżŀşďşřðńşăď Dim PriceRent As Integer = 0 ' ðżŀşďşřðńşăď ğŀűðě ¾ Dim s1() As String Dim s2() As String Dim date_sent1 As Date Dim date_true1 As Date Dim n2 As Integer ' ďŀşğňůřłńş Private Sub Empsentbook_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Conndata() GenerateID() showname() showgridview() txtempname.enabled = False DTPSent.Enabled = False txtsentid.enabled = False Private Sub Conndata() With Conn If.State = ConnectionState.Open Then.Close().ConnectionString = StrConn.Open() Private Sub GenerateID() Dim sqlorder As String Dim tmpid As Integer Dim lastid As String = "" sqlorder = "SELECT TOP 1 sent_id FROM tb_bookreturning ORDER BY sent_id DESC" Conndata().CommandText = sqlorder dr =.ExecuteReader dr.read()

58 210 If dr.hasrows Then lastid = CStr(dr(0).ToString.Trim) tmpid = CInt(Microsoft.VisualBasic.Right(lastId, 6)) tmpid = tmpid + 1 lastid = tmpid.tostring("000000") txtsentid.text = CStr(lastId) Else lastid = "000001" txtsentid.text = CStr(lastId) dr.close() Private Sub showname() Dim sqlname As String sqlname = "SELECT Li_id,Li_name FROM tb_employee WHERE (Liuser='" & CStr(U_name) & "')".CommandText = sqlname dr =.ExecuteReader() dr.read() EmpID = CStr(dr.Item("Li_id")) Full_Name = CStr(dr.Item("Li_name")) txtempname.text = Full_name Private Sub cmdcancel2_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdcancel2.click Me.grdBook.Rows.Clear() txtsummoney.text = "" txtsumbook.text = "" txtbookid.text = "" txtbooknum.text = "" Private Sub cmdexit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdexit.click Me.Close() Private Sub showgridview() Dim cs As New DataGridViewCellStyle cs.font = New Font("Ms Sans Serif ", 10, FontStyle.Bold) With grdbook.columnheadersdefaultcellstyle = cs.columns.add(cstr(0), "ăěŀęłŀăžőş ").Columns.Add(CStr(1), "ăěŀęłŀăăő ").Columns.Add(CStr(2), "ăěŀęěşŀðęőĺ ").Columns.Add(CStr(3), "ðżŀşďş").columns.add(cstr(4), "ďŀşğňůžőş ").Columns.Add(CStr(5), "ďŀşğňůžőşðăńð ")

59 211.Columns.Add(CStr(6), "ďŀşğňůřłńş ").Columns.Add(CStr(7), "ŽůŀĆăĿş ").Columns(0).Width = 110.Columns(1).Width = 110.Columns(2).Width = 110.Columns(3).Width = 80.Columns(4).Width = 100.Columns(5).Width = 100.Columns(6).Width = 78.Columns(7).Width = 60 Private Sub cmdadd_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdadd.click Addgrid() Private Sub Addgrid() Dim strsql As String ReDim Preserve mydinamic(sizes - 1) sum_book = 0 Price_sent = 0 If txtbookid.text = "" Then MessageBox.Show("łăő¼ŀłăĹłăĚĿęĚŞĿÐęŐĹ¾ŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) txtbookid.focus() 'If txtbooknum.text = "" And CInt(txtbooknum.Text) = 0 And CInt(txtbooknum.Text) <> 1 Then ' MessageBox.Show("łăő¼ŀðŻŀŞďŞĚŞĿÐęŐĹŢĚŰĞŔł ŰĹоŰďĂŽůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) ' txtbooknum.text = "" ' txtbooknum.focus() ' ' strsql = " SELECT Bor_id,Book_id,Date_sent FROM tb_bookborrowingdetail WHERE (Book_id='" & Trim(txtBookID.Text) & "')" Conndata().CommandText = strsql dr =.ExecuteReader() dr.read() If dr.hasrows = False Then MessageBox.Show("ţ ů ŇăĚĿęĚŞĿÐęŐĹğŇůĂŐ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) txtbookid.text = "" txtbooknum.text = ""

60 212 dr.close() sent_id = CStr(txtsentID.Text) bor_id = CStr(dr.Item("Bor_id")) book_id = CStr(txtBookID.Text) 'book_num = CInt(txtbooknum.Text) s1 = CStr(dr.Item("Date_sent")).Split(CChar(" ")) s2 = CStr(DTPSent.Value.ToString("dd/MM/yyyy")).Split(CChar(" ")) date_sent1 = CType(s1(0), Date) date_true1 = CType(s2(0), Date) n2 = CInt(DateDiff(DateInterval.Day, date_sent1, date_true1)) If n2 < 0 Then n2 = 0 SumMoney = 0 If n2 > 0 Then SumMoney = n2 * price For i = 0 To mydinamic.getlowerbound(0) For j = 0 To Me.grdBook.Rows.Count - 1 ' ăďðęĺşăěŀęęńşžűŀğňůřčńů ÞŻŰŀłĿŞĚăŐĹţ ů tmp1 = CStr(grdBook.Rows.Item(j).Cells(2).Value) 'ăěŀęěşŀðęőĺ If tmp1 = CStr(book_id) Then MessageBox.Show("ţ ůęŀ ŀăğřčńů ţ¾űřşőůĺððŀłăěŀęěşŀðęőĺþżűŀłŀş ", "ćąłŀă ăďðęĺş ", MessageBoxButtons.OK, MessageBoxIcon.Error) txtbookid.text = "" txtbooknum.text = "" dr.close() sum_book = sum_book + book_num ' ðżŀşďşěşŀðęőĺğŀűðě ¾ PriceRent = Price_sent + SumMoney ' ăŀžŀăď Next 'řčńů ŠŰĹ ŔąąÐŢŞ ŀăŀð Me.grdBook.Rows.Add(sent_id, bor_id, book_id, book_num, s1(0).tostring, s2(0).tostring, n2, SumMoney) dr.close() Next txtsummoney.text = PriceRent.ToString("#,##0.00") txtsummoney.enabled = False txtsumbook.text = CStr(sum_book) txtsumbook.enabled = False txtbookid.text = "" 'txtbooknum.text = "" Private Sub cmdsubmit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles

61 213 cmdsubmit.click Adddata() Private Sub Adddata() Dim sqladd1 As String Dim sqladd2 As String Dim sqledit As String If CBool(grdBook.Rows.Item(0).Cells(0).Value) = False Then MessageBox.Show("ţ ů ŇăŀĂłŀăŽŐŞ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) If MessageBox.Show("Žő¼ ŰĹÐłŀăşĿŞğňłŠŰĹ ŔąłŀăŽŐŞŢýůĚăŐĹţ ů ", "ŽŻŀĂŐŞĂĿŞ ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then Try sqladd1 = "INSERT INTO tb_bookreturning(sent_id,li_id,num_book,date_borrow,date_return,date_over,price_sent)values(" sqladd1 &= " '" & txtsentid.text & "'," sqladd1 &= " '" & EmpID & "'," sqladd1 &= " " & sum_book & "," sqladd1 &= " '" & date_sent1 & "'," sqladd1 &= " '" & date_true1 & "'," sqladd1 &= " " & n2 & "," sqladd1 &= " " & PriceRent & " )" Conndata().CommandText = sqladd1.executenonquery() For j = 0 To Me.grdBook.Rows.Count - 1 tmp1 = CStr(grdBook.Rows.Item(j).Cells(2).Value) tmp2 = CStr(grdBook.Rows.Item(j).Cells(3).Value) If (tmp1 = "") And (tmp2 = "") Then Exit Try sqladd2 = "INSERT INTO tb_bookreturningdetail(sent_id,book_id,num_book)values(" sqladd2 &= " '" & txtsentid.text & "'," sqladd2 &= " '" & tmp1 & "'," sqladd2 &= " " & tmp2 & ")".CommandText = sqladd2.executenonquery() Next

62 214 Catch ErrortoAdd As Exception MessageBox.Show("ţ ůęŀ ŀăğřčńů ŠŰĹ Ŕąţ¾ŰřŞŐůĹÐðŀł " & ErrortoAdd.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally Conn.Close() End Try Try For j = 0 To Me.grdBook.Rows.Count - 1 tmp1 = CStr(grdBook.Rows.Item(j).Cells(2).Value) If tmp1 = "" Then Exit Try sqledit = "UPDATE tb_book " sqledit &= "SET Book_status=" & status & " " sqledit &= "WHERE (Book_id ='" & tmp1 & "' )" Conndata().CommandText = sqledit.executenonquery() Next Catch ErrorToDelete As Exception MessageBox.Show("ţ ůęŀ ŀăğřćąňůăşęğŀşľěşŀðęőĺţ¾űřşőůĺððŀł " & ErrorToDelete.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally Conn.Close() End Try MessageBox.Show("şĿŞğňłŠŰĹ ŔąłŀăŽŐŞĚŞĿÐęŐĹřăŇĂşăŰĹĂŚąŰď ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) Me.grdBook.Rows.Clear() txtsumbook.text = "" txtsummoney.text = "" GenerateID() sum_book = 0 Price_sent = 0 End Class Source Code ช อ Empsentdetaili Option Explicit On Option Strict On

63 215 Imports System.data Imports System.Data.OleDb Public Class Empsentdetaili Dim cs As New DataGridViewCellStyle Private Sub Empsentdetaili_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Conndata() showsent() Private Sub Conndata() With Conn If.State = ConnectionState.Open Then.Close().ConnectionString = StrConn.Open() Private Sub showsent() Dim sqlshowrent As String sqlshowrent = "SELECT tb_bookreturning.sent_id,tb_employee.li_name,tb_book.book_name,tb_bookreturningdetail.num_book,tb_ Bookreturning.date_borrow,tb_Bookreturning.date_return FROM tb_bookreturning,tb_bookreturningdetail,tb_employee,tb_book " sqlshowrent &= "WHERE tb_bookreturning.sent_id=tb_bookreturningdetail.sent_id And tb_bookreturning.li_id=tb_employee.li_id And tb_bookreturningdetail.book_id=tb_book.book_id " da = New OleDbDataAdapter(sqlShowrent, Conn) da.fill(ds, "tb_bookborrowing") With grdrent.readonly = True.DataSource = ds.tables("tb_bookborrowing") cs.font = New Font("Ms Sans Serif ", 10, FontStyle.Bold) With grdrent.columnheadersdefaultcellstyle = cs.columns(0).headertext = "ăěŀęłŀăăő ".Columns(1).HeaderText = "ýőůĺčşŀłðŀş ".Columns(2).HeaderText = "ýőůĺěşŀðęőĺ ".Columns(3).HeaderText = "ðżŀşďş".columns(4).headertext = "ďŀşğňůăő ".Columns(5).HeaderText = "ďŀşğňůžőş ".Columns(0).Width = 150.Columns(1).Width = 150.Columns(2).Width = 150.Columns(3).Width = 150.Columns(4).Width = 150.Columns(5).Width = 155

64 216 ds.tables.clear() Private Sub cmdexit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdexit.click Me.Close() End Class Source Code ช อ Empsuplier Option Explicit On Option Strict On Imports System.data Imports System.Data.OleDb Public Class Empsuplier Dim SupID As String 'ăěŀę ĿďŚğŞðŻŀĚŞůŀĂ 'Dim TypeName As String 'ýőůĺćăľř ğěşŀðęőĺ Dim cs As New DataGridViewCellStyle Private Sub Empsuplier_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Conndata() ' řăňăłconndata GenerateID() ' řăňăłgenerateid show_suplier() show_sup(supid) ' řăňăłshow_book txtsupid.enabled = False ' ń¾ ůĺ²ŀşšűĺ Ŕą Private Sub Conndata() With Conn If.State = ConnectionState.Open Then.Close().ConnectionString = StrConn.Open() 'Generate ăěŀęćăľř ğęńşžűŀ Private Sub GenerateID() Dim sqlgenerateid As String Dim tmpid As Integer Dim lastid As String dr.close() sqlgenerateid = "SELECT TOP 1 Sup_id FROM tb_supplier ORDER BY Sup_id DESC" Conndata()

65 217.CommandText = sqlgenerateid dr =.ExecuteReader dr.read() If dr.hasrows = True Then lastid = CStr(dr(0).ToString.Trim) tmpid = CInt(Microsoft.VisualBasic.Right(lastId, 6)) tmpid = tmpid + 1 lastid = tmpid.tostring("000000") txtsupid.text = CStr(lastId) Else lastid = "000001" txtsupid.text = CStr(lastId).ToString dr.close() Private Sub cleardata() txtsupid.text = "" txtsupname.text = "" txtsupaddress.text = "" txtsuptel.text = "" txtsupid.enabled = False Private Sub show_suplier() Dim sqlbooktype As String = "" sqlbooktype = "SELECT Sup_id,Sup_name,Sup_add,Sup_tel FROM tb_supplier" da = New OleDbDataAdapter(sqlBooktype, Conn) da.fill(ds, "tb_supplier") With grdsuplier.readonly = True.DataSource = ds.tables("tb_supplier") cs.font = New Font("Ms Sans Serif ", 10, FontStyle.Bold) With grdsuplier.columnheadersdefaultcellstyle = cs.columns(0).headertext = "ăěŀę ĿďŚğŞ ".Columns(1).HeaderText = "ýőůĺ ĿďŚğŞ ".Columns(2).HeaderText = "ğňůĺăŕů ".Columns(3).HeaderText = "řşĺăźśğăđŀčğź ".Columns(0).Width = 120.Columns(1).Width = 120.Columns(2).Width = 120.Columns(3).Width = 97 ds.tables.clear() Private Sub show_sup(byval SupID As String)

66 218 Dim sqlbook As String = "" If SupID = "" Then If SupID <> "" Then sqlbook = "SELECT tb_book.book_id,tb_book.book_isbn,tb_book.book_name FROM tb_book WHERE (tb_book.sup_id='" & SupID & "')" da = New OleDbDataAdapter(sqlBook, Conn) da.fill(ds, "tb_book") If Not IsDBNull(ds) Then With grdsupbook.readonly = True.DataSource = ds.tables("tb_book") cs.font = New Font("Ms Sans Serif ", 10, FontStyle.Bold) With grdsupbook.columnheadersdefaultcellstyle = cs.columns(0).headertext = "ăěŀęěşŀðęőĺ ".Columns(1).HeaderText = "řąšřăňăłěşŀðęőĺ ".Columns(2).HeaderText = "ýőůĺěşŀðęőĺ ".Columns(0).Width = 150.Columns(1).Width = 150.Columns(2).Width = 133 ds.tables.clear() dr.close() Private Sub cmdadd_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdadd.click Adddata() ' řăňăłþŀşśčăþňřðĺăź Adddata řčőůĺřčńů ŠŰĹ Ŕą ' řčńů ŠŰĹ ŔąĆăľř ğěşŀðęőĺ Private Sub Adddata() Dim sqladd As String If txtsupname.text = "" Then MessageBox.Show("łăő¼ŀłăĹłýŐůĹ ĿďŚğŞðŻŀĚŞůŀĂŢĚŰŽăş!!!", "ćąłŀă ăďðęĺş ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtsupname.focus() If txtsupaddress.text = "" Then MessageBox.Show("łăő¼ŀłăĹłğŇůĹĂŔůŢĚŰŽăş!!!", "ćąłŀă ăďðęĺş ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtsupaddress.focus() If txtsuptel.text = "" Then

67 219 MessageBox.Show("łăő¼ŀłăĹłřşĹăźśğăĐĿčğźŢĚŰŽăş!!!", "ćąłŀă ăďðęĺş ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtsuptel.focus() If MessageBox.Show("Žő¼ ŰĹÐłŀăřčńů ŠŰĹ ŔąŢýůĚăŐĹţ ů ", "ŽŻŀĂŐŞĂĿŞ ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then Try sqladd = "INSERT INTO tb_supplier(sup_id,sup_name,sup_add,sup_tel)values(" sqladd &= " '" & txtsupid.text & "'," sqladd &= " '" & txtsupname.text & "'," sqladd &= " '" & txtsupaddress.text & "'," sqladd &= " '" & txtsuptel.text & "')" 'Conndata().CommandText = sqladd.executenonquery() Catch ErrortoAdd As Exception MessageBox.Show("ţ ůęŀ ŀăğřčńů ŠŰĹ Ŕąţ¾ŰřŞŐůĹÐðŀł " & ErrortoAdd.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) txtsupid.focus() Finally Conn.Close() End Try MessageBox.Show("řčńů ŠŰĹ Ŕą ĿďŚğŞðŻŀĚŞůŀĂřăŇĂşăŰĹĂŚąŰď ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) cleardata() show_suplier() GenerateID() ' ŚłŰţŠŠŰĹ ŔąĆăľř ğěşŀðęőĺ Private Sub cmdedit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdedit.click Dim sqledit As String If txtsupname.text = "" Then MessageBox.Show("łăő¼ŀłăĹłýŐůĹ ĿďŚğŞðŻŀĚŞůŀĂŢĚŰŽăş!!!", "ćąłŀă ăďðęĺş ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtsupname.focus() If txtsupaddress.text = "" Then MessageBox.Show("łăő¼ŀłăĹłğŇůĹĂŔůŢĚŰŽăş!!!", "ćąłŀă ăďðęĺş ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtsupaddress.focus()

68 220 If txtsuptel.text = "" Then MessageBox.Show("łăő¼ŀłăĹłřşĹăźśğăĐĿčğźŢĚŰŽăş!!!", "ćąłŀă ăďðęĺş ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtsuptel.focus() If MessageBox.Show("Žő¼ ŰĹÐłŀ㌳ŰţŠŠŰĹ ŔąŢýůĚăŐĹţ ů ", "ŽŻŀĂŐŞĂĿŞ ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then Try sqledit = "UPDATE tb_supplier " sqledit &= "SET Sup_name='" & txtsupname.text & "'," sqledit &= "Sup_add='" & txtsupaddress.text & "'," sqledit &= "Sup_tel='" & txtsuptel.text & "'" sqledit &= "WHERE (Sup_id='" & txtsupid.text & "' )".CommandText = sqledit.executenonquery() Catch ErrorToUpdate As Exception MessageBox.Show("ţ ůęŀ ŀăğśłűţššűĺ Ŕąţ¾ŰřŞŐůĹÐðŀł " & ErrorToUpdate.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally Conn.Close() End Try MessageBox.Show("ŚłŰţŠŠŰĹ Ŕą ĿďŚğŞðŻŀĚŞůŀĂřăŇĂşăŰĹĂŚąŰď ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) cleardata() show_suplier() txtsupid.enabled = False GenerateID() ' ąşšűĺ ŔąĆăľř ğěşŀðęőĺ Private Sub cmddelete_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmddelete.click Dim sqldelete As String Dim tmprowsaffected As Short If MessageBox.Show("Žő¼ ŰĹÐłŀăąşŠŰĹ ŔąŢýůĚăŐĹţ ů ", "ŽŻŀĂŐŞĂĿŞ ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then Try sqldelete = "DELETE FROM tb_supplier " sqldelete &= "WHERE (Sup_id='" & txtsupid.text & "')" 'Conndata().CommandText = sqldelete tmprowsaffected = CShort(.ExecuteNonQuery())

69 221 If tmprowsaffected = 0 Then MessageBox.Show("ţ ů ŇăĚĿę ĿďŚğŞðŻŀĚŞůŀĂğŇůŽő¼ ŰĹÐłŀăąş ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) txtsupid.focus() Catch ErrorToDelete As Exception MessageBox.Show("ţ ůęŀ ŀăğąşšűĺ Ŕąţ¾ŰřŞŐůĹÐðŀł " & ErrorToDelete.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) txtsupid.focus() Finally Conn.Close() End Try MessageBox.Show("ąşŠŰĹ Ŕą ĿďŚğŞðŻŀĚŞůŀĂřăŇĂşăŰĹĂŚąŰď ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) cleardata() show_suplier() txtsupid.enabled = False GenerateID() ' Ăłřąńł Private Sub cmdclear_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdclear.click cleardata() GenerateID() ' Ćń¾đĹăź Private Sub cmdexit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdexit.click Me.Close() ' Žąńłłăń¾ŢĚŰŚę¾ÐŠŰĹ ŔąŢŞ textbox Private Sub grdsuplier_cellcontentclick(byval sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles grdsuplier.cellcontentclick If e.rowindex = grdsuplier.rows.count - 1 Then txtsupid.enabled = False With grdsuplier txtsupid.text =.Rows.Item(e.RowIndex).Cells(0).Value.ToString() txtsupname.text =.Rows.Item(e.RowIndex).Cells(1).Value.ToString() txtsupaddress.text =.Rows.Item(e.RowIndex).Cells(2).Value.ToString() txtsuptel.text =.Rows.Item(e.RowIndex).Cells(3).Value.ToString() SupID = txtsupid.text show_sup(supid.tostring) ' ł¾ćőů Enter ĹŞřčńů ŠŰĹ Ŕą

70 222 Private Sub txtsuptel_keydown(byval sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtsuptel.keydown If e.keycode = Keys.Enter Then Adddata() Private Sub txtsuptel_keypress(byval sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtsuptel.keypress If (e.keychar < Chr(48) Or e.keychar > Chr(57)) And e.keychar <> Chr(8) Then e.handled = True End Class Source Code ช อ Emptypebook Option Explicit On Option Strict On Imports System.data Imports System.Data.OleDb Public Class Emptypebook Dim TypeID As String 'ăěŀęćăľř ğěşŀðęőĺ Dim TypeName As String 'ýőůĺćăľř ğěşŀðęőĺ Dim cs As New DataGridViewCellStyle Private Sub Emptypebook_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Conndata() ' řăňăłconndata GenerateID() ' řăňăłgenerateid show_typebook() ' řăňăłshow_typebook show_book(typeid) ' řăňăłshow_book txttypeid.enabled = False ' ń¾ ůĺ²ŀşšűĺ Ŕą Private Sub Conndata() With Conn If.State = ConnectionState.Open Then.Close().ConnectionString = StrConn.Open() 'Generate ăěŀęćăľř ğęńşžűŀ Private Sub GenerateID() Dim sqlgenerateid As String Dim tmpid As Integer Dim lastid As String dr.close()

71 223 sqlgenerateid = "SELECT TOP 1 Bt_id FROM tb_booktype ORDER BY Bt_id DESC" Conndata().CommandText = sqlgenerateid dr =.ExecuteReader dr.read() If dr.hasrows = True Then lastid = CStr(dr(0).ToString.Trim) tmpid = CInt(Microsoft.VisualBasic.Right(lastId, 6)) tmpid = tmpid + 1 lastid = tmpid.tostring("000000") txttypeid.text = CStr(lastId) Else lastid = "000001" txttypeid.text = CStr(lastId).ToString dr.close() Private Sub cleardata() txttypeid.text = "" txttypename.text = "" txttypeid.enabled = False Private Sub show_typebook() Dim sqlbooktype As String = "" sqlbooktype = "SELECT Bt_id,Bt_name FROM tb_booktype" da = New OleDbDataAdapter(sqlBooktype, Conn) da.fill(ds, "tb_booktype") With grdtypebook.readonly = True.DataSource = ds.tables("tb_booktype") cs.font = New Font("Ms Sans Serif ", 10, FontStyle.Bold) With grdtypebook.columnheadersdefaultcellstyle = cs.columns(0).headertext = "ăěŀęćăľř ğęńşžűŀ ".Columns(1).HeaderText = "ýőůĺćăľř ğęńşžűŀ ".Columns(0).Width = 217.Columns(1).Width = 217 ds.tables.clear() Private Sub show_book(byval TypeID As String) Dim sqlbook As String = ""

72 224 If TypeID = "" Then If TypeID <> "" Then sqlbook = "SELECT tb_book.bt_id,tb_book.book_isbn,tb_book.book_name,tb_book.price_rent FROM tb_book WHERE (tb_book.bt_id='" & TypeID & "')" da = New OleDbDataAdapter(sqlBook, Conn) da.fill(ds, "tb_book") If Not IsDBNull(ds) Then With grdbook.readonly = True.DataSource = ds.tables("tb_book") cs.font = New Font("Ms Sans Serif ", 10, FontStyle.Bold) With grdbook.columnheadersdefaultcellstyle = cs.columns(0).headertext = "ăěŀęěşŀðęőĺ ".Columns(1).HeaderText = "řąšřăňăłěşŀðęőĺ ".Columns(2).HeaderText = "ýőůĺěşŀðęőĺ ".Columns(3).HeaderText = "ăŀžŀřýůŀ".columns(0).width = 110.Columns(1).Width = 110.Columns(2).Width = 110.Columns(3).Width = 105 ds.tables.clear() dr.close() Private Sub cmdadd_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdadd.click Adddata() ' řăňăłþŀşśčăþňřðĺăź Adddata řčőůĺřčńů ŠŰĹ Ŕą ' řčńů ŠŰĹ ŔąĆăľř ğěşŀðęőĺ Private Sub Adddata() Dim sqladd As String If txttypename.text = "" Then MessageBox.Show("łăő¼ŀłăĹłýŐůĹĆăľř ğěşŀðęőĺţěűžăş!!!", "ćąłŀă ăďðęĺş ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txttypename.focus() If MessageBox.Show("Žő¼ ŰĹÐłŀăřčńů ŠŰĹ ŔąŢýůĚăŐĹţ ů ", "ŽŻŀĂŐŞĂĿŞ ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then Try sqladd = "INSERT INTO tb_booktype(bt_id,bt_name)values(" sqladd &= " '" & txttypeid.text & "'," sqladd &= " '" & txttypename.text & "')"

73 225 'Conndata().CommandText = sqladd.executenonquery() Catch ErrortoAdd As Exception MessageBox.Show("ţ ůęŀ ŀăğřčńů ŠŰĹ Ŕąţ¾ŰřŞŐůĹÐðŀł " & ErrortoAdd.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) txttypeid.focus() Finally Conn.Close() End Try MessageBox.Show("řčńů ŠŰĹ ŔąĆăľř ğěşŀðęőĺřăňăşăűĺăśąűď ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) cleardata() show_typebook() GenerateID() ' ŚłŰţŠŠŰĹ ŔąĆăľř ğěşŀðęőĺ Private Sub cmdedit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdedit.click Dim sqledit As String If txttypename.text = "" Then MessageBox.Show("łăő¼ŀłăĹłýŐůĹĆăľř ğěşŀðęőĺţěűžăş¾űďăžůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) txttypename.focus() txttypename.selectall() If MessageBox.Show("Žő¼ ŰĹÐłŀ㌳ŰţŠŠŰĹ ŔąŢýůĚăŐĹţ ů ", "ŽŻŀĂŐŞĂĿŞ ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then Try sqledit = "UPDATE tb_booktype " sqledit &= "SET Bt_name='" & txttypename.text & "'" sqledit &= "WHERE (Bt_id='" & txttypeid.text & "' )".CommandText = sqledit.executenonquery() Catch ErrorToUpdate As Exception MessageBox.Show("ţ ůęŀ ŀăğśłűţššűĺ Ŕąţ¾ŰřŞŐůĹÐðŀł " & ErrorToUpdate.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error)

74 226 Finally Conn.Close() End Try MessageBox.Show("ŚłŰţŠŠŰĹ ŔąĆăľř ğěşŀðęőĺřăňăşăűĺăśąűď ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) cleardata() show_typebook() txttypeid.enabled = False GenerateID() ' ąşšűĺ ŔąĆăľř ğěşŀðęőĺ Private Sub cmddelete_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmddelete.click Dim sqldelete As String Dim tmprowsaffected As Short If txttypename.text = "" Then MessageBox.Show("łăő¼ŀłăĹłýŐůĹĆăľř ğěşŀðęőĺţěűžăş¾űďăžůľ ", "ŠŰĹ Ŕąćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) txttypename.focus() txttypename.selectall() If MessageBox.Show("Žő¼ ŰĹÐłŀăąşŠŰĹ ŔąŢýůĚăŐĹţ ů ", "ŽŻŀĂŐŞĂĿŞ ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then Try sqldelete = "DELETE FROM tb_booktype " sqldelete &= "WHERE (Bt_id='" & txttypeid.text & "')" 'Conndata().CommandText = sqldelete tmprowsaffected = CShort(.ExecuteNonQuery()) If tmprowsaffected = 0 Then MessageBox.Show("ţ ů ŇăĚĿęĆăľř ğěşŀðęőĺğňůžő¼ ŰĹÐłŀăąş ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) txttypeid.focus() Catch ErrorToDelete As Exception MessageBox.Show("ţ ůęŀ ŀăğąşšűĺ Ŕąţ¾ŰřŞŐůĹÐðŀł " & ErrorToDelete.Message, "ŠŰĹćń¾čąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) txttypeid.focus() Finally Conn.Close() End Try

75 227 MessageBox.Show("ąşŠŰĹ ŔąĆăľř ğěşŀðęőĺřăňăşăűĺăśąűď ", "ćąłŀăğżŀðŀş", MessageBoxButtons.OK, MessageBoxIcon.Information) cleardata() show_typebook() txttypeid.enabled = False GenerateID() ' Ăłřąńł Private Sub cmdclear_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdclear.click cleardata() GenerateID() ' Ćń¾đĹăź Private Sub cmdexit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdexit.click Me.Close() ' Žąńłłăń¾ŢĚŰŚę¾ÐŠŰĹ ŔąŢŞ textbox Private Sub grdtypebook_cellcontentclick(byval sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles grdtypebook.cellcontentclick If e.rowindex = grdtypebook.rows.count - 1 Then txttypeid.enabled = False With grdtypebook txttypeid.text =.Rows.Item(e.RowIndex).Cells(0).Value.ToString() txttypename.text =.Rows.Item(e.RowIndex).Cells(1).Value.ToString() TypeID = txttypeid.text TypeName = txttypename.text show_book(typeid.tostring) ' ł¾ćőů Enter ĹŞřčńů ŠŰĹ Ŕą Private Sub txttypename_keydown(byval sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txttypename.keydown If e.keycode = Keys.Enter Then Adddata() End Class Source Code ช อ Login Option Explicit On Option Strict On Imports System.Data Imports System.Data.OleDb

76 228 Public Class Login Private Sub Login_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Conndata() Cleardata() Private Sub Conndata() With Conn If.State = ConnectionState.Open Then.Close().ConnectionString = StrConn.Open() Private Sub Cleardata() txtusername.text = "" txtpassword.text = "" rdtype1.checked = False rdtype2.checked = False Private Sub cmdlogin_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdlogin.click Dim strlogin As String If txtusername.text = "" Then MessageBox.Show("łăő¼ŀłăĹł Username ¾ŰďĂŽůľ!!!", "ćąłŀă ăďðęĺş ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtusername.focus() If txtpassword.text = "" Then MessageBox.Show("łăő¼ŀłăĹł Password ¾ŰďĂŽůľ!!!", "ćąłŀă ăďðęĺş ", MessageBoxButtons.OK, MessageBoxIcon.Warning) txtpassword.focus() ' řðűŀšĺðăűŀş If rdtype1.checked = True Then flagu = 1 ' čşŀłðŀş If rdtype2.checked = True Then flagu = 2 ' ąůĺłĺńşšĺðřðűŀšĺðăűŀş ĚăŐĹćŔŰ¾ŔŚąăľşş If flagu = 1 Then If txtusername.text <> "" And txtpassword.text <> "" Then strlogin = "SELECT * FROM tb_admin WHERE (Admin_Uname='" & CStr(txtUsername.Text) & "') And (Admin_Upass ='" & CStr(txtPassword.Text) & "') "

77 229 Conndata().CommandText = strlogin dr =.ExecuteReader() dr.read() If dr.hasrows = False Then MessageBox.Show("Username Śąľ Password ţ ůğŕł ŰĹÐłăő¼ŀ ăďðęĺşţě ůĺňłžăŀűð ", "łŀăřšűŀęŕů ăľşşćń¾ćąŀ¾", MessageBoxButtons.OK, MessageBoxIcon.Error) txtusername.text = "" txtpassword.text = "" rdtype1.checked = False rdtype2.checked = False txtusername.focus() dr.close() U_name = CStr(dr.Item("Admin_Uname")) U_pass = CStr(dr.Item("Admin_Upass")) If txtusername.text <> U_name And txtpassword.text <> U_pass Then MessageBox.Show("Username Śąľ Password ţ ůğŕł ŰĹÐłăő¼ŀ ăďðęĺşţě ůĺňłžăŀűð ", "łŀăřšűŀęŕů ăľşşćń¾ćąŀ¾", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.Show() txtusername.text = "" txtpassword.text = "" rdtype1.checked = False rdtype2.checked = False txtusername.focus() dr.close() Else Admin.Show() MessageBox.Show("ĂńŞ¾Ň ŰĹŞăĿşřŠŰŀęŔůăľşş ĂŐ -ŽŐŞăŰŀŞŚłůŞłŀăź ŔŞ ", "łŀăřšűŀęŕůăľşşřęăůðę şŕă ", MessageBoxButtons.OK, MessageBoxIcon.Information) Me.Hide() Else MessageBox.Show("łăő¼ŀłăĹł Username Śąľ Password ŢĚŰŽăşĞŰďŞ ", "łŀăřšűŀęŕůăľşşćń¾ćąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) txtusername.text = "" txtpassword.text = "" rdtype1.checked = False rdtype2.checked = False txtusername.focus() dr.close() Cleardata() 'ąůĺłĺńşšĺðčşŀłðŀş If flagu = 2 Then If txtusername.text <> "" And txtpassword.text <> "" Then strlogin = "SELECT * FROM tb_employee WHERE (Liuser='" & CStr(txtUsername.Text) & "') And (Lipassword ='" & CStr(txtPassword.Text) & "') "

78 230 Conndata().CommandText = strlogin dr =.ExecuteReader() dr.read() If dr.hasrows = False Then MessageBox.Show("Username Śąľ Password ţ ůğŕł ŰĹÐłăő¼ŀ ăďðęĺşţě ůĺňłžăŀűð ", "łŀăřšűŀęŕů ăľşşćń¾ćąŀ¾", MessageBoxButtons.OK, MessageBoxIcon.Error) txtusername.text = "" txtpassword.text = "" rdtype1.checked = False rdtype2.checked = False txtusername.focus() dr.close() U_name = CStr(dr.Item("Liuser")) U_pass = CStr(dr.Item("Lipassword")) If txtusername.text <> U_name And txtpassword.text <> U_pass Then MessageBox.Show("Username Śąľ Password ţ ůğŕł ŰĹÐłăő¼ŀ ăďðęĺşţě ůĺňłžăŀűð ", "łŀăřšűŀęŕů ăľşşćń¾ćąŀ¾", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.Show() txtusername.text = "" txtpassword.text = "" rdtype1.checked = False rdtype2.checked = False txtusername.focus() dr.close() Else Mainemployee.Show() MessageBox.Show("ĂńŞ¾Ň ŰĹŞăĿşřŠŰŀęŔůăľşş ĂŐ -ŽŐŞăŰŀŞŚłůŞłŀăź ŔŞ ", "łŀăřšűŀęŕůăľşşřęăůðę şŕă ", MessageBoxButtons.OK, MessageBoxIcon.Information) Me.Hide() Else MessageBox.Show("łăő¼ŀłăĹł Username Śąľ Password ŢĚŰŽăşĞŰďŞ ", "łŀăřšűŀęŕůăľşşćń¾ćąŀ¾ ", MessageBoxButtons.OK, MessageBoxIcon.Error) txtusername.text = "" txtpassword.text = "" rdtype1.checked = False rdtype2.checked = False txtusername.focus() dr.close() Cleardata() Private Sub cmdexit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles cmdexit.click

79 231 If MessageBox.Show("Žő¼ ŰĹÐłŀăĹĹłðŀłăľşşăŰŀŞŚłůŞłŀăŔ ŔŞðăńÐĚăŐĹţ ů ", "ŽŻŀĂŐŞĂĿŞ ", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) = Windows.Forms.DialogResult.OK Then Application.Exit() End Class Source Code ช อ Mainemployee Imports System.Windows.Forms Public Class Mainemployee Private Sub ĹĹłðŀłăľşş ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ĹĹłðŀłăľşş ToolStripMenuItem.Click If MessageBox.Show("Žő¼ ŰĹÐłŀăĹĹłðŀłăľşşðăńÐĚăŐĹţ ů ", "ŽŻŀĂŐŞĂĿŞ ", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) = Windows.Forms.DialogResult.OK Then Me.Close() Login.Show() Private Sub čşłðŀş ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles čşłðŀş ToolStripMenuItem.Click With Empemployee.MdiParent = Me.Show().Focus() Private Sub ďśğşðżŀěşŀătoolstripmenuitem_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles ďśğşðżŀěşŀătoolstripmenuitem.click With Empsuplier.MdiParent = Me.Show().Focus() Private Sub ę ŀýł ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ę ŀýł ToolStripMenuItem.Click With Empmember.MdiParent = Me.Show().Focus() Private Sub Ćăľř ğěşðęĺtoolstripmenuitem_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles Ćăľř ğěşðęĺtoolstripmenuitem.click With Emptypebook.MdiParent = Me.Show()

80 232.Focus() Private Sub ĚŞÐęĹToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ĚŞÐęĹToolStripMenuItem.Click With Empbook.MdiParent = Me.Show().Focus() Private Sub Ă ĚŞÐęĹToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Ă ĚŞÐęĹToolStripMenuItem1.Click With Emprentbook.MdiParent = Me.Show().Focus() Private Sub ăŀăłŀăă ĚŞÐęĹ ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ăŀăłŀăă ĚŞÐęĹ ToolStripMenuItem.Click With Emprentdetail.MdiParent = Me.Show().Focus() Private Sub ŽŞĚŞÐęĹToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ŽŞĚŞÐęĹToolStripMenuItem1.Click With Empsentbook.MdiParent = Me.Show().Focus() Private Sub ăŀăłŀăžşěşðęĺtoolstripmenuitem_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles ăŀăłŀăžşěşðęĺtoolstripmenuitem.click With Empsentdetaili.MdiParent = Me.Show().Focus() Private Sub ÞĹĚŞÐęĹToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ÞĹĚŞÐęĹToolStripMenuItem.Click With Emporder.MdiParent = Me.Show().Focus()

81 233 Private Sub ăŀăłŀăþĺěşðęĺ ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ăŀăłŀăþĺěşðęĺ ToolStripMenuItem.Click With Emporderdetail.MdiParent = Me.Show().Focus() Private Sub ăşěşðęĺtoolstripmenuitem1_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles ăşěşðęĺtoolstripmenuitem1.click With Empreceive.MdiParent = Me.Show().Focus() Private Sub ăŀăłŀăăşěşðęĺ ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ăŀăłŀăăşěşðęĺ ToolStripMenuItem.Click With Empreceivedetail.MdiParent = Me.Show().Focus() Private Sub ðŀăýżŀăľtoolstripmenuitem1_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles ðŀăýżŀăľtoolstripmenuitem1.click With Emppay.MdiParent = Me.Show().Focus() Private Sub ăŀăłŀăðŀăýżŀăľ ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ăŀăłŀăðŀăýżŀăľ ToolStripMenuItem.Click With Emppaydetail.MdiParent = Me.Show().Focus() End Class

82 ภาคผนวก ข. บทน าเสนอโครงงานเทคโนโลย สารสนเทศธ รก จ 234

83 235 บทน าเสนอโครงงานเทคโนโลย สารสนเทศธ รก จ 1 ประจ าภาคเร ยนท 1/2553 ว ชา : โครงงานเทคโนโลย สารสนเทศธ รก จ 1 จ านวน 1 หน วยก จ (0-2-0) ช อโครงงาน : ระบบบร หารจ ดการการย ม-ค น หน งส อร านแก นการ ต น จ งหว ดมหาสารคาม รายช อผ ศ กษาโครงงาน : 1. นางสาววช ดา ภ ผาบาง รห สประจ าต ว อาจารย ท ปร กษาโครงงาน: อาจารย เกร ยงศ กด จ นท นอก ( ) กรรมการท ปร กษา ( ) กรรมการคนท 1 ( ) กรรมการคนท 2

84 ความเป นมาและความส าค ญของป ญหา ร านแก นการ ต น อ าเภอเม อง จ งหว ดมหาสารคาม ประกอบธ รก จให เช าการ ต น และน ตยสารต างๆ ซ งในป จจ บ นร านแก นการ ต นย งไม ม ระบบบร หารจ ดการในการย ม-ค นท ด เน องจากขาดเคร องม อในการจ ดการข อม ล ย งม ร ปแบบการด าเน นงานโดยการจดบ นท กด วยม อ และการเก บข อม ลล กค าไว ในแฟ ม ซ งพบว าม ป ญหาต างๆเก ดข นมากมายท งในด านการเก บข อม ล สมาช กและการย ม-ค นหน งส อ ท าให ระบบการจ ดการย งขาดประส ทธ ภาพ ระยะเวลาในการ ด าเน นงานล าช า และการค นหาเอกสารย งเป นไปด วยความยากล าบาก โดยล กษณะการด าเน นก จการของทางร านควรม การน าเอาเทคโนโลย สารสนเทศ เข ามาช วยในการด าเน นงานของทางร าน ไม ว าจะเป นการบร หารจ ดการร านต างๆ การจ ดเก บ ข อม ลสมาช ก รวมถ งการบ นท กการย ม-ค นของล กค า เพ อให เข าถ งข อม ลได อย างถ กต อง รวดเร ว และช วยในการเก บเอกสารของทางร าน ท าให เก ดแนวความค ดท จะท าโปรแกรมข นเพ อช วยงาน ของระบบ ท งน เพ อตอบสนองความต องการในเร องของการท างานของทางร าน ด วยเหต ด งกล าวจ งได ค ดท จะพ ฒนาระบบชวยงานและพ ฒนาระบบงานของทาง ร านแก นการ ต น โดยการน าเสนอในร ปแบบซอฟต แวร เพ อให เก ดความสะดวกรวดเร วในการ ท างานของระบบ โดยสามารถบ นท ก ลบ แก ไข จ ดเก บข อม ลภายในร าน ด งน นการพ ฒนาระบบ ย ม-ค น หน งส อด งกล าวจ งท าให งานม ประส ทธ ภาพและเก ดความถ กต องแม นย าควบค ไปก บความ รวดเร วได อ กด วย 1.2 ว ตถ ประสงค เพ อพ ฒนาระบบ งานย ม ค นหน งส อร านแก นการ ต น อ าเภอเม อง จ งหว ด มหาสารคาม ให สามารถท างานได จร งและม ประส ทธ ภาพส งส ด

85 ขอบเขตการด าเน นงาน หร บขอบเขตในการพ ฒนาระบบงานย ม - ค นหน งส อร านแก นการ ต น น าข อม ลของร าน แก นการ ต น อ าเภอเม อง จ งหว ดมหาสารคาม จะเป นการท างานในล กษณะ Window Base Applicationโดยแบ งขอบเขตการด าเน นงานเพ อการพ ฒนาระบบแบ งออกเป น 9 ส วนย อย ด งน ศ กษาขさอม ลท าการว เคราะห じและออกแบบระบบ งานของร านแก นการ ต น สร างระบบ login ส าหร บการเข าไปใช งานระบบ เป นการก าหนดส ทธ ของผ ใช ระบบ โดย การก าหนด User และ Password เพ อเป นการร กษาความปลอดภ ยของข อม ล ซ งจะแบ งผ ใช ออกเป น กล ม User ค อ เจ าของร าน ข อม ลเก ยวก บสมาช ก ระบบสามารถเก บข อม ลสมาช กในการเข ามาย ม-ค นหน งส อการ ต นของร านแก นการ ต น การบ นท กข อม ลสมาช กสามารถ เพ ม ลบ แก ไข บ นท กและค นหาข อม ลใหม ได ข อม ลเก ยวก บหน งส อ ระบบตรวจสอบหน งส อท ม ไว ให ย มได ระบบสามารถ เพ ม ลบ แก ไข บ นท กและค นหาข อม ลได การย มหน งส อ ระบบสามารถตรวจสอบข อม ลการย มหน งส อของล กค าได การบ นท กข อม ลการย มหน งส อของล กค า สามารถเพ ม ลบ แก ไขข อม ลได ระบบสามารถแสดงรายการย มหน งส อของล กค าได การค นหน งส อ ระบบตรวจสอบข อม ลการย มหน งส อของล กค าได ระบบตรวจสอบข อม ลการค นหน งส อได การบ นท กข อม ลการค นหน งส อ สามารถ เพ ม ลบ แก ไข และค นหาข อม ลได ระบบสามารถแสดงรายการค นหน งส อได ระบบสามารถค านวณค าปร บ ท เก ดจากการค นหน งส อล าช า การส งซ อหน งส อ ระบบตรวจสอบข อม ลต วแทนจ าหน ายได ระบบสามารถบ นท กการส งซ อส นค าได

86 ระบบสามารถด ประว ต การส งซ อได ระบบสามารถแสดงรายการ การส งซ อได การบ นท กข อม ลการส งซ อส นค าสามารถเพ ม ลบ แก ไขข อม ลการส งซ อได การร บส นค า ระบบตรวจสอบข อม ลการส งซ อส นค าได กรอกข อม ลส นค าท ร บ พร อมพ มพ รายการจ ายช าระ บ นท กรายละเอ ยดข อม ลการร บส นค าได ระบบสามารถ เพ ม ลบ แก ไข ค นหาข อม ลได การจ ายช าระ ระบบตรวจสอบรายการร บส นค าได ระบบสามารถบ นท กข อม ลการจ ายช าระได เก บรายการจ ายช าระได ระบบสามารถตรวจสอบรายการส งซ อส นค าได รายงานเอกสารต างๆ รายงานการสม ครสมาช ก รายงานการย มหน งส อ รายงานการค นหน งส อ รายงานการส งซ อหน งส อ รายงานการร บส นค า รายงานการจ ายช าระ 1.4 เคร องม อท ใช ในการพ ฒนาระบบ ด านฮาร ดแวร เคร องคอมพ วเตอร จ านวน 1 เคร อง ด งรายละเอ ยดด งน - CPU Core 2 Duo 2.53 GHz - RAM 2 GB - HDD 250 GB

87 เคร องพ มพ (Printer) จ านวน 1 เคร อง ด านซอฟต แวร ระบบปฏ บ ต การ Windows Dark Edition V ระบบจ ดการฐานข อม ล Microsoft SQL Server 2005 (ใช เพ อสร างและจ ดการฐานข อม ล) โปรแกรม Visual studio.net(ใช เพ อเข ยนค าส งในการสร างโปรแกรม) โปรแกรม Crystal Repot 11.0(ใช เพ อออกรายงานต างๆ) 1.5 ว ธ การด าเน นงาน ศ กษาและว เคราะห ระบบงานย ม - ค นหน งส อร านแก นการ ต น ศ กษาด วยว ธ การส มภาษณ การพ ฒนาระบบ ศ กษาและความต องการของระบบข นตอนน เป นการศ กษาป ญหาและความ ต องการของระบบ โดยเก ยวข องก บกระบวนการท างานของระบบท ม อย ในป จจ บ น เพ อ น ามาว เคราะห และออกแบบพ ฒนาระบบ ศ กษาข นตอนการท างาน เป นการศ กษาข นตอนในการจ ดเก บข อม ลต าง ๆ เช น ข อม ลต าง ๆ เช น ข อม ลล กค าและการพ ฒนางานต างๆของระบบ ศ กษาเคร องม อการพ ฒนาระบบ เป นการศ กษาถ งว ธ การใช เคร องม อในเคร อง คอมพ วเตอร และซอฟต แวร ในการพ ฒนาระบบ การออกแบบระบบ การว เคราะห ระบบงานเด ม เป นการว เคราะห ระบบการท างานใน ระบบงานเด ม ของระบบงานย ม - ค นหน งส อท ม อย แล วว าม ข อบกพร องอะไรบ าง การว เคราะห ระบบงานใหม เป นการศ กษาถ งโครงสร างของระบบ งานพ ฒนา ระบบ เพ อจะน าเอาระบบสารสนเทศเข ามาช วยในการด าเน นงาน เพ อลดข อบกพร อง และสามารถประมวลผลได สะดวกเร วย งข น การพ ฒนาระบบ ข นตอนน เป นการสร างและพ ฒนาระบบงาน การทดสอบระบบ ท าการตรวจสอบเน อหาทดสอบเพ อหาข อผ ดพลาด

88 สร ปผลการด าเน นงาน สร ปผลการจ ดท าโครงงานท งหมดท ได พ ฒนาข น โดยจ ดท า ในร ปแบบของเอกสาร และรวบรวมเสนอแนะในคร งต อไป 1.6 ระยะเวลาในการด าเน นงาน ตารางท 1-1 แสดงระยะเวลาในการปฎ บ ต งาน พ.ศ ก จกรรม ม.ย. ก.ค ส.ค ก.ย. ต.ค พ.ย ธ.ค ม.ค ก.พ น าเสนอห วข อต ออาจารย ศ กษาและเก บรวบรวมข อม ล ว เคราะห และออกแบบระบบ พ ฒนาระบบ ทดสอบและแก ไขข อผ ดพลาด น าเสนอผลงานต อคณะกรรมการ จ ดท าค ม อ 1.7 ประโยชน ท คาดว าจะได ร บ ระบบงานสามารถน าไปพ ฒนาต อในอนาคตเพ อให สามารถใช งานได จร ง ก อให เก ดความรวดเร วในการปฏ บ ต งาน ระบบงานม ความเป นมาตรฐานมากข น การเก บข อม ลง าย สะดวก และรวดเร วมากข น

89 ภาคผนวก ค. รายงานการเข าพบอาจารย ท ปร กษา 241

90 242 รายงานการเข าพบอาจารย ท ปร กษา ช อเร อง ระบบบร หารจ ดการการย ม-ค นหน งส อ ร านแก นการ ต น จ งหว ดมหาสารคาม ผ ศ กษา 1.นางสาววช ดา ภ ผาบาง รห ส BC507 ท ปร กษา อาจารย เกร ยงศ กด จ นท นอก ว น/เด อน/ป รายวานความค บหน า/การให ค าปร กษา ลายม อช อท ปร กษา 19/10/2010 ขอค าปร กษาการท า ITP2 12/11/2010 เสนอส วนงานหน าร าน ให อาจารย ท ปร กษา พ จารณา และน าข อผ ดพลาดมาแก ไข 11/12/2010 เสนอร ปแบบการท าท าส จ บ ตร และ Template Poster ให อาจารย ท ปร กษา พ จารณา 12/01/2011 เสนองานแก อาจารย ท ปร กษาก อนข นสอบ 17/01/2011 น าเสนอระบบงานต อคณะกรรมการ

Source Code ช อ frmcar

Source Code ช อ frmcar 122 Source Code ช อ frmcar Imports System.Data Imports System.Data.SqlClient Imports System.Globalization Public Class frmcar Dim ds, ds1, dsc As New DataSet Dim hit As DataGridView.HitTestInfo Dim N As

More information

ก Microsoft Visual Studio 2008

ก Microsoft Visual Studio 2008 ก 58 ก ก ก ก ก 58 59 ก Microsoft Visual Studio 2008 1. DVD ก MSVS2008 ก MSVS2008 ก ก MSVS2008 ก ก 180 DVD DVD ก MSVS2008 ก ก Install Visual Studio 2008 2. ก ก ก ก ก Next 3. ก ก Options Page ก Custom ก

More information

โปรแกรมช วยทดสอบหม อแปลงกระแส

โปรแกรมช วยทดสอบหม อแปลงกระแส โปรแกรมช วยทดสอบหม อแปลงกระแส 1.เมน ของโปรแกรม ภาพท 1 หน าเมน ของโปรแกรม Public Class frmmain Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

More information

ภาคผนวก ก การต ดต งโปรแกรม

ภาคผนวก ก การต ดต งโปรแกรม ภาคผนวก ภาคผนวก ก การต ดต งโปรแกรม โปรแกรม Visual Basic.Net ข นตอนการต ดต งโปรแกรม Visual Basic.Net (Visual Studio.net 2008) 1. ใส แผ นโปรแกรม Visual Studio.net 2008 ลงใน CD-Rom Drive 2. รอให โปรแกรมท

More information

Member Management System

Member Management System Member Management System These codes are provided ONLY for reference / Help developers. And also SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUERMENT FOR THE AWARD OF BACHELOR OF COMPUTER APPLICATION (BCA)

More information

LAMPIRAN. Universitas Sumatera Utara

LAMPIRAN. Universitas Sumatera Utara LAMPIRAN 1. Modul Imports System.Data Imports System.Data.OleDb Module Module1 Public conn As OleDbConnection Public CMD As OleDbCommand Public DS As New DataSet Public DA As OleDbDataAdapter Public RD

More information

VISUAL BASIC PROGRAMMING (44) Technical Task KEY. Regional 2013 TOTAL POINTS (485)

VISUAL BASIC PROGRAMMING (44) Technical Task KEY. Regional 2013 TOTAL POINTS (485) 5 Pages VISUAL BASIC PROGRAMMING (44) Technical Task KEY Regional 2013 TOTAL POINTS (485) Graders: Please double-check and verify all scores! Property of Business Professionals of America. May be reproduced

More information

LISTING PROGRAM. frmmenu.vb. frmlogin.vb. Universitas Sumatera Utara. Public Class frmmenu

LISTING PROGRAM. frmmenu.vb. frmlogin.vb. Universitas Sumatera Utara. Public Class frmmenu LISTING PROGRAM frmmenu.vb Public Class frmmenu Private Sub QuitToolStripMenuItem_Click(ByVal sender As QuitToolStripMenuItem.Click Close() Private Sub OtoritasToolStripMenuItem_Click(ByVal sender As OtoritasToolStripMenuItem.Click

More information

Form Adapter Example. DRAFT Document ID : Form_Adapter.PDF Author : Michele Harris Version : 1.1 Date :

Form Adapter Example. DRAFT Document ID : Form_Adapter.PDF Author : Michele Harris Version : 1.1 Date : Form Adapter Example DRAFT Document ID : Form_Adapter.PDF Author : Michele Harris Version : 1.1 Date : 2009-06-19 Form_Adapter.doc DRAFT page 1 Table of Contents Creating Form_Adapter.vb... 2 Adding the

More information

Learning VB.Net. Tutorial 19 Classes and Inheritance

Learning VB.Net. Tutorial 19 Classes and Inheritance Learning VB.Net Tutorial 19 Classes and Inheritance Hello everyone welcome to vb.net tutorials. These are going to be very basic tutorials about using the language to create simple applications, hope you

More information

Lab 3 The High-Low Game

Lab 3 The High-Low Game Lab 3 The High-Low Game LAB GOALS To develop a simple windows-based game named High-Low using VB.Net. You will use: Buttons, Textboxes, Labels, Dim, integer, arithmetic operations, conditionals [if-then-else],

More information

"!#... )*! "!# )+, -./ 01 $

!#... )*! !# )+, -./ 01 $ Email engauday@hotmail.com! "!#... $ %&'... )*! "!# )+, -./ 01 $ ) 1+ 2#3./ 01 %.. 7# 89 ; )! 5/< 3! = ;, >! 5 6/.?

More information

C4.3, 4 Lab: Conditionals - Select Statement and Additional Input Controls Solutions

C4.3, 4 Lab: Conditionals - Select Statement and Additional Input Controls Solutions C4.3, 4 Lab: Conditionals - Select Statement and Additional Input Controls Solutions Between the comments included with the code and the code itself, you shouldn t have any problems understanding what

More information

DO NOT COPY AMIT PHOTOSTUDIO

DO NOT COPY AMIT PHOTOSTUDIO AMIT PHOTOSTUDIO These codes are provided ONLY for reference / Help developers. And also SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUERMENT FOR THE AWARD OF BACHELOR OF COMPUTER APPLICATION (BCA) All rights

More information

Menus, Common Dialog Controls, Context Menus, Sub Procedures, and Functions

Menus, Common Dialog Controls, Context Menus, Sub Procedures, and Functions 5-menus.htm; updated September 12, 2011 Menus, Common Dialog Controls, Context Menus, Sub Procedures, and Functions Coverage: This chapter covers several important topics: (1) use of menus and context

More information

IMS1906: Business Software Fundamentals Tutorial exercises Week 5: Variables and Constants

IMS1906: Business Software Fundamentals Tutorial exercises Week 5: Variables and Constants IMS1906: Business Software Fundamentals Tutorial exercises Week 5: Variables and Constants These notes are available on the IMS1906 Web site http://www.sims.monash.edu.au Tutorial Sheet 4/Week 5 Please

More information

A-1 LISTING PROGRAM. 1. Module1

A-1 LISTING PROGRAM. 1. Module1 A-1 LISTING PROGRAM 1. Module1 Imports System.Data.Odbc Imports System.Data Imports System.Data.SqlClient Imports MySql.Data.MySqlClient Module Module1 Public userid As String Public level As String Public

More information

LAMPIRAN A: Listing Program

LAMPIRAN A: Listing Program 78 LAMPIRAN A: Listing Program 1. Form Login Public Class FrmLogin Public user As String Private Sub CmdLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdLogin.Click Dim

More information

Connection Example. Document ID : Connection_Example.PDF Author : Michele Harris Version : 1.1 Date :

Connection Example. Document ID : Connection_Example.PDF Author : Michele Harris Version : 1.1 Date : Connection Example Document ID : Connection_Example.PDF Author : Michele Harris Version : 1.1 Date : 2009-06-19 page 1 Table of Contents Connection Example... 2 Adding the Code... 2 Quick Watch myconnection...

More information

Objectives. After completing this topic, the students will: Understand of the concept of polymorphism Know on How to implement 2 types of polymorphism

Objectives. After completing this topic, the students will: Understand of the concept of polymorphism Know on How to implement 2 types of polymorphism Polymorphism Objectives After completing this topic, the students will: Understand of the concept of polymorphism Know on How to implement 2 types of polymorphism Definition Polymorphism provides the ability

More information

System Analysis and Design

System Analysis and Design System Analysis and Design LAB RECORD-INFS -280/L Information Systems Department University of Nizwa, Sultanate of Oman Table of Contents Task. No: Title Page Nos. Date 1) VB Text box and Message Button

More information

1 Dept: CE.NET Programming ( ) Prof. Akash N. Siddhpura. Working with Form: properties, methods and events

1 Dept: CE.NET Programming ( ) Prof. Akash N. Siddhpura. Working with Form: properties, methods and events Working with Form: properties, methods and events To create a New Window Forms Application, Select File New Project. It will open one dialog box which is shown in Fig 2.1. Fig 2.1 The New Project dialog

More information

PROGRAMMING ASSIGNMENT: MOVIE QUIZ

PROGRAMMING ASSIGNMENT: MOVIE QUIZ PROGRAMMING ASSIGNMENT: MOVIE QUIZ For this assignment you will be responsible for creating a Movie Quiz application that tests the user s of movies. Your program will require two arrays: one that stores

More information

Revision for Final Examination (Second Semester) Grade 9

Revision for Final Examination (Second Semester) Grade 9 Revision for Final Examination (Second Semester) Grade 9 Name: Date: Part 1: Answer the questions given below based on your knowledge about Visual Basic 2008: Question 1 What is the benefit of using Visual

More information

LAMPIRAN A-2 : LAPORAN PENJUALAN DOKUMEN KELUARAN

LAMPIRAN A-2 : LAPORAN PENJUALAN DOKUMEN KELUARAN LAMPIRAN A-2 : LAPORAN PENJUALAN DOKUMEN KELUARAN LAMPIRAN A-1 : NOTA DOKUMEN KELUARAN LAMPIRAN B MASUKAN SISTEM BERJALAN LAMPIRAN B-1 : DATA BARANG DOKUMEN MASUKAN LAMPIRAN B-2 : DATA PELANGGAN DOKUMEN

More information

CALIFORNIA STATE UNIVERSITY, SACRAMENTO College of Business Administration. MIS 15 Introduction to Business Programming. Programming Assignment 3 (P3)

CALIFORNIA STATE UNIVERSITY, SACRAMENTO College of Business Administration. MIS 15 Introduction to Business Programming. Programming Assignment 3 (P3) CALIFORNIA STATE UNIVERSITY, SACRAMENTO College of Business Administration MIS 15 Introduction to Business Programming Programming Assignment 3 (P3) Points: 50 Due Date: Tuesday, May 10 The purpose of

More information

EXAMGOOD QUESTION & ANSWER. Accurate study guides High passing rate! Exam Good provides update free of charge in one year!

EXAMGOOD QUESTION & ANSWER. Accurate study guides High passing rate! Exam Good provides update free of charge in one year! EXAMGOOD QUESTION & ANSWER Exam Good provides update free of charge in one year! Accurate study guides High passing rate! http://www.examgood.com Exam : 70-547(VB) Title : PRO:Design and Develop Web-Basd

More information

Lampiran 1 Kode Program

Lampiran 1 Kode Program 53 Lampiran 1 Kode Program Kode Program 1 Kode Menu Peminjaman Private Sub BT_Cari_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT_Cari.Click Call CariKaset() Private Sub RB_CheckedChanged(ByVal

More information

DEVELOPING OBJECT ORIENTED APPLICATIONS

DEVELOPING OBJECT ORIENTED APPLICATIONS DEVELOPING OBJECT ORIENTED APPLICATIONS By now, everybody should be comfortable using form controls, their properties, along with methods and events of the form class. In this unit, we discuss creating

More information

1. Introduction The idea of the traditional programming

1. Introduction The idea of the traditional programming 1. Introduction The way of programming differs a lot depending on a programmer using a traditional way of programming or if she/he uses a graphical environment for creating a program. 1.1. The idea of

More information

C16 Visual Basic Net Programming

C16 Visual Basic Net Programming C16 Visual Basic Net Programming Student ID Student Name Date - Module Tutor - 1 P a g e Report Contents Introduction... 2 Software Development Process... 3 Self Reflection... 6 References... 6 Appendices...

More information

Private Sub MenuUtamaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Me.ShowDialog() End Sub

Private Sub MenuUtamaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Me.ShowDialog() End Sub LISTING PROGRAM Menu_Utama.vb Public Class FrmUtama Private Sub DataMovieToolStripMenuItem_Click(ByVal sender As DataMovieToolStripMenuItem.Click FrmMovie.ShowDialog() Private Sub DataPeminjamToolStripMenuItem_Click(ByVal

More information

Herefordshire College of Technology Centre Edexcel BTEC Level 3 Extended Diploma in Information Technology (Assignment 1 of 3)

Herefordshire College of Technology Centre Edexcel BTEC Level 3 Extended Diploma in Information Technology (Assignment 1 of 3) Student: Candidate Number: Assessor: Len Shand Herefordshire College of Technology Centre 24150 Edexcel BTEC Level 3 Extended Diploma in Information Technology (Assignment 1 of 3) Course: Unit: Title:

More information

1. Create your First VB.Net Program Hello World

1. Create your First VB.Net Program Hello World 1. Create your First VB.Net Program Hello World 1. Open Microsoft Visual Studio and start a new project by select File New Project. 2. Select Windows Forms Application and name it as HelloWorld. Copyright

More information

Private Sub Cours_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Private Sub Cours_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Public Class Cours Private nc As Integer Private Sub Cours_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'TODO : cette ligne de code charge les données dans la table

More information

FOR 240 Homework Assignment 4 Using DBGridView and Other VB Controls to Manipulate Database Introduction to Computing in Natural Resources

FOR 240 Homework Assignment 4 Using DBGridView and Other VB Controls to Manipulate Database Introduction to Computing in Natural Resources FOR 240 Homework Assignment 4 Using DBGridView and Other VB Controls to Manipulate Database Introduction to Computing in Natural Resources This application demonstrates how a DataGridView control can be

More information

Else. End If End Sub End Class. PDF created with pdffactory trial version

Else. End If End Sub End Class. PDF created with pdffactory trial version Dim a, b, r, m As Single Randomize() a = Fix(Rnd() * 13) b = Fix(Rnd() * 13) Label1.Text = a Label3.Text = b TextBox1.Clear() TextBox1.Focus() Private Sub Button2_Click(ByVal sender As System.Object, ByVal

More information

To enter the number in decimals Label 1 To show total. Text:...

To enter the number in decimals Label 1 To show total. Text:... Visual Basic tutorial - currency converter We will use visual studio to create a currency converter where we can convert a UK currency pound to other currencies. This is the interface for the application.

More information

Learning VB.Net. Tutorial 15 Structures

Learning VB.Net. Tutorial 15 Structures Learning VB.Net Tutorial 15 Structures Hello everyone welcome to vb.net tutorials. These are going to be very basic tutorials about using the language to create simple applications, hope you enjoy it.

More information

Learning VB.Net. Tutorial 17 Classes

Learning VB.Net. Tutorial 17 Classes Learning VB.Net Tutorial 17 Classes Hello everyone welcome to vb.net tutorials. These are going to be very basic tutorials about using the language to create simple applications, hope you enjoy it. If

More information

Déclaration du module

Déclaration du module Déclaration du module Imports System.IO Module ModuleStagiaires Public Structure Stagiaire Private m_code As Long Private m_nom As String Private m_prenom As String Public Property code() As Long Get Return

More information

This PDF was generated in real-time using DynamicPDF; Generator for.net.

This PDF was generated in real-time using DynamicPDF; Generator for.net. TableReport.aspx 1 1 Imports System 2 Imports System.Data 3 Imports System.Data.SqlClient 4 5 Imports cete.dynamicpdf 6

More information

PROGRAM 1: SIMPLE CALCULATOR

PROGRAM 1: SIMPLE CALCULATOR PROGRAM 1: SIMPLE CALCULATOR Option Explicit Dim operand1 As Double, operand2 As Double Dim op1 As Double, op2 As Double Dim operator As String Dim cleardisplay As Boolean Private Sub Cmdclear_Click()

More information

Unit 4. Lesson 4.1. Managing Data. Data types. Introduction. Data type. Visual Basic 2008 Data types

Unit 4. Lesson 4.1. Managing Data. Data types. Introduction. Data type. Visual Basic 2008 Data types Managing Data Unit 4 Managing Data Introduction Lesson 4.1 Data types We come across many types of information and data in our daily life. For example, we need to handle data such as name, address, money,

More information

Serial-out Color Sensor. Overview. Features

Serial-out Color Sensor. Overview. Features Visit us @ www.thearyatechnologies.com Email: aryaprotech@gmail.com / info@thearyatechnologies.com Contact us@ 0253-2512131 Serial-out Color Sensor Overview Color sensor identifies primary colors (Red,

More information

Visual Basic/C# Programming (330)

Visual Basic/C# Programming (330) Page 1 of 12 Visual Basic/C# Programming (330) REGIONAL 2017 Production Portion: Program 1: Calendar Analysis (400 points) TOTAL POINTS (400 points) Judge/Graders: Please double check and verify all scores

More information

Learning VB.Net. Tutorial 10 Collections

Learning VB.Net. Tutorial 10 Collections Learning VB.Net Tutorial 10 Collections Hello everyone welcome to vb.net tutorials. These are going to be very basic tutorials about using the language to create simple applications, hope you enjoy it.

More information

Final Exam 7:00-10:00pm, April 14, 2008

Final Exam 7:00-10:00pm, April 14, 2008 Name:, (last) (first) Student Number: Section: Instructor: _P. Cribb_ L. Lowther_(circle) York University Faculty of Science and Engineering Department of Computer Science and Engineering Final Exam 7:00-10:00pm,

More information

How to Validate DataGridView Input

How to Validate DataGridView Input How to Validate DataGridView Input This example explains how to use DR.net to set validation criteria for a DataGridView control on a Visual Studio.NET form. Why You Should Use This To add extensible and

More information

In this tutorial we will create a simple calculator to Add/Subtract/Multiply and Divide two numbers and show a simple message box result.

In this tutorial we will create a simple calculator to Add/Subtract/Multiply and Divide two numbers and show a simple message box result. Simple Calculator In this tutorial we will create a simple calculator to Add/Subtract/Multiply and Divide two numbers and show a simple message box result. Let s get started First create a new Visual Basic

More information

How to work with data sources and datasets

How to work with data sources and datasets Chapter 14 How to work with data sources and datasets Objectives Applied Use a data source to get the data that an application requires. Use a DataGridView control to present the data that s retrieved

More information

My first game. 'function which adds objects with bug tag to bugarray array. Saturday, November 23, :06 AM

My first game. 'function which adds objects with bug tag to bugarray array. Saturday, November 23, :06 AM My first game Saturday, November 23, 2013 5:06 AM Public Class Form1 Dim moveright As Boolean = False Dim moveup As Boolean = False Dim moveleft As Boolean = False Dim movedown As Boolean = False Dim score

More information

Learning VB.Net. Tutorial 16 Modules

Learning VB.Net. Tutorial 16 Modules Learning VB.Net Tutorial 16 Modules Hello everyone welcome to vb.net tutorials. These are going to be very basic tutorials about using the language to create simple applications, hope you enjoy it. If

More information

Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init

Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init Option Strict On Imports System.Drawing.Imaging Imports System.Drawing Imports System Imports System.Collections Imports System.Configuration Imports System.Data Imports System.IO Imports System.Web Imports

More information

VARIABLES. 1. STRINGS Data with letters and/or characters 2. INTEGERS Numbers without decimals 3. FLOATING POINT NUMBERS Numbers with decimals

VARIABLES. 1. STRINGS Data with letters and/or characters 2. INTEGERS Numbers without decimals 3. FLOATING POINT NUMBERS Numbers with decimals VARIABLES WHAT IS A VARIABLE? A variable is a storage location in the computer s memory, used for holding information while the program is running. The information that is stored in a variable may change,

More information

Tutorial 03 understanding controls : buttons, text boxes

Tutorial 03 understanding controls : buttons, text boxes Learning VB.Net Tutorial 03 understanding controls : buttons, text boxes Hello everyone welcome to vb.net tutorials. These are going to be very basic tutorials about using the language to create simple

More information

} } public void getir() { DataTable dt = vt.dtgetir("select* from stok order by stokadi");

} } public void getir() { DataTable dt = vt.dtgetir(select* from stok order by stokadi); Form1 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;

More information

Huw Talliss Data Structures and Variables. Variables

Huw Talliss Data Structures and Variables. Variables Data Structures and Variables Variables The Regex class represents a read-only regular expression. It also contains static methods that allow use of other regular expression classes without explicitly

More information

IN COLLABORATION WITH IVTB. Diploma in Information Technology. Examinations for / Semester 2

IN COLLABORATION WITH IVTB. Diploma in Information Technology. Examinations for / Semester 2 IN COLLABORATION WITH IVTB Diploma in Information Technology DIP/03/Full Time Examinations for 2004 2005 / Semester 2 MODULE: VISUAL PROGRAMMING MODULE CODE: BISE070 Duration: 2 Hours + 10 Minutes (Reading

More information

VB FUNCTIONS AND OPERATORS

VB FUNCTIONS AND OPERATORS VB FUNCTIONS AND OPERATORS In der to compute inputs from users and generate results, we need to use various mathematical operats. In Visual Basic, other than the addition (+) and subtraction (-), the symbols

More information

Events. Event Handler Arguments 12/12/2017. EEE-425 Programming Languages (2016) 1

Events. Event Handler Arguments 12/12/2017. EEE-425 Programming Languages (2016) 1 Events Events Single Event Handlers Click Event Mouse Events Key Board Events Create and handle controls in runtime An event is something that happens. Your birthday is an event. An event in programming

More information

LAMPIRAN A: Listing Program

LAMPIRAN A: Listing Program 67 1. Form Menu Utama LAMPIRAN A: Listing Program Public Class MScreen Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.Hide() Form1.Show()

More information

Design Of Human Computer Interfaces Assignment 1- Hello World. Compliance Report

Design Of Human Computer Interfaces Assignment 1- Hello World. Compliance Report Design Of Human Computer Interfaces Assignment 1- Hello World Compliance Report Prepared for: Skip Poehlman Prepared By: K C Course: SE 4D03 Date: September 30, 2008 Contents 1. Code Listing a. Module

More information

DRAWING AND MOVING IMAGES

DRAWING AND MOVING IMAGES DRAWING AND MOVING IMAGES Moving images and shapes in a Visual Basic application simply requires the user of a Timer that changes the x- and y-positions every time the Timer ticks. In our first example,

More information

I101/B100 Problem Solving with Computers

I101/B100 Problem Solving with Computers I101/B100 Problem Solving with Computers By: Dr. Hossein Hakimzadeh Computer Science and Informatics IU South Bend 1 What is Visual Basic.Net Visual Basic.Net is the latest reincarnation of Basic language.

More information

Repetition Structures

Repetition Structures Repetition Structures There are three main structures used in programming: sequential, decision and repetition structures. Sequential structures follow one line of code after another. Decision structures

More information

VISUAL BASIC II CC111 INTRODUCTION TO COMPUTERS

VISUAL BASIC II CC111 INTRODUCTION TO COMPUTERS VISUAL BASIC II CC111 INTRODUCTION TO COMPUTERS Intended Learning Objectives Able to build a simple Visual Basic Application. 2 The Sub Statement Private Sub ControlName_eventName(ByVal sender As System.Object,

More information

Instant Autosesk Revit 2013 Customization with.net How-to: Bonus Section

Instant Autosesk Revit 2013 Customization with.net How-to: Bonus Section Instant Autosesk Revit 2013 Customization with.net How-to: Bonus Section This is the bonus section of the book Instant Autosesk Revit 2013 Customization with.net How-to. Here we are going to cover recipes

More information

ISM 3253 Exam I Spring 2009

ISM 3253 Exam I Spring 2009 ISM 3253 Exam I Spring 2009 Directions: You have exactly 75 minutes to complete this test. Time available is part of the exam conditions and all work must cease when "Stop work" is announced. Failing to

More information

Visual Basic 2008 The programming part

Visual Basic 2008 The programming part Visual Basic 2008 The programming part Code Computer applications are built by giving instructions to the computer. In programming, the instructions are called statements, and all of the statements that

More information

Oracle Rdb Developer Tools for Visual Studio Developer s Guide, Release Copyright 2011 Oracle Corporation Corporation. All rights reserved.

Oracle Rdb Developer Tools for Visual Studio Developer s Guide, Release Copyright 2011 Oracle Corporation Corporation. All rights reserved. Oracle Rdb Developer Tools for Visual Studio Developer's Guide V7.3.2.1 May 2011 Oracle Rdb Developer Tools for Visual Studio Developer s Guide, Release 7.3-21 Copyright 2011 Oracle Corporation Corporation.

More information

Instructor s Notes Programming Logic Printing Reports. Programming Logic. Printing Custom Reports

Instructor s Notes Programming Logic Printing Reports. Programming Logic. Printing Custom Reports Instructor s Programming Logic Printing Reports Programming Logic Quick Links & Text References Printing Custom Reports Printing Overview Page 575 Linking Printing Objects No book reference Creating a

More information

Santiago Canyon College Computer Science

Santiago Canyon College Computer Science P a g e 1 Santiago Canyon College Computer Science The.Net Threading Model Introduction The purpose of this paper is to introduce you to multi-threading in Visual Studio. Learning how to take advantage

More information

Oracle Rdb Developer Tools for Visual Studio Developer's Guide Release June 2015

Oracle Rdb Developer Tools for Visual Studio Developer's Guide Release June 2015 Oracle Rdb Developer Tools for Visual Studio Developer's Guide Release 7.3.4.0 June 2015 Oracle Rdb Data Provider for.net Developer's Guide, Release 7.3.4.0 Copyright 2011, 2015 Oracle and/or its affiliates.

More information

Interacting with External Applications

Interacting with External Applications Interacting with External Applications DLLs - dynamic linked libraries: Libraries of compiled procedures/functions that applications link to at run time DLL can be updated independently of apps using them

More information

Visual Programming (761220) First Exam First Semester of Date: I Time: 60 minutes

Visual Programming (761220) First Exam First Semester of Date: I Time: 60 minutes Philadelphia University Lecturer : Mrs. Eman Alnaji Coordinator : Miss. Reem AlQaqa Internal Examiner: Dr. Nameer Al Emam Faculty of Information Technology Department of CIS Examination Paper Visual Programming

More information

Applications with Multiple Forms

Applications with Multiple Forms Applications with Multiple Forms APPENDIX D After studying Appendix D, you should be able to: Explain the difference between SDI, MDI, and TDI applications Create an SDI application that contains more

More information

WEEK 1. Event: Tick: Occurs when the specified timer interval has elapsed and the timer is enabled.

WEEK 1. Event: Tick: Occurs when the specified timer interval has elapsed and the timer is enabled. WEEK 1 Timer: A Timer is used to raise an event at user-defined intervals. It is optimized for use in Windows Forms applications. Timer is used to control and manage events that are time related. For example:

More information

VB.NET Programs. ADO.NET (insert, update, view records)

VB.NET Programs. ADO.NET (insert, update, view records) ADO.NET (insert, update, view records) VB.NET Programs Database: Student Table : Studtab (adno, name, age, place) Controls: DataGridView, Insert button, View button, Update button, TextBox1 (for Admission

More information

...ic Programming\Mystery Escape\Mystery Escape\frmEscape.vb

...ic Programming\Mystery Escape\Mystery Escape\frmEscape.vb ...ic Programming\Mystery Escape\Mystery Escape\frmEscape.vb 1 1 Option Strict On 2 3 Public Class frmescape 4 5 ' Class variables. 6 7 Private _intonehour As Integer = 1 8 Private _inttwohour As Integer

More information

Visual Studio.NET for AutoCAD Programmers

Visual Studio.NET for AutoCAD Programmers December 2-5, 2003 MGM Grand Hotel Las Vegas Visual Studio.NET for AutoCAD Programmers Speaker Name: Andrew G. Roe, P.E. Class Code: CP32-3 Class Description: In this class, we'll introduce the Visual

More information

超音波モータ制御プログラムの作成 (v1.2.1)

超音波モータ制御プログラムの作成 (v1.2.1) 超音波モータ制御プログラムの作成 (v1.2.1) 2008 年 11 月 28 日 Masaaki MATSUO 構成機器 モータ本体 : フコク ロータリーエンコーダー内蔵型超音波モータ USB-60E モータ制御部 : フコク 位置決制御ドライバ DCONT-3-60 (SD13) コントローラ : Interface 2 軸絶縁パルスモーションコントローラ ( 直線補間エンコーダ入力 5V)

More information

Examples. Products. W informs Controls > Products > Navigation Bar > Examples. This topic provides how -to examples, grouped by features.

Examples. Products. W informs Controls > Products > Navigation Bar > Examples. This topic provides how -to examples, grouped by features. Examples 3564 W informs Controls > Products > Navigation Bar > Examples This topic provides how -to examples, grouped by features. Examples Layout How to: Create a NavBar Control in Code How to: Activate

More information

Upgrading Distributed Applications

Upgrading Distributed Applications C2161587x.fm Page 435 Friday, November 16, 2001 9:08 AM Upgrading Distributed Applications Until now we haven t really talked about upgrading large-scale distributed applications. But building these types

More information

Mr.Khaled Anwar ( )

Mr.Khaled Anwar ( ) The Rnd() function generates random numbers. Every time Rnd() is executed, it returns a different random fraction (greater than or equal to 0 and less than 1). If you end execution and run the program

More information

Updated: Saturday, November 29, 2014 Page 1

Updated: Saturday, November 29, 2014 Page 1 ' Copyright 2013 Safe T Services - All Rights Reserved '=========================================================================================== 'Changed by Change Date Change Tag ' Description of Change

More information

Creating a Dynamo with VBA Scripts

Creating a Dynamo with VBA Scripts Creating a Dynamo with VBA Scripts Creating a Dynamo with VBA 1 Table of Contents 1. CREATING A DYNAMO WITH VBA... 3 1.1 NAMING CONVENTIONS FOR DYNAMO OBJECTS...3 1.2 CREATING A DYNAMO...4 1.3 DESIGNING

More information

'The following GUID is for the ID of the typelib if this project is exposed to COM <Assembly: Guid("8b a5-46bb-a6a9-87b4949d1f4c")>

'The following GUID is for the ID of the typelib if this project is exposed to COM <Assembly: Guid(8b a5-46bb-a6a9-87b4949d1f4c)> LAMPIRAN A : LISTING PROGRAM Imports System Imports System.Reflection Imports System.Runtime.InteropServices ' General Information about an assembly is controlled through the following ' set of attributes.

More information

OVERLOADING METHODS AND CONSTRUCTORS: The Ball Class

OVERLOADING METHODS AND CONSTRUCTORS: The Ball Class OVERLOADING METHODS AND CONSTRUCTORS: The Ball Class Create a Ball Demo program that uses a Ball class. Use the following UML diagram to create the Ball class: Ball - ballcolor: Color - ballwidth, ballheight:

More information

Home and Mailing Addresses Overview

Home and Mailing Addresses Overview Home and Mailing Addresses Overview Introduction This guide provides the procedures for members to update their home and mailing addresses and enter a Thrift Savings Plan (TSP) address in Direct Access.

More information

CS708 Lecture Notes. Visual Basic.NET Object-Oriented Programming. Implementing Business Objects Data Access Code.

CS708 Lecture Notes. Visual Basic.NET Object-Oriented Programming. Implementing Business Objects Data Access Code. CS708 Lecture Notes Visual Basic.NET Object-Oriented Programming Implementing Business Objects Data Access Code Part (III of III) (Lecture Notes 3C) Professor: A. Rodriguez CHAPTER 7 BUSINESS OBJECTS DATA

More information

Chapter 8 Arrays. Programming In Visual Basic.NET

Chapter 8 Arrays. Programming In Visual Basic.NET Chapter 8 Arrays Programming In Visual Basic.NET 1 Case Structure Best alternative for testing a single variable or expression for multiple values Any decisions coded with nested If statements can also

More information

Imports System.Data.SqlClient. Public Class Phonebook

Imports System.Data.SqlClient. Public Class Phonebook Imports System.Data.SqlClient Public Class Phonebook Dim vbdatabasedataset As New vbdatabasedataset() Dim PhonebookTableAdapter As New vbdatabasedatasettableadapters.phonebooktableadapter() Dim selection

More information

S.2 Computer Literacy Question-Answer Book

S.2 Computer Literacy Question-Answer Book S.2 C.L. Half-yearly Examination (2012-13) 1 12-13 S.2 C.L. Question- Answer Book Hong Kong Taoist Association Tang Hin Memorial Secondary School 2012-2013 Half-yearly Examination S.2 Computer Literacy

More information

Answer on Question# Programming, C#

Answer on Question# Programming, C# Answer on Question#38723 - Programming, C# 1. The development team of SoftSols Inc. has revamped the software according to the requirements of FlyHigh Airlines and is in the process of testing the software.

More information

Lecture 10 OOP and VB.Net

Lecture 10 OOP and VB.Net Lecture 10 OOP and VB.Net Pillars of OOP Objects and Classes Encapsulation Inheritance Polymorphism Abstraction Classes A class is a template for an object. An object will have attributes and properties.

More information

Lab 6: Making a program persistent

Lab 6: Making a program persistent Lab 6: Making a program persistent In this lab, you will cover the following topics: Using the windows registry to make parts of the user interface sticky Using serialization to save application data in

More information

Visual Basic: Opdracht Structuur

Visual Basic: Opdracht Structuur Visual Basic: Opdracht Structuur HoofdMenu.vb SubMenu_Kwadraat.vb Form1.vb Form2.vb Submenu_Som.vb Form3.vb Form4.vb SubMenu_Gem.vb Form5.vb Form6.vb Form10.vb SubMenu_Naam.vb Form7.vb Form11.vb Form8.vb

More information

Data Verification and Validation Process in the Management System Development

Data Verification and Validation Process in the Management System Development Middle-East Journal of Scientific Research 25 (5): 902-911, 2017 ISSN 1990-9233 IDOSI Publications, 2017 DOI: 10.5829/idosi.mejsr.2017.902.911 Data Verification and Validation Process in the Management

More information

A Complete Tutorial for Beginners LIEW VOON KIONG

A Complete Tutorial for Beginners LIEW VOON KIONG I A Complete Tutorial for Beginners LIEW VOON KIONG Disclaimer II Visual Basic 2008 Made Easy- A complete tutorial for beginners is an independent publication and is not affiliated with, nor has it been

More information