Protected Sub gridProducts_CustomCallback(ByVal sender As Object, ByVal e As ASPxGridViewCustomCallbackEventArgs)
Dim colQty As GridViewDataColumn = DirectCast(gridProducts.Columns(3), GridViewDataColumn)
Dim colDiscount As GridViewDataColumn = DirectCast(gridProducts.Columns(4), GridViewDataColumn)
Dim cart As New ShoppingCart()
For i As Integer = 0 To gridProducts.VisibleRowCount - 1
Dim pID As Integer = CInt(gridProducts.GetRowValues(i, "ID"))
Dim spinMainQuantity As ASPxSpinEdit = TryCast(gridProducts.FindRowCellTemplateControl(i, colQty, "spinMainQuantity"), ASPxSpinEdit)
Dim spinMainDiscount As ASPxSpinEdit = TryCast(gridProducts.FindRowCellTemplateControl(i, colDiscount, "spinMainDiscount"), ASPxSpinEdit)
If CInt(spinMainQuantity.Number) > 0 Then
cart.AddItem(InventoryItem.GeteCommerceInventoryItem(pID), CInt(spinMainQuantity.Number), spinMainDiscount.Number)
End If
Next
cart.Save()
End Sub
Dim colQty As GridViewDataColumn = DirectCast(gridProducts.Columns(3), GridViewDataColumn)
Dim colDiscount As GridViewDataColumn = DirectCast(gridProducts.Columns(4), GridViewDataColumn)
Dim cart As New ShoppingCart()
For i As Integer = 0 To gridProducts.VisibleRowCount - 1
Dim pID As Integer = CInt(gridProducts.GetRowValues(i, "ID"))
Dim spinMainQuantity As ASPxSpinEdit = TryCast(gridProducts.FindRowCellTemplateControl(i, colQty, "spinMainQuantity"), ASPxSpinEdit)
Dim spinMainDiscount As ASPxSpinEdit = TryCast(gridProducts.FindRowCellTemplateControl(i, colDiscount, "spinMainDiscount"), ASPxSpinEdit)
If CInt(spinMainQuantity.Number) > 0 Then
cart.AddItem(InventoryItem.GeteCommerceInventoryItem(pID), CInt(spinMainQuantity.Number), spinMainDiscount.Number)
End If
Next
cart.Save()
End Sub
No comments:
Post a Comment