VB图书管理系统毕业设计

来源:互联网 发布:jquery 1.11.1.js 编辑:程序博客网 时间:2024/05/01 15:00

目录

第一章系统概述.1

1.1 系统开发背景和意义.1

1.2 开发环境.1

第二章 系统需求分析.2

2.1 任务概述.2

2.2 数据描述(数据流图+数据字典)2

2.3 功能需求.6

2.4性能需求.6

第三章 系统总体设计.8

3.1 新的业务流程.8

3.2 系统功能模块图.8

3.3 系统的流程图.9

第四章 详细设计.11

4.1 程序流程图.11

4.2 程序输入输出描述.13

4.2.1 主模块.13

4.2.1 学生管理模块.13

4.2.2 图书管理模块.13

4.2.3 借阅管理模块.13

4.2.4 归还管理模块.13

4.2.5 管理措施设置模块.13

4.3 程序接口描述.14

4.3.1 外部接口.14

4.3.2 内部接口.14

4.4 数据库的设计.14

4.4.1 数据库的逻辑设计.14

4.4.2 数据库的物理设计.16

第五章 编码实现.19

5.1 程序编码.19

第六章 测试分析报告.37

6.1 测试计划和要点.37

6.1.1 主模块测试要点.37

6.1.2 借阅模块测试要点.37

6.1.3 学生查询模块测试要点.37

6.1.4 图书查询模块测试要点.38

6.1.5 图书归还模块测试要点.38

6.2 测试用例.38

6.2.1 主模块测试用例.39

6.2.2 借阅模块测试用例.39

6.2.3 学生查询模块测试用例.40

6.2.4 图书查询模块测试用例.40

6.2.5 图书归还模块测试用例.40

6.3 测试结果及结论.41

6.3.1 测试的结果.41

6.3.2 缺陷分析及改进.42

6.3.3 测试结论.43

总结.44

参考文献.45

 

 

4.2 程序输入输出描述

4.2.1 主模块

1.输入项目:操作系统传递至的各种消息以及用户的输入数据。

2.输出项目:用户界面显示。

4.2.1 学生管理模块

1.输入项目:与学生管理操作子对话框有关的用户输入及系统消息。

2.输出项目:操作结果显示。

4.2.2 图书管理模块

1.输入项目:用户口令。

2.输出项目:相应的界面。

4.2.3 借阅管理模块

1.输入项目:学生学号、图书编号。

2.输出项目:学生信息、相关借书信息。

4.2.4 归还管理模块

1.输入项目:图书编号。

2.输出项目:相关学生信息。

4.2.5 管理措施设置模块

1.输入项目:用户的输入。

2.输出项目:根据用户的输入显示相应的对话框。

5.1 程序编码

登陆界面如图5.1所示。

图5.1登陆界面

程序代码如下:

Function Check_Password(ByVal UserName As String,ByVal UserPassword As String) As Integer

    On ErrorGoTo ER2:

    IfConnectToServer = True Then

        SetobjRs = New Recordset

        StrSql ="select cOperatorPassword from tOperators where cOperatorName='"& Trim(cboName.Text) & "'"

        GetDataStrSql 'Reference function to get data

        IfobjRs.EOF Then

           Check_Password = 0 'This Operator not exist

        Else

           IftxtPassword.Text <>Trim(objRs.Fields("cOperatorPassword").Value) Then

             Check_Password = 1 ' password error

           Else

             Check_Password = 2 'password ok

             CurrentOpname = Trim(cboName.Text)

              CurrentOppassword =objRs.Fields("cOperatorPassword").Value

             'Here can save a operator grade for expand

           EndIf

        End If

      objCon.Close

       ExitFunction

ER2:

    MsgBoxErr.Description

   Check_Password = 255

    End If

End Function

Private Sub cmdCancel_Click()

    Unload Me

    End

End Sub

Private Sub cmdOK_Click()

    Dim intCheckAs Integer

    'StaticintLogTimes to save user login times

    StaticintLogTimes As Integer

    intLogTimes= intLogTimes + 1 'Save login times

    IfintLogTimes > MaxLogTimes Then

        'Overallowed login times then list information

        MsgBox"You have over allowed loghin times,login failure !", vbCritical,"LoginError"

        UnloadMe

    Else

        intCheck= Check_Password(Trim(txtPassword), Trim(cboName))

        SelectCase intCheck

        Case 0

           MsgBox "Your are not a system user !", vbInformation +vbOKOnly, "LoginError"

        Case 1

           MsgBox "Password error ,please check your password !",vbInformation + vbOKOnly, "LoginError"

        Case 2

            Unload Me

            IfCurrentOpname = "Admin" And CurrentOppassword = "1" Then

               MainWin.mnuOp.Visible = True

            Else

               MainWin.mnuOp.Visible = False

            EndIf

            LoadMainWin

           MainWin.Show

        EndSelect

 

      End If

End Sub

 

主界面如图5.2所示。

图5.2 程序主界面

程序代码如下:

