Beispiel #1
0
        private void Button1_Click(object sender, EventArgs e)
        {
            folhaPagamento fol = new folhaPagamento();

            fol.Salario_bruto = float.Parse(textBox1.Text);
            textBox2.Text     = fol.Somar_INSS().ToString("C");
        }
Beispiel #2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            //float salario1;
            string nome;
            //float soma;
            folhaPagamento folha = new folhaPagamento();

            MySqlDataAdapter adapter   = new MySqlDataAdapter();
            MySqlDataReader  rdl       = null;
            string           stconexao = "Select nomefun,salariofun from funcionario";
            MySqlConnection  conect1   = new MySqlConnection();

            conect1 = new MySqlConnection("Persist Security Info = False; Server=localhost;Database=erp;Uid=root;Pwd='root' ");
            conect1.Open();
            MySqlCommand cmd = new MySqlCommand(stconexao, conect1);

            rdl = cmd.ExecuteReader();
            while (rdl.Read())
            {
                nome = rdl[0].ToString();

                folha.Salario_bruto = float.Parse(rdl[1].ToString());
                // soma = salario1 + 100;
                DataTable tabela = new DataTable();
                tabela.Columns.Add("Nome", typeof(string));
                tabela.Columns.Add("Salario", typeof(float));
                tabela.Columns.Add("Soma", typeof(float));


                DataRow linha = tabela.NewRow();
                linha[0] = nome.ToString();
                linha[1] = folha.Salario_bruto.ToString();

                linha[2] = folha.Somar_INSS().ToString();
                tabela.Rows.Add();

                lista.Items.Add(linha[0] + "-" + linha[1] + "-" + linha[2]);
            }
        }