예제 #1
0
        private void btDelete_Click(object sender, EventArgs e)
        {
            int currentRow = dgvTour.CurrentCellAddress.Y;

            if (-1 < currentRow && currentRow < dgvTour.RowCount)
            {
                DialogResult diaRes = MessageBox.Show("Bạn có chắc muốn xóa tour " + tbName.Text + "?", "Information",
                                                      MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                switch (diaRes)
                {
                case DialogResult.Yes:
                    Result result = tourBUS.Delete(tbID.Text);
                    if (result.Flag)
                    {
                        MessageBox.Show("Xóa thông tin tour thành công", "Information", MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                        LoadDgvTour(tourBUS.SelectAll());
                        ResetField();
                    }
                    else
                    {
                        MessageBox.Show("Xóa thông tin tour thất bại\n Error: " + result.Message, "Information", MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                    }
                    break;

                case DialogResult.No:
                    return;
                }
            }
        }