Need to expand products to include sizes and scents, but I could use some help with the classes

Last post 10-01-2009 10:33 PM by Mainship. 2 replies.

Sort Posts:

  • Need to expand products to include sizes and scents, but I could use some help with the classes

    10-01-2009, 6:36 PM
    • Member
      305 point Member
    • Mainship
    • Member since 01-03-2007, 11:54 AM
    • New York
    • Posts 1,475

    I need to expand the products to include sizes (each with it's own price) and scents.  I've added three new tables (all have addeddate and addedby as well):

    ProductSizes
         ProductSizeID - identity and PK
         ProductID - int and FK
         SizeCost - money
         SizeDiscountPercent - int
         SizeDescript - sring
         SizeSKL - String

    ProductScents
         ProductScentID - identity and PK
         ProductID - int and FK
         scentID - int and FK

    Scentss
         ScentID - identity and PK
         Scent - nvarchar(50)

    I created the relationships, and cascades.  But now I'm not sure what to do.  I have had very little experience with classes, n-tier development or doing things the right way, and I'm hoping to learn how from this project.  I do have the book, but I don't understand everything in it.  I could use some help.

    I need to add a way for the shopkeeper to add/edit the scents first.  I created App_Code\BLL\Store\ScentMethod.vb and App_Code\DAL\ScentMethodDetails.vb based on the respective shipping classes, removing prices and replacing title with scent, and adding the following if App_Code\DAL\StoreProvider.vb:

    ' methods that work with scent methods
            Public MustOverride Function GetScentMethods() As List(Of ScentMethodDetails)
            Public MustOverride Function GetScentMethodByID(ByVal scentMethodID As Integer) As ScentMethodDetails
            Public MustOverride Function DeleteScentMethod(ByVal scentMethodID As Integer) As Boolean
            Public MustOverride Function UpdateScentMethod(ByVal scentMethod As ScentMethodDetails) As Boolean
            Public MustOverride Function InsertScentMethod(ByVal scentMethod As ScentMethodDetails) As Integer

    I tried to build and got the following error: Error    6    Class 'SqlStoreProvider' must either be declared 'MustInherit' or override the following inherited 'MustOverride' member(s):
        MB.TheBeerHouse.DAL.StoreProvider : Public MustOverride Function GetScentMethods() As System.Collections.Generic.List(Of ScentMethodDetails)
        MB.TheBeerHouse.DAL.StoreProvider : Public MustOverride Function GetScentMethodByID(scentMethodID As Integer) As ScentMethodDetails
        MB.TheBeerHouse.DAL.StoreProvider : Public MustOverride Function DeleteScentMethod(scentMethodID As Integer) As Boolean
        MB.TheBeerHouse.DAL.StoreProvider : Public MustOverride Function UpdateScentMethod(scentMethod As ScentMethodDetails) As Boolean
        MB.TheBeerHouse.DAL.StoreProvider : Public MustOverride Function InsertScentMethod(scentMethod As ScentMethodDetails) As Integer.    H:\Documents and Settings\Diane\My Documents\Visual Studio 2008\WebSites\Stambrys\App_Code\DAL\SQLClient\SqlStoreProvider.vb    8    18    H:\...\Stambrys\

    What did I not do or do wrong?

  • Re: Need to expand products to include sizes and scents, but I could use some help with the classes

    10-01-2009, 7:33 PM
    • Member
      305 point Member
    • Mainship
    • Member since 01-03-2007, 11:54 AM
    • New York
    • Posts 1,475

    I figured out my problem an I have it working, but I have no idea what I did or why.  Can someone walk me through this?  How does this work?

  • Re: Need to expand products to include sizes and scents, but I could use some help with the classes

    10-01-2009, 10:33 PM
    • Member
      305 point Member
    • Mainship
    • Member since 01-03-2007, 11:54 AM
    • New York
    • Posts 1,475

    I'm getting an error while trying to insert a new scent:

    ObjectDataSource 'objCurrScent' could not find a non-generic method 'InsertScentMethod' that has parameters: scent, ID, AddedDate, AddedBy.

    What am I doing wrong?  I checked everything, but I can't find the problem.

Page 1 of 1 (3 items)