예제 #1
0
 private void btnSuaLP_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Bạn có chắc chắn muốn sửa nó", "Thông báo!!", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
     {
         string  maloaiphong  = txtMaLP.Text;
         string  tenloaiphong = txtTenLP.Text;
         decimal giaphong     = Decimal.Parse(txtGiaLP.Text);
         int     songuoi      = Int32.Parse(txtSoNguoiLP.Text);
         if (lpBus.SuaLoaiPhong(maloaiphong, tenloaiphong, giaphong, songuoi))
         {
             MessageBox.Show("Sửa thành công");
         }
         else
         {
             MessageBox.Show("Có lỗi khi Sửa");
         }
         DanhSachLoaiPhong();
         LoaiPhongBiding();
     }
 }
예제 #2
0
        private void Sua_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.KiemTraSua(lp);

            if (temp == 1)
            {
                MessageBox.Show("Mã loại phòng không tồn tại trong danh sách", "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.SuaLoaiPhong(lp))
                {
                    MessageBox.Show("Cập nhật 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");
                }
            }
        }