Exemple #1
0
        protected override void BeforePostback()
        {
            base.BeforePostback();
            lblAssessmentName.Text = gAssessment.GetAssessmentName(gAssessmentID);
            if (cmbAssessmentItems.DataSource == null)
            {
                cmbAssessmentItems.DataTextField  = nameof(ClsListAssessmentItem.Text);
                cmbAssessmentItems.DataValueField = nameof(ClsListAssessmentItem.ItemID);
                List <ClsListAssessmentItem> listAI = gAssessment.GetAssessmentItemListFromCache(gAssessmentID, true);
                if (listAI != null && listAI.Count > 0)
                {
                    listAI = listAI.FindAll(o => o.TypeID != Convert.ToInt32(Constants.enAssessmentItemType.PAGE_BREAK));
                }
                cmbAssessmentItems.DataSource = listAI;
                cmbAssessmentItems.DataBind();
                if (cmbAssessmentItems.Items.FindByValue("-1") == null)
                {
                    cmbAssessmentItems.Items.Insert(0, new ListItem("Please select...", "-1"));
                }

                cmbAssessmentItems.Enabled = true;
            }
            BindControlsToDataSources();
            if (gPageMode == Constants.enPageMode.UPDATE_DATA)
            {
                //fill the question information
                DataAccess.AssessmentItem objAssessment = gAssessment.GetAssessmentItemByItemIDFromCache(AssessmentItemID);
                FillControls(objAssessment);
                CheckIfTypeIsMultipleChoice();
                //fill choices
                ListChoice = gAssessment.GetAssessmentItemChoicesByItemIDFromCache(AssessmentItemID, true);
                ListSubAI  = gAssessment.GetSubAssessmentItemsByParentID(AssessmentItemID);
                Prepare_Choice_Section();
            }
        }
Exemple #2
0
        private void BindAssessmentItems()
        {
            StringBuilder sb = new StringBuilder();
            List <BusinessRules.ClsListAssessmentItem> listItems = gAssessment_br.GetAssessmentItemListFromCache(gAssessmentID);

            if (listItems == null || listItems.Count == 0)
            {
                Set_Error_Message("This assessment has no items!");
                return;
            }
            listItems = listItems.OrderBy(o => o.Order).ToList();
            List <BusinessRules.ClsListAssessmentItem> listPageBreaks = listItems.FindAll(o => o.TypeID == Convert.ToInt32(Constants.enAssessmentItemType.PAGE_BREAK));

            if (listPageBreaks != null && listPageBreaks.Count > 0)
            {
                gIsPagingEnabled = true;
                CreateAssessmentWizard(listPageBreaks, ref sb);
                divWizard.Visible          = true;
                divAssessmentItems.Visible = false;
            }
            else
            {
                divWizard.Visible = false;
                gIsPagingEnabled  = false;
            }
            CreateAssessment(listItems);
        }
        private void BindGrid()
        {
            int total_count = 0;
            List <BusinessRules.ClsListAssessmentItem> listAssessmentItemList = gAssessment.GetAssessmentItemListFromCache(gAssessmentID);

            if (listAssessmentItemList == null)
            {
                return;
            }
            grd.TotalCount = total_count;
            grd.DataSource = listAssessmentItemList.ToDataTable();
        }