public void Initialize()
 {
     using (ContextoFinanzas db = new ContextoFinanzas())
     {
         db.Database.Initialize(true);
     }
 }
Beispiel #2
0
 private void btnEliminarDatos_Click(object sender, EventArgs e)
 {
     using (ContextoFinanzas db = new ContextoFinanzas())
     {
         db.Database.ExecuteSqlCommand("DELETE FROM MONTOCATEGORIAS");
         db.Database.ExecuteSqlCommand("DELETE FROM PRESUPUESTOES;");
         db.Database.ExecuteSqlCommand("DELETE FROM GASTOES;");
         db.Database.ExecuteSqlCommand("DELETE FROM PALABRACLAVES;");
         db.Database.ExecuteSqlCommand("DELETE FROM CATEGORIAS;");
         db.Database.ExecuteSqlCommand("DELETE FROM MONEDAS;");
     }
 }
 public void CleanUp()
 {
     using (ContextoFinanzas db = new ContextoFinanzas())
     {
         db.Database.ExecuteSqlCommand("DELETE FROM MONTOCATEGORIAS");
         db.Database.ExecuteSqlCommand("DELETE FROM PRESUPUESTOES;");
         db.Database.ExecuteSqlCommand("DELETE FROM GASTOES;");
         db.Database.ExecuteSqlCommand("DELETE FROM PALABRACLAVES;");
         db.Database.ExecuteSqlCommand("DELETE FROM CATEGORIAS;");
         db.Database.ExecuteSqlCommand("DELETE FROM MONEDAS;");
     }
 }
Beispiel #4
0
 private void RegistroCategorias_Load(object sender, EventArgs e)
 {
     try
     {
         using (ContextoFinanzas db = new ContextoFinanzas())
         {
             db.Database.Connection.Open();
             db.Database.Connection.Close();
         }
     }
     catch (System.Data.Entity.Core.EntityException)
     {
         this.Enabled = false;
         MessageBox.Show("Error: La base de datos no se encuentra disponible");
     }
     catch (System.Data.SqlClient.SqlException)
     {
         this.Enabled = false;
         MessageBox.Show("Error: La base de datos no se encuentra disponible");
     }
 }
Beispiel #5
0
 public BaseController(ContextoFinanzas context)
 {
     this.context = context;
 }
 public CrudController(ContextoFinanzas context, IHostEnvironment hostEnv) : base(context)
 {
     _context = context;
     _hostEnv = hostEnv;
 }
 public AuthController(ContextoFinanzas context, IConfiguration configuration) : base(context)
 {
     this.context       = context;
     this.configuration = configuration;
 }