public List <ePhieuDNXK> laydanhsachPhieuDNXK()
        {
            var listphieuDNXK    = db.Tbl_PhieuDNXKs.ToList();
            List <ePhieuDNXK> ls = new List <ePhieuDNXK>();
            var k = db.Tbl_PhieuXKs.ToList();
            int kq;

            foreach (Tbl_PhieuDNXK xk in listphieuDNXK)
            {
                kq = 0;
                ePhieuDNXK ednxk = new ePhieuDNXK();
                ednxk.maKho   = xk.maKho;
                ednxk.maNV    = xk.maNV;
                ednxk.ngayLap = xk.ngayLap;
                ednxk.soPDNXK = xk.soPDNNK;

                foreach (Tbl_PhieuXK i in k)
                {
                    ePhieuNK epnk = new ePhieuNK();
                    epnk._maPhieuNhap = i.maPhieuXuat;
                    if (ednxk.soPDNXK == epnk._maPhieuNhap)
                    {
                        kq = 1;
                    }
                }
                if (kq == 0)
                {
                    ls.Add(ednxk);
                }
            }
            return(ls);
        }
Exemple #2
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     try
     {
         ePhieuNK newpNk = new ePhieuNK();
         newpNk._maNV        = cbbMaNV.Text;
         newpNk._maPhieuNhap = txtMaPhieuNhap.Text;
         newpNk._msKho       = cbbMaKho.Text;
         newpNk._tinhTrang   = cbbTinhTrang.Text;
         newpNk._ngayLapNhap = dtpNgayLapPhieu.Value;
         int kq = bllpNK.ThemPhieuNhapKho(newpNk);
         if (kq == 1)
         {
             MessageBox.Show("Thêm thành công!!!");
         }
         else
         {
             MessageBox.Show("Trùng mã phiếu!!");
         }
         listpNK = bllpNK.laydanhsachphieuNhapKho();
         //listtp = blltp.getthuephongbymaphong(txtmaphong.Text);
         LoaddulieulendatagridviewPhieuNhapKho(dgvNhapKho, listpNK);
         CheDoButton(true);
         CheDoComboBox(false);
         btnThem.Text = "Thêm";
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     listpDNNK = bllNDLTPKH.laydanhsachPhieuDNNK();
     LoaddulieulendatagridviewPhieuDeNghiNhapKho(dgvPhieuDNChuaLap, listpDNNK);
 }
Exemple #3
0
        public int ThemPhieuNhapKho(ePhieuNK newpnk)
        {
            if (Kiemtrasutontai(newpnk._maPhieuNhap))
            {
                return(0);
            }
            Tbl_PhieuNK pnkTmp = new Tbl_PhieuNK();

            pnkTmp.maPhieuNhap = newpnk._maPhieuNhap;
            pnkTmp.ngayLapNhap = newpnk._ngayLapNhap;
            pnkTmp.maNV        = newpnk._maNV;
            pnkTmp.msKho       = newpnk._msKho;
            pnkTmp.tinhTrang   = newpnk._tinhTrang;
            DB.Tbl_PhieuNKs.InsertOnSubmit(pnkTmp);
            DB.SubmitChanges();
            return(1);
        }
Exemple #4
0
        public List <ePhieuNK> laydanhsachphieuNhapKho()
        {
            var             listNK = DB.Tbl_PhieuNKs.ToList();
            List <ePhieuNK> ls     = new List <ePhieuNK>();

            foreach (Tbl_PhieuNK newNK in listNK)
            {
                ePhieuNK enk = new ePhieuNK();
                enk._maNV        = newNK.maNV;
                enk._maPhieuNhap = newNK.maPhieuNhap;
                enk._msKho       = newNK.msKho;
                enk._ngayLapNhap = newNK.ngayLapNhap;
                enk._tinhTrang   = newNK.tinhTrang;
                ls.Add(enk);
            }
            return(ls);
        }
Exemple #5
0
 public bool UpDatePhieuNK(ePhieuNK updatepnk)
 {
     try
     {
         Tbl_PhieuNK pnk = DB.Tbl_PhieuNKs.Single(x => x.maPhieuNhap == updatepnk._maPhieuNhap);
         pnk.maPhieuNhap = updatepnk._maPhieuNhap;
         pnk.ngayLapNhap = Convert.ToDateTime(updatepnk._ngayLapNhap);
         pnk.maNV        = updatepnk._maNV;
         pnk.msKho       = updatepnk._msKho;
         pnk.tinhTrang   = updatepnk._tinhTrang;
         DB.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemple #6
0
 public bool AddAllPhieuNK(ePhieuNK newpnk)
 {
     try
     {
         Tbl_PhieuNK pnk = DB.Tbl_PhieuNKs.Single(x => x.maPhieuNhap == newpnk._maPhieuNhap);
         pnk.maPhieuNhap = newpnk._maPhieuNhap;
         pnk.ngayLapNhap = Convert.ToDateTime(newpnk._ngayLapNhap);
         pnk.maNV        = newpnk._maNV;
         pnk.msKho       = newpnk._msKho;
         pnk.tinhTrang   = newpnk._tinhTrang;
         DB.Tbl_PhieuNKs.InsertOnSubmit(pnk);
         DB.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }