コード例 #1
0
ファイル: ShoppingCartManager.cs プロジェクト: Musasthl/gaols
        public void Update(int RowID, int ProductID, int Quantity, decimal Price)
        {
            DataRow row = _cartTable.Rows[RowID];

            ManagerDS.ShoppingCartRow Item = row as ManagerDS.ShoppingCartRow;
            Item.ItemNumber = ProductID;
            Item.Quantity   = Quantity;
            Item.Price      = Price;
            Item.SubTotal   = Price * Quantity;
            _lastUpdate     = DateTime.Now;
        }
コード例 #2
0
ファイル: ShoppingCartManager.cs プロジェクト: Musasthl/gaols
        public void Insert(int ItemNumber, decimal Price, decimal Quantity, string Description, string ImageUrl)
        {
            int ItemIndex = ItemIndexOfID(ItemNumber);

            if (ItemIndex == -1)
            {
                ManagerDS.ShoppingCartRow NewItem = _cartTable.NewRow() as ManagerDS.ShoppingCartRow;

                NewItem.ItemNumber  = ItemNumber;
                NewItem.Quantity    = Quantity;
                NewItem.Price       = Price;
                NewItem.Description = Description;
                NewItem.SubTotal    = NewItem.Quantity * NewItem.Price;
                _cartTable.Rows.Add(NewItem);
            }
            else
            {
                ManagerDS.ShoppingCartRow row = _cartTable.Rows[ItemIndex] as ManagerDS.ShoppingCartRow;
                row.Quantity += 1;
                row.SubTotal  = row.Price * row.Quantity;
            }
            _lastUpdate = DateTime.Now;
        }