Exemplo n.º 1
0
        private void dgv1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            List <InventoryManagementView> list = Program.list;

            if (e.RowIndex >= 0)
            {
                if (dgv1.Rows[e.RowIndex].Cells[e.ColumnIndex] is DataGridViewLinkCell)
                {
                    DataGridViewLinkCell link = (DataGridViewLinkCell)dgv1.Rows[e.RowIndex].Cells[e.ColumnIndex];
                    if (link.Value.ToString() == "Remove")
                    {
                        DialogResult rs = MessageBox.Show("Are you sure?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                        if (rs == DialogResult.Yes)
                        {
                            XuLy.RemoveInventoryManagement(list[e.RowIndex].OrderID, list[e.RowIndex].OrderItemsID);
                            Program.list = XuLy.getInventoryManagementView();
                            Program.f.viewInventoryTable(Program.list);
                        }
                    }

                    if (link.Value.ToString() == "Edit")
                    {
                        EditInventoryManagement edit = new EditInventoryManagement();
                        Program.oldEdit = list[e.RowIndex];
                        edit.Show();
                    }
                }
            }
        }