Imports System.Data
Imports System.Data.SqlClient
Partial Class BusinessAssociates_SSALogin
    Inherits System.Web.UI.Page

    Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
        Try

            Dim con As New SqlConnection()
            con.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("ConnectionString")
            Dim str As String = "SELECT * FROM SSA_Master WHERE SSA_EmailAddress='" & txtName.Text.Trim & "' And SSA_Password='" & txtpwd.Text.Trim & "' And SSA_Status='Approved' And SSA_IsDeleted='0'"
            If con.State = ConnectionState.Open Then
                con.Close()
            End If
            con.Open()
            Dim cmd As New SqlCommand(str, con)
            Dim dr As SqlDataReader
            dr = cmd.ExecuteReader()
            If dr.Read Then
                Session.Clear()
                Session("SSAID") = Nothing
                Session("SSAID") = dr.Item("SSA_KID").ToString

                Session("g_Company") = "00006Z4"
                Session("g_FinYear") = "000010N"
                lblError.Visible = False

                con.Close()
                con.Dispose()

                lblError.Visible = True


                Response.Redirect("SSA_Home.aspx?" & Session.SessionID)

            Else
                lblError.Visible = True
                lblError.Text = "Invalid UserName and Password !!"
            End If

        Catch ex As Exception
            'ex.Message.ToString()
        End Try
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Page.IsPostBack = False Then
            txtName.Focus()
            Session("AdminID") = Nothing
        End If
    End Sub
End Class
