Exemple #1
0
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     if (survey != null && Settings != null && Settings.ContainsKey("SurveyQuestion") && Settings.ContainsKey("surveyDataClassDataContext"))
     {
         currentQuestion            = Settings["SurveyQuestion"] as hitbl_Survey_Question_SQU;
         surveyDataClassDataContext = Settings["surveyDataClassDataContext"] as SurveyDataClassDataContext;
         FillEditForm();
     }
     else
     {
         throw new SiemeArgumentException("_4screen.CSB.DataObj.UserControls.Wizards.SurveyQuestion", "OnInit", "SurveyQuestion", "SurveyQuestion was not send with the Settings Dictionary");
     }
 }
        protected void lbtnNQ_Click(object sender, EventArgs e)
        {
            hitbl_Survey_Question_SQU newQuestion = new hitbl_Survey_Question_SQU();

            newQuestion.SQU_ID       = Guid.NewGuid();
            newQuestion.QuestionText = string.Format(GuiLanguage.GetGuiLanguage("DataObjectSurvey").GetString("DefaultQuestionText"), newQuestion.SortNumber);
            newQuestion.QuestionType = (int)SurveyAnswersType.NotSelected;
            newQuestion.SPG_ID       = currentPage.SPG_ID;
            newQuestion.SortNumber   = Convert.ToInt32(((LinkButton)sender).CommandArgument);
            surveyDataClassDataContext.hitbl_Survey_Question_SQUs.InsertOnSubmit(newQuestion);
            surveyDataClassDataContext.SubmitChanges();
            LinkButton lbtnNQ = sender as LinkButton;

            lbtnNQ.Visible = false;
            LoadQuestionOutput(newQuestion, true, lbtnNQ);
        }
        private void LoadQuestionOutput(hitbl_Survey_Question_SQU surveyQuestion, bool editMode, LinkButton buttonNew)
        {
            string            idPostFix        = surveyQuestion.SQU_ID.ToString().Replace("_", "_");
            Control           ucSurveyQuestion = LoadControl("/UserControls/Wizards/SurveyQuestion.ascx");
            ISurveyWizardPage iSurveyQuestion  = ucSurveyQuestion as ISurveyWizardPage;

            iSurveyQuestion.survey   = survey;
            iSurveyQuestion.Settings = new Dictionary <string, object>
            {
                { "SurveyQuestion", surveyQuestion },
                { "surveyDataClassDataContext", surveyDataClassDataContext }
            };
            if (editMode)
            {
                iSurveyQuestion.Settings.Add("EditMode", editMode);
                iSurveyQuestion.Settings.Add("ButtonNew", buttonNew);
            }
            ucSurveyQuestion.ID = string.Format("GDP_{0}", idPostFix);
            radMP.PageViews[1].Controls.Add(ucSurveyQuestion);
        }