Esempio n. 1
0
        protected override void Initialize()
        {
            base.Initialize();
            try
            {
                gAssessmentID = Convert.ToInt32(this.DecryptQueryString(Request.QueryString["value"], "AssessmentID"));
            }
            catch (Exception)
            {
                gAssessmentID = -1;
                return;
            }

            try
            {
                gAssessmentRespID = Convert.ToInt32(this.DecryptQueryString(Request.QueryString["value"], "AssessmentRespID"));
            }
            catch (Exception)
            {
                gAssessmentRespID = -1;
            }


            gAssessment_br = new BusinessRules.OP_Assessment(BSWSession.SessionID, BSWSession.UserID);
            gLookUp        = new BusinessRules.OP_LookUp(BSWSession.SessionID, BSWSession.UserID);


            listResponses = new List <AssessmentItemResponse>();
            if (gAssessmentRespID > 0)
            {
                //load old responses
                AssessmentResponse objResp = gAssessment_br.GetAssessmentResponse(BSWSession.UserID, gAssessmentRespID, null);

                listResponses       = OP_Assessment.GetItemResponsesByAssessmentRespID(gAssessmentRespID);
                gIsAssessmentClosed = !objResp.IsCurent;

                if (gIsAssessmentClosed)
                {
                    btnDeleteAssessmentResponse.Visible = true;
                }
            }
            else
            {
                gIsAssessmentClosed = false;
            }
        }
Esempio n. 2
0
        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();
            }
        }