Exemple #1
0
        public ActionResult List(string Value)
        {
            TSS_SectionBL sb     = new TSS_SectionBL();
            var           rec    = (Value != "0")? sb.ToList("By_SurveyId", Value):null;
            var           rec1   = (Value != "0")? sb.ToListWithoutTree("By_SurveyId", Value):null;
            var           result = new { list1 = rec, list2 = rec1 };

            //return PartialView("~/Areas/Survey/Views/Section/_List.cshtml", rec);
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public List <TSS_Section> SurveySections(Int64 Id)
        {
            try
            {
                TSS_SectionBL sb  = new TSS_SectionBL();
                var           sec = sb.ToList("By_SurveyId", Id.ToString()).ToList();

                return(GetTreeView(sec));
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #3
0
        private List <TSS_Section> GetTreeView(List <TSS_Section> sec)
        {
            TSS_SectionBL sb = new TSS_SectionBL();

            foreach (var s in sec)
            {
                if (s.PSectionId > 0)
                {
                    var sec2 = sb.ToList("By_SectionId", s.PSectionId.ToString()).ToList();
                    if (sec2 != null)
                    {
                        s.Sections.AddRange(sec2);
                        GetTreeView(sec2);
                    }
                }
            }

            return(sec);
        }
Exemple #4
0
        public ActionResult Tree(string filter, string value)
        {
            TSS_SectionBL sb   = new TSS_SectionBL();
            var           list = sb.ToList(filter, value);
            //var Parent = Sections.Where(m => m.PSectionId == 0).ToList();


            List <TSS_Section> treeList = new List <TSS_Section>();

            //foreach (var item in Sections)
            //{
            //    GetTreeView(item, Sections);
            //}
            //return Json(Parent, JsonRequestBehavior.AllowGet);

            if (list.Count > 0)
            {
                treeList = BuildTree(list);
            }
            return(new JsonResult {
                Data = new { treeList = treeList }, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }