public void UpdateButton_Click(Object sender, EventArgs e)
{
bool boolfalse = false; //Set if the cart contains items
Cart shoppingCart = ShoppingCart(false);
if (!shoppingCart.IsEmpty)
{
if (!Page.IsValid)
{
return;
}
DataRowCollection orderRows = shoppingCart.OrderItems.Rows;
int i = 0;
foreach (DataGridItem item in CartItemsDataGrid.Items)
{
orderRows[i][1] = Int32.Parse(((TextBox)item.FindControl("QuantityTextBox")).Text);
++i;
}
shoppingCart.UpdateItems();
boolfalse = !shoppingCart.IsEmpty;
if (boolfalse)
{
CartItemsDataGrid.DataSource = (ICollection)shoppingCart.OrderItems.DefaultView;
CartItemsDataGrid.DataBind();
}
}
ShoppingCartPanel.Visible = boolfalse;
CartItemsDataGrid.Visible = boolfalse;
CheckOutHyperLink.Visible= boolfalse;
EmptyCartLabel.Visible = !boolfalse;
}
{
bool boolfalse = false; //Set if the cart contains items
Cart shoppingCart = ShoppingCart(false);
if (!shoppingCart.IsEmpty)
{
if (!Page.IsValid)
{
return;
}
DataRowCollection orderRows = shoppingCart.OrderItems.Rows;
int i = 0;
foreach (DataGridItem item in CartItemsDataGrid.Items)
{
orderRows[i][1] = Int32.Parse(((TextBox)item.FindControl("QuantityTextBox")).Text);
++i;
}
shoppingCart.UpdateItems();
boolfalse = !shoppingCart.IsEmpty;
if (boolfalse)
{
CartItemsDataGrid.DataSource = (ICollection)shoppingCart.OrderItems.DefaultView;
CartItemsDataGrid.DataBind();
}
}
ShoppingCartPanel.Visible = boolfalse;
CartItemsDataGrid.Visible = boolfalse;
CheckOutHyperLink.Visible= boolfalse;
EmptyCartLabel.Visible = !boolfalse;
}