private void rawmaterislaItemdataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) { return; } try { if (e.ColumnIndex == Convert.ToInt32("0" + rawmaterislaItemdataGridView.Rows[e.RowIndex].Cells["up"].ColumnIndex)) { int itemId = Convert.ToInt32("0" + rawmaterislaItemdataGridView.Rows[e.RowIndex].Cells["II_id"].Value); ItemUpdateForm objUpdate = new ItemUpdateForm(itemId); objUpdate.Parent = this.ParentForm; UserControlManager.UserControls.Push(this); Panel pnl = (Panel)this.ParentForm.Controls["pnlContext"]; string s = pnl.Name; objUpdate.ParentForm.Controls[s].Controls.Clear(); objUpdate.ParentForm.Controls[s].Controls.Add(objUpdate); } else if (e.ColumnIndex == Convert.ToInt32("0" + rawmaterislaItemdataGridView.Rows[e.RowIndex].Cells["del"].ColumnIndex)) { DialogResult result = MessageBox.Show("Do you want to Deleted it?", "Confirmation", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { InventoryItemBLL aItemBll = new InventoryItemBLL(); int itemId = Convert.ToInt32("0" + rawmaterislaItemdataGridView.Rows[e.RowIndex].Cells["II_id"].Value); bool res = aItemBll.DeleteItem(itemId); if (res) { rawmaterislaItemdataGridView.Rows.RemoveAt(e.RowIndex); } } else if (result == DialogResult.No) { } } } catch (Exception) { } }
private void rawmaterislaItemdataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) { return; } try { if (e.ColumnIndex == Convert.ToInt32("0" + rawmaterislaItemdataGridView.Rows[e.RowIndex].Cells["up"].ColumnIndex)) { int itemId = Convert.ToInt32("0" + rawmaterislaItemdataGridView.Rows[e.RowIndex].Cells["II_id"].Value); ItemUpdateForm objUpdate = new ItemUpdateForm(itemId); objUpdate.Parent = this.ParentForm; UserControlManager.UserControls.Push(this); Panel pnl = (Panel)this.ParentForm.Controls["pnlContext"]; string s = pnl.Name; objUpdate.ParentForm.Controls[s].Controls.Clear(); objUpdate.ParentForm.Controls[s].Controls.Add(objUpdate); } else if (e.ColumnIndex == Convert.ToInt32("0" + rawmaterislaItemdataGridView.Rows[e.RowIndex].Cells["del"].ColumnIndex)) { DialogResult result = MessageBox.Show("Do you want to Deleted it?", "Confirmation", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { InventoryItemBLL aItemBll = new InventoryItemBLL(); int itemId = Convert.ToInt32("0" + rawmaterislaItemdataGridView.Rows[e.RowIndex].Cells["II_id"].Value); bool res = aItemBll.DeleteItem(itemId); if (res) { rawmaterislaItemdataGridView.Rows.RemoveAt(e.RowIndex); } } else if (result == DialogResult.No) { } } } catch (Exception) { } }