示例#1
0
        void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ClsQuestion objQue = new ClsQuestion();
                if (varState == 0)
                {
                    objQue.ID = -1;
                }
                else
                {
                    objQue.ID = varID;
                }
                objQue.Category    = cmbCategory.Text;
                objQue.Description = txtDescription.Text;
                objQue.Header      = txtHeader.Text;
                objQue.Name        = txtName.Text;
                objQue.ScriptID    = int.Parse(((ListBoxItem)cmbScript.SelectedItem).Tag.ToString());
                int Queueid = objQue.Save();

                ClsAnswer.Delete(Queueid);

                int count = 0;

                if (txtNoOfOptions.Text.ToString() != "")
                {
                    count = int.Parse(txtNoOfOptions.Text.ToString());
                }

                for (int i = 0; i < count; i++)
                {
                    ClsAnswer objAns = new ClsAnswer();
                    objAns.ID         = -1;
                    objAns.QuestionID = Queueid;
                    objAns.OptionName = txtOption[i].Text.ToString();
                    if (cmbOption[i].SelectedItem != null)
                    {
                        objAns.ActionQuestionID = int.Parse(((ListBoxItem)cmbOption[i].SelectedItem).Tag.ToString());
                    }
                    else
                    {
                        objAns.ActionQuestionID = Queueid;
                    }
                    objAns.Description = "";
                    objAns.Save();
                }

                FncFillGrid();
                FncClearAll();

                PrevOption = 0;
            }
            catch (Exception exp)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(exp, "btnSave_Click()", "CtlQuestionAns.xaml.cs");
            }
        }
示例#2
0
        void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (txtHeader.Text.Trim() != "" && txtDescription.Text.Trim() != "" && txtName.Text.Trim() != "")
            {
                ClsQuestion objQue = new ClsQuestion();
                if (varState == 0)
                {
                    objQue.ID = -1;
                }
                else
                {
                    objQue.ID = varID;
                }
                objQue.Category    = cmbCategory.Text;
                objQue.Description = txtDescription.Text;
                objQue.Header      = txtHeader.Text;
                objQue.Name        = txtName.Text;
                objQue.ScriptID    = int.Parse(((ListBoxItem)cmbScript.SelectedItem).Tag.ToString());
                int Queueid = objQue.Save();

                ClsAnswer.Delete(Queueid);

                int count = 0;

                if (txtNoOfOptions.Text.ToString() != "")
                {
                    count = int.Parse(txtNoOfOptions.Text.ToString());
                }

                for (int i = 0; i < count; i++)
                {
                    ClsAnswer objAns = new ClsAnswer();
                    objAns.ID         = -1;
                    objAns.QuestionID = Queueid;
                    objAns.OptionName = txtOption[i].Text.ToString();
                    if (cmbOption[i].SelectedItem != null)
                    {
                        objAns.ActionQuestionID = int.Parse(((ListBoxItem)cmbOption[i].SelectedItem).Tag.ToString());
                        objAns.Description      = "";
                        objAns.Save();
                    }
                    else
                    {
                        objAns.ActionQuestionID = Queueid;
                        MessageBox.Show("Fill Answer tab also");
                        break;
                    }
                }
                FncFillGrid();
                if (objQColl.Count != 0)
                {
                    btnDesigner.IsEnabled = true;
                }
                FncClearAll();
                PrevOption = 0;
            }
            else
            {
                MessageBox.Show("Fill all Information");
            }
        }
示例#3
0
        void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ClsQuestion objQue = new ClsQuestion();
                if (varState == 0)
                {
                    objQue.ID = -1;
                }
                else
                {
                    objQue.ID = varID;
                }
                objQue.Category    = cmbCategory.Text;
                objQue.Description = txtDescription.Text;
                objQue.Header      = txtHeader.Text;
                objQue.Name        = txtName.Text;
                objQue.ScriptID    = int.Parse(((ListBoxItem)cmbScript.SelectedItem).Tag.ToString());
                int Queueid = objQue.Save();

                ClsAnswer.Delete(Queueid);

                int count = 0;

                if (txtNoOfOptions.Text.ToString() != "")
                {
                    count = int.Parse(txtNoOfOptions.Text.ToString());
                }

                for (int i = 0; i < count; i++)
                {
                    ClsAnswer objAns = new ClsAnswer();
                    objAns.ID         = -1;
                    objAns.QuestionID = Queueid;
                    objAns.OptionName = txtOption[i].Text.ToString();
                    if (cmbOption[i].SelectedItem != null)
                    {
                        objAns.ActionQuestionID = int.Parse(((ListBoxItem)cmbOption[i].SelectedItem).Tag.ToString());
                    }
                    else
                    {
                        objAns.ActionQuestionID = Queueid;
                    }
                    objAns.Description = "";
                    objAns.Save();
                }

                FncFillGrid();
                FncClearAll();

                PrevOption = 0;
            }
            catch (Exception exp)
            {
                exp.Data.Add("My Key", "btnSave_Click()--:--CtlQuestionAns.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);
            }
        }