| |
|||
Последний столбец, имеющий тип Button, нужен для размещения ссылок Удалить. Эту ссылку посетитель использует для удаления товара из своей корзины:
HeaderText=''Щелкните для удаления товара из корзины" ButtonType="LinkButton" Text="Удалить" CommandName="cmdRemoveItem"
id="lblPriceTotal" Font-Bold="True" Width="90%" runat="server" />
id="lblShippingTotal" Font-Bold="True" Width="90%" runat="server" />
id="lblGrandTotal" Font-Bold="True" Width="90%" runat="server" />
If Len(Session("CustomerlD")) <> 0 Then Dim DBConn as OleDbConnection Dim DBCommand As OleDbDataAdapter Dim DSPageData as New DataSet DBConn = New OleDbConnection("Provider=sqloledb;" _ & "server=localhost;" _ & "Initial Catalog=INETC15;" _ & "User Id=sa;" _ & "Password=yourpassword;") DBCommand = New OleDbDataAdapter _ ("Select ShoppingCartltemID, ProductName, " & "Quantity, Price, Shipping From " _ & "ShoppingCartltems Where " _ & "CustomerlD = " & Session("CustomerlD") _ & " Order By ProductName" __ , DBConn) DBCommand.Fill(DSPageData, _ "ShoppingCart") If DSPageData.Tables("ShoppingCart").Rows.Count = 0 Then iblPriceTotal.Text = "В Вашей корзине " _ & "нет товаров." Else dgShoppingCart.DataSource = _ DSPageData.Tables("ShoppingCart").DefaultView dgShoppingCart.DataBind, DBCommand = New OleDbDataAdapter _ ("Select Sum(Price) as PriceSum, " _ & "Sum(Shipping) as ShippingSum From " _ & "ShoppingCartltems Where " _ & "CustomerlD = " & Session("CustomerlD") _ , DBConn) DBCommand.Fill(DSPageData, _ "Totals") IblPriceTotal.Text = "Итого: " _ & FormatCurrency(DSPageData.Tables("Totals"). _ Rows(O).Item("PriceSum")) IblShippingTotal.Text = "Доставка: " _ & FormatCurrency(DSPageData.Tables ("Totals") . _ Rows(O).Item("ShippingSum")) IblGrandTotal.Text = "Всего: " _ & FormatCurrency(DSPageData.Tables ("Totals") . _ Rows(0).Item("PriceSum") + _ DSPageData.Tables("Totals"). _ Rows(O).Item("ShippingSum")) End.If Else IblPriceTotal.Text = " В Вашей корзине " _ & "нет товаров." End If End Sub
|
|||