locked
HELP ME!!!!! RRS feed

  • Question

  • User1692641958 posted

    Hello, I'm currently doing a web service rest, in which I have a method that returns two variables and if one of those varibles is empty or null execute a different method by passing the variable that is not empty or null.

    Here the method that returns two variables:
    PER_CON_CODIGO, PER_CON_SIGUIENTE_PERFIL, if PER_CON_SIGUIENTE_PERFIL is null or empty, execute a method to obtain obtenerPerfilesByContinuidad passing it the PER_CON_CODIGO that obtains from the method to obtenerPerfilContinuidad.

    Method obtenerPerfilContinuidad:

    public LaboratorioPerfil obtenerPerfilContinuidad(string id)
    {
    using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["Conexion"].ToString()))
    {
    StringBuilder errorMessages = new StringBuilder();
    LaboratorioPerfil lab = new LaboratorioPerfil();
    try
    {
    cn.Open();
    SqlCommand cmd = new SqlCommand("opGlobal.SP_SEL_CONTINUIDAD_CONTINUACION_BY_PERFIL", cn);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.AddWithValue("@PERFIL", id);
    SqlDataReader dr = cmd.ExecuteReader();
    while (dr.Read())
    {

    lab.PER_CON_CODIGO = dr.GetString(0);
    lab.PER_CON_SIGUIENTE_PERFIL = dr.GetString(0);


    }

    return lab;

    }
    catch (SqlException ex)
    {
    return null;

    }
    finally
    {
    cn.Close();
    }
    }

    }

    Here the method that I want to execute after

    Method obtenerPerfilesByContinuidad:

    public LaboratorioContinuidad obtenerPerfilesByContinuidad(string continuidad)
    {
    using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["Conexion"].ToString()))
    {
    LaboratorioContinuidad lab = new LaboratorioContinuidad();
    try
    {
    cn.Open();
    SqlCommand cmd = new SqlCommand("opGlobal.SP_SEL_PERFILES_BY_CONTINUIDAD", cn);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.AddWithValue("@CONTINUIDAD", continuidad);
    SqlDataReader dr = cmd.ExecuteReader();
    while (dr.Read())
    {

    lab.PER_CON_PRUEBAS_BASICAS = dr.GetString(0);


    }

    return lab;
    }
    catch (Exception)
    {

    return null;
    }
    finally
    {
    cn.Close();
    }

    }
    }

    Monday, September 17, 2018 4:57 PM

All replies

  • User839733648 posted

    Hi RockChris,

    execute a method to obtain obtenerPerfilesByContinuidad passing it the PER_CON_CODIGO that obtains from the method to obtenerPerfilContinuidad

    I do not fully understand what you want to do.

    Do you want to pass  PER_CON_CODIGO  which is not null or empty to the method  obtenerPerfilesByContinuidad?

    What is the function of the method  obtenerPerfilesByContinuidad?

    Is there any contacts between the two methods you’ve provided?

    If possible, please describe your requirement more in details so that it will be easier for us to help with you.

    Best Regards,

    Jenifer

    Tuesday, September 18, 2018 10:19 AM