Beispiel #1
0
 protected void radTab_TabClick(object sender, RadTabStripEventArgs e)
 {
     if (e.Tab.Value.Equals("NewPage", StringComparison.InvariantCultureIgnoreCase))
     {
         int tabIndex = e.Tab.Index;
         //Create the Page
         hitbl_Survey_Page_SPG surveyPageSpg = new hitbl_Survey_Page_SPG();
         surveyPageSpg.SPG_ID     = Guid.NewGuid();
         surveyPageSpg.OBJ_ID     = survey.ObjectID.Value;
         surveyPageSpg.SortNumber = (tabIndex) * 10;
         surveyPageSpg.Title      = string.Format("{0} {1}", GuiLanguage.GetGuiLanguage("DataObjectSurvey").GetString("DefaultPageName"), tabIndex);
         surveyDataClassDataContext.hitbl_Survey_Page_SPGs.InsertOnSubmit(surveyPageSpg);
         surveyDataClassDataContext.SubmitChanges();
         CreateTabContext(tabIndex, surveyPageSpg);
         radTab.SelectedIndex = tabIndex;
     }
     else
     {
         var surveyPage = (from allPages in surveyDataClassDataContext.hitbl_Survey_Page_SPGs.Where(x => x.OBJ_ID == survey.ObjectID)
                           orderby allPages.SortNumber ascending
                           select allPages).ToList().ElementAtOrDefault(e.Tab.Index);
         if (surveyPage != null)
         {
             InsertControlInPageView(e.Tab.Index, surveyPage);
         }
     }
     radMultiPage.SelectedIndex = radTab.SelectedIndex;
     hfCT.Value = e.Tab.Index.ToString();
 }
Beispiel #2
0
        private void CreateTabContext(int tabIndex, hitbl_Survey_Page_SPG surveyPage)
        {
            string idPostFix = surveyPage.SPG_ID.ToString().Replace("_", "_");

            radTab.Tabs.Insert(tabIndex, new RadTab(surveyPage.Title, surveyPage.SPG_ID.ToString()));
            RadPageView rpvw = new RadPageView
            {
                ID = string.Format("RPW_{0}", idPostFix)
            };

            radMultiPage.PageViews.Insert(tabIndex, rpvw);
            if (currentPageTabIndex == tabIndex)
            {
                InsertControlInPageView(tabIndex, surveyPage);
            }
        }
Beispiel #3
0
        private void InsertControlInPageView(int pageIndex, hitbl_Survey_Page_SPG surveyPage)
        {
            string idPostFix = surveyPage.SPG_ID.ToString().Replace("_", "_");

            radMultiPage.PageViews[pageIndex].Controls.Clear();
            Control           ucSurveyPageInfo = LoadControl("/UserControls/Wizards/SurveyPageInfo.ascx");
            ISurveyWizardPage iSurveyPageInfo  = ucSurveyPageInfo as ISurveyWizardPage;

            iSurveyPageInfo.survey   = survey;
            iSurveyPageInfo.Settings = new Dictionary <string, object>
            {
                { "SurveyPage", surveyPage },
                { "surveyDataClassDataContext", surveyDataClassDataContext },
                { "currentPageTab", radTab.Tabs[pageIndex] }
            };
            ucSurveyPageInfo.ID = string.Format("GDP_{0}", idPostFix);
            radMultiPage.PageViews[pageIndex].Controls.Add(ucSurveyPageInfo);
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            string currentTab = Request.Form[hfCT.UniqueID];

            if (!string.IsNullOrEmpty(currentTab))
            {
                currentPageInfoTab = Convert.ToInt32(currentTab);
            }
            if (survey != null && Settings != null && Settings.ContainsKey("SurveyPage") && Settings.ContainsKey("surveyDataClassDataContext"))
            {
                currentPage = Settings["SurveyPage"] as hitbl_Survey_Page_SPG;
                surveyDataClassDataContext = Settings["surveyDataClassDataContext"] as SurveyDataClassDataContext;
                FillEditForm();
            }
            else
            {
                throw new SiemeArgumentException("_4screen.CSB.DataObj.UserControls.Wizards.SurveyPageInfo", "OnInit", "SurveyPage", "SurveyPage was not send with the Settings Dictionary");
            }
        }
