// click表格 private void ClickItem(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == -1 || e.RowIndex == -1) { return; } else { _currentRow = e.RowIndex; // 取得目前row Index _itemPictureBox.Image = _inventorySystemPresentationModel.GetImageFilePath(((DataGridView)sender).Rows[e.RowIndex].Index); _itemDetailTextBox.Text = _inventorySystemPresentationModel.GetItemDetail(((DataGridView)sender).Rows[e.RowIndex].Index); if (e.ColumnIndex == REPLENISHMENT_COLUMN_INDEX) // 如果按補貨按鈕 { Replenishment replenishment = new Replenishment(((DataGridView)sender).Rows[e.RowIndex].Index, _productManagement); replenishment.ShowDialog(); } } }
public InventorySystem(ReadFile initial, ProductManagement productManagement) { InitializeComponent(); _productManagement = productManagement; _inventorySystemPresentationModel = new InventorySystemPresentationModel(_productManagement); _productManagement._writeNewData += UpdateProductData; this.LoadAndShowDataGridView(); _itemPictureBox.Image = _inventorySystemPresentationModel.GetImageFilePath(0); _itemDetailTextBox.Text = _inventorySystemPresentationModel.GetItemDetail(0); }
public void GetItemDetailTest() { Assert.AreEqual(_inventorySystemPresentationModel.GetItemDetail(0), _productManagement.AllProducts[0].ProductDetail); }