コード例 #1
0
        private void txtChecar_Click(object sender, EventArgs e)
        {
            chart1.Series.Clear();
            a.setNome(cbMoeda.SelectedItem.ToString());
            int aux = b.getIds(a);

            chart1.Series.Add("Preco");
            chart1.Series["Preco"].ChartType  = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
            chart1.Series["Preco"].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime;
            listarHistorico(aux);
        }
コード例 #2
0
        private void btnCad_Click(object sender, EventArgs e)
        {
            if (txt_Nome.Text != "" && txt_Valor.Text != "")
            {
                a.setNome(txt_Nome.Text);
                string bufunfa = txt_Valor.Text;
                bufunfa = bufunfa.Replace("R$", string.Empty);
                bufunfa = bufunfa.Replace(" ", string.Empty);
                a.setValor(Double.Parse(bufunfa));

                b.criarMoeda(a);
            }
        }
コード例 #3
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            CadastroMoeda a = new CadastroMoeda();

            a.setId(int.Parse(txtId.Text));
            a.setNome(txtNome.Text);
            a.setValor(Double.Parse(txtValor.Text));
            a.setAttt(DateTime.Parse(txtAtt.Text));

            consultaDao.atualizarMoeda(a);

            listarTable();

            txtId.Clear();
            txtNome.Clear();
            txtAtt.Clear();
            txtValor.Clear();
        }
コード例 #4
0
        public CadastroMoeda listarMoeda(int id)
        {
            conn1 = classeConexão.obterConexao();
            if (conn1.State == ConnectionState.Open)
            {
                SqlCommand cmd = new SqlCommand("select * from Moeda where idMoeda = @id", conn1);
                cmd.Parameters.AddWithValue("@id", id);

                try
                {
                    CadastroMoeda a      = new CadastroMoeda();
                    SqlDataReader reader = cmd.ExecuteReader();

                    if (reader.Read())
                    {
                        a.setId(int.Parse(reader[0].ToString()));
                        a.setNome(reader[1].ToString());
                        a.setValor(Double.Parse(reader[2].ToString()));
                        a.setAttt(DateTime.Parse(reader[3].ToString()));
                        return(a);
                    }
                    else
                    {
                        return(null);
                    }
                }
                catch (Exception error)
                {
                    MessageBox.Show("Erro: " + error);

                    return(null);
                }
                finally
                {
                    classeConexão.fecharConexao();
                }
            }
            else
            {
                MessageBox.Show("Erro: " + conn1.State.ToString());
                return(null);
            }
        }