PageRenderTime 448ms CodeModel.GetById 162ms app.highlight 15ms RepoModel.GetById 139ms app.codeStats 3ms

/e_desk/index.aspx.vb

http://github.com/shafiqissani/eDesk-Systems
Visual Basic | 69 lines | 48 code | 17 blank | 4 comment | 0 complexity | cb419d984704487e3a9d0c7df29052c1 MD5 | raw file
 1Imports System.Data
 2Imports System.Data.SqlClient
 3
 4
 5Namespace e_desk
 6
 7Partial Class index
 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    End Sub
29
30    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
31        Dim con As SqlConnection = New SqlConnection("Server=(local);uid=sa;database=eDesk")
32        con.Open()
33        Dim s1, s2, s3, s4, s5, s6 As String
34        s1 = t1.Text
35        s2 = t2.Text
36
37        s3 = "select usertype from registration where userid = '" + s1 + "' and password = '" + s2 + "'"
38        Dim cmd As SqlCommand = New SqlCommand(s3, con)
39        Dim dr As SqlDataReader = cmd.ExecuteReader()
40        If dr.Read() Then
41            s4 = dr.GetValue(0)
42            Response.Write(s4)
43            Session.Add("username", s1)
44            If s4 = "hd user" Then
45                Response.Redirect("hduser_main_leftmenu.aspx")
46            ElseIf s4 = "super user" Then
47                Response.Redirect("admin_main_menu.aspx")
48            Else
49                Response.Redirect("user_menu.aspx")
50            End If
51        Else
52            Response.Write("user is not valid please register or go to forget Password")
53        End If
54
55
56        dr.Close()
57        con.Close()
58    End Sub
59
60    Private Sub LinkButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton2.Click
61        Response.Redirect("registeruser.aspx")
62    End Sub
63
64    Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
65        Response.Redirect("forgotpassword.aspx")
66    End Sub
67End Class
68
69End Namespace