Пример #1
0
        public static ClsQuestion GetByQueID(int QueID)
        {
            ClsQuestion obj = new ClsQuestion();
            DataSet     ds  = new ScriptDesigner.DataAccess.ClsQuestionAnsDataService().Question_GetByID(QueID);

            if (!obj.MapData(ds.Tables[0]))
            {
                obj = null;
            }
            return(obj);
        }
Пример #2
0
        public static ClsQuestion GetByQueID(int QueID)
        {
            ClsQuestion obj = new ClsQuestion();
            DataSet ds = new ScriptDesigner.DataAccess.ClsQuestionAnsDataService().Question_GetByID(QueID);

            if (!obj.MapData(ds.Tables[0])) obj = null;
            return obj;
        }
        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");
            }
        }