Imports EDSL.DAL
Imports EDSL.Entities

Public Class BaseDropDownValues
    Inherits System.Web.UI.UserControl

#Region "Page Events"

#End Region

#Region "Protected Subs"
    Protected Sub BindTitleDropDownValues(ByVal userControl As UserControl)
        Dim dropDownListValues As New dbMainDropDownFunctions
        Dim ddlTitle As DropDownList = CType((userControl.FindControl("lstTitle")), DropDownList)
        Dim titleList As List(Of entMainDropDown) = dropDownListValues.GetDropDownValues(1)

        ddlTitle.Items.Add(New ListItem("Please Select..", ""))

        For Each title As entMainDropDown In titleList

            ddlTitle.Items.Add(New ListItem(title.TextDisplay, title.DropDownValue))

        Next
    End Sub
    Protected Sub BindBillingCountryDropDownValues(ByVal userControl As UserControl, ByVal listControl As String)

        Dim dropDownListValues As New dbMainDropDownFunctions
        Dim ddlCountries As DropDownList = CType((userControl.FindControl(listControl)), DropDownList)
        Dim countryList As List(Of entMainDropDown) = dropDownListValues.GetDropDownValues(2)

        ddlCountries.Items.Add(New ListItem("Please Select..", ""))

        For Each country As entMainDropDown In countryList

            ddlCountries.Items.Add(New ListItem(country.TextDisplay, country.DropDownValue))

        Next

    End Sub
    Protected Sub BindQuantityDropDownValues(ByVal control As WebControls.RepeaterItemEventArgs, ByVal listControl As String, ByVal quantityOrder As Integer, ByVal inStock As Integer)
        Dim dropDownListValues As New dbMainDropDownFunctions
        Dim ddlQuantity As DropDownList = CType(control.Item.FindControl("ddlCourseQuantity"), DropDownList)
        Dim quantityList As List(Of entMainDropDown) = dropDownListValues.GetDropDownValues(6)
        Dim i As New Integer


        For Each quantity As entMainDropDown In quantityList
            i = i + 1
            
            If quantity.DropDownValue = quantityOrder Then
                ddlQuantity.Items.Add(New ListItem(quantity.TextDisplay, quantity.DropDownValue))
                ddlQuantity.Items.FindByValue(quantityOrder).Selected = True
            Else
                ddlQuantity.Items.Add(New ListItem(quantity.TextDisplay, quantity.DropDownValue))
            End If
            If i = inStock Then
                Exit For
            End If
        Next
    End Sub

#End Region
End Class
