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(); } }
private void CreateAssessment(List <ClsListAssessmentItem> listItems) { StringBuilder sb = new StringBuilder(); // StringBuilder sb_toc = new StringBuilder(); //TOC List <ClsListAssessmentItem> list_addedsubItems = new List <ClsListAssessmentItem>(); List <string> listDivWizards = new List <string>(); List <AssessmentItemResponse> listAIR = null; if (gIsAssessmentClosed) { listAIR = OP_Assessment.GetItemResponsesByAssessmentRespID(gAssessmentRespID); } foreach (ClsListAssessmentItem item in listItems) { if (list_addedsubItems.Contains(item)) { continue; } ClsListAssessmentItem _item = null; if (gIsAssessmentClosed && listAIR != null) { List <int> listAllAIds = gAssessment_br.GetAssessmentItemIDsByTreeID(item.AITreeID); if (listAllAIds != null & listAllAIds.Count > 0) { AssessmentItemResponse objAIR = listAIR.Find(o => listAllAIds.Contains(o.AssessmentItemID)); if (objAIR != null) { _item = ClsListAssessmentItem.ConvertAssessmentItemToClass(gAssessment_br.GetAssessmentItemByItemIDFromCache(objAIR.AssessmentItemID)); } } } if (_item == null) { _item = item; } //gAssessment_br.GetAssessment_itemBy_itemTreeIDFromCache() //DataAccess.Assessment_item obj = gAssessment_br.GetAssessment_itemBy_itemIDFromCache(_item._itemID); //HtmlGenericControl divTemp = new HtmlGenericControl("div"); if (_item.TypeID == Convert.ToInt32(Constants.enAssessmentItemType.PAGE_BREAK)) { string _div = string.Empty; int _id_count = listDivWizards.Count + 1; _div = @"<h3><span class='cat__wizard__steps__title'>" + _id_count.ToString() + "</span></h3><section class=''>" + sb.ToString() + "</section>"; //divTemp.Attributes.Add("class", "tab-pane"); //divTemp.ID = "tab" + _id_count.ToString(); //divTemp.InnerHtml = sb.ToString(); //divTemp.ClientIDMode = ClientIDMode.Static; listDivWizards.Add(_div); sb = new StringBuilder(); continue; } sb.Append(CreateAssessmentItem(_item, false)); if (_item.SubItems.Count > 0) { foreach (ClsListAssessmentItem sub_item in _item.SubItems) { if (list_addedsubItems.Contains(sub_item)) { continue; } //obj = gAssessment_br.GetAssessmentItemByItemIDFromCache(sub_item.ItemID); bool is_sub_grid = ((sub_item.TypeID == Convert.ToInt32(Constants.enAssessmentItemType.GRID_CHK) || sub_item.TypeID == Convert.ToInt32(Constants.enAssessmentItemType.GRID_RADIO)) && sub_item.ParentID > 0); // sb_toc.Append(CreateaTOCSub(_item.Order, sub_item.Order)); sb.Append(CreateAssessmentItem(sub_item, is_sub_grid, _item.Order, sub_item.Order)); if (is_sub_grid) { list_addedsubItems.AddRange(_item.SubItems.FindAll(o => o.ParentID == sub_item.ParentID)); } } } if (gIsPagingEnabled && _item.Equals(listItems.Last())) { string _div = string.Empty; int _id_count = listDivWizards.Count + 1; _div = @"<h3><span class='cat__wizard__steps__title'>" + _id_count.ToString() + "</span></h3><section class=''>" + sb.ToString() + "</section>"; listDivWizards.Add(_div); } } //divTOC_Contents.InnerHtml = sb_toc.ToString(); if (listDivWizards.Count > 0) { foreach (var item in listDivWizards) { divWizardContent.InnerHtml += item; } string scr = @"$(function () { $('[id*=divWizardContent]').steps({ headerTag: 'h3', bodyTag: 'section', transitionEffect: 'slideLeft', autoFocus: true, onFinishing: StepsFinishing, onFinished: StepsFinished }); $(""[aria-label='Pagination']"").prepend(""<li aria-hidden='false' aria-disabled='false'><a href='AssessmentList.aspx'><i class='fa fa-arrow-left' aria-hidden='true'></i>Back To List</a></li>"");"; if (gIsAssessmentClosed) { scr += @"$(""[aria-label='Pagination']"").children().last().remove();"; } scr += "});"; ScriptManager.RegisterClientScriptBlock(pnl, pnl.GetType(), "CreateAssessmentItemXChoice" + Guid.NewGuid().ToString(), scr, true); divBtnSinglePage.Visible = false; } else { divBtnSinglePage.Visible = true; divAssessmentItems.InnerHtml = sb.ToString(); } }