primera version estable
This commit is contained in:
48
bdEmtusa/dbcontext/conexion.cs
Normal file
48
bdEmtusa/dbcontext/conexion.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
using tsUtilidades.Enumeraciones;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace bdEmtusa.dbcontext
|
||||
{
|
||||
public class Conexion
|
||||
{
|
||||
public string Nombre { get; set; }
|
||||
public string Servidor { get; set; }
|
||||
public int Puerto { get; set; }
|
||||
|
||||
public string Database { get; set; }
|
||||
public string Usuario { get; set; }
|
||||
public string Contraseña { get; set; }
|
||||
|
||||
|
||||
public static List<Conexion> ListaConexiones()
|
||||
{
|
||||
List<Conexion> lc = new List<Conexion>();
|
||||
lc.Add(new Conexion() { Nombre = "Producción", Puerto = 3306, Servidor = "192.168.41.56", Usuario = "root", Contraseña = "0êmF/e#g/*6pZÛLWqölLvPp", Database = "gestionemtusa" });
|
||||
return lc;
|
||||
}
|
||||
internal static string ObtieneConexionDefecto(string NombreConexion="Producción")
|
||||
{
|
||||
try
|
||||
{
|
||||
// server=10.10.10.1;database=Emtusa;port=3306;uid=root;pwd=larga;persistsecurityinfo=True;TreatTinyAsBoolean=False;allowuservariables=True
|
||||
string cs = @";persistsecurityinfo=True;TreatTinyAsBoolean=False;allowuservariables=True";
|
||||
var lc = ListaConexiones();
|
||||
|
||||
var cn = lc.First(x => x.Nombre == NombreConexion);
|
||||
cs = "server=" + cn.Servidor + ";pwd=" + tsUtilidades.crypt.FEncS(cn.Contraseña, @"[JO1]", @"[JD1]", -875421649) + ";port=" + cn.Puerto.ToString() + ";uid=" + cn.Usuario + ";database=" + cn.Database + cs;
|
||||
return cs;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception(ex.Message, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user