public CuentaAmiga ObtenerCuentaAmiga(int id_cuenta_amiga) { CuentaAmiga ca = new CuentaAmiga(); string sql = $"SELECT * FROM CuentasAmigas WHERE id_cuenta_amiga = '{id_cuenta_amiga}';"; ca = GestorBD.GetObject <CuentaAmiga>(sql); return(ca); }
public Operacion ObtenerOperacion(int id_operacion, int CVU_cuenta) { Operacion opc = new Operacion(); string sql = $"SELECT * FROM OPERACIONES WHERE id_operacion = '{id_operacion}' AND CVU_cuenta = '{CVU_cuenta}';"; opc = GestorBD.GetObject <Operacion>(sql); string sql2 = $"SELECT id_tipo_operacion, descripcion, nombre FROM OPERACIONESTIPO WHERE id_tipo_operacion = '{opc.id_tipo_operacion}';"; opc.operacionTipo = GestorBD.GetObject <OperacionTipo>(sql2); string sql3 = $"SELECT id_moneda, nombre FROM MONEDAS WHERE id_moneda = '{opc.id_moneda}';"; opc.moneda = GestorBD.GetObject <Moneda>(sql3); return(opc); }
public List <Operacion> ObtenerOperaciones(int CVU_cuenta) { List <Operacion> listOperaciones = new List <Operacion>(); string sql = $"SELECT * FROM OPERACIONES WHERE CVU_cuenta = '{CVU_cuenta}';"; listOperaciones = GestorBD.GetList <Operacion>(sql); foreach (var opc in listOperaciones) { string sql2 = $"SELECT * FROM OPERACIONESTIPO WHERE id_tipo_operacion = '{opc.id_tipo_operacion}';"; opc.operacionTipo = GestorBD.GetObject <OperacionTipo>(sql2); string sql3 = $"SELECT * FROM MONEDAS WHERE id_moneda = '{opc.id_moneda}';"; opc.moneda = GestorBD.GetObject <Moneda>(sql3); } return(listOperaciones); }
public Usuario ObtenerUsuario(string usuario, string contrasenia) { Usuario user = new Usuario(); contrasenia = Security.Encrypt(contrasenia); string sql = $"SELECT * FROM USUARIOS WHERE usuario = '{usuario}' and contrasenia = '{contrasenia}';"; user = GestorBD.GetObject <Usuario>(sql); if (user != null) { string sql2 = $"SELECT * FROM BARRIOS WHERE id_barrio = '{user.id_barrio}';"; user.barrio = GestorBD.GetObject <Barrio>(sql2); user.contrasenia = Security.Decrypt(user.contrasenia); } return(user); }
public Cuenta ObtenerCuentaFiltro(string filtro) { Cuenta cta = new Cuenta(); string sql = $"SELECT TOP 1 * FROM CUENTAS WHERE usuario = '{filtro}' OR alias = '{filtro}'"; int filtroCVU; bool success = Int32.TryParse(filtro, out filtroCVU); if (success) { sql += $"OR CVU = {filtroCVU}"; } cta = GestorBD.GetObject <Cuenta>(sql); if (cta != null) { string sql2 = $"SELECT * FROM CUENTATIPO WHERE id_tipo_cuenta = '{cta.id_tipo_cuenta}';"; cta.cuentaTipo = GestorBD.GetObject <CuentaTipo>(sql2); string sql3 = $"SELECT * FROM USUARIOS WHERE usuario = '{cta.usuario}';"; cta.user = GestorBD.GetObject <Usuario>(sql3); } return(cta); }
public Cuenta ObtenerCuenta(string usuario) { Cuenta cta = new Cuenta(); string sql = $"SELECT * FROM CUENTAS WHERE usuario = '{usuario}';"; cta = GestorBD.GetObject <Cuenta>(sql); if (cta != null) { string sql2 = $"SELECT * FROM CUENTATIPO WHERE id_tipo_cuenta = '{cta.id_tipo_cuenta}';"; cta.cuentaTipo = GestorBD.GetObject <CuentaTipo>(sql2); if (cta.cuentaTipo != null) { string sqlMoneda = $"SELECT * FROM Monedas WHERE id_moneda = '{cta.cuentaTipo.id_moneda}';"; cta.cuentaTipo.moneda = GestorBD.GetObject <Moneda>(sqlMoneda); } string sql3 = $"SELECT * FROM USUARIOS WHERE usuario = '{cta.usuario}';"; cta.user = GestorBD.GetObject <Usuario>(sql3); } return(cta); }