private void btnLuu_Click(object sender, EventArgs e) { int soLoi = 0; if (!CheckTenCongViec()) { soLoi++; } if (!CheckNgayKetThuc()) { soLoi++; } if (soLoi > 0) { txtTenCongViec.Focus(); MessageBox.Show("Thong Tin Nhap Khong Hop Le"); return; } eDuAn da = busDuAn.GetItemByCondition(t => t.MaDuAn.Equals(cboDuAn.SelectedValue.ToString())); congViec.DuAn = new eDuAn(da.MaDuAn, da.TenDuAn, null, da.NgayBatDau, da.NgayKetThuc, da.TienDo, da.TrangThai); congViec.TenCongViec = txtTenCongViec.Text; congViec.Tiendo = (int)nudTienDoCongViec.TextAlign; congViec.TrangThai = cboTrangThai.Text; congViec.NgayBatDau = dtmNgayKetThuc.Value; congViec.NgayKetThuc = dtmNgayBatDau.Value; congViec.ViTriCongViec = cboViTriCongViec.Text; busCongViec.AddItem(congViec); DialogResult = DialogResult.OK; this.Close(); }
private void btnLuu_Click(object sender, EventArgs e) { congViec.DuAn.MaDuAn = cboDuAn.SelectedValue.ToString(); congViec.TenCongViec = txtTenCongViec.Text; congViec.Tiendo = (int)nudTienDoCongViec.TextAlign; congViec.TrangThai = cboTrangThai.Text; congViec.NgayBatDau = dtmNgayBatDau.Value; congViec.NgayKetThuc = dtmNgayKetThuc.Value; congViec.ViTriCongViec = cboViTriCongViec.Text; busCongViec.AddItem(congViec); DialogResult = DialogResult.OK; this.Close(); }