Beispiel #5
0
        private void FillEditForm()
        {
            FillHiddenFields();

            //Add the "AddNewPage" Tab
            RadPageView rpAddNew = new RadPageView
            {
                ID = "NewPage"
            };

            radMultiPage.PageViews.Add(rpAddNew);
            radTab.Tabs.Add(new RadTab(GuiLanguage.GetGuiLanguage("DataObjectSurvey").GetString("TabAddNewPage"), "NewPage"));

            var allSurveyPages = from allPages in surveyDataClassDataContext.hitbl_Survey_Page_SPGs.Where(x => x.OBJ_ID == survey.ObjectID)
                                 orderby allPages.SortNumber ascending
                                 select allPages;

            if (allSurveyPages.Count() == 0)
            {
                //One Page schould allways exits.. so createit
                hitbl_Survey_Page_SPG firstPage = new hitbl_Survey_Page_SPG
                {
                    OBJ_ID     = survey.ObjectID.Value,
                    Title      = GuiLanguage.GetGuiLanguage("DataObjectSurvey").GetString("StartPageName"),
                    SortNumber = 0,
                    SPG_ID     = Guid.NewGuid()
                };
                surveyDataClassDataContext.hitbl_Survey_Page_SPGs.InsertOnSubmit(firstPage);
                surveyDataClassDataContext.SubmitChanges();
                allSurveyPages = from allPages in surveyDataClassDataContext.hitbl_Survey_Page_SPGs.Where(x => x.OBJ_ID == survey.ObjectID)
                                 orderby allPages.SortNumber ascending
                                 select allPages;
            }
            int i = 0;

            foreach (hitbl_Survey_Page_SPG surveyPage in allSurveyPages)
            {
                CreateTabContext(i++, surveyPage);
            }
        }
        private Control PrintQuestionAndAnswers(hitbl_Survey_Page_SPG surveyPage)
        {
            Panel pnlPage = new Panel
            {
                ID       = string.Format("pnlPage{0}", surveyPage.SPG_ID),
                CssClass = "CSB_SurveyDetail_Page"
            };

            if (!string.IsNullOrEmpty(surveyPage.Description))
            {
                pnlPage.Controls.Add(new LiteralControl(string.Format("<div class='Desc'>{0}</div>", surveyPage.Description)));
            }
            foreach (hitbl_Survey_Question_SQU surveyQuestion in surveyPage.hitbl_Survey_Question_SQUs.OrderBy(x => x.SortNumber))
            {
                if (surveyQuestion.QuestionType != SurveyAnswersType.NotSelected)
                {
                    totalTestQuestions++;
                    pnlPage.Controls.Add(new LiteralControl(string.Format("<div class='CSB_SurveyDetail_Question'>{0}</div>", surveyQuestion.QuestionText)));
                    Control controlAnswer = null;
                    switch (surveyQuestion.QuestionType)
                    {
                    case SurveyAnswersType.SingleTextbox:
                        TextBox txtSingleTextbox = new TextBox
                        {
                            Width = Unit.Percentage(100),
                            ID    = string.Format("txt_{0}", surveyQuestion.SQU_ID)
                        };
                        controlAnswer = txtSingleTextbox;
                        break;

                    case SurveyAnswersType.Textarea:
                        TextBox txtTextarea = new TextBox
                        {
                            Width    = Unit.Percentage(100),
                            ID       = string.Format("txtArea_{0}", surveyQuestion.SQU_ID),
                            Rows     = 2,
                            TextMode = TextBoxMode.MultiLine
                        };
                        controlAnswer = txtTextarea;
                        break;

                    case SurveyAnswersType.MultipleChoiceMultipleAnswers:
                        CheckBoxList cbl = new CheckBoxList
                        {
                            ID = string.Format("cbl{0}", surveyQuestion.SQU_ID)
                        };
                        foreach (hitbl_Survey_Answer_Row_SAR surveyAnswerRow in surveyQuestion.hitbl_Survey_Answer_Row_SARs.OrderBy(x => x.SortNumber))
                        {
                            cbl.Items.Add(new ListItem(surveyAnswerRow.AnswerText, string.Format("{0}_{1}", surveyAnswerRow.AnswerWeight, surveyAnswerRow.SAR_ID.ToString().Replace("-", ""))));
                        }
                        controlAnswer = cbl;
                        break;

                    case SurveyAnswersType.MultipleChoiceOnlyOneAnswer:
                        RadioButtonList rbl = new RadioButtonList
                        {
                            ID = string.Format("rbl{0}", surveyQuestion.SQU_ID)
                        };
                        foreach (hitbl_Survey_Answer_Row_SAR surveyAnswerRow in surveyQuestion.hitbl_Survey_Answer_Row_SARs.OrderBy(x => x.SortNumber))
                        {
                            rbl.Items.Add(new ListItem(surveyAnswerRow.AnswerText, string.Format("{0}_{1}", surveyAnswerRow.AnswerWeight, surveyAnswerRow.SAR_ID.ToString().Replace("-", ""))));
                        }
                        controlAnswer = rbl;
                        break;

                    default:
                        break;
                    }
                    if (controlAnswer != null)
                    {
                        AnswerControls.Add(controlAnswer.ID, controlAnswer);
                        pnlPage.Controls.Add(new LiteralControl("<div class='CSB_SurveyDetail_Answer'>"));
                        pnlPage.Controls.Add(controlAnswer);
                        pnlPage.Controls.Add(new LiteralControl("</div>"));
                    }
                }
            }
            return(pnlPage);
        }