📄 流通管理.vb
字号:
Exit Sub
End If
End If
shuzi = DataGrid3.Item(DataGrid3.CurrentCell.RowNumber, 0)
If RadioButton1.Checked Then
If TypeOf (DataGrid3.Item(DataGrid3.CurrentCell.RowNumber, 6)) Is System.DBNull Then
Else
datt3 = DataGrid3.Item(DataGrid3.CurrentCell.RowNumber, 6)
End If
Else
If TypeOf (DataGrid3.Item(DataGrid3.CurrentCell.RowNumber, 12)) Is System.DBNull Then
Else
datt3 = DataGrid3.Item(DataGrid3.CurrentCell.RowNumber, 12)
End If
End If
Catch ex As Exception
MsgBox("数据库中还没有录入数据")
Exit Sub
End Try
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Try
If eee <> 1 Then
MsgBox("没有借书者")
Exit Sub
End If
Dim tianshu As Int64
Dim tianshucomm As New OleDbCommand("select * from 用户 where 图书证号='" & TextBox1.Text & "'", myconn)
Dim tianshudda As OleDbDataAdapter = New OleDbDataAdapter(tianshucomm)
Dim tianshuddsa As DataSet = New DataSet
tianshuddsa.Clear()
tianshudda.Fill(tianshuddsa)
tianshu = tianshuddsa.Tables(0).Rows(0)("可借天数")
Dim t As Date
Dim tt As Date = Now
t = DateAdd(DateInterval.Day, tianshu, tt)
Dim sqlstr As String
If RadioButton1.Checked Then
sqlstr = "update 中外文现刊表 set 图书证号='" & TextBox1.Text & "',借阅日期='" & Now & "',应归还日期='" & t & "' where ID like '" & shuzi & "'"
Else
sqlstr = "update 过刊图书表 set 图书证号='" & TextBox1.Text & "',借阅日期='" & Now & "',应归还日期='" & t & "' where 财产号 ='" & shuzi & "'"
End If
myconn.Open()
cmd4.Connection = myconn
cmd4.CommandText() = sqlstr
cmd4.ExecuteScalar()
myconn.Close()
tushu2()
tushu1()
Catch ex As Exception
End Try
End Sub
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
i += 1
End Sub
Private Sub DataGrid2_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid2.CurrentCellChanged
Try
gh = DataGrid2.Item(DataGrid2.CurrentCell.RowNumber, 0)
datt = DataGrid2.Item(DataGrid2.CurrentCell.RowNumber, 12)
Catch ex As Exception
MsgBox("你还没借书")
Exit Sub
End Try
End Sub
Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged
Try
gh = DataGrid1.Item(DataGrid1.CurrentCell.RowNumber, 0)
datt = DataGrid1.Item(DataGrid1.CurrentCell.RowNumber, 7)
Catch ex As Exception
MsgBox("你还没借书")
Exit Sub
End Try
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Try
If myconn.State <> ConnectionState.Open Then
myconn.Open()
End If
Dim sqlstr1 As String
Dim t As Integer
t = InputBox("续借天数:")
Dim dat As Date
dat = DateAdd(DateInterval.Day, t, datt)
If i Mod 2 = 0 Then
sqlstr1 = "update 过刊图书表 set 应归还日期='" & dat & "' where 财产号 ='" & gh & "'"
Else
sqlstr1 = "update 中外文现刊表 set 应归还日期='" & dat & "' where ID like '" & gh & "'"
End If
cmd4 = New OleDbCommand
cmd4.Connection = myconn
cmd4.CommandText() = sqlstr1
cmd4.ExecuteScalar()
myconn.Close()
tushu1()
Catch ex As Exception
End Try
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Try
If myconn.State <> ConnectionState.Open Then
myconn.Open()
End If
Dim sqlstr As String
Dim t As Integer
Try
t = InputBox("续借天数:")
Catch ex As Exception
MsgBox("不能为空")
End Try
Dim dat As Date
dat = DateAdd(DateInterval.Day, t, datt3)
If RadioButton1.Checked Then
sqlstr = "update 中外文现刊表 set 应归还日期='" & dat & "' where ID like '" & shuzi & "'"
Else
sqlstr = "update 过刊图书表 set 应归还日期='" & dat & "' where 财产号 ='" & shuzi & "'"
End If
cmd4 = New OleDbCommand
cmd4.Connection = myconn
cmd4.CommandText() = sqlstr
cmd4.ExecuteScalar()
myconn.Close()
tushu2()
Catch ex As Exception
End Try
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Try
If myconn.State <> ConnectionState.Open Then
myconn.Open()
End If
Dim response As MsgBoxResult
Dim sqlstr1 As String
If i Mod 2 = 0 Then
If DataGrid2.Item(DataGrid2.CurrentCell.RowNumber, 15) = "No" Then
response = MsgBox("是否真的要挂失", MsgBoxStyle.YesNo)
Select Case response
Case MsgBoxResult.Yes
sqlstr1 = "update 过刊图书表 set 挂失=""Yes"" where 财产号 ='" & gh & "'"
Case MsgBoxResult.No
Exit Sub
End Select
Else
response = MsgBox("是否真要解除挂失", MsgBoxStyle.YesNo)
Select Case response
Case MsgBoxResult.Yes
sqlstr1 = "update 过刊图书表 set 挂失=""No"" where 财产号 ='" & gh & "'"
Case MsgBoxResult.No
Exit Sub
End Select
End If
Else
If DataGrid1.Item(DataGrid1.CurrentCell.RowNumber, 9) = "No" Then
response = MsgBox("是否真的要挂失", MsgBoxStyle.YesNo)
Select Case response
Case MsgBoxResult.Yes
sqlstr1 = "update 中外文现刊表 set 挂失=""Yes"" where ID like '" & gh & "'"
Case MsgBoxResult.No
Exit Sub
End Select
Else
response = MsgBox("是否真要解除挂失", MsgBoxStyle.YesNo)
Select Case response
Case MsgBoxResult.Yes
sqlstr1 = "update 中外文现刊表 set 挂失=""No"" where ID like '" & gh & "'"
Case MsgBoxResult.No
Exit Sub
End Select
End If
End If
cmd4 = New OleDbCommand
cmd4.Connection = myconn
cmd4.CommandText() = sqlstr1
cmd4.ExecuteScalar()
myconn.Close()
tushu1()
Catch ex As Exception
End Try
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Try
If myconn.State <> ConnectionState.Open Then
myconn.Open()
End If
Dim response As MsgBoxResult
Dim sqlstr1 As String
If RadioButton2.Checked Then
If DataGrid3.Item(DataGrid3.CurrentCell.RowNumber, 15) = "No" Then
response = MsgBox("是否真的要挂失", MsgBoxStyle.YesNo)
Select Case response
Case MsgBoxResult.Yes
sqlstr1 = "update 过刊图书表 set 挂失=""Yes"" where 财产号 ='" & shuzi & "'"
Case MsgBoxResult.No
Exit Sub
End Select
Else
response = MsgBox("是否真要解除挂失", MsgBoxStyle.YesNo)
Select Case response
Case MsgBoxResult.Yes
sqlstr1 = "update 过刊图书表 set 挂失=""No"" where 财产号 ='" & shuzi & "'"
Case MsgBoxResult.No
Exit Sub
End Select
End If
Else
If DataGrid3.Item(DataGrid3.CurrentCell.RowNumber, 9) = "No" Then
response = MsgBox("是否真的要挂失", MsgBoxStyle.YesNo)
Select Case response
Case MsgBoxResult.Yes
sqlstr1 = "update 中外文现刊表 set 挂失=""Yes"" where ID like '" & shuzi & "'"
Case MsgBoxResult.No
Exit Sub
End Select
Else
response = MsgBox("是否真要解除挂失", MsgBoxStyle.YesNo)
Select Case response
Case MsgBoxResult.Yes
sqlstr1 = "update 中外文现刊表 set 挂失=""No"" where ID like '" & shuzi & "'"
Case MsgBoxResult.No
Exit Sub
End Select
End If
End If
cmd4 = New OleDbCommand
cmd4.Connection = myconn
cmd4.CommandText() = sqlstr1
cmd4.ExecuteScalar()
myconn.Close()
tushu2()
Catch ex As Exception
End Try
End Sub
Private Sub MenuItem7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem7.Click
Dim form As New 流通查询
form.ShowDialog()
End Sub
Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
Me.Close()
End Sub
Private Sub MenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem6.Click
Process.Start(Application.StartupPath & ("\5.txt"))
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim tn As Date = Now
Dim tian As Int64
Dim yinggtianshu As Date
Dim jin As Double
Dim jincomm As New OleDbCommand("select * from 字典表4", myconn)
Dim jinada As New OleDbDataAdapter(jincomm)
Dim jinset As New DataSet
Try
jinset.Clear()
jinada.Fill(jinset)
jin = jinset.Tables(0).Rows(0)(0)
If myconn.State <> ConnectionState.Open Then
myconn.Open()
End If
Dim sqlstr1 As String
If i Mod 2 = 0 Then
Dim yingcomm As New OleDbCommand("select * from 过刊图书表 where 财产号 ='" & gh & "'", myconn)
Dim yingada As New OleDbDataAdapter(yingcomm)
Dim yingset As New DataSet
yingset.Clear()
yingada.Fill(yingset)
tian = yingset.Tables(0).Rows(0)("应归还日期").ToString
sqlstr1 = "update 过刊图书表 set 图书证号="" "",借阅日期=""1000-01-01"",应归还日期=""1000-01-01"" where 财产号 ='" & gh & "'"
Else
Dim yingcomm As New OleDbCommand("select * from 中外文现刊表 where ID like '" & gh & "'", myconn)
Dim yingada As New OleDbDataAdapter(yingcomm)
Dim yingset As New DataSet
yingset.Clear()
yingada.Fill(yingset)
yinggtianshu = yingset.Tables(0).Rows(0)("应归还日期").ToString
sqlstr1 = "update 中外文现刊表 set 图书证号="" "",借阅日期=""1000-01-01"",应归还日期=""1000-01-01"" where ID like '" & gh & "'"
End If
tian = DateDiff(DateInterval.DayOfYear, Now, yinggtianshu)
If tian < 0 Then
MsgBox("要罚款" & tian * jin & "元")
End If
cmd4 = New OleDbCommand
cmd4.Connection = myconn
cmd4.CommandText() = sqlstr1
cmd4.ExecuteScalar()
myconn.Close()
tushu1()
Catch ex As Exception
End Try
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
Try
tushu3()
Button3.Enabled = True
Button7.Enabled = True
Button8.Enabled = True
Catch ex As Exception
End Try
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -