Beispiel #1
0
 public static T Obter()
 {
     try
     {
         var context = new ContextDAO();
         return(context.database.Table <T>().FirstOrDefault());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #2
0
 public static void Alterar(T conf)
 {
     try
     {
         var context = new ContextDAO();
         context.database.Update(conf);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #3
0
 public static void Inserir(T conf)
 {
     try
     {
         var context = new ContextDAO();
         context.database.Insert(conf);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #4
0
 public static Parceiro Get()
 {
     try
     {
         var context = new ContextDAO();
         var retorno = context.database.Table <Parceiro>().FirstOrDefault();
         return(retorno);
     }
     catch (Exception e)
     {
         throw;
     }
 }
Beispiel #5
0
 public static bool InsertConfig(Parceiro c)
 {
     try
     {
         var context = new ContextDAO();
         context.database.DeleteAll <Parceiro>();
         return(context.database.Insert(c) > 0);
     }
     catch (Exception e)
     {
         throw;
     }
 }
Beispiel #6
0
        public static bool DeleteConfig()
        {
            try
            {
                var context = new ContextDAO();
                var config  = context.database.Table <Config>().FirstOrDefault();
                if (config != null)
                {
                    context.database.Delete(config);
                }

                return(true);
            }
            catch (Exception e)
            {
                throw;
            }
        }
Beispiel #7
0
 public static bool InsertConfig(Config c)
 {
     try
     {
         var context = new ContextDAO();
         c.CodConfig = 1;
         if (!context.database.Table <Config>().Any())
         {
             return(context.database.Insert(c) > 0);
         }
         else
         {
             return(context.database.Update(c) > 0);
         }
     }
     catch (Exception e)
     {
         throw;
     }
 }