Imports System.Data
Imports System.Data.SqlClient
Partial Class ChangePassword
    Inherits System.Web.UI.Page
    Dim strQry As String
    Protected Sub BtnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnSave.Click
        If IsAlreadyPresent("select Count(BuyerRegister_AdminUserId) from BuyerRegister where BuyerRegister_AdminUserId='" & txtOldpassword.Text.Trim & "' and BuyerRegister_Kid='" & Session("BuyId").ToString().Trim & "' and BuyerRegister_IsDeleted='0'") = True Then
            If txtnewpassword.Text.Length > 5 Then
                ExecuteQuery("Update BuyerRegister set BuyerRegister_AdminUserId='" & txtnewpassword.Text.Trim & "' where BuyerRegister_AdminUserId='" & txtOldpassword.Text.Trim & "' and BuyerRegister_Kid='" & Session("BuyId").ToString().Trim & "' and BuyerRegister_IsDeleted='0'")
                lblMessage.Text = "Password is Successfully Changed !..."
                txtOldpassword.Text = ""
            Else
                lblMessage.Text = "New Password Must have 6 Character !..."
            End If

        Else
            lblMessage.Text = "Old Password is Wrong !..."
        End If
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Label1.Text = ReturnValue("select BuyerRegister_EmailId from BuyerRegister where  BuyerRegister_Kid='" & Session("BuyId").ToString().Trim & "'")
    End Sub
End Class
