Beispiel #1
0
 private void btThem_Click(object sender, EventArgs e)
 {
     if (txtMaPhong.Text.Trim() == "")
     {
         MessageBox.Show("Bạn chưa nhập mã phòng!", "THÔNG BÁO!", MessageBoxButtons.OK);
     }
     else
     {
         if (PHBLL.Dembanghi(txtMaPhong.Text) == 1)
         {
             MessageBox.Show("Mã phòng đã tồn tại.Hãy nhập lại mã khác!", "THÔNG BÁO!", MessageBoxButtons.OK, MessageBoxIcon.Information);
             txtMaPhong.Text = "";
         }
         else
         {
             if (txtTenPhong.Text.Trim() == "" || cbMaToaNha.Text.Trim() == "" || cbLoaiPhong.Text.Trim() == "" || txtSoLuongNguoi.Text.Trim() == "" || txtTinhTrang.Text.Trim() == "")
             {
                 MessageBox.Show("Bạn chưa nhập đầy đủ thông tin cho phòng!", "THÔNG BÁO!", MessageBoxButtons.OK);
             }
             else
             {
                 PHBLL.ThemPhong(txtMaPhong.Text, txtTenPhong.Text, cbMaToaNha.Text, cbLoaiPhong.Text, txtSoLuongNguoi.Text, txtTinhTrang.Text);
                 dgQLPhong.DataSource = PHBLL.Load();
                 btLamMoi_Click(sender, e);
             }
         }
     }
 }