-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlabtop.aspx.vb
109 lines (91 loc) · 4.59 KB
/
labtop.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
Imports System.Configuration
Imports System.Data.OleDb
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("usr_name") = Nothing Then
Response.Redirect("default.aspx")
Else
End If
End Sub
Protected Sub Menu3_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles Menu3.MenuItemClick
End Sub
Public Sub clear()
Texttype.Text = ""
txtmodel.Text = ""
TextBox1.Text = ""
TextBox2.Text = ""
txtprss.Text = ""
txtscrn.Text = ""
txtcost.Text = ""
txtdother.Text = ""
End Sub
Protected Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click
Me.Label1.Visible = True
If Me.txtmodel.Text = "" Or Me.Texttype.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 laptob.lap_no, laptob.lap_type, laptob.lap_modul, laptob.lap_hdd, laptob.lap_ram, laptob.lap_cpu, laptob.lap_lcd, laptob.lap_cost, laptob.lap_other, laptob.cmp_no FROM company INNER JOIN laptob ON company.cmp_no = laptob.cmp_no", con)
' íÊã ÊÚÈÆÉ ÇáÏÇÊÇ ÓíÊ ÈÇáÌÏæá
dp.Fill(ds, "laptob")
Dim s As New OleDbCommand
s.Connection = con
s.CommandText = "insert into laptob ( lap_modul, lap_type, lap_hdd, lap_ram, lap_cpu, lap_lcd, lap_cost, lap_other, cmp_no ) values ('" & Me.txtmodel.Text & "','" & Me.Texttype.Text & "','" & Me.TextBox1.Text & "','" & Me.TextBox2.Text & "','" & Me.txtprss.Text & "','" & Me.txtscrn.Text & "','" & Me.txtcost.Text & "','" & Me.txtdother.Text & "'," & Session("usr_name") & ")"
'íÊã ÊäÝíÐ ÌãáÉ ÇáÇÓ ßíæ Çá
s.ExecuteNonQuery()
con.Close()
Me.Label1.Text = "Êã ÇáÍÝÙ ÈäÌÇÍ"
clear()
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.txtmodel.Text = "" Or Me.Texttype.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 laptob"
Dim da As New OleDbDataAdapter(sql, con)
da.Fill(ds, "laptob")
Dim aa As New OleDbCommand
aa.Connection = con
aa.CommandText = "delete from laptob where lap_modul='" & Me.txtmodel.Text & "' and cmp_no=" & Session("usr_name") & ""
'con.Open()
aa.ExecuteNonQuery()
MsgBox("Êã ÇáÍÐÝ ÈäÌÇÍ", MsgBoxStyle.Information)
con.Close()
Me.Label1.Text = "Êã ÇáÍÐÝ ÈäÌÇÍ"
clear()
End If
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Label1.Visible = True
If Me.txtmodel.Text = "" Then
Me.Label1.Text = "íÌÈ ÇÏÎÇá ãæÏíá ÇáÌåÇÒÇáãÑÇÏ ÊÚÏíáå"
Else
Dim cona As New OleDbConnection
cona.ConnectionString = ConfigurationManager.AppSettings("con")
cona.Open()
Dim sql As String = "select * from laptob"
Dim dp As New OleDbDataAdapter
Dim ds As New Data.DataSet
dp = New OleDbDataAdapter(sql, cona)
dp.Fill(ds, "laptob")
Dim savrr As New OleDbCommand
savrr.Connection = cona
savrr.CommandText = "UPDATE laptob SET lap_type='" & Me.Texttype.Text & "',lap_modul='" & Me.txtmodel.Text & "',lap_hdd='" & Me.TextBox1.Text & "',lap_ram='" & Me.TextBox2.Text & "',lap_cpu='" & Me.txtprss.Text & "',lap_lcd='" & Me.txtscrn.Text & "',lap_cost='" & Me.txtcost.Text & "',lap_other='" & Me.txtdother.Text & "' where lap_modul ='" & Me.txtmodel.Text & "' and cmp_no=" & Session("usr_name") & ""
savrr.ExecuteNonQuery()
Me.Label1.Text = "Êã ÇáÊÚÏíá ÈäÌÇÍ"
cona.Close()
clear()
End If
End Sub
End Class