Beispiel #1
0
 public bool ThemPhieuNhap(PHIEU_NHAP pn)
 {
     try
     {
         qlkho.PHIEU_NHAPs.InsertOnSubmit(pn);
         qlkho.SubmitChanges();
         return(true);
     }
     catch { return(false); }
 }
Beispiel #2
0
 public bool SuaTTPhieuNhap(PHIEU_NHAP p)
 {
     try
     {
         PHIEU_NHAP k = qlkho.PHIEU_NHAPs.Where(t => t.MAPN == p.MAPN).FirstOrDefault();
         k = p;
         qlkho.SubmitChanges();
         return(true);
     }
     catch { return(false); }
 }
Beispiel #3
0
 public bool XoaPhieuNhap(string mapn)
 {
     try
     {
         PHIEU_NHAP p = qlkho.PHIEU_NHAPs.Where(t => t.MAPN == mapn).FirstOrDefault();
         qlkho.PHIEU_NHAPs.DeleteOnSubmit(p);
         qlkho.SubmitChanges();
         return(true);
     }
     catch { return(false); }
 }
        public decimal layTongTien(string maPN)
        {
            db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, db.PHIEU_NHAPs);
            var        tim = from p in db.PHIEU_NHAPs where p.MAPN.Equals(maPN) select p;
            PHIEU_NHAP pn  = tim.First();

            if (pn == null || pn.TONGTIEN == null)
            {
                return(0);
            }
            return(decimal.Parse(pn.TONGTIEN.ToString()));
        }
        public EStatus them(PHIEU_NHAP pn)
        {
            //ton?
            PHIEU_NHAP pTim = db.PHIEU_NHAPs.FirstOrDefault(n => n.MAPN == pn.MAPN);

            if (pTim != null)
            {
                return(EStatus.TRUNG_KHOA);
            }
            db.PHIEU_NHAPs.InsertOnSubmit(pn);
            db.SubmitChanges();
            return(EStatus.THANH_CONG);
        }
Beispiel #6
0
        public bool KTKhoaPhieuNhap(string mapn)
        {
            PHIEU_NHAP pn = sp.PHIEU_NHAPs.Where(t => t.MAPN == mapn).FirstOrDefault();

            if (pn == null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #7
0
        public string KiemTraTrung()
        {
            string     a  = MaPhieuNhap();
            PHIEU_NHAP pn = sp.PHIEU_NHAPs.Where(t => t.MAPN == a).FirstOrDefault();

            if (pn == null)
            {
                return(a);
            }
            else
            {
                return(KiemTraTrung());
            }
        }
 public bool them(PHIEU_NHAP pn, List <CT_PHIEU_NHAP> ctPNs)
 {
     if (ctPNs.Count == 0)
     {
         return(false);
     }
     try
     {
         db.PHIEU_NHAPs.InsertOnSubmit(pn);
         db.SubmitChanges();
         foreach (CT_PHIEU_NHAP ct in ctPNs)
         {
             db.CT_PHIEU_NHAPs.InsertOnSubmit(ct);
         }
         db.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
        public List <CT_PhieuNhap_Print> layPhieuNhap_s(PHIEU_NHAP pn, List <CT_PHIEU_NHAP> ctPhieuNhaps)
        {
            List <CT_PhieuNhap_Print> result = new List <CT_PhieuNhap_Print>();
            SanPham_DTO     sp;
            SanPham_DAL_BLL spDAL_BLL = new SanPham_DAL_BLL();

            foreach (CT_PHIEU_NHAP ct in ctPhieuNhaps)
            {
                sp = spDAL_BLL.laySanPham(ct.MASP);

                result.Add(new CT_PhieuNhap_Print
                {
                    MaPN     = pn.MAPN,
                    MaSP     = sp.MaSP,
                    TenSP    = sp.TenSP,
                    NgayNhap = pn.NGAYNHAP,
                    GiaNhap  = string.Format("{0:N0}", ct.GIANHAP),
                    SlNhap   = ct.SL_NHAP
                });
            }

            return(result);
        }