开发者

DNN Dal+ - retrieve individual info class collection items (vb.NET)

I can't seem to find any answers that work. Here's the setup:

Info class:

Public Class Pro开发者_开发问答ductStageInfo

    Private _ProductNumber As String
    Private _ProductReference As String

    Public Sub New()
    End Sub

    Public Property ProductNumber() As String
        Get
            Return _ProductNumber
        End Get
        Set(ByVal Value As String)
            _ProductNumber = Value
        End Set
    End Property

    End Class

and so on; I have four class declarations in the info class, the one above has fifteen different items - product number, product reference, product name, and so forth. The other's are catalogue classifications, which 'stage' of production the product is in, quality assurance questions; etc.

Then in the Controller class for DNN, I have those various info classes filled via queries to the DB DNN was deployed on; example:

       Public Shared Function LoadStages(ByVal ProductNumber As String) As List(Of ProductStageInfo)
        Return CBO.FillCollection(Of ProductStageInfo)(CType(DataProvider.Instance().ExecuteReader("Product_LoadStages", ProductNumber), IDataReader))
    End Function

and everything works so far, I can fill a datalist using <%# DataBinder.Eval(Container.DataItem, "ProductNumber" %> and in code behind:

  Dim ProductStageList As List(Of ProductStageInfo)

            ProductStageList = ProductController.LoadStages(ProductNumber)

            ProductStageDataList.DataSource = ProductStageList
            ProductStageDataList.DataBind()

so far, so good...

but now I need to allow individuals to 'create' stages, and one of the business reqs' is that people shouldn't be able to create, for example, a delivery stage before a packaging stage.

So, how do I go about 'finding' a product number, product reference, stage number, within a collection? I thought I could fill the collection with all the stages of a certain product number, and then do an if/then stage = 0 found, stage > 5 found, etc.

If ProductStageList.Contains(strProductNumber) then

end if

gives error value of type string cannot be converted to namespace.ProductStageInfo; same thing for ProductStageList.Find...

maybe I just don't understand the whole collection/index/thing. All the examples I've found are regarding single dimension collections - 'how to find name within this collection', and the responses use strings to search through them, but somehow the Info class is being treated differently, and I'm not sure how to translate this...

any hints, tips, advice, tutorials.... appreciate it :)

thanks!


Pretty sure I just found the answer by reviewing another module; basically I need to create an empty object instead of a list object of the same class and use the two to iterate through using for/each, etc.

        Dim objStages As ProductStagesInfo
        Dim intStages, StageSelected As Integer
        Dim intStageOption As Integer = -1
        Dim blnValid As Boolean = True
        Dim ProductChosen As String = lblStagesCNHeader.Text
        Dim ProductStageList As List(Of ProductStagesInfo) = ProductController.LoadStages(ProductChosenNumber)

        For intStages = 0 To StageList.Count - 1
               objStages = StageList(intStages)
                 intStageOption += 1

                Select objStages.StageSetNumber
                      Case "0"

                Next

objStages._ provides me the ability to get the data I needed to do the business logic

<.<

seems so simple once you see it, wish I could just store it all in my brain

blah!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