Imports Microsoft.VisualBasic
Imports System.Web
Imports System.Web.Security


Public Class UserPI
    Private _userId As Guid
    Private _userName As String
    Private _storeId As Integer
    Private _storeName As String
    Private _fname As String
    Private _lname As String
    Private _flname As String
    Private _address As String
    Private _address1 As String
    Private _city As String
    Private _state As String
    Private _zip As String
    Private _country As String
    Private _phone As String
    Private _phoneExt As String
    Private _fax As String
    Private _email As String
    Private _userRole As String

    Private _webWS As New WebWS

    Public ReadOnly Property UserId() As Guid
        Get
            Return _userId
        End Get
    End Property

    Public ReadOnly Property StoreId() As String
        Get
            Return _storeId
        End Get
    End Property

    Public ReadOnly Property UserName() As String
        Get
            Return _userName
        End Get
    End Property

    Public Property FName() As String
        Get
            Return _fname
        End Get
        Set(ByVal value As String)
            _fname = value
        End Set
    End Property

    Public Property LName() As String
        Get
            Return _lname
        End Get
        Set(ByVal value As String)
            _lname = value
        End Set
    End Property

    Public ReadOnly Property FullName() As String
        Get
            Return _fname & " " & _lname
        End Get
    End Property

    Public Property StoreName() As String
        Get
            Return _storeName
        End Get
        Set(ByVal value As String)
            _storeName = value
        End Set
    End Property

    Public Property Address() As String
        Get
            Return _address
        End Get
        Set(ByVal value As String)
            _address = value
        End Set
    End Property

    Public Property Address1() As String
        Get
            Return _address1
        End Get
        Set(ByVal value As String)
            _address1 = value
        End Set
    End Property

    Public Property City() As String
        Get
            Return _city
        End Get
        Set(ByVal value As String)
            _city = value
        End Set
    End Property

    Public Property State() As String
        Get
            Return _state
        End Get
        Set(ByVal value As String)
            _state = value
        End Set
    End Property

    Public Property Country() As String
        Get
            Return _country
        End Get
        Set(ByVal value As String)
            _country = value
        End Set
    End Property

    Public Property Zip() As String
        Get
            Return _zip
        End Get
        Set(ByVal value As String)
            _zip = value
        End Set
    End Property

    Public Property Phone() As String
        Get
            Return _phone
        End Get
        Set(ByVal value As String)
            _phone = value
        End Set
    End Property

    Public Property PhoneExt() As String
        Get
            Return _phoneExt
        End Get
        Set(ByVal value As String)
            _phoneExt = value
        End Set
    End Property

    Public Property Fax() As String
        Get
            Return _fax
        End Get
        Set(ByVal value As String)
            _fax = value
        End Set
    End Property

    Public Property Email() As String
        Get
            Return _email
        End Get
        Set(ByVal value As String)
            _email = value
        End Set
    End Property

    Public Property UserRole() As String
        Get
            Return _userRole
        End Get
        Set(ByVal value As String)
            _userRole = value
        End Set
    End Property


    Public Sub New(ByVal storeId As Integer)

        Dim _user As MembershipUser = Membership.GetUser()
        _userId = _user.ProviderUserKey
        _userName = _user.UserName
        _email = _user.Email
        _userRole = Roles.Provider.GetRolesForUser(_userName)(0).ToString()

     End Sub

    Public Sub New()

        Dim _user As MembershipUser = Membership.GetUser()
        _userId = _user.ProviderUserKey
        _userName = _user.UserName
        _email = _user.Email
        _userRole = Roles.Provider.GetRolesForUser(_userName)(0).ToString()

        'Dim _profile As New ProfileCommon

        'Try
        '    _storeId = _profile.StoreId
        'Catch ex As Exception
        '    _storeId = 0
        'End Try
        'Try
        '    _storeName = _profile.Item("StoreName")
        'Catch ex As Exception
        '    _storeName = ""
        'End Try
        'Try
        '    _fname = _profile.Item("FName")
        'Catch ex As Exception
        '    _fname = ""
        'End Try
        'Try
        '    _lname = _profile.Item("LName")
        'Catch ex As Exception
        '    _lname = ""
        'End Try
        'Try
        '    _flname = _fname & " " & _lname
        'Catch ex As Exception
        '    _flname = ""
        'End Try
        'Try
        '    _address = _profile.Item("Address")
        'Catch ex As Exception
        '    _address = ""
        'End Try
        'Try
        '    _address1 = _profile.Item("Address1")
        'Catch ex As Exception
        '    _address1 = ""
        'End Try
        'Try
        '    _city = _profile.Item("City")
        'Catch ex As Exception
        '    _city = ""
        'End Try
        'Try
        '    _state = _profile.Item("State")
        'Catch ex As Exception
        '    _state = ""
        'End Try
        'Try
        '    _zip = _profile.Item("Zip")
        'Catch ex As Exception
        '    _zip = ""
        'End Try
        'Try
        '    _country = _profile.Item("Country")
        'Catch ex As Exception
        '    _country = ""
        'End Try
        'Try
        '    _phone = _profile.Item("Phone")
        'Catch ex As Exception
        '    _phone = ""
        'End Try
        'Try
        '    _phoneExt = _profile.Item("PhoneExt")
        'Catch ex As Exception
        '    _phoneExt = ""
        'End Try
        'Try
        '    _fax = _profile.Item("Fax")
        'Catch ex As Exception
        '    _fax = ""
        'End Try

    End Sub



    'Public Sub New(ByVal guid As Guid)

    '    Dim _user As MembershipUser = Membership.GetUser(guid)
    '    _userId = guid
    '    _userName = _user.UserName
    '    _email = _user.Email
    '    _userRole = Roles.Provider.GetRolesForUser(_userName)(0).ToString()

    '    Dim _profile As New ProfileCommon
    '    Try
    '        _storeId = _profile.StoreId
    '    Catch ex As Exception
    '        _storeId = ""
    '    End Try
    '    Try
    '        _storeName = _profile.StoreName
    '    Catch ex As Exception
    '        _storeName = ""
    '    End Try
    '    Try
    '        _fname = _profile.FName
    '    Catch ex As Exception
    '        _fname = ""
    '    End Try
    '    Try
    '        _lname = _profile.LName
    '    Catch ex As Exception
    '        _lname = ""
    '    End Try
    '    Try
    '        _flname = _fname & " " & _lname
    '    Catch ex As Exception
    '        _flname = ""
    '    End Try
    '    Try
    '        _address = _profile.Address
    '    Catch ex As Exception
    '        _address = ""
    '    End Try
    '    Try
    '        _address1 = _profile.Address1
    '    Catch ex As Exception
    '        _address1 = ""
    '    End Try
    '    Try
    '        _city = _profile.City
    '    Catch ex As Exception
    '        _city = ""
    '    End Try
    '    Try
    '        _state = _profile.State
    '    Catch ex As Exception
    '        _state = ""
    '    End Try
    '    Try
    '        _zip = _profile.Zip
    '    Catch ex As Exception
    '        _zip = ""
    '    End Try
    '    Try
    '        _country = _profile.Country
    '    Catch ex As Exception
    '        _country = ""
    '    End Try
    '    Try
    '        _phone = _profile.Phone
    '    Catch ex As Exception
    '        _phone = ""
    '    End Try
    '    Try
    '        _phoneExt = _profile.PhoneExt
    '    Catch ex As Exception
    '        _phoneExt = ""
    '    End Try
    '    Try
    '        _fax = _profile.Fax
    '    Catch ex As Exception
    '        _fax = ""
    '    End Try
    'End Sub

End Class
