Ejemplo n.º 1
0
        // OPT00020100219
        public static PollVoteCollection GetPollVoteByPollAnswerID(Guid pollAnswerID)
        {
            DataSet      ds    = new DataSet();
            SqlParameter param = new SqlParameter();

            param       = new SqlParameter("@PollAnswerID", SqlDbType.UniqueIdentifier);
            param.Value = pollAnswerID;

            ds = SqlDataProvider.ExecuteDataset
                 (
                Tools.DatabaseConnectionString,
                CommandType.StoredProcedure,
                "GetPollVoteByPollAnswerID",
                param
                 );

            PollVoteCollection oc = new PollVoteCollection();

            foreach (DataRow r in ds.Tables[0].Rows)
            {
                PollVote o = PollVote.Fill(r);
                oc.Add(o);
            }
            return(oc);
        }
Ejemplo n.º 2
0
        public static PollVoteCollection GetPollVotes(int questionnaireID, Guid personneGUID)
        {
            SqlParameter[] parameters = new SqlParameter[2];
            parameters[0]       = new SqlParameter("@QuestionnaireID", SqlDbType.Int);
            parameters[0].Value = questionnaireID;
            parameters[1]       = new SqlParameter("@UserGUID", SqlDbType.UniqueIdentifier);
            parameters[1].Value = personneGUID;

            DataSet ds = SqlDataProvider.ExecuteDataset
                         (
                Tools.DatabaseConnectionString,
                CommandType.StoredProcedure,
                "GetPollVotes",
                parameters
                         );

            PollVoteCollection oc = new PollVoteCollection();

            foreach (DataRow r in ds.Tables[0].Rows)
            {
                PollVote o = PollVote.Fill(r);
                oc.Add(o);
            }
            return(oc);
        }
Ejemplo n.º 3
0
        // Lorsque l'on boucle sur toutes les Personne d'un Questionnaire > 500
        // l'utilisation de GetPollVotes lance un procedure stockee 500 fois
        // ce n'est pas optimum on va preferer lancer une fois GetPollVotesByQuestionnaireID
        // et utiliser cette fonction
        public PollVoteCollection FindByPersonneGUID(Guid userGUID)
        {
            PollVoteCollection newpvc = new PollVoteCollection();

            foreach (PollVote pv in this)
            {
                if (pv.UserGUID == userGUID)
                {
                    newpvc.Add(pv);
                }
            }
            return(newpvc);
        }
Ejemplo n.º 4
0
        // Trouver les Votes pour une Reponse donnee dans la Collection
        public PollVoteCollection FindByAnswerID(Guid answerID)
        {
            PollVoteCollection newpvc = new PollVoteCollection();

            foreach (PollVote pv in this)
            {
                if (pv.PollAnswerId == answerID)
                {
                    newpvc.Add(pv);
                }
            }
            return(newpvc);
        }
Ejemplo n.º 5
0
        // Pareil 70 ms environ
        public static int CountTotalVotes(Guid pollQuestionId)
        {
            int count = 0;
            PollVoteCollection pvc = PollVoteCollection.GetAll();

            foreach (PollVote pv in pvc)
            {
                if (pv.PollQuestionID == pollQuestionId)
                {
                    count += 1;
                }
            }
            return(count);
        }
Ejemplo n.º 6
0
        // OPT00020100219
        // Voila une procedure qui prend 100 ms au bas mot lorsque l'on a 1300 votes
        public static int NumberOfVotesByAnswer(Guid answerID)
        {
            // OPT00020100219int count = 0;
            //PollVoteCollection pvc = PollVoteCollection.GetAll();
            //foreach ( PollVote pv in pvc )
            //{
            //    if ( pv.PollAnswerId == answerID )
            //    {
            //        count += 1;
            //    }
            //}

            PollVoteCollection pvc = PollVoteDAL.GetPollVoteByPollAnswerID(answerID);

            return(pvc.Count);
        }
Ejemplo n.º 7
0
        // Trouver les Votes pour une Reponse donnee
        public static PollVoteCollection GetVotes(Guid answerID)
        {
            //PollVoteCollection pvc = PollVoteCollection.GetAll();
            //PollVoteCollection newpvc = new PollVoteCollection();
            //foreach ( PollVote pv in pvc )
            //{
            //    if ( pv.PollAnswerId == answerID )
            //    {
            //        newpvc.Add( pv );
            //    }
            //}

            // OPT00020100219
            PollVoteCollection newpvc = PollVoteDAL.GetPollVoteByPollAnswerID(answerID);

            return(newpvc);
        }
Ejemplo n.º 8
0
        public static PollVoteCollection GetAll()
        {
            DataSet ds = new DataSet();

            ds = SqlDataProvider.ExecuteDataset
                 (
                Tools.DatabaseConnectionString,
                CommandType.StoredProcedure,
                "GetPollVoteAll"
                 );

            PollVoteCollection oc = new PollVoteCollection();

            foreach (DataRow r in ds.Tables[0].Rows)
            {
                PollVote o = PollVote.Fill(r);
                oc.Add(o);
            }
            return(oc);
        }