Current Path : G:/PleskVhosts/mpcdp.in/cmamp.mpcdp.in/cdpp3/App_Code/BL/ |
Windows NT SG2NWVPWEB022 10.0 build 17763 (Windows Server 2016) i586 |
Current File : G:/PleskVhosts/mpcdp.in/cmamp.mpcdp.in/cdpp3/App_Code/BL/Members.vb |
Imports System.Data Imports System.Configuration Imports System.Web Imports System.Web.Security Imports System.Data.SqlClient Imports Microsoft.VisualBasic 'Public Class Members Public Class Members Inherits dalMembers ' ' TODO: Add constructor logic here ' Public Sub New() End Sub Public Shared Function SignIn(ByVal Email As String, ByVal Password As String, ByVal IsAdmin As Boolean) As Boolean Return SignIn(Email, Password, True, IsAdmin) End Function Public Shared Function SignIn(ByVal Email As String, ByVal Password As String, ByVal RememberMe As Boolean, ByVal IsAdmin As Boolean) As Boolean Dim Result As Boolean = False Dim command As New Command("Admin_SignIn", True) command.Parameters.AddWithValue("@Email", Email) command.Parameters.AddWithValue("@Password", Password) command.Parameters.Add("@AdminID", System.Data.SqlDbType.Int).Direction = System.Data.ParameterDirection.Output command.Parameters.Add("@Status", System.Data.SqlDbType.Int).Direction = System.Data.ParameterDirection.Output command.ExecuteNonQuery() If Not IsDBNull(command.Parameters("@AdminID").Value) Then Dim AdminID As Integer = CInt(command.Parameters("@AdminID").Value) Dim Status As Integer = CInt(command.Parameters("@Status").Value) If AdminID > 0 Then FormsAuthentication.SignOut() ' FormsAuthentication.SetAuthCookie(MemberID.ToString("x"), RememberMe); Dim AuthTicket As New FormsAuthenticationTicket(1, AdminID.ToString("x"), DateTime.Now, DateTime.Now.AddMonths(3), RememberMe, AdminID.ToString("x"), _ FormsAuthentication.FormsCookiePath) Dim AuthCookie As New HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(AuthTicket)) If RememberMe Then AuthCookie.Expires = DateTime.Now.AddMonths(3) End If HttpContext.Current.Response.Cookies.Add(AuthCookie) Dim cookieMember As New HttpCookie("admin") cookieMember("status") = Status.ToString() cookieMember("adminID") = AdminID.ToString() If RememberMe Then cookieMember.Expires = DateTime.Now.AddMonths(3) End If HttpContext.Current.Response.Cookies.Add(cookieMember) Result = True End If End If Return Result End Function End Class