Exemplo n.º 1
0
        private void btnXoaGiaPhong_Click(object sender, EventArgs e)
        {
            if (txbLoaiPhong.Text == "")
            {
                MessageBox.Show("Bạn chưa điền loại phòng muốn xóa", "Xóa giá phòng", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }

            if (phong.KiemTraLoaiPhongDaTonTaiTrongTableGiaPhong(txbLoaiPhong.Text))
            {
                if (MessageBox.Show("Bạn có chắc chắn muốn xóa giá phòng này?", "Xóa giá phòng",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    double giaPhong = Convert.ToDouble(txbGiaPhong.Text);

                    if (phong.XoaGiaPhongTrongTableGiaPhong(txbLoaiPhong.Text.Trim()))
                    {
                        MessageBox.Show("Xóa giá phòng thành công", "Xóa giá phòng",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Xóa giá phòng thất bại", "Xóa giá phòng",
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else
            {
                MessageBox.Show("Loại phòng bạn muốn xóa không tồn tại", "Xóa giá phòng",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }