Exemplo n.º 1
0
        // 更新商品資料
        public void UpdateProductData()
        {
            int rowIndex = _productManagement.GetEditProductIndexOfAllProducts();

            try
            {
                _itemDataGridView.Rows[rowIndex].Cells[NAME_COLUMN_INDEX].Value  = _inventorySystemPresentationModel.GetName();
                _itemDataGridView.Rows[rowIndex].Cells[TYPE_COLUMN_INDEX].Value  = _inventorySystemPresentationModel.GetCategory();
                _itemDataGridView.Rows[rowIndex].Cells[PRICE_COLUMN_INDEX].Value = _inventorySystemPresentationModel.GetPrice();
                _itemDataGridView.Rows[rowIndex].Cells[STOCK_COLUMN_INDEX].Value = _inventorySystemPresentationModel.GetStock();
                _itemPictureBox.Image   = _inventorySystemPresentationModel.GetImageFilePath(_itemDataGridView.CurrentCell.RowIndex);
                _itemDetailTextBox.Text = _inventorySystemPresentationModel.GetItemDetail(_itemDataGridView.CurrentCell.RowIndex);
            }
            catch
            {
                _itemDataGridView.Rows.Add(_inventorySystemPresentationModel.GetLatestItemDetail());
            }
        }
Exemplo n.º 2
0
 public void GetEditProductIndexOfAllProductsTest()
 {
     _productManagement.EditProductName(_productManagement.AllProducts[0], "test");
     Assert.AreEqual(_productManagement.GetEditProductIndexOfAllProducts(), 0);
 }