Ejemplo n.º 1
0
        private void btnThemGiaPhong_Click(object sender, EventArgs e)
        {
            if (txbGiaPhong.Text == "" || txbLoaiPhong.Text == "")
            {
                MessageBox.Show("Bạn chưa điền đầy đủ thông tin", "Thêm giá phòng", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }

            if (!phong.KiemTraLoaiPhongDaTonTaiTrongTableGiaPhong(txbLoaiPhong.Text))
            {
                double giaPhong = Convert.ToDouble(txbGiaPhong.Text);

                if (phong.ThemGiaPhongTrongTableGiaPhong(txbLoaiPhong.Text.Trim(), giaPhong))
                {
                    MessageBox.Show("Thêm giá phòng thành công", "Thêm giá phòng",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Thêm giá phòng thất bại", "Thêm giá phòng",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Loại phòng đã tồn tại rồi", "Thêm giá phòng", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }