Exemple #1
0
    private void CarregarObjetos(Utilitarios.TipoTransacao objTipoTransacao)
    {
        switch (objTipoTransacao)
        {
        //Novo Grupo
        case Utilitarios.TipoTransacao.Limpar:
            codigo = 0;

            txtGrupo.Text = string.Empty;

            break;

        //Carregar Dados do Grupo
        case Utilitarios.TipoTransacao.Salvar:

            if (gobjGrupoLinks == null)
            {
                gobjGrupoLinks = new GrupoLinks();
            }

            gobjGrupoLinks.Descricao = txtGrupo.Text;

            break;
        }
    }
Exemple #2
0
    public static List <GrupoLinks> ListarGrupos()
    {
        string        strConectionString = ConfigurationManager.ConnectionStrings["BradescoRI"].ConnectionString;
        SqlConnection objConexao         = new SqlConnection(strConectionString);

        SqlCommand objComando = new SqlCommand("SPE_L_GRUPO_LINKS");

        objComando.Connection  = objConexao;
        objComando.CommandType = CommandType.StoredProcedure;


        try
        {
            //Abre Conexao
            objConexao.Open();

            //Declara variavel de retorno
            List <GrupoLinks> objList = new List <GrupoLinks>();
            GrupoLinks        obj     = default(GrupoLinks);

            IDataReader idrReader = default(IDataReader);

            idrReader = objComando.ExecuteReader();

            while ((idrReader.Read()))
            {
                obj = new GrupoLinks();
                obj.FromIDataReader(idrReader);
                objList.Add(obj);
            }

            return(objList);
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            //Fecha a conexao se aberta
            if (objConexao.State != ConnectionState.Closed)
            {
                objConexao.Close();
            }
        }
    }
Exemple #3
0
    public static GrupoLinks ObterGrupo(int pintIdGrupo)
    {
        string        strConectionString = ConfigurationManager.ConnectionStrings["BradescoRI"].ConnectionString;
        SqlConnection objConexao         = new SqlConnection(strConectionString);

        SqlCommand objComando = new SqlCommand("SPE_L_GRUPO_LINKS_ID");

        objComando.Connection  = objConexao;
        objComando.CommandType = CommandType.StoredProcedure;

        objComando.Parameters.Add("@grupoId", SqlDbType.Int).Value = pintIdGrupo;

        try
        {
            objConexao.Open();

            GrupoLinks obj = new GrupoLinks();

            IDataReader idrReader = default(IDataReader);

            idrReader = objComando.ExecuteReader();

            while ((idrReader.Read()))
            {
                obj.FromIDataReader(idrReader);
            }

            return(obj);
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            //Fecha a conexao se aberta
            if (objConexao.State != ConnectionState.Closed)
            {
                objConexao.Close();
            }
        }
    }
Exemple #4
0
    public static int InserirGrupo(GrupoLinks pobjGrupoLinks)
    {
        string        strConectionString = ConfigurationManager.ConnectionStrings["BradescoRI"].ConnectionString;
        SqlConnection objConexao         = new SqlConnection(strConectionString);

        SqlCommand objComando = new SqlCommand("SPE_I_GRUPO_LINKS");

        objComando.Connection  = objConexao;
        objComando.CommandType = CommandType.StoredProcedure;

        //Define parametros da procedure
        objComando.Parameters.Add("@descricao", SqlDbType.VarChar, 100).Value = pobjGrupoLinks.Descricao;

        try
        {
            //Abre conexão com o banco de dados
            objConexao.Open();

            //Declara variavel de retorno
            int intRetorno = 0;

            //Executa comando no banco de dados
            intRetorno = objComando.ExecuteNonQuery();

            return(intRetorno);
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            //Fecha a conexao se aberta
            if (objConexao.State != ConnectionState.Closed)
            {
                objConexao.Close();
            }
        }
    }