Exemplo n.º 1
0
        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            try
            {
            List<string> strOptions = new List<string>() { };
            int count = 0;
            if (txtNoOfOptions.Text.Trim() != "")
                count = int.Parse(txtNoOfOptions.Text);
            

            for (int i = 0; i < count; i++)
            {
                string str = lsttxt[i].Text;
                if (lstActionQue[i].Items.Count > 0)
                {
                    str = str + "*****" + ((ComboBoxItem)lstActionQue[i].SelectedItem).Content.ToString();
                }
                strOptions.Add(str);
            }

            if(((ComboBoxItem)cmbType.SelectedItem).Content.ToString().ToLower() == "combobox")
            {
                clsQuestionDynamic objQuestion = new clsQuestionDynamic(txtHeader.Text, count, TypeOfOptions.ComboBox, strOptions);
                lstQuestions.Add(objQuestion);
            }
            else if(((ComboBoxItem)cmbType.SelectedItem).Content.ToString().ToLower() == "listbox")
            {
                clsQuestionDynamic objQuestion = new clsQuestionDynamic(txtHeader.Text, count, TypeOfOptions.ListBox, strOptions);
                lstQuestions.Add(objQuestion);
            }
            else if (((ComboBoxItem)cmbType.SelectedItem).Content.ToString().ToLower() == "radiobutton")
            {
                clsQuestionDynamic objQuestion = new clsQuestionDynamic(txtHeader.Text, count, TypeOfOptions.RadioButton, strOptions);
                lstQuestions.Add(objQuestion);
            }
            else if (((ComboBoxItem)cmbType.SelectedItem).Content.ToString().ToLower() == "checkbox")
            {
                clsQuestionDynamic objQuestion = new clsQuestionDynamic(txtHeader.Text, count, TypeOfOptions.CheckBox, strOptions);
                lstQuestions.Add(objQuestion);
            }

            else if (((ComboBoxItem)cmbType.SelectedItem).Content.ToString().ToLower() == "textbox")
            {
                clsQuestionDynamic objQuestion = new clsQuestionDynamic(txtHeader.Text, count, TypeOfOptions.TextBox, strOptions);
                lstQuestions.Add(objQuestion);
            }

            lstQuestion.Items.Add(txtHeader.Text);

            cnvOptions.Children.Clear();

            txtHeader.Text = "";
            txtNoOfOptions.Text = "";

            }
            catch (Exception exp)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(exp, "btnNext_Click()", "ctlQuestion.xaml.cs");
            }
        }
Exemplo n.º 2
0
        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            try
            {
            List<string> strOptions = new List<string>() { };
            int count = 0;
            if (txtNoOfOptions.Text.Trim() != "")
                count = int.Parse(txtNoOfOptions.Text);
            

            for (int i = 0; i < count; i++)
            {
                string str = lsttxt[i].Text;
                if (lstActionQue[i].Items.Count > 0)
                {
                    str = str + "*****" + ((ComboBoxItem)lstActionQue[i].SelectedItem).Content.ToString();
                }
                strOptions.Add(str);
            }

            if(((ComboBoxItem)cmbType.SelectedItem).Content.ToString().ToLower() == "combobox")
            {
                clsQuestionDynamic objQuestion = new clsQuestionDynamic(txtHeader.Text, count, TypeOfOptions.ComboBox, strOptions);
                lstQuestions.Add(objQuestion);
            }
            else if(((ComboBoxItem)cmbType.SelectedItem).Content.ToString().ToLower() == "listbox")
            {
                clsQuestionDynamic objQuestion = new clsQuestionDynamic(txtHeader.Text, count, TypeOfOptions.ListBox, strOptions);
                lstQuestions.Add(objQuestion);
            }
            else if (((ComboBoxItem)cmbType.SelectedItem).Content.ToString().ToLower() == "radiobutton")
            {
                clsQuestionDynamic objQuestion = new clsQuestionDynamic(txtHeader.Text, count, TypeOfOptions.RadioButton, strOptions);
                lstQuestions.Add(objQuestion);
            }
            else if (((ComboBoxItem)cmbType.SelectedItem).Content.ToString().ToLower() == "checkbox")
            {
                clsQuestionDynamic objQuestion = new clsQuestionDynamic(txtHeader.Text, count, TypeOfOptions.CheckBox, strOptions);
                lstQuestions.Add(objQuestion);
            }

            else if (((ComboBoxItem)cmbType.SelectedItem).Content.ToString().ToLower() == "textbox")
            {
                clsQuestionDynamic objQuestion = new clsQuestionDynamic(txtHeader.Text, count, TypeOfOptions.TextBox, strOptions);
                lstQuestions.Add(objQuestion);
            }

            lstQuestion.Items.Add(txtHeader.Text);

            cnvOptions.Children.Clear();

            txtHeader.Text = "";
            txtNoOfOptions.Text = "";

        }
            catch (Exception exp)
            {
                exp.Data.Add("My Key", "btnNext_Click()--:--clsQuestion.xaml.cs--:--" + exp.Message + " :--:--");
                //ClsException.LogError(ex);
                //ClsException.WriteToErrorLogFile(ex);
                System.Text.StringBuilder sb = new StringBuilder();
                sb.AppendLine(exp.Message);
                sb.AppendLine();
                sb.AppendLine("StackTrace : " + exp.StackTrace);
                sb.AppendLine();
                sb.AppendLine("Location : " + exp.Data["My Key"].ToString());
                sb.AppendLine();
                sb1 = CreateTressInfo();
                sb.Append(sb1.ToString());
                VMuktiAPI.ClsLogging.WriteToTresslog(sb);
            }
        }