1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| protected void btnValider_click(object sender, EventArgs e)
{
Reponse reponse = new Reponse();
DataSet dtsReponseUser = reponse.ListerUtilisateur(Session["IdUtilisateur"].ToString(), strPage);
if (dtsReponseUser.Tables[0].Rows.Count > 0)
{
//Si l'utilisateur a deja repondu au sondage, on supprime ses anciennes reponses
int b;
b = verificationUtilisateur();
if (b != 0)
{
reponse.iFormulaire = 1;
if (reponse.SupprimerAllReponseUser(Session["IdUtilisateur"].ToString(), strPage) == 0)
Response.Redirect(Application["pageProblemeBD"].ToString(), false);
}
}
foreach (GridViewRow rowQuestion in gvQuestion.Rows)
{
int Formul = 1;
string strIdQuestion = ((Label)rowQuestion.FindControl("lblId")).Text;
RadioButton rbOui = (RadioButton)rowQuestion.FindControl("rbReponseOui");
RadioButton rbNon = (RadioButton)rowQuestion.FindControl("rbReponseNon");
reponse.iFormulaire = Formul;
reponse.iUtilisateur = Convert.ToInt32(Session["IdUtilisateur"].ToString());
reponse.strQuestion = strIdQuestion;
if (rbOui.Checked)
reponse.strReponseUtilisateur = "Oui";
else if (rbNon.Checked)
reponse.strReponseUtilisateur = "Non";
else
reponse.strReponseUtilisateur = "Non Repondu";
if (Request.QueryString["id"] == null)
{
if (reponse.AjouterReponse(Session["IdUtilisateur"].ToString(), strPage) == 0)
Response.Redirect(Application["pageProblemeBD"].ToString(), false);
}
else
{
if (reponse.ModifierReponse(Session["IdUtilisateur"].ToString(), strPage) == 0)
Response.Redirect(Application["pageProblemeBD"].ToString(), false);
}
} |
Partager