Пример #1
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            int          tmp          = dataGrdV.CurrentCell.RowIndex;
            string       index        = dataGrdV.Rows[tmp].Cells[0].Value.ToString();
            DialogResult dialogResult = MessageBox.Show("Bạn có muốn xóa ID Dịch Vụ: " + index, "Xóa Dịch Vụ", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                if (!dvBus.XoaThongTinDichVu(index))
                {
                    MessageBox.Show("Xóa thông tin dịch vụ thất bại", "Thất bại",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    DocDuLieu(dvBus.LayDuDieu());
                    MessageBox.Show("Xóa thông tin dịch vụ thành công", "Thành công", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else if (dialogResult == DialogResult.No)
            {
                //do something else
            }
        }