private void btnLuu_Click(object sender, EventArgs e) { if (Them) { try { BLLoaiPhong blLp = new BLLoaiPhong(); blLp.ThemLoaiPhong(this.txtLoaiPhong.Text.Trim(), Convert.ToInt32(this.txtGiaPhong.Text.Trim()), ref err); LoadData(); MessageBox.Show("Đã Thêm Xong"); } catch (SqlException) { MessageBox.Show("ko thêm đc. Lỗi r!."); } } else { BLLoaiPhong blLp = new BLLoaiPhong(); blLp.CapNhatLoaiPhong(this.txtLoaiPhong.Text.Trim(), Convert.ToInt32(this.txtGiaPhong.Text.Trim()), ref err); LoadData(); MessageBox.Show("Đã sửa xong"); } }