Option Explicit

Private Sub MDIForm_Activate()

    IfCurrentOpname = "Admin" Then

        StatusBar2.Panels(1).Text = "管理员:"& CurrentOpname

        Toolbar1.Buttons(1).Visible = True

        Toolbar1.Buttons(2).Visible = True

    Else

       StatusBar2.Panels(1).Text = "操作员:"& CurrentOpname

        Toolbar1.Buttons(1).Visible = False

        Toolbar1.Buttons(2).Visible = False

    End If

End Sub

Private Sub MDIForm_MouseDown(Button As Integer, ShiftAs Integer, X As Single, Y As Single)

    If Button =vbRightButton Then

    PopupMenumnuOperation 'Design popup menu

    End If

End Sub

Private Sub MDIForm_Unload(Cancel As Integer)

   CheckConnect  'Reference functionto make objcon break if connection is open

End Sub

 

Private Sub mnuAbout_Click()

   frmAbout.Show

End Sub

 

Private Sub mnuBookQuery_Click()

 CheckConnect'Reference function to make objcon break if connection is open

    LoadfrmBookQuery

   frmBookQuery.Show

End Sub

 

Private Sub mnuBookRegist_Click()

 CheckConnect'Reference function to make objcon break if connection is open

    LoadfrmBookReg

   frmBookReg.Show

End Sub

Private Sub mnuBorrowQuery_Click()

 CheckConnect'Reference function to make objcon break if connection is open

    LoadfrmReadQuery

   frmReadQuery.Show

End Sub

Private Sub mnuExit_Click()

 CheckConnect'Reference function to make objcon break if connection is open

    Unload Me

    End

End Sub

Private Sub mnuReLogin_Click()

    CheckConnect'Reference function to make objcon break if connection is open

    Unload Me

    LoadfrmLogin

   frmLogin.Show

End Sub

Private Sub mnuVipQuery_Click()

    CheckConnect'Reference function to make objcon break if connection is open

    LoadfrmVipQuery

   frmVipQuery.Show

End Sub

 

Private Sub mnuVipRegist_Click()

    CheckConnect'Reference function to make objcon break if connection is open

    LoadfrmVipReg

   frmVipReg.Show

End Sub

Private Sub munReadRegist_Click()

    CheckConnect'Reference function to make objcon break if connection is open

    LoadfrmReadRegist

   frmReadRegist.Show

End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button AsMSComctlLib.Button)

Select Case Button.Key

    Case"operatorReg"

       CheckConnect 'Reference function to make objcon break if connection isopen

        LoadfrmAdmin

       frmAdmin.Show

    Case"vipReg"

       CheckConnect 'Reference function to make objcon break if connection isopen

        LoadfrmVipReg

       frmVipReg.Show

    Case"vipQuery"

       CheckConnect 'Reference function to make objcon break if connection isopen

        LoadfrmVipQuery

       frmVipQuery.Show

    Case"BookReg"

       CheckConnect 'Reference function to make objcon break if connection isopen

        LoadfrmBookReg

       frmBookReg.Show

    Case"bookQuery"

       CheckConnect 'Reference function to make objcon break if connection isopen

        LoadfrmBookQuery

       frmBookQuery.Show

    Case"readReg"

       CheckConnect 'Reference function to make objcon break if connection isopen

        LoadfrmReadRegist

       frmReadRegist.Show

    Case"readQuery"

       CheckConnect 'Reference function to make objcon break if connection isopen

        LoadfrmReadQuery

       frmReadQuery.Show

End Select

End Sub

操作员管理界面如图5.3所示。

图5.3操作员管理界面

代码如下:

Option Explicit

Sub SetTextEmpty()

'This function is set all text to empty

     txtOpID.Text = ""

     txtOpName.Text = ""

     txtOpPwd.Text = ""

     cboOpGrade.Text = ""

     txtOpAddTime.Text = ""

End Sub

Sub RefreshOperator()

'This function is to Refresh text

      txtOpID.Text = objRs.Fields(0).Value

      txtOpName.Text = objRs.Fields(1).Value

      txtOpPwd.Text = objRs.Fields(2).Value

      cboOpGrade.Text = objRs.Fields(3).Value

      'txtOpAddTime.Text = objRs.Fields(4).Value

End Sub

