-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin2.aspx.vb
179 lines (149 loc) · 7.34 KB
/
admin2.aspx.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
Imports System.Configuration
Imports System.Data.OleDb
Partial Class _Default
Inherits System.Web.UI.Page
'Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
' 'Dim i As Integer
' ' Dim con As New OleDbConnection
' ' ' con.ConnectionString = ConfigurationManager.AppSettings("con")
' ' con.Open()
' ' Dim ds As New Data.DataSet
' ' Dim dp As New OleDbDataAdapter("SELECT q FROM n ", con)
' ' dp.Fill(ds, "n")
' ' Dim s As New OleDbCommand
' ' s.Connection = con
' 's.CommandType = Data.CommandType.Text
' ' s.CommandText = "insert into n (w,q) values (" & Me.TextBox2.Text & ",'" & Me.TextBox1.Text & "')"
' 'con.Open()
' ' s.ExecuteNonQuery()
' ' con.Close()
' ' Response.Redirect("Default.aspx")
' ' For i = 0 To ds.Tables("n").Rows.Count = 0
' ' 'Response.Write(Me.TextBox1.Text = ds.Tables("n").Rows(i).Item(0))
' ' 'Response.Write(Me.TextBox2.Text = ds.Tables("n").Rows(i).Item(1))
' ' drpcartype.Items.Add(ds.Tables("n").Rows(i).Item(0))
' ' Next
' 'End If
'End Sub
'Protected Sub drpcartype_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles drpcartype.SelectedIndexChanged
' 'Me.drpcartype.Items.Clear()
' ' Dim i As Integer
' ' Dim con As New OleDbConnection
' 'con.ConnectionString = ConfigurationManager.AppSettings("con")
' 'con.Open()
' 'Dim ds As New Data.DataSet
' 'Dim dp As New OleDbDataAdapter("SELECT * FROM n where w =" & Me.drpcartype.Text & " ", con)
' 'dp.Fill(ds, "n")
' 'Me.GridView1.DataSource = ds
' 'Me.GridView1.DataMember = "n"
'End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Public Sub clrear()
txtsupid.Text = ""
txttele.Text = ""
TextBox1.Text = ""
TextBox2.Text = ""
txtsup.Text = ""
txttele.Text = ""
txtmailo.Text = ""
txtothersup.Text = ""
End Sub
Protected Sub Menu3_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles Menu3.MenuItemClick
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Label1.Visible = True
If Me.txtsup.Text = "" Or Me.txtsupid.Text = "" Then
Me.Label1.Text = "íÌÈ Úáíß ÇÏÎÇá ÇáÈíÇäÇÊ ÇáÖÑæÑíÉ"
Else
Dim con As New OleDbConnection
con.ConnectionString = ConfigurationManager.AppSettings("con")
con.Open()
Dim ds As New Data.DataSet
Dim dp As New OleDbDataAdapter("SELECT * FROM Supervisors ", con)
dp.Fill(ds, "Supervisors")
Dim s As New OleDbCommand
s.Connection = con
s.CommandText = "insert into Supervisors ( super_name,super_id, super_cntry, super_city, super_tel, super_mob, super_email, super_other)values('" & Me.txtsup.Text & "'," & Me.txtsupid.Text & ",'" & Me.TextBox1.Text & "','" & Me.TextBox2.Text & "','" & Me.txttele.Text & "','" & Me.txtmobile.Text & "','" & Me.txtmailo.Text & "','" & Me.txtothersup.Text & "')"
s.ExecuteNonQuery()
con.Close()
Me.Label1.Text = "Êã ÇáÍÝÙ ÈäÌÇÍ"
clrear()
End If
End Sub
Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click
Me.Label1.Visible = True
If Me.txtsup.Text = "" Then
Me.Label1.Text = "íÌÈ Úáíß ÇÏÎÇá ÇÓã ÇáãÔÑÝ ÇáãÑÇÏ ÍÐÝ ÈíÇäÇÊå"
Else
Dim con As New OleDbConnection
Dim ds As New Data.DataSet
con.ConnectionString = ConfigurationManager.AppSettings("con")
con.Open()
Dim sql As String = "select * from Supervisors"
Dim da As New OleDbDataAdapter(sql, con)
da.Fill(ds, "Supervisors")
Dim aa As New OleDbCommand
aa.Connection = con
aa.CommandText = "delete from Supervisors where super_name='" & Me.txtsup.Text & "'"
'con.Open()
aa.ExecuteNonQuery()
Me.Label1.Text = "Êã ÇáÍÐÝ ÈäÌÇÍ"
con.Close()
clrear()
End If
End Sub
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Label1.Visible = True
If Me.txtsup.Text = "" Then
Me.Label1.Text = "íÌÈ Úáíß ÇÏÎÇá ÇÓã ÇáãÔÑÝ ÇáãÑÇÏ ÇáÊÚÏíá Úáì ÈíÇäÇÊå"
Else
Dim cona As New OleDbConnection
cona.ConnectionString = ConfigurationManager.AppSettings("con")
cona.Open()
Dim sql As String = "select * from Supervisors"
Dim dp As New OleDbDataAdapter
Dim ds As New Data.DataSet
dp = New OleDbDataAdapter(sql, cona)
dp.Fill(ds, "Supervisors")
Dim savrr As New OleDbCommand
savrr.Connection = cona
savrr.CommandText = "UPDATE Supervisors SET super_id= " & Me.txtsupid.Text & ", super_cntry= '" & Me.TextBox1.Text & "', super_city= '" & Me.TextBox2.Text & "', super_tel= '" & Me.txttele.Text & "', super_mob= '" & Me.txtmobile.Text & "', super_email= '" & Me.txtmailo.Text & "', super_other= '" & Me.txtothersup.Text & "' where super_name='" & Me.txtsup.Text & "'"
savrr.ExecuteNonQuery()
Me.Label1.Text = "Êã ÇáÊÚÏíá ÈäÌÇÍ"
cona.Close()
clrear()
End If
End Sub
Protected Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click
Me.Label1.Visible = True
If Me.txtsup.Text = "" Then
Me.Label1.Text = "íÌÈ Úáíß ÇÏÎÇá ÇÓã ÇáãÔÑÝ ÇáãÑÇÏ ÇÖåÇÑ ÈíÇäÇÊå"
Else
Dim cona As New OleDbConnection
cona.ConnectionString = ConfigurationManager.AppSettings("con")
cona.Open()
Dim sql As String = "select * from Supervisors where super_name='" & Me.txtsup.Text & "' "
Dim dp As New OleDbDataAdapter
Dim ds As New Data.DataSet
dp = New OleDbDataAdapter(sql, cona)
dp.Fill(ds, "Supervisors")
Dim i As Integer
For i = 0 To ds.Tables("Supervisors").Rows.Count - 1
Next
If i > 0 Then
For i = 0 To ds.Tables("Supervisors").Rows.Count - 1
Me.txtsupid.Text = ds.Tables("Supervisors").Rows(i).Item(1)
Me.TextBox1.Text = ds.Tables("Supervisors").Rows(i).Item(2)
Me.TextBox2.Text = ds.Tables("Supervisors").Rows(i).Item(3)
Me.txtmobile.Text = ds.Tables("Supervisors").Rows(i).Item(5)
Me.txttele.Text = ds.Tables("Supervisors").Rows(i).Item(4)
Me.txtmailo.Text = ds.Tables("Supervisors").Rows(i).Item(6)
Me.txtothersup.Text = ds.Tables("Supervisors").Rows(i).Item(7)
Next
Else
Me.Label1.Text = "áÇ íæÌÏ ãÔÑÝ ÈåÐÇ ÇáÇÓã"
End If
End If
End Sub
End Class