void AfficherOnReponduATout() { if (Page.IsPostBack == false) { ListBoxQui.Items.Clear(); PersonnesOntReponduATout.Clear(); } PanelReponses.Controls.Clear(); PanelReponsesEnBas.Controls.Clear(); AfficherVotantEnModePrint(); AfficherEnHautReponsesDeSousPopulation(); if (PollAnswerID.Count > 0) { // Afficher les questions et les reponses en bas du formulaire // Une seule reponse cliquee par l'utilisateur if (PollAnswerID.Count == 1) { // Afficher la seule Reponse et la seule Question Label labelQ = new Label(); labelQ.CssClass = "LabelQuestionStyle"; labelQ.Text = Questions[0].Rank.ToString() + " - " + Questions[0].Question; PanelReponsesEnBas.Controls.Add(labelQ); Label labelBR = new Label(); labelBR.Text = "<br/>"; PanelReponsesEnBas.Controls.Add(labelBR); Label labelR = new Label(); labelR.CssClass = "HyperLinkQuestionEnCoursStyle"; labelR.Text = Reponses[0].Rank.ToString() + " - " + Reponses[0].Answer; PanelReponsesEnBas.Controls.Add(labelR); Label labelBR1 = new Label(); labelBR1.Text = "<br/>"; PanelReponsesEnBas.Controls.Add(labelBR1); Guid pollAnswerID = new Guid(PollAnswerID[0].ToString()); Table table = new Table(); int idx = 0; foreach (Personne p in Personnes) { //PollVoteCollection pvc = Votes.FindByPersonneGUID( p.PersonneGUID ); PollVoteCollection pvc = TableauVotesPersonnes[idx].FindByAnswerID(pollAnswerID); foreach (PollVote pv in pvc) { string personne = FormatPersonne(p); if (Page.IsPostBack == false) { if (SessionState.Questionnaire.Anonymat) { personne = "personne" + idx.ToString(); Personne anonymat = new Personne(); anonymat = p; anonymat.Nom = personne; anonymat.Prenom = ""; anonymat.EmailBureau = ""; ListBoxQui.Items.Add(personne); PersonnesOntReponduATout.Add(anonymat); } else { ListBoxQui.Items.Add(personne); PersonnesOntReponduATout.Add(p); } } // Table de Reponses des Interviewes TableCell cellP = new TableCell(); TableRow rowP = new TableRow(); if (SessionState.CheckBox["CheckBoxAfficherDateVote"]) { TableCell cellD = new TableCell(); cellD.Text = pv.CreationDate.ToString(); rowP.Cells.Add(cellD); } cellP.Text = Strings.TexteToHTML(personne); cellP.CssClass = "TableReponsePersonneStyle"; rowP.Cells.Add(cellP); table.Rows.Add(rowP); // Pour les reponses textuelles if (pv.Vote != "") { TableCell cellV = new TableCell(); TableRow rowV = new TableRow(); cellV.Text = Strings.TexteToHTML(pv.Vote); //cell.CssClass = "TableReponsePersonneStyle"; rowV.Cells.Add(cellV); table.Rows.Add(rowV); } } idx += 1; } PanelReponsesEnBas.Controls.Add(table); } else // Reponse multiples cliquee par l'utilisateur { // Remplir d'abord ListBoxQui trouver au passage les personnes qui ont // repondu a tout int idx = 0; foreach (Personne p in Personnes) { //PollVoteCollection pvc = Votes.FindByPersonneGUID( p.PersonneGUID ); PollVoteCollection pvc = TableauVotesPersonnes[idx]; bool aReponduATout = true; foreach (Guid guid in PollAnswerID) { bool aRepondu = false; foreach (PollVote pv in pvc) { if (guid == pv.PollAnswerId) { aRepondu = true; break; } } aReponduATout = aReponduATout & aRepondu; if (aRepondu == false) { break; } } if (aReponduATout) { string personne = FormatPersonne(p); if (Page.IsPostBack == false) { if (SessionState.Questionnaire.Anonymat) { personne = "personne" + idx.ToString(); Personne anonymat = new Personne(); anonymat = p; anonymat.Nom = personne; anonymat.Prenom = ""; anonymat.EmailBureau = ""; anonymat.Civilite = ""; anonymat.TelephonePerso = ""; ListBoxQui.Items.Add(personne); PersonnesOntReponduATout.Add(anonymat); } else { ListBoxQui.Items.Add(personne); PersonnesOntReponduATout.Add(p); } } } idx += 1; } int i = 0; foreach (Guid pollAnswerGUID in PollAnswerID) { // Afficher la Reponse et le Question Label labelQ = new Label(); labelQ.CssClass = "LabelQuestionStyle"; labelQ.Text = Questions[i].Rank.ToString() + " - " + Questions[i].Question; PanelReponsesEnBas.Controls.Add(labelQ); Label labelBR = new Label(); labelBR.Text = "<br/>"; PanelReponsesEnBas.Controls.Add(labelBR); Label labelR = new Label(); labelR.CssClass = "HyperLinkQuestionEnCoursStyle"; labelR.Text = Reponses[i].Rank.ToString() + " - " + Reponses[i].Answer; PanelReponsesEnBas.Controls.Add(labelR); Label labelBR1 = new Label(); labelBR1.Text = "<br/>"; PanelReponsesEnBas.Controls.Add(labelBR1); i = i + 1; Table table = new Table(); idx = 0; foreach (Personne p in PersonnesOntReponduATout) { //PollVoteCollection pvc = Votes.FindByPersonneGUID( p.PersonneGUID ); PollVoteCollection pvc = TableauVotesPersonnesOntReponduATout[idx].FindByAnswerID(pollAnswerGUID); string personne = FormatPersonne(p); foreach (PollVote pv in pvc) { // Table de Reponses des Interviewes TableCell cellP = new TableCell(); TableRow rowP = new TableRow(); if (SessionState.CheckBox["CheckBoxAfficherDateVote"]) { TableCell cellD = new TableCell(); cellD.Text = pv.CreationDate.ToString(); rowP.Cells.Add(cellD); } cellP.Text = Strings.TexteToHTML(personne); cellP.CssClass = "TableReponsePersonneStyle"; rowP.Cells.Add(cellP); table.Rows.Add(rowP); // Pour les reponses textuelles if (pv.Vote != "") { TableCell cellV = new TableCell(); TableRow rowV = new TableRow(); cellV.Text = Strings.TexteToHTML(pv.Vote); //cell.CssClass = "TableReponsePersonneStyle"; rowV.Cells.Add(cellV); table.Rows.Add(rowV); } } idx += 1; } PanelReponsesEnBas.Controls.Add(table); } } Label labelCount = new Label(); labelCount.Text = "Nombre de réponses : " + ListBoxQui.Items.Count.ToString(); PanelReponsesEnBas.Controls.Add(labelCount); initTableauVotesPersonnesOntReponduATout(PersonnesOntReponduATout.Count, PersonnesOntReponduATout); } }
void AfficherTout() { if (Page.IsPostBack == false) { ListBoxQui.Items.Clear(); PersonnesOntReponduATout.Clear(); } PanelReponses.Controls.Clear(); PanelReponsesEnBas.Controls.Clear(); // Afficher toute les questions et toutes les reponses en haut du formulaire for (int i = 0; i < Questions.Count; i++) { Label labelQ = new Label(); labelQ.CssClass = "LabelQuestionStyle"; labelQ.Text = Questions[i].Rank.ToString() + " - " + Questions[i].Question; PanelReponses.Controls.Add(labelQ); Label labelBR = new Label(); labelBR.Text = "<br/>"; PanelReponses.Controls.Add(labelBR); Label labelR = new Label(); labelR.CssClass = "HyperLinkQuestionEnCoursStyle"; labelR.Text = Reponses[i].Rank.ToString() + " - " + Reponses[i].Answer; PanelReponses.Controls.Add(labelR); Label labelBR1 = new Label(); labelBR1.Text = "<br/>"; PanelReponses.Controls.Add(labelBR1); } if (PollAnswerID.Count > 0) { // Afficher les questions et les reponses en bas du formulaire // Une seule reponse cliquee par l'utilisateur if (PollAnswerID.Count == 1) { // Afficher la seule Reponse et la seule Question Label labelQ = new Label(); labelQ.CssClass = "LabelQuestionStyle"; labelQ.Text = Questions[0].Rank.ToString() + " - " + Questions[0].Question; PanelReponsesEnBas.Controls.Add(labelQ); Label labelBR = new Label(); labelBR.Text = "<br/>"; PanelReponsesEnBas.Controls.Add(labelBR); Label labelR = new Label(); labelR.CssClass = "HyperLinkQuestionEnCoursStyle"; labelR.Text = Reponses[0].Rank.ToString() + " - " + Reponses[0].Answer; PanelReponsesEnBas.Controls.Add(labelR); Label labelBR1 = new Label(); labelBR1.Text = "<br/>"; PanelReponsesEnBas.Controls.Add(labelBR1); Guid pollAnswerID = new Guid(PollAnswerID[0].ToString()); Table table = new Table(); foreach (Personne p in Personnes) { PollVoteCollection pvc = Votes.FindByPersonneGUID(p.PersonneGUID); foreach (PollVote pv in pvc) { if (pollAnswerID == pv.PollAnswerId) { string personne = p.Nom + "/" + p.Prenom + "/" + p.EmailBureau; if (Page.IsPostBack == false) { ListBoxQui.Items.Add(personne); PersonnesOntReponduATout.Add(p); } // Table de Reponses des Interviewes //TableCell cellP = new TableCell(); //TableRow rowP = new TableRow(); //cellP.Text = Strings.TexteToHTML( personne ); //cellP.CssClass = "TableReponsePersonneStyle"; //rowP.Cells.Add( cellP ); //table.Rows.Add( rowP ); // Pour les reponses textuelles if (pv.Vote != "") { TableCell cellV = new TableCell(); TableRow rowV = new TableRow(); cellV.Text = Strings.TexteToHTML(pv.Vote); //cell.CssClass = "TableReponsePersonneStyle"; rowV.Cells.Add(cellV); table.Rows.Add(rowV); } } } } PanelReponsesEnBas.Controls.Add(table); } else // Reponse multiples cliquee par l'utilisateur { // Remplir d'abord ListBoxQui trouver au passage les personnes qui ont // repondu a tout foreach (Personne p in Personnes) { PollVoteCollection pvc = Votes.FindByPersonneGUID(p.PersonneGUID); bool aReponduATout = true; foreach (Guid guid in PollAnswerID) { bool aRepondu = false; foreach (PollVote pv in pvc) { if (guid == pv.PollAnswerId) { aRepondu = true; break; } } aReponduATout = aReponduATout & aRepondu; if (aRepondu == false) { break; } } if (aReponduATout) { string personne = p.Nom + "/" + p.Prenom + "/" + p.EmailBureau; if (Page.IsPostBack == false) { ListBoxQui.Items.Add(personne); PersonnesOntReponduATout.Add(p); } } } int i = 0; foreach (Guid pollAnswerGUID in PollAnswerID) { // Afficher la Reponse et le Question Label labelQ = new Label(); labelQ.CssClass = "LabelQuestionStyle"; labelQ.Text = Questions[i].Rank.ToString() + " - " + Questions[i].Question; PanelReponsesEnBas.Controls.Add(labelQ); Label labelBR = new Label(); labelBR.Text = "<br/>"; PanelReponsesEnBas.Controls.Add(labelBR); Label labelR = new Label(); labelR.CssClass = "HyperLinkQuestionEnCoursStyle"; labelR.Text = Reponses[i].Rank.ToString() + " - " + Reponses[i].Answer; PanelReponsesEnBas.Controls.Add(labelR); Label labelBR1 = new Label(); labelBR1.Text = "<br/>"; PanelReponsesEnBas.Controls.Add(labelBR1); i = i + 1; Table table = new Table(); foreach (Personne p in PersonnesOntReponduATout) { PollVoteCollection pvc = Votes.FindByPersonneGUID(p.PersonneGUID); string personne = p.Nom + "/" + p.Prenom + "/" + p.EmailBureau; foreach (PollVote pv in pvc) { if (pv.PollAnswerId == pollAnswerGUID) { // Table de Reponses des Interviewes //TableCell cellP = new TableCell(); //TableRow rowP = new TableRow(); //cellP.Text = Strings.TexteToHTML( personne ); //cellP.CssClass = "TableReponsePersonneStyle"; //rowP.Cells.Add( cellP ); //table.Rows.Add( rowP ); // Pour les reponses textuelles if (pv.Vote != "") { TableCell cellV = new TableCell(); TableRow rowV = new TableRow(); cellV.Text = Strings.TexteToHTML(pv.Vote); //cell.CssClass = "TableReponsePersonneStyle"; rowV.Cells.Add(cellV); table.Rows.Add(rowV); } } } } PanelReponsesEnBas.Controls.Add(table); } } Label labelCount = new Label(); labelCount.Text = "Nombre de réponses : " + ListBoxQui.Items.Count.ToString(); PanelReponsesEnBas.Controls.Add(labelCount); } }