PageRenderTime 397ms CodeModel.GetById 81ms app.highlight 163ms RepoModel.GetById 50ms app.codeStats 13ms

/e_desk/user_menu.aspx.vb

http://github.com/shafiqissani/eDesk-Systems
Visual Basic | 95 lines | 72 code | 18 blank | 5 comment | 0 complexity | fce24d915b9f029b3d1cba2d8e256756 MD5 | raw file
 1Imports System.Data
 2Imports System.Data.SqlClient
 3
 4
 5Namespace e_desk
 6
 7Partial Class user_menu
 8    Inherits System.Web.UI.Page
 9
10#Region " Web Form Designer Generated Code "
11
12    'This call is required by the Web Form Designer.
13    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
14
15    End Sub
16
17
18    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
19        'CODEGEN: This method call is required by the Web Form Designer
20        'Do not modify it using the code editor.
21        InitializeComponent()
22    End Sub
23
24#End Region
25
26    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
27        'Put user code to initialize the page here
28        Dim con As SqlConnection = New SqlConnection("Server=(local);uid=sa;database=eDesk")
29        con.Open()
30        If Not IsPostBack Then
31            Dim str As String
32            str = "select categorycode from hdcategories"
33            Dim cmd1 As SqlCommand = New SqlCommand(str, con)
34            Dim dr As SqlDataReader
35            dr = cmd1.ExecuteReader()
36            t5.DataSource = dr
37            t5.DataBind()
38            con.Close()
39        End If
40    End Sub
41
42    Private Sub t5_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t5.SelectedIndexChanged
43        Dim con As SqlConnection = New SqlConnection("Server=(local);uid=sa;database=eDesk")
44        con.Open()
45        Dim str, s As String
46        s = t5.SelectedItem.Value
47        str = "select modulecode from hdmodules where categorycode='" + s + "' and status='Enabled'"
48        Dim cmd1 As SqlCommand = New SqlCommand(str, con)
49        Dim dr As SqlDataReader
50        dr = cmd1.ExecuteReader()
51        mt5.DataSource = dr
52        mt5.DataBind()
53        con.Close()
54    End Sub
55
56    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
57        Dim s1, s2, s3, s4, str As String
58        s1 = t1.Text
59        s2 = t2.Text
60        s3 = t5.SelectedItem.Value
61        s4 = mt5.SelectedItem.Value
62
63
64        Dim con As SqlConnection = New SqlConnection("Server=(local);uid=sa;database=eDesk")
65        'con.Open()
66
67        Dim cmd As SqlCommand
68        str = "select max(problemid) from problems_master"
69        cmd = New SqlCommand(str, con)
70        Dim pi As Integer
71        Dim dr As SqlDataReader
72        con.Open()
73        dr = cmd.ExecuteReader
74        If dr.Read Then
75            pi = dr.GetInt32(0)
76        End If
77        con.Close()
78
79        str = "insert into problems_master(problemid,categorycode,modulecode,sub,problem,userid,status) values(" & pi + 1 & ",'" + s3 + "','" + s4 + "','" + s1 + "','" + s2 + "','" + Session("username") + "','Open')"
80        cmd = New SqlCommand(str, con)
81        con.Open()
82        cmd.ExecuteNonQuery()
83        Response.Write("Problem post sucessfully")
84        p1.Visible = False
85        con.Close()
86    End Sub
87
88    Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
89        p1.Visible = True
90        t1.Text = ""
91        t2.Text = ""
92    End Sub
93End Class
94
95End Namespace