Private Sub cmdAdd_Click()

   txtOpID.Enabled = True 'You don't change datagrid untill you add datafinish

   dgdOp.Enabled = False

    IfcmdAdd.Caption = "添加" Then

       cmdAdd.Caption = "确定"

       SetTextEmpty ' reference settextempty founction to set empty

       cmdDel.Enabled = False

       cmdModify.Enabled = False

       cmdRefresh.Enabled = False

       txtOpID.SetFocus

    Else

         IfTrim(txtOpName.Text) = "" Then

           MsgBox "Operator name must not null ,please input operator name!", vbInformation + vbOKOnly

           txtOpName.SetFocus

            ExitSub

         ElseIfTrim(txtOpID.Text) = "" Then

           MsgBox "Operator ID must not null ,please input operator ID!", vbInformation + vbOKOnly

           txtOpID.SetFocus

            ExitSub

         ElseIfTrim(txtOpPwd.Text) = "" Then

           MsgBox "Operator password must not null ,please input operatorpassword !", vbInformation + vbOKOnly

           txtOpPwd.SetFocus

            ExitSub

         Else

            With objRs

               checkAddNew = True

              .Filter = "cOperatorID='" & Trim(txtOpID.Text) &"'"

               If .RecordCount > 0 Then

                   MsgBox "This operator has been exist !"

                   txtOpID.Text = ""

                   txtOpID.SetFocus

                   .Filter = "cOperatorID<>''"

                   cmdRefresh.Value = True 'To executer refresh once

                   checkAddNew = False

                   cmdDel.Enabled = True

                    cmdModify.Enabled = True

                   cmdAdd.Caption = "添加(&A)"

                   txtOpID.Enabled = False

                   cmdRefresh.Enabled = True

                   dgdOp.Enabled = True

                   checkAddNew = False

                    Exit Sub

               End If

               checkAddNew = True

               .AddNew

               .Fields(0).Value = Trim(txtOpID.Text)

               .Fields(1).Value = Trim(txtOpName.Text)

               .Fields(2).Value = Trim(txtOpPwd.Text)

               .Fields(3).Value = Trim(cboOpGrade.Text)

               .Fields(4).Value = Trim(txtOpAddTime.Text)

               .Update

                MsgBox "Operator add success !", vbInformation + vbOKOnly

               .Filter = "cOperatorID<>''"

               cmdRefresh.Value = True 'To executer refresh once

            EndWith

           checkAddNew = False

           '----There will reference a founction to set empty

           txtOpID.Enabled = False

           cmdDel.Enabled = True

           cmdModify.Enabled = True

           cmdRefresh.Enabled = True

           cmdAdd.Caption = "添加"

           dgdOp.Enabled = True 'You can use datagrid after add finish

        End If

   End If

End Sub

Private Sub cmdDel_Click()

    IfEmpty_Check = True Then Exit Sub 'Reference function to check if your databaseis null

    If NotobjRs.EOF And objRs.RecordCount > 0 Then

        IfMsgBox("The : " & txtOpName & " 's data will deletecontinue ?", vbYesNo + vbInformation) = vbYes Then

           objRs.Delete

        End If

    End If

End Sub

Private Sub cmdModify_Click()

    IfEmpty_Check = True Then Exit Sub 'Reference function to check if your databaseis null

       dgdOp.Enabled = False

    IftxtOpID.Text <> objRs.Fields(0).Value Then Exit Sub 'To check operator ID

    IfcmdModify.Caption = "修改" Then

       cmdModify.Caption = "确定"

       cmdDel.Enabled = False

       cmdAdd.Enabled = False

    Else

        WithobjRs

               .Fields(0).Value = Trim(txtOpID.Text)

                .Fields(1).Value =Trim(txtOpName.Text)

               .Fields(2).Value = Trim(txtOpPwd.Text)

               .Fields(3).Value = Trim(cboOpGrade.Text)

               .Update

        End With

       cmdModify.Caption = "修改"

       cmdDel.Enabled = True

       cmdAdd.Enabled = True

       dgdOp.Enabled = True

    End If

End Sub

Private Sub cmdExit_Click()

    Unload Me

End Sub

Private Sub cmdRefresh_Click()

   RefreshOperator 'Reference function is to Refresh text

End Sub

Private Sub dgdOp_RowColChange(LastRow As Variant,ByVal LastCol As Integer)

    IfcheckAddNew = True Then Exit Sub

   cmdRefresh.Value = True

End Sub

 

Private Sub Form_Activate()

    FormMiddlefrmAdmin 'Reference function to make form in MDIForm'mddile

   cboOpGrade.ListIndex = 1

    IfConnectToServer = True Then

           SetobjRs = New ADODB.Recordset

          StrSql = "select * from tOperators"

          GetData StrSql 'Reference function to get data

           SetdgdOp.DataSource = objRs

          cmdRefresh.Value = True

    End If

    End Sub

Private Sub txtOpAddTime_KeyPress(KeyAscii As Integer)

   'CheckInputNum 'Reference function to check input

    If Not(KeyAscii >= vbKey0 And KeyAscii <= vbKey9 _

               Or KeyAscii = vbKeyBack _

                Or KeyAscii = Asc("-")) Then

      KeyAscii =0

     End If

End Sub

Private Sub txtOpID_KeyPress(KeyAscii As Integer)

    If Not(KeyAscii >= vbKey0 And KeyAscii <= vbKey9 _

               Or KeyAscii = vbKeyBack) Then

      KeyAscii =0

    End If

End Sub

学生登记界面如图5.4所示。

图5.4学生信息登记界面

代码如下:


更多相关毕业设计资料:www.doc78.com   QQ80072749

 

0 0
原创粉丝点击