Exemple #1
0
        public void ObtenerDatos_Prestamo(PrestamoE entidad)
        {
            SqlConnection con     = new SqlConnection(Properties.Settings.Default.Conexion);
            SqlCommand    command = new SqlCommand("ObtenerDatos_PrestamoMaximo", con);

            command.Parameters.AddWithValue("@CantHijos", entidad.CantHijos);
            command.Parameters.AddWithValue("@Casado", entidad.Casado);
            command.Parameters.AddWithValue("@Vehiculo", entidad.Vehiculo);
            command.Parameters.AddWithValue("@Casa", entidad.Casa);
            command.Parameters.AddWithValue("@IDRangoRiesgo", entidad.IDRangoRiesgo);
            command.Parameters.AddWithValue("@INSS", entidad.INSS);
            command.Parameters.AddWithValue("@Salario", entidad.Salario);

            command.Parameters.Add("@PrestamoMaximo", SqlDbType.Decimal).Direction  = ParameterDirection.Output;
            command.Parameters.Add("@ValorPorcentual", SqlDbType.Decimal).Direction = ParameterDirection.Output;
            // Variables para Historial Cliente
            command.Parameters.Add("@VehiculoID", SqlDbType.Int).Direction = ParameterDirection.Output;
            command.Parameters.Add("@CasaID", SqlDbType.Int).Direction     = ParameterDirection.Output;
            command.Parameters.Add("@HijosID", SqlDbType.Int).Direction    = ParameterDirection.Output;
            command.Parameters.Add("@CasadoID", SqlDbType.Int).Direction   = ParameterDirection.Output;
            command.CommandType = CommandType.StoredProcedure;
            con.Open();
            command.ExecuteNonQuery();

            entidad.prestamoMaximo  = Convert.ToDecimal(command.Parameters["@PrestamoMaximo"].Value);
            entidad.ValorProcentual = Convert.ToDecimal(command.Parameters["@ValorPorcentual"].Value);

            //Variables para Historial Cliente
            entidad.HijosID    = Convert.ToInt32(command.Parameters["@HijosID"].Value);
            entidad.CasadoID   = Convert.ToInt32(command.Parameters["@CasadoID"].Value);
            entidad.CasaID     = Convert.ToInt32(command.Parameters["@CasaID"].Value);
            entidad.VehiculoID = Convert.ToInt32(command.Parameters["@VehiculoID"].Value);
            con.Close();
        }
Exemple #2
0
        public void Insertar_Prestamo(PrestamoE entidad)
        {
            SqlConnection con     = new SqlConnection(Properties.Settings.Default.Conexion);
            SqlCommand    command = new SqlCommand("Insertar_Prestamo", con);

            command.Parameters.AddWithValue("@ClienteID", entidad.ClienteID);
            command.Parameters.AddWithValue("@Prestamo", entidad.Prestamo);
            command.Parameters.AddWithValue("@IntervaloMeses", entidad.Meses);
            command.Parameters.AddWithValue("@Comision", entidad.Comision);
            command.Parameters.AddWithValue("@PagoxMes", entidad.PagoxMes);
            command.CommandType = CommandType.StoredProcedure;
            con.Open();
            command.ExecuteNonQuery();
            con.Close();
        }