private void btnChon_Click(object sender, EventArgs e) { eDuAn.TenDuAn = txtTenDuAn.Text; eDuAn.NgayBatDau = dtmNgayBatDau.Value; eDuAn.NgayKetThuc = dtmNgayKetThuc.Value; eDuAn.TrangThai = cboTrangThai.Text; eDuAn.TienDo = (int)nudTienDoHoanThanh.Value; eDuAn.DiaChi = new eDiaChi(txtSoNha.Text, cboPhuongXa.Text, cboQuanHuyen.Text, cboThanhPho.Text); busDuAn.AddItem(eDuAn); this.Close(); }
private void btnChon_Click(object sender, EventArgs e) { int soLoi = 0; if (!CheckNgayKetThuc()) { soLoi++; } if (!CheckSoNha()) { soLoi++; } if (!CheckTenDuAn()) { soLoi++; } if (!CheckTienDoHoanThanh()) { soLoi++; } if (soLoi > 0) { txtSoNha1.Focus(); MessageBox.Show("Thong Tin Khong Hop Le"); return; } eDuAn.TenDuAn = txtSoNha1.Text; eDuAn.NgayBatDau = dtmNgayBatDau.Value; eDuAn.NgayKetThuc = dtmNgayKetThuc.Value; eDuAn.TrangThai = cboTrangThai.Text; eDuAn.TienDo = (int)nudTienDoHoanThanh.Value; eDuAn.DiaChi = new eDiaChi(txtTenDuAn.Text, cboPhuongXa.Text, cboQuanHuyen.Text, cboThanhPho.Text); busDuAn.AddItem(eDuAn); this.Close(); }