图5.11 客机信息管理界面
代码:
Dim sql1 As String
sql1 = "select * from 客机信息表"
Dim selectcommand1 As SqlCommand = New SqlCommand(sql1, myconnection)
Dim mycommand1 As New SqlDataAdapter(sql1, myconnection)
Dim reader1 As SqlDataReader
Dim ds1 As New DataSet
myconnection.Open()
reader1 = selectcommand1.ExecuteReader()
myconnection.Close()
mycommand1.Fill(ds1, "Literature")
DataGrid1.DataSource = ds1.Tables("Literature").DefaultView
DataGrid1.DataBind()
图5.12 客机信息增添界面
代码:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myconnection As SqlConnection
myconnection = New SqlConnection("server=(local);uid=sa;password=123;database=电子客票")
Dim sql As String
sql = "select * from 客机信息表 where 客机编号= '" & plannum.Text & "'"
Dim selectcommand As SqlCommand = New SqlCommand(sql, myconnection)
Dim reader As SqlDataReader
Dim temp As String
myconnection.Open()
reader = selectcommand.ExecuteReader()
temp = reader.Read()
myconnection.Close()
If LCase(temp) = "true" Then
Response.Write("<script languaage='javascript'>alert('此客机已存在!')</script>")
Else
Dim sql1 As String
sql1 = "insert into 客机信息表(客机编号,客机型号,购买日期,服役日期,经济舱座位数量,商务舱座位数量,头等舱座位数量) values ('" & plannum.Text.Trim & "','" & plankind.Text.Trim & "','" & buydate.Text.Trim & "','" & usedate.Text.Trim & "','" & jjc.Text.Trim & "','" & swc.Text.Trim & "','" & tdc.Text.Trim & "')"
Dim selectcommand1 As SqlCommand = New SqlCommand(sql1, myconnection)
myconnection.Open()
selectcommand1.ExecuteNonQuery()
myconnection.Close()
Response.Write("<script languaage='javascript'>alert('增添成功!')</script>")
plannum.Text = ""
plankind.Text = ""
buydate.Text = ""
usedate.Text = ""
jjc.Text = ""
swc.Text = ""
tdc.Text = ""
End If
myconnection.Close()
End Sub
图5.13 客机信息修改删除界面
图5.14 客机信息修改界面
代码:代码与用户信息管管理和修改相似,这里略去。
本功能有两个子功能,航线的增添、修改、删除和航线时刻的增添,用户通过这两个表搜索到航班信息。航班界面设计如图5.15 至 图5.20 所示。
图5.15 航线信息管理界面
代码:与客机信息管理相似这里略去。
图5.16航线信息增添界面设计
代码:与客机信息增添相似这里略去。
图5.17航线信息删除修改界面
图5.18 航线信息修改界面设计
代码:与客机信息修改和删除相似这里略去。
图5.19 航班信息管理界面设计
图5.20 航班增添界面设计
代码:与客机信息管理和客机信息增添相似这里略去。
本功能有管理员增添和修改密码,增添管理员只有系统管理员才能增添。其他管理员只能修改密码。管理员管理界面如图5.21 图5.22 所示。
图5.21 增添管理员
代码:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
If adminid.Text = "" Then
Response.Write("<script languaage='javascript'>alert('用户名不能为空,请认真填写!')</script>")
Else
Dim myconnection As SqlConnection
myconnection = New SqlConnection("server=(local);uid=sa;password=123;database=电子客票")
Dim sql As String
sql = "select 管理员名 from 管理员表 where 管理员名='" & adminid.Text & "'"
Dim selectcommand As SqlCommand = New SqlCommand(sql, myconnection)
Dim reader As SqlDataReader
Dim temp As String
myconnection.Open()
reader = selectcommand.ExecuteReader()
temp = reader.Read()
myconnection.Close()
If LCase(temp) = "true" Then
Response.Write("<script languaage='javascript'>alert('账号以存在!')</script>")
adminid.Text = ""
pwd1.Text = ""
pwd2.Text = ""
Else
If pwd1.Text = "" Then
Response.Write("<script languaage='javascript'>alert('请输入密码!')</script>")
Else
If pwd1.Text <> pwd2.Text Then
Response.Write("<script languaage='javascript'>alert('密码不正确!')</script>")
pwd1.Text = ""
pwd2.Text = ""
Else
Dim sql1 As String
sql1 = "insert into 管理员表(管理员名,权限,密码) values ('" & adminid.Text.Trim & "','" & DropDownList1.SelectedItem.Text.Trim & "','" & pwd1.Text.Trim & "')"
Dim selectcommand1 As SqlCommand = New SqlCommand(sql1, myconnection)
myconnection.Open()
selectcommand1.ExecuteNonQuery()
myconnection.Close()
Response.Write("<script languaage='javascript'>alert('注册成功!')</script>")
Session("用户名") = adminid.Text
Session("权限") = DropDownList1.SelectedItem.Text
Response.Redirect("管理主页.aspx")
End If
End If
End If
End If
End Sub
图5.22 修改密码
代码:与用户修改密码相似这里略去。
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>