示例#1
0
        public bool editNFC(NFC objNFC)
        {
            using (EmarketEntities mdeEmarket = new EmarketEntities())
            {
                try
                {
                    int        idUser    = Convert.ToInt32(objNFC.idUser);
                    int        idScan    = Convert.ToInt32(objNFC.idScan);
                    int        StoreCNPJ = Convert.ToInt32(objNFC.StoreCNPJ);
                    NFCeEntity NFC       = mdeEmarket.NFCeEntities.Single(p => p.idNF == objNFC.idNF &&
                                                                          p.idUser == idUser &&
                                                                          p.idScan == idScan);

                    NFC.idNF      = objNFC.idNF;
                    NFC.idUser    = idUser;
                    NFC.idScan    = idScan;
                    NFC.StoreCNPJ = StoreCNPJ;
                    mdeEmarket.SaveChanges();
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
        }
示例#2
0
        public bool deleteNFC(NFC objNFC)
        {
            using (EmarketEntities mdeEmarket = new EmarketEntities())
            {
                try
                {
                    NFCeEntity NFC = mdeEmarket.NFCeEntities.Single(p => p.idNF == objNFC.idNF);

                    mdeEmarket.NFCeEntities.Remove(NFC);
                    mdeEmarket.SaveChanges();
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
        }
示例#3
0
        /***********************************************************************************************/


        /**************************************** NFC **************************************************/
        public bool createNFC(NFC objNFC)
        {
            using (EmarketEntities mdeEmarket = new EmarketEntities())
            {
                try
                {
                    int        idScan = Convert.ToInt32(objNFC.idScan);
                    int        idUser = Convert.ToInt32(objNFC.idUser);
                    NFCeEntity entNFC = new NFCeEntity();
                    entNFC.idNF      = objNFC.idNF;
                    entNFC.idUser    = idUser;
                    entNFC.idScan    = idScan;
                    entNFC.StoreCNPJ = objNFC.StoreCNPJ;
                    mdeEmarket.NFCeEntities.Add(entNFC);
                    mdeEmarket.SaveChanges();
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
        }