Example #1
0
        public ActionResult AddMoreDetail(string idcontenteditor)
        {
            List <DIContentMoreDetail> list = contentmorerepo.AddContentMoreDeatil(idcontenteditor).ToList();
            showContentEditor          sh   = new showContentEditor();
            string detaileditor             = "";
            string scriptdetaileditor       = "";
            string firstnode = "";
            string linktype  = "";

            foreach (var data in list)
            {
                if (data.ordernumber == 1)
                {
                    firstnode = data.idcontenteditordetail.ToString();
                    linktype  = data.contentlinktype;
                }
                sh.trick = data.imgthickboxshow.ToString();
                sh.id    = data.idcontenteditordetail;
                sh.order = data.ordernumber;
                string html = System.Web.HttpUtility.HtmlDecode(data.textdata);
                sh.text            = html;
                sh.imgpath         = data.imgpath;
                detaileditor       = detaileditor + RenderPartialToString("_contentEditorMoreDetail", sh);
                scriptdetaileditor = scriptdetaileditor + RenderPartialToString("_contentEditorMoreDetailScript", sh);
            }
            detaileditor = "<input type='hidden' id='morehidden' value='" + firstnode + "'/>" + detaileditor;
            string htmlandscript = detaileditor + "<....>" + scriptdetaileditor + "<....>" + linktype;

            return(Content(htmlandscript));
        }
Example #2
0
        public ActionResult Index()
        {
            List <DIContent> list = contentrepo.ShowContent("1").ToList();

            if (list.Count() != 0)
            {
                string            editor    = "";
                string            script    = "";
                string            preview   = "";
                string            tab       = "";
                showContentEditor sh        = new showContentEditor();
                string            idcontent = list[0].idcontenteditor.ToString();

                sh.trick = list[0].imgthickboxshow.ToString();
                sh.id    = list[0].idcontenteditor;
                sh.order = list[0].ordernumber;
                string html = System.Web.HttpUtility.HtmlDecode(list[0].textdata);
                sh.text    = html;
                sh.imgpath = list[0].imgpath;
                editor     = editor + RenderPartialToString("_contentEditor", sh);
                script     = script + RenderPartialToString("_contentEditorScript", sh);
                if (list[0].imgposition == 1)
                {
                    preview = preview + RenderPartialToString("_contentImgLeft", sh);
                }
                else if (list[0].imgposition == 2)
                {
                    preview = preview + RenderPartialToString("_contentImgCenter", sh);
                }
                else if (list[0].imgposition == 3)
                {
                    preview = preview + RenderPartialToString("_contentImgRight", sh);
                }

                //if (list[0].bmoredetail == 0)
                //{
                //    tab = "<ul><li class='k-state-active'>พิมพ์ข้อความ</li><li id='more' style='display:none'>รายละเอียด</li></ul>";
                //}
                //else
                //{
                //    tab = "<ul><li class='k-state-active'>พิมพ์ข้อความ</li><li id='more'>รายละเอียด</li></ul>";
                //}

                List <DIContent> list2 = contentrepo.ShowChildContent(idcontent).ToList();
                foreach (var data in list2)
                {
                    sh.order = data.ordernumber;
                    sh.trick = data.imgthickboxshow.ToString();
                    sh.id    = data.idcontenteditor;
                    string html2 = System.Web.HttpUtility.HtmlDecode(data.textdata);
                    sh.text    = html2;
                    sh.imgpath = data.imgpath;
                    editor     = editor + RenderPartialToString("_contentEditor", sh);
                    script     = script + RenderPartialToString("_contentEditorScript", sh);
                    if (data.imgposition == 1)
                    {
                        preview = preview + RenderPartialToString("_contentImgLeft", sh);
                    }
                    else if (data.imgposition == 2)
                    {
                        preview = preview + RenderPartialToString("_contentImgCenter", sh);
                    }
                    else if (data.imgposition == 3)
                    {
                        preview = preview + RenderPartialToString("_contentImgRight", sh);
                    }
                }
                ViewBag.drawEdit = "<input type='hidden' id='hidden' value='" + list[0].idcontenteditor + "'/>" + editor;
                //ViewBag.drawUL = tab;
                ViewBag.draw           = preview;
                ViewBag.drawMoreDetail = "<img id='linkvaluepreview' src='/ContentManager/ImageIcon?id=" + list[0].ContentLinkTypeValue + "'/>";
                ViewBag.script         = script;
            }
            return(View());
        }