Imports EDSL.Entities
Imports EDSL.DAL

Partial Public Class Breadcrumb
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim categoryID As New Integer
        Dim subCategoryID As New Integer
        Dim productID As New Integer

    End Sub
  
    Public Sub SetProductLinks(ByVal name As String, ByVal breadcrumbList As String)

        Dim categoryArr As Array
        Dim func As New miscFunctions
        categoryArr = Split(breadcrumbList, "|")
        Dim count As New Integer
        Dim categoryID As New Integer
        Dim subCategoryID As New Integer
        Dim countarry As New Integer
        countarry = categoryArr.GetLength(0)
        lnkPage.Text = ""
        For Each category In categoryArr
            Select Case count
                Case 0
                    ' Parent Category
                    Dim parentyArr As Array
                    parentyArr = Split(category, ",")
                    
                    If parentyArr(0) <> "" Then
                        categoryID = Convert.ToInt32(parentyArr(0))
                        lnkCategory.Text = parentyArr(1).ToString()
                        If categoryID > 1 Then
                            lnkCategory.NavigateUrl = "~/solutions/EDSL-" & parentyArr(1).ToString() & "-" & parentyArr(0).ToString()
                        Else
                            lnkCategory.NavigateUrl = "~/solutions/Solvitt-" & parentyArr(0).ToString()
                        End If

                        lnkCategory.Visible = True
                        'If countarry = 1 Then
                        '    lnkSubCategory.Visible = True
                        '    lnkSubCategory.Enabled = False
                        '    lnkSubCategory.Text = name

                        'End If
                        'lblSubCat.Visible = True
                    Else
                        lnkCategory.Text = name
                        lnkCategory.Visible = True
                        lnkCategory.Enabled = False

                    End If
                    'Case 1
                    '    ' sub category category
                    '    Dim subcategoryArr As Array
                    '    subcategoryArr = Split(category, ",")
                    '    subCategoryID = Convert.ToInt32(subcategoryArr(0).ToString().Trim())
                    '    lnkSubCategory.Text = subcategoryArr(1).ToString()
                    '    lnkSubCategory.Visible = True
                    '    lnkSubCategory.NavigateUrl = "~/solutions/l-" & categoryID & "-" & func.CleanUrlString(subcategoryArr(1).ToString()) & "-" & subcategoryArr(0).ToString()
                    '    If countarry = 2 Then
                    '        lnkPage.Visible = True
                    '        lnkPage.Enabled = False
                    '        lnkPage.Text = name
                    '    End If

                Case 1
                        'Product 
                        Dim productArr As Array
                        productArr = Split(category, ",")
                        LblProduct.Visible = True
                        'lnkSubCategory.Enabled = True
                        lnkProduct.Text = productArr(1).ToString()
                        lnkProduct.Visible = True
                        If countarry = 2 And name.ToLower() = "contact us" Then
                            lnkPage.Visible = True
                            lnkPage.Enabled = False
                            lnkPage.Text = name
                            lnkProduct.Enabled = True
                        Else
                            lnkProduct.Enabled = False
                        End If

                        lnkProduct.NavigateUrl += "~/products/" & productArr(1).ToString() & "-" & func.CleanUrlString(productArr(0).ToString()) & "-" & categoryID

            End Select
            count += 1
        Next

    End Sub



    Public Sub SetHyperLinkField(ByVal navigateString As String, ByVal navigateLabel As String, ByVal detailBread As String)
        lnkPage.NavigateUrl = navigateString
        lnkPage.Text = navigateLabel
        spnBreadDetails.InnerHtml = detailBread

    End Sub
End Class
