예제 #1
0
        private void btnThemLP_Click(object sender, EventArgs e)
        {
            string  maloaiphong  = lpBus.SinhMaLoaiPhong();
            string  tenloaiphong = txtTenLP.Text;
            decimal giaphong     = Decimal.Parse(txtGiaLP.Text);
            int     songuoi      = Int32.Parse(txtSoNguoiLP.Text);

            if (maloaiphong.ToString() != "" && tenloaiphong.ToString() != "" && giaphong.ToString() != "" && songuoi.ToString() != "")
            {
                if (lpBus.ThemLoaiPhong(maloaiphong, tenloaiphong, giaphong, songuoi))
                {
                    MessageBox.Show("Thêm mới thành công");
                    DanhSachLoaiPhong();
                    LoaiPhongBiding();
                }
                else
                {
                    MessageBox.Show("Có lỗi khi thêm ");
                }
            }
            else
            {
                MessageBox.Show("Mời nhập dữ liệu!");
            }
        }
예제 #2
0
        private void Them_Click(object sender, EventArgs e)
        {
            if (txt_MaLP.Text == "" || txt_Maks.Text == "" || txt_Dongia.Text == "" || txt_TenLP.Text == "" || txt_Sltrong.Text == "")
            {
                MessageBox.Show("Vui lòng nhập đầy đủ thông tin!", "Thông báo");
                return;
            }
            LoaiPhongDTO lp = new LoaiPhongDTO();

            lp.MaLoaiPhong  = txt_MaLP.Text;
            lp.MaKS         = txt_Maks.Text;
            lp.DonGia       = float.Parse(txt_Dongia.Text);
            lp.TenLoaiPhong = txt_TenLP.Text;
            lp.SlTrong      = int.Parse(txt_Sltrong.Text);
            lp.MoTa         = txt_Mota.Text;
            int temp = LoaiPhongBUS.KiemTra(lp);

            if (temp == 1)
            {
                MessageBox.Show("Mã loại phòng đã tồn tại, vui lòng nhập mã loại phòng khác", "Thông báo");
                return;
            }
            else if (temp == 2)
            {
                MessageBox.Show("Mã khách sạn không tồn tại!", "Thông báo");
                return;
            }
            else
            {
                if (LoaiPhongBUS.ThemLoaiPhong(lp))
                {
                    MessageBox.Show("Thêm loại phòng thành công!", "Thông báo");
                }
                else
                {
                    MessageBox.Show("Lỗi, vui lòng thử lại! \n ", "Thông báo");
                }
            }
        }