Example #1
0
 public virtual void Update(T data)
 {
     using (var conn = SQLiteDb.GetConnection())
     {
         conn.Update(data);
     }
 }
Example #2
0
 public virtual void Delete(T data)
 {
     using (var conn = SQLiteDb.GetConnection())
     {
         conn.Delete <T>(data.Id);
     }
 }
Example #3
0
 public virtual T GetById(int id)
 {
     using (var conn = SQLiteDb.GetConnection())
     {
         return(conn.Get <T>(id));
     }
 }
Example #4
0
 public virtual IList <T> List()
 {
     using (var conn = SQLiteDb.GetConnection())
     {
         return(conn.Table <T>().ToList());
     }
 }
Example #5
0
 public virtual T Insert(T data)
 {
     using (var conn = SQLiteDb.GetConnection())
     {
         conn.Insert(data);
         return(data);
     }
 }
Example #6
0
 public IList <NFcItem> ListByNFc(int nfcId)
 {
     using (var conn = SQLiteDb.GetConnection())
     {
         return(conn.Table <NFcItem>()
                .Where(item => item.NFcId == nfcId)
                .ToList());
     }
 }
        public NFcComercio FindByCnpjOrNew(NFcComercio comercio)
        {
            using (var conn = SQLiteDb.GetConnection())
            {
                var comercioExistente = conn.Table <NFcComercio>()
                                        .Where(nfcc => nfcc.CNPJ == comercio.CNPJ)
                                        .FirstOrDefault();
                if (comercioExistente == null)
                {
                    return(Insert(comercio));
                }

                return(comercioExistente);
            }
        }
        public override NFc GetById(int id)
        {
            using (var conn = SQLiteDb.GetConnection())
            {
                var nfc = conn.Get <NFc>(id);
                if (nfc == null)
                {
                    return(nfc);
                }

                nfc.Comercio = _nfcComercioService.GetById(nfc.ComercioId);
                nfc.Itens    = _nfcItemService.ListByNFc(nfc.Id);

                return(nfc);
            }
        }