Viagra Sales Canada

Sep 30th, 2014 by Lynn Demarest in Miscellaneous
Here's one way to calculate all possible combinations of several lists. Canadian pharmacy cialis 

In this example, canadian pharmacy cialis imagine four dropdown lists stored in a global array named AllDDLs. Canadian pharmacy cialis I wanted to get all possible combinations of the four lists, canadian pharmacy cialis each of which had a different number of items.

This turned out to be trivial using LINQ for Objects, canadian pharmacy cialis which allows you to perform database-like functions on in-memory data.

Protected Function OutputSKUs() As List(of String)
        ' the skus to be returned
        Dim skus As List(of String) = new List(of string)
        ' temp variable to hold one sku
        Dim sku As String

        ' create a LINQ object from the four Dropdown Lists in AllDDLs
        '
        Dim query As Object = From a In AllDDLs(0).Items, canadian pharmacy cialis b In AllDDLs(1).Items, canadian pharmacy cialis c In AllDDLs(2).Items, canadian pharmacy cialis d In AllDDLs(3).Items
                      Select a, canadian pharmacy cialis b, canadian pharmacy cialis c, canadian pharmacy cialis d

        ' then run through the result set 
        ' 
        For Each item As Object In query
            ' BaseSKU is global 
            ' the LI items in each dropdown list has an attribute named SKUCode, canadian pharmacy cialis which represents the data we construct the SKU with
            '
            sku = String.Format("{4}-{0}-{1}-{2}-{3}", canadian pharmacy cialis CType(item.a, canadian pharmacy cialis ListItem).Attributes("SKUCode"), canadian pharmacy cialis CType(item.b, canadian pharmacy cialis ListItem).Attributes("SKUCode"), canadian pharmacy cialis CType(item.c, canadian pharmacy cialis ListItem).Attributes("SKUCode"), canadian pharmacy cialis CType(item.d, canadian pharmacy cialis ListItem).Attributes("SKUCode"), canadian pharmacy cialis BaseSKU)

            skus.Add(sku)
        Next

        Return skus
    End Function



In SQL Server this is done in a similar way:


select ogi1.OptionGroupItemSKUCode + '-' + ogi2.OptionGroupItemSKUCode + '-' + ogi3.OptionGroupItemSKUCode+ '-' + ogi4.OptionGroupItemSKUCode
from OptionGroupItem ogi1, canadian pharmacy cialis OptionGroupItem ogi2, canadian pharmacy cialis OptionGroupItem ogi3, canadian pharmacy cialis OptionGroupItem ogi4
where ogi1.OptionGroupID = 1
and ogi2.OptionGroupID = 2
and ogi3.OptionGroupID = 3
and ogi4.OptionGroupID = 4

Average Rating: 4.9 out of 5 based on 168 user reviews.

No Comments

 

Comments have been closed for this post.