예제 #1
0
        public void ObtenerRango(RangoE entidad)
        {
            SqlConnection con     = new SqlConnection(Properties.Settings.Default.Conexion);
            SqlCommand    command = new SqlCommand("Rango_Seleccionar", con);

            command.Parameters.AddWithValue("@Prestamo", entidad.Prestamo);

            command.Parameters.Add("@MesMin", SqlDbType.Int).Direction          = ParameterDirection.Output;
            command.Parameters.Add("@MesMax", SqlDbType.Int).Direction          = ParameterDirection.Output;
            command.Parameters.Add("@Comision", SqlDbType.Decimal).Direction    = ParameterDirection.Output;
            command.Parameters.Add("@TasaInteres", SqlDbType.Decimal).Direction = ParameterDirection.Output;
            command.Parameters.Add("@Mora", SqlDbType.Decimal).Direction        = ParameterDirection.Output;
            command.Parameters.Add("@Seguro", SqlDbType.Decimal).Direction      = ParameterDirection.Output;
            command.Parameters.Add("@Rango", SqlDbType.Int).Direction           = ParameterDirection.Output;

            //Estableciendo escala a 4
            command.Parameters["@Comision"].Precision    = 4;
            command.Parameters["@TasaInteres"].Precision = 4;
            command.Parameters["@Seguro"].Precision      = 4;
            command.Parameters["@Comision"].Scale        = 4;
            command.Parameters["@TasaInteres"].Scale     = 4;
            command.Parameters["@Seguro"].Scale          = 4;

            command.CommandType = CommandType.StoredProcedure;
            con.Open();
            command.ExecuteNonQuery();

            entidad.RangoID     = Convert.ToInt32(command.Parameters["@Rango"].Value);
            entidad.MesMin      = Convert.ToInt32(command.Parameters["@MesMin"].Value);
            entidad.MesMax      = Convert.ToInt32(command.Parameters["@MesMax"].Value);
            entidad.Comision    = Convert.ToDecimal(command.Parameters["@Comision"].Value);
            entidad.TasaInteres = Convert.ToDecimal(command.Parameters["@TasaInteres"].Value);
            entidad.Mora        = Convert.ToInt32(command.Parameters["@Mora"].Value);
            entidad.Seguro      = Convert.ToDecimal(command.Parameters["@Seguro"].Value);
        }
예제 #2
0
        public Int32 Modificar(RangoE entidad)
        {
            Int32         wea     = 0;
            SqlConnection con     = new SqlConnection(Properties.Settings.Default.Conexion);
            SqlCommand    command = new SqlCommand("Modificar_Rango", con);

            command.Parameters.AddWithValue("@RangoID", entidad.RangoID);
            command.Parameters.AddWithValue("@TasaInteres", entidad.TasaInteres);
            command.Parameters.AddWithValue("@Comision", entidad.Comision);
            command.Parameters.AddWithValue("@Mora", entidad.Mora);
            command.Parameters.AddWithValue("@Seguro", entidad.Seguro);
            command.CommandType = CommandType.StoredProcedure;
            con.Open();
            wea = Convert.ToInt32(command.ExecuteScalar());
            con.Close();
            return(wea);
        }