コード例 #1
0
 public Acao(string codAtivo, double cotacaoAtual, string empresa, SegmentoEmpresa segmento, double lucroAnoAnt, int quantAcoes, double dividaLiquida, double patrimonioLiquido)
     : base(codAtivo, cotacaoAtual)
 {
     Empresa           = empresa;
     Segmento          = segmento;
     LucroAnoAnt       = lucroAnoAnt;
     QuantAcoes        = quantAcoes;
     DividaLiquida     = dividaLiquida;
     PatrimonioLiquido = patrimonioLiquido;
 }
コード例 #2
0
    public static List <SegmentoEmpresa> Listar(int pintIdIdioma = 0, int pintId = 0)
    {
        string        strConectionString = ConfigurationManager.ConnectionStrings["BradescoRI"].ConnectionString;
        SqlConnection objConexao         = new SqlConnection(strConectionString);

        SqlCommand objComando = new SqlCommand("SPE_L_SEGMENTO_EMPRESA");

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

        ///Parametros
        if (pintIdIdioma > 0)
        {
            objComando.Parameters.Add("@idiomaId", SqlDbType.Int).Value = pintIdIdioma;
        }
        if (pintId > 0)
        {
            objComando.Parameters.Add("@segmentoEmpresaId", SqlDbType.Int).Value = pintId;
        }

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

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

            IDataReader idrReader = default(IDataReader);

            idrReader = objComando.ExecuteReader();

            while ((idrReader.Read()))
            {
                obj = new SegmentoEmpresa();
                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();
            }
        }
    }
コード例 #3
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            string          empresa           = txbNome.Text;
            string          codAtivo          = txbCod.Text;
            SegmentoEmpresa segmento          = (SegmentoEmpresa)cmbSegmento.SelectedItem;
            double          patrimonioLiquido = double.Parse(txbPatrimonio.Text);
            double          dividaLiquida     = double.Parse(txbDivida.Text);
            double          lucroAnoAnt       = double.Parse(txbLucro.Text);
            int             quantAcoes        = int.Parse(txbQuantAcoes.Text);
            double          preco             = double.Parse(txbPreco.Text);

            Acao a = new Acao(codAtivo, preco, empresa, segmento, lucroAnoAnt, quantAcoes, dividaLiquida, patrimonioLiquido);

            CadastratAcao(a);
            LimparCampos();
        }