Imports System.Data.SqlClient

Partial Class BuyersTopBannerInside
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            Try
                lblBuyerName.Text = Session("Byrusername").ToString
            Catch ex As Exception

            End Try

        End If
    End Sub

    Protected Sub btnlogout_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnlogout.Click
        Try
            Dim con1 As New SqlConnection
            con1.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("ConnectionString")
            con1.Open()

            InsertAdminUserLog(Session("LogKid"), Session("LogName"), Request.UserHostAddress, 1, "Buyer", "BuyerLogin", "Update")

            Dim str As String = "delete  FROM ShopCart where ShopCart_BuyerUserId ='" & Session("BuyId") & "'"
            Dim da As New SqlDataAdapter
            Dim cmd As New SqlCommand(str, con1)
            cmd.ExecuteNonQuery()
            Session.Abandon()
            Session.RemoveAll()
            con1.Close()
            cmd.Dispose()
            da.Dispose()
            con1.Dispose()
            Response.Redirect(Page.ResolveUrl("buyer-home.aspx"))
        Catch ex As Exception
            Response.Write(ex.Message.ToString & "<br/>Please Login Again.")
        End Try
    End Sub
End Class
