コード例 #1
0
 //Sua chi tiet pn
 public bool SuaCTNP(int pMaPN, int pMaSp, double pDonGia, int pNum)
 {
     try
     {
         detail_receipt_import check = _Coffee.detail_receipt_imports.Where(t => t.ID_RECEIPT_IMPORT.Equals(pMaPN) && t.ID_ITEM.Equals(pMaSp)).FirstOrDefault();
         if (check != null)
         {
             int numchang = pNum - check.NUMBER;
             check.ID_ITEM        = pMaSp;
             check.NUMBER         = pNum;
             check.PRICE_PURCHASE = pDonGia;
             dll.UpdateNumber(pMaSp, numchang);
             _Coffee.SubmitChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch
     {
         return(false);
     }
 }
コード例 #2
0
        //them moi chi tiet phieu nhap
        public bool ThemMoiCTPN(int pMaPN, int pMaSp, double pDonGia, int pNum)
        {
            try
            {
                detail_receipt_import check = _Coffee.detail_receipt_imports.Where(t => t.ID_RECEIPT_IMPORT.Equals(pMaPN) && t.ID_ITEM.Equals(pMaSp)).FirstOrDefault();
                if (check != null)
                {
                    return(false);
                }
                else
                {
                    detail_receipt_import add = new detail_receipt_import();
                    add.ID_RECEIPT_IMPORT = pMaPN;
                    add.ID_ITEM           = pMaSp;
                    add.PRICE_PURCHASE    = pDonGia;
                    add.NUMBER            = pNum;

                    _Coffee.detail_receipt_imports.InsertOnSubmit(add);
                    _Coffee.SubmitChanges();
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
        }
コード例 #3
0
 //Cap nhat ctpn
 public bool CapNhatCTPN(int pMaPN, int pMaSp, int pNum)
 {
     try
     {
         detail_receipt_import check = _Coffee.detail_receipt_imports.Where(t => t.ID_RECEIPT_IMPORT.Equals(pMaPN) && t.ID_ITEM.Equals(pMaSp)).FirstOrDefault();
         check.NUMBER = pNum;
         _Coffee.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
コード例 #4
0
 //Xoa chi tiet pn
 public bool XoaCTNP(int pMaPN, int pMaSp)
 {
     try
     {
         detail_receipt_import check = _Coffee.detail_receipt_imports.Where(t => t.ID_RECEIPT_IMPORT.Equals(pMaPN) && t.ID_ITEM.Equals(pMaSp)).FirstOrDefault();
         if (check != null)
         {
             _Coffee.detail_receipt_imports.DeleteOnSubmit(check);
             _Coffee.SubmitChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch
     {
         return(false);
     }
 }