private void ToolStripMenuItemAddRelationToItem_Click(object sender, EventArgs e) { FrmSelectItemSKU frmSelectSKU = new FrmSelectItemSKU(); frmSelectSKU.ShowDialog(); string itemSKU = frmSelectSKU.SKU; if (itemSKU == null || itemSKU == "") { return; } DataGridViewSelectedRowCollection selectedRows = this.dataGridViewAllOrders.SelectedRows; foreach (DataGridViewRow row in selectedRows) { String orderLineItemId = row.Cells[OrderDgv_OrderLineItemIndex].Value.ToString(); EbayTransactionType trans = EbayTransactionDAL.GetOneTransaction(orderLineItemId); if (trans == null) { return; } EbayTransactionDAL.UpdateTransactionItemSKU(trans.TransactionId, itemSKU); row.Cells[OrderDgv_ItemSKUIndex].Value = itemSKU; } MessageBox.Show("订单关联商品sku成功", "恭喜", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void dgvItems_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex != SKUColIndex) { return; } DataGridViewCell cell = this.dgvItems.CurrentCell; if (cell == null) { return; } DataGridViewRow row = cell.OwningRow; if (row == null) { return; } FrmSelectItemSKU frm = new FrmSelectItemSKU(); frm.StartPosition = FormStartPosition.CenterParent; frm.ShowDialog(); if (frm.SKU != null) { cell.Value = frm.SKU; InventoryItemType item = ItemDAL.GetItemBySKU(frm.SKU); row.Cells[ItemTitleColIndex].Value = item.ItemName; } }
private void ToolStripMenuItemAddRelationToItem_Click(object sender, EventArgs e) { FrmSelectItemSKU frmSelectSKU = new FrmSelectItemSKU(); frmSelectSKU.ShowDialog(); string itemSKU = frmSelectSKU.SKU; if (itemSKU == null || itemSKU == "") return; DataGridViewSelectedRowCollection selectedRows = this.dataGridViewAllOrders.SelectedRows; foreach (DataGridViewRow row in selectedRows) { String orderLineItemId = row.Cells[OrderDgv_OrderLineItemIndex].Value.ToString(); EbayTransactionType trans = EbayTransactionDAL.GetOneTransaction(orderLineItemId); if (trans == null) return; EbayTransactionDAL.UpdateTransactionItemSKU(trans.TransactionId, itemSKU); row.Cells[OrderDgv_ItemSKUIndex].Value = itemSKU; } MessageBox.Show("订单关联商品sku成功", "恭喜", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void dgvItems_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex != SKUColIndex) return; DataGridViewCell cell = this.dgvItems.CurrentCell; if (cell == null) return; DataGridViewRow row = cell.OwningRow; if (row == null) return; FrmSelectItemSKU frm = new FrmSelectItemSKU(); frm.StartPosition = FormStartPosition.CenterParent; frm.ShowDialog(); if (frm.SKU != null) { cell.Value = frm.SKU; InventoryItemType item = ItemDAL.GetItemBySKU(frm.SKU); row.Cells[ItemTitleColIndex].Value = item.ItemName; } }