Пример #1
0
        public bool GetAllEvaluations(string ClientID)
        {
            try
            {

                string sql;
                sql = "Select * from ctool_evaluation where question_ownerid= " + ClientID;
                ArrayList results =  dbCon.Execute(sql);
                for(int i = 0 ; i < results.Count ; i++)
                {
                    ArrayList Fields = (ArrayList)results[i];
                    WebPoll poll = new WebPoll();
                    poll.question = (string)Fields[2].ToString();
                    poll.questionOwner = Convert.ToInt32(Fields[1]);
                    int Type = Convert.ToInt32(Fields[3]);
                    switch(Type)
                    {
                        case 1:
                            poll.pollType = PollType.FreeResponse;
                            break;
                        case 2:
                            poll.pollType = PollType.SingleSelect;
                            break;
                        case 3:
                            poll.pollType = PollType.MultipleSelect;
                            break;
                        case 4:
                            poll.pollType = PollType.TrueFalse;
                            break;
                        case 5:
                            poll.pollType = PollType.YesNo;
                            break;
                        default:
                            poll.pollType = PollType.SingleSelect;
                            break;

                    }

                    string answers = (string)Fields[4];
                    string[] choices = answers.Split(':');
                    poll.choices= new ArrayList();
                    foreach (string choice in choices)
                        poll.choices.Add(choice);

                    //poll.WebPollAnswersList ;// GetAnswersOfPoll((string)Fields[0]);

                    WebPollArray.Add(poll);
                }

                return true;

            }
            catch(Exception ee)
            {
            //		MessageBox.Show(ee.Message);

            }

            return false;
        }
Пример #2
0
        public bool ShowWebPollQuestion(WebPoll poll)
        {
            try
            {
                this.textQuestion.Text = poll.question;
                if((poll.pollType == PollType.FreeResponse)||(poll.pollType == PollType.TrueFalse) || (poll.pollType == PollType.YesNo))
                {
                    HideWindows(false);
                    switch(poll.pollType)
                    {
                        case PollType.FreeResponse:

                            textBox1.Visible = false;
                            textBox2.Visible = false;
                            comboType.SelectedIndex = 0;
                            //comboBoxNumberOfAnswers.SelectedIndex = 0;
                            break;
                        case PollType.TrueFalse:
                            //comboBoxNumberOfAnswers.SelectedIndex = 0;
                            comboType.SelectedIndex = 3;
                            break;
                        case PollType.YesNo:
                            //comboBoxNumberOfAnswers.SelectedIndex = 0;
                            comboType.SelectedIndex = 4;
                            break;
                    }

                }
                else
                {
                    HideWindows(true);
                    if(poll.pollType == PollType.MultipleSelect)
                        comboType.SelectedIndex = 2;
                    else
                        comboType.SelectedIndex = 1;

                    int nCount=0;
                    foreach(string str in poll.choices)
                    {
                        switch(nCount)
                        {
                            case 0:
                                textBox1.Text = str;
                                comboBoxNumberOfAnswers.SelectedIndex = 0;
                                break;
                            case 1:
                                textBox2.Text = str;
                                comboBoxNumberOfAnswers.SelectedIndex = 0;
                                break;
                            case 2:
                                textBox3.Text = str;
                                comboBoxNumberOfAnswers.SelectedIndex = 1;
                                break;
                            case 3:
                                comboBoxNumberOfAnswers.SelectedIndex = 2;
                                textBox4.Text = str;
                                break;
                            case 4:
                                comboBoxNumberOfAnswers.SelectedIndex = 3;
                                textBox5.Text = str;
                                break;
                        }
                        nCount++;
                    }

                }
                textBox1.ReadOnly = true;
                textBox2.ReadOnly =true;
                textBox3.ReadOnly = true;
                textBox4.ReadOnly = true;
                textBox5.ReadOnly = true;
                comboBoxNumberOfAnswers.Enabled = false;
                comboType.Enabled = false;
                textQuestion.ReadOnly = true;
                checkAnonymous.Enabled = false;
                comboBoxNumberOfAnswers.Enabled = false;
                makeReadOnly = true;
                if(ShowDialog() == DialogResult.OK)
                    return true;
                else
                    return false;

            }
            catch(Exception )
            {
            }
            return false;
        }
Пример #3
0
        public bool GetAllEvaluations(string ClientID)
        {
            try
            {
                string sql;
                sql = "Select * from ctool_evaluation where question_ownerid= " + ClientID;
                ArrayList results = dbCon.Execute(sql);
                for (int i = 0; i < results.Count; i++)
                {
                    ArrayList Fields = (ArrayList)results[i];
                    WebPoll   poll   = new WebPoll();
                    poll.question      = (string)Fields[2].ToString();
                    poll.questionOwner = Convert.ToInt32(Fields[1]);
                    int Type = Convert.ToInt32(Fields[3]);
                    switch (Type)
                    {
                    case 1:
                        poll.pollType = PollType.FreeResponse;
                        break;

                    case 2:
                        poll.pollType = PollType.SingleSelect;
                        break;

                    case 3:
                        poll.pollType = PollType.MultipleSelect;
                        break;

                    case 4:
                        poll.pollType = PollType.TrueFalse;
                        break;

                    case 5:
                        poll.pollType = PollType.YesNo;
                        break;

                    default:
                        poll.pollType = PollType.SingleSelect;
                        break;
                    }

                    string   answers = (string)Fields[4];
                    string[] choices = answers.Split(':');
                    poll.choices = new ArrayList();
                    foreach (string choice in choices)
                    {
                        poll.choices.Add(choice);
                    }

                    //poll.WebPollAnswersList ;// GetAnswersOfPoll((string)Fields[0]);

                    WebPollArray.Add(poll);
                }

                return(true);
            }
            catch (Exception ee)
            {
                //		MessageBox.Show(ee.Message);
            }

            return(false);
        }