Exemple #1
0
        public void Cadastrar(BLL.VotosBLL v)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = con.Conectar();
            cmd.CommandText = @"INSERT INTO TBVotos(VOTO1, VOTO2, VOTO3, TOTALVOTOS
                                        )VALUES(@voto1, @voto2, @voto3, @totalvotos)";

            cmd.Parameters.AddWithValue("@voto1", v.Voto1);
            cmd.Parameters.AddWithValue("@voto2", v.Voto2);
            cmd.Parameters.AddWithValue("@voto3", v.Voto3);

            cmd.ExecuteNonQuery();
            con.Desconectar();
        }
        protected void BtnVoto_Click(object sender, EventArgs e)
        {
            BLL.VotosBLL v    = new BLL.VotosBLL();
            DAL.VotosDAL cdal = new DAL.VotosDAL();

            if (rdVoto1.Checked)
            {
                Response.Write("Você votou em " + rdVoto1.Text + " < br /> ");
            }
            else if (rdVoto2.Checked)
            {
                Response.Write("Você votou em " + rdVoto3.Text + "<br/>");
            }
            else
            {
                Response.Write("Você votou em " + rdVoto3.Text + "<br/>");
            }
        }