private void btn_Edit_Click(object sender, EventArgs e)
        {
            Form form = new QuanLyThuoc.FormEditMedicine();

            form.ShowDialog();
        }
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            UndoChangeFormDisplay();

            if (e.RowIndex >= 0)
            {
                // Lay ID cua ban ghi duoc chon --> chuan bi cho Xem, Sua, Xoa
                string strID = dataGridView1.SelectedCells[0].OwningRow.Cells[0].Value.ToString();
                int    id    = -1;
                if (!strID.Equals(""))
                {
                    id = Convert.ToInt32(strID);
                }

                // Xu ly cac truong hop Xem(detail), Sua(edit), Xoa(delete)
                if (e.ColumnIndex == dataGridView1.Columns["detail"].Index)
                {
                    if (id != -1)
                    {
                        // Code xu ly lay du lieu tu ban ghi chuyen sang FormDetailMedicine
                        medicineID    = dataGridView1.SelectedCells[0].OwningRow.Cells["_id"].Value.ToString();
                        medicineName  = dataGridView1.SelectedCells[0].OwningRow.Cells["_name"].Value.ToString();
                        medicineGroup = dataGridView1.SelectedCells[0].OwningRow.Cells["_group"].Value.ToString();
                        uses          = dataGridView1.SelectedCells[0].OwningRow.Cells["_uses"].Value.ToString();
                        unit          = dataGridView1.SelectedCells[0].OwningRow.Cells["_unit"].Value.ToString();
                        price         = dataGridView1.SelectedCells[0].OwningRow.Cells["_price"].Value.ToString();
                        inventory     = dataGridView1.SelectedCells[0].OwningRow.Cells["_inventory"].Value.ToString();
                        note          = dataGridView1.SelectedCells[0].OwningRow.Cells["_note"].Value.ToString();
                        mostUsedMonth = dataGridView1.SelectedCells[0].OwningRow.Cells["_mostUsed"].Value.ToString();

                        // Hien thi FormDetailMedicine
                        Form form = new QuanLyThuoc.FormDetailMedicine();
                        form.ShowDialog();
                        LoadData();
                    }
                }
                else if (e.ColumnIndex == dataGridView1.Columns["edit"].Index)
                {
                    if (id != -1)
                    {
                        // Code xu ly lay du lieu tu ban ghi chuyen sang FormEditMedicine
                        medicineID    = dataGridView1.SelectedCells[0].OwningRow.Cells["_id"].Value.ToString();
                        medicineName  = dataGridView1.SelectedCells[0].OwningRow.Cells["_name"].Value.ToString();
                        medicineGroup = dataGridView1.SelectedCells[0].OwningRow.Cells["_group"].Value.ToString();
                        uses          = dataGridView1.SelectedCells[0].OwningRow.Cells["_uses"].Value.ToString();
                        unit          = dataGridView1.SelectedCells[0].OwningRow.Cells["_unit"].Value.ToString();
                        price         = dataGridView1.SelectedCells[0].OwningRow.Cells["_price"].Value.ToString();
                        inventory     = dataGridView1.SelectedCells[0].OwningRow.Cells["_inventory"].Value.ToString();
                        note          = dataGridView1.SelectedCells[0].OwningRow.Cells["_note"].Value.ToString();
                        mostUsedMonth = dataGridView1.SelectedCells[0].OwningRow.Cells["_mostUsed"].Value.ToString();

                        // Hien thi FormEditMedicine
                        Form form = new QuanLyThuoc.FormEditMedicine();
                        form.ShowDialog();
                        LoadData();
                    }
                }
                else if (e.ColumnIndex == dataGridView1.Columns["delete"].Index)
                {
                    if (id != -1)
                    {
                        DialogResult dlr = MessageBox.Show("Chắc chắn xoá ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                        if (dlr == DialogResult.Yes)
                        {
                            // Code xu ly xoa thuoc
                            ctrl.Delete(strID);
                            MessageBox.Show("Xoá thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            LoadData();
                        }
                    }
                }
            }
        }