public List <ePhieuDNNK> laydanhsachPhieuDNNK() { var listphieuDNNK = db.Tbl_PhieuDNNKs.ToList(); List <ePhieuDNNK> ls = new List <ePhieuDNNK>(); var k = db.Tbl_PhieuNKs.ToList(); int kq; foreach (Tbl_PhieuDNNK nk in listphieuDNNK) { kq = 0; ePhieuDNNK ednnk = new ePhieuDNNK(); ednnk.maKho = nk.maKho; ednnk.maNV = nk.maNV; ednnk.ngayLapphieu = nk.ngayLapphieu; ednnk.soPDNNK = nk.soPDNNK; foreach (Tbl_PhieuNK i in k) { ePhieuNK epnk = new ePhieuNK(); epnk._maPhieuNhap = i.maPhieuNhap; if (ednnk.soPDNNK == epnk._maPhieuNhap) { kq = 1; } } if (kq == 0) { ls.Add(ednnk); } } return(ls); }
public int themPDNNK(ePhieuDNNK PDNNK) { var tPDNNK = db.Tbl_PhieuDNNKs.Where(x => x.soPDNNK == PDNNK.soPDNNK).FirstOrDefault(); if (tPDNNK != null) { return(0); } Tbl_PhieuDNNK p = new Tbl_PhieuDNNK(); p.soPDNNK = PDNNK.soPDNNK; p.maNV = PDNNK.maNV; p.ngayLapphieu = Convert.ToDateTime(PDNNK.ngayLapphieu); p.maKho = PDNNK.maKho; db.Tbl_PhieuDNNKs.InsertOnSubmit(p); db.SubmitChanges(); return(1); }
private void btnthemdnnk_Click(object sender, EventArgs e) { ePhieuDNNK p = new ePhieuDNNK(); p.soPDNNK = txtsophieu.Text; p.ngayLapphieu = Convert.ToString(dtpngaylapphieudnnk.Text); p.maNV = txtMaNV.Text; p.maKho = cmbMakho.Text; int m = pdnnkbll.themPDNNK(p); if (m == 1) { MessageBox.Show("Thêm thành công"); } else { MessageBox.Show("Thêm thất bại"); } dgvPDNNK.DataSource = pdnnkbll.getAllPDNNK(); btnsuadnnk.Enabled = true; }
public PhieuDNNK_BLL(ePhieuDNNK pdn) { this.pdn = pdn; ctp = new List <eCTPhieuDNNK>(); }