PageRenderTime 20ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/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
  1. Imports System.Data
  2. Imports System.Data.SqlClient
  3. Namespace e_desk
  4. Partial Class index
  5. Inherits System.Web.UI.Page
  6. #Region " Web Form Designer Generated Code "
  7. 'This call is required by the Web Form Designer.
  8. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  9. End Sub
  10. Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
  11. 'CODEGEN: This method call is required by the Web Form Designer
  12. 'Do not modify it using the code editor.
  13. InitializeComponent()
  14. End Sub
  15. #End Region
  16. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  17. 'Put user code to initialize the page here
  18. End Sub
  19. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  20. Dim con As SqlConnection = New SqlConnection("Server=(local);uid=sa;database=eDesk")
  21. con.Open()
  22. Dim s1, s2, s3, s4, s5, s6 As String
  23. s1 = t1.Text
  24. s2 = t2.Text
  25. s3 = "select usertype from registration where userid = '" + s1 + "' and password = '" + s2 + "'"
  26. Dim cmd As SqlCommand = New SqlCommand(s3, con)
  27. Dim dr As SqlDataReader = cmd.ExecuteReader()
  28. If dr.Read() Then
  29. s4 = dr.GetValue(0)
  30. Response.Write(s4)
  31. Session.Add("username", s1)
  32. If s4 = "hd user" Then
  33. Response.Redirect("hduser_main_leftmenu.aspx")
  34. ElseIf s4 = "super user" Then
  35. Response.Redirect("admin_main_menu.aspx")
  36. Else
  37. Response.Redirect("user_menu.aspx")
  38. End If
  39. Else
  40. Response.Write("user is not valid please register or go to forget Password")
  41. End If
  42. dr.Close()
  43. con.Close()
  44. End Sub
  45. Private Sub LinkButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton2.Click
  46. Response.Redirect("registeruser.aspx")
  47. End Sub
  48. Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
  49. Response.Redirect("forgotpassword.aspx")
  50. End Sub
  51. End Class
  52. End Namespace