private string Slider()
    {
        Model_MasterSlider     ms = new Model_MasterSlider();
        Model_MasterSliderItem mi = new Model_MasterSliderItem();
        // string ret = StringUtility.GetTemplate("Slider");

        List <Model_MasterSlider> mslist = ms.GetMasterList();

        List <Model_MasterSliderItem> msitem = mi.GetMasterItemList();
        StringBuilder template = new StringBuilder();

        template.Append("<style>");

        int count = 1;

        foreach (Model_MasterSlider m in mslist)
        {
            template.Append(".flexslider.top_slider .slide" + count + " {");
            template.Append("width: 100%;");
            template.Append("background-image: url(" + m.MediaFullPath + ");");
            template.Append("background-size: cover;");
            template.Append("}");

            count = count + 1;
        }

        template.Append("</style>");



        template.Append("<section id=\"home\" class=\"padbot30\">");
        template.Append("<div class=\"flexslider top_slider\">");
        template.Append("<ul class=\"slides\">");
        count = 1;
        foreach (Model_MasterSlider m in mslist)
        {
            template.Append("<li class=\"slide" + count + "\" >");

            template.Append("<div class=\"container\">");

            template.Append("<div class=\"flex_caption1\">");
            template.Append("<p class=\"title1 captionDelay2 FromTop\">" + m.Text1 + "</p>");
            template.Append("<p class=\"title2 captionDelay3 FromTop\">" + m.Text2 + "</p>");
            template.Append("</div>");

            template.Append("<a class=\"flex_caption2\" href=\"javascript:void(0);\"><div class=\"middle\">Download<span> Brochure</span>Click</div></a>");

            template.Append("<div class=\"flex_caption3 slide_banner_wrapper\">");


            //MSID
            int count_i = 1;
            foreach (Model_MasterSliderItem i in msitem.Where(r => r.MSID == m.MSID))
            {
                if (count_i == 3)
                {
                    template.Append("<a style=\"width:550px;height:180px;background-size: cover;background-image: url(" + i.MediaFullPath + ");\" class=\"slide_banner slide1_banner" + count_i + " captionDelay" + (3 + count_i) + " FromBottom\" href=\"javascript:void(0);\"></a>");
                }
                else
                {
                    template.Append("<a style=\"width:278px;height:180px;background-size: cover;background-image: url(" + i.MediaFullPath + ");\" class=\"slide_banner slide1_banner" + count_i + " captionDelay" + (3 + count_i) + " FromBottom\" href=\"javascript:void(0);\"></a>");
                }


                count_i = count_i + 1;
            }



            //template.Append("<a class=\"slide_banner slide1_banner2 captionDelay5 FromBottom\" href=\"javascript:void(0);\"><img src=\"/Theme/maintheme/images/slider/slide1_baner2.jpg\" alt=\"\" /></a>");
            //template.Append("<a class=\"slide_banner slide1_banner3 captionDelay6 FromBottom\" href=\"javascript:void(0);\"><img src=\"/Theme/maintheme/images/slider/slide1_baner3.jpg\" alt=\"\" /></a>");



            template.Append(" </div>");
            template.Append("</div>");
            template.Append("</li>");

            count = count + 1;
        }

        template.Append("</ul>");
        template.Append("</div>");
        template.Append("</section>");


        //string body = ret.GetKeywordReplace("<!-- ###MASTERITEM_START### -->", "<!-- ###MASTERITEM_END### -->");
        //string style = ret.GetKeywordReplace(" <!-- ###STYLE_START### -->", "<!-- ###STYLE_END### -->");
        //StringBuilder strStyle = new StringBuilder();
        //StringBuilder strBody = new StringBuilder();

        //return ret.Replace(body, strBody.ToString());

        return(template.ToString());
    }
示例#2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.Page.IsPostBack)
        {
            Model_MasterSlider     ms = new Model_MasterSlider();
            Model_MasterSliderItem mi = new Model_MasterSliderItem();

            List <Model_MasterSlider> mslist = ms.GetMasterList();
            string media = string.Empty;
            foreach (Model_MasterSlider m in mslist)
            {
                int uuid = m.MSID;
                media += "<input type=\"checkbox\" name=\"chk_master_slider\" checked=\"checked\" value=\"" + uuid + "\" style=\"display:none;\" />";
                media += "<div class=\"media_item_box\"  style=\"border-top:2px solid #eee;margin-top:20px;padding-top:20px;\" id=\"media_item_box_" + uuid + "\"   style=\"margin-top:5px;\"><label> No Media selected</label>";

                media += " <button id=\"addimg_" + uuid + "\" type=\"button\" class=\"addmedia btn btn-success btn-xs\" onclick=\"BindMediaBoxList(this);\"> Add main picture</button>";
                media += "<input type=\"hidden\" id=\"b3_url_" + uuid + "\"  name=\"b3_url_" + uuid + "\" value=\"" + m.MediaFullPath + "\" />";
                media += "<input type=\"hidden\" id=\"b3_id_" + uuid + "\" name=\"b3_id_" + uuid + "\" value=\"" + m.MID + "\" />";

                media += "<h1><input type=\"textbox\" placeholder=\"TEXT HERE\" name=\"b3_text_big_" + uuid + "\" style=\"width:100%;\" value=\"" + m.Text1 + "\" /><h2>";
                media += "<h2><input type=\"textbox\" placeholder=\"TEXT HERE\" name=\"b3_text_normal_" + uuid + "\" style=\"width:100%;\" value=\"" + m.Text2 + "\" /></h2>";

                media += "</div >";

                List <Model_MasterSliderItem> milist = mi.GetMasterItemList(m.MSID);
                int itemcount = milist.Count;
                //item list
                media += "<div class=\"master_item_block\">";
                //  ---------
                //List 1
                media += "<div class=\"media_item_master media_item_box\" id=\"media_item_box_item_1_" + uuid + "\"   style=\"margin-top:5px;\"><label> No Media selected</label>";
                media += " <button id=\"addimg_item_1_" + uuid + "\" type=\"button\" class=\"addmedia btn btn-success btn-xs\" onclick=\"BindMediaBoxList(this);\"> Add Banner</button>";
                media += "<input type=\"hidden\" id=\"b3_url_item_1" + uuid + "\"  name=\"b3_url_item_1" + uuid + "\" value=\"" + (itemcount > 0? milist[0].MediaFullPath : "") + "\"  />";
                media += "<input type=\"hidden\" id=\"b3_id_item_1" + uuid + "\" name=\"b3_id_item_1" + uuid + "\" value=\"" + (itemcount > 0 ? milist[0].MID.ToString() : "") + "\" />";
                media += "<input type=\"textbox\" id=\"b3_link_item_1" + uuid + "\" name=\"b3_link_item_1" + uuid + "\" value=\"" + (itemcount > 0 ? milist[0].Link : "") + "\"  class=\"form-control\" placeholder=\"Link\" />";
                media += "</div>";
                //List 1
                //  ---------
                //List 2
                media += "<div class=\"media_item_master media_item_box\" id=\"media_item_box_item_2_" + uuid + "\"   style=\"margin-top:5px;\"><label> No Media selected</label>";
                media += " <button id=\"addimg_item_2_" + uuid + "\" type=\"button\" class=\"addmedia btn btn-success btn-xs\" onclick=\"BindMediaBoxList(this);\"> Add Banner</button>";
                media += "<input type=\"hidden\" id=\"b3_url_item_2" + uuid + "\"  name=\"b3_url_item_2" + uuid + "\" value=\"" + (itemcount > 1 ? milist[1].MediaFullPath : "") + "\"  />";
                media += "<input type=\"hidden\" id=\"b3_id_item_2" + uuid + "\" name=\"b3_id_item_2" + uuid + "\" value=\"" + (itemcount > 1 ? milist[1].MID.ToString() : "") + "\" />";
                media += "<input type=\"textbox\" id=\"b3_link_item_2" + uuid + "\" name=\"b3_link_item_2" + uuid + "\" value=\"" + (itemcount > 1? milist[1].Link : "") + "\" class=\"form-control\" placeholder=\"Link\" />";
                media += "</div>";
                //List 2
                //  ---------
                //List 3
                media += "<div class=\"media_item_master media_item_box\" id=\"media_item_box_item_3_" + uuid + "\"   style=\"margin-top:5px;\"><label> No Media selected</label>";
                media += " <button id=\"addimg_item_3_" + uuid + "\" type=\"button\" class=\"addmedia btn btn-success btn-xs\" onclick=\"BindMediaBoxList(this);\"> Add Banner</button>";
                media += "<input type=\"hidden\" id=\"b3_url_item_3" + uuid + "\"  name=\"b3_url_item_3" + uuid + "\" value=\"" + (itemcount > 2 ? milist[2].MediaFullPath : "") + "\"  />";
                media += "<input type=\"hidden\" id=\"b3_id_item_3" + uuid + "\" name=\"b3_id_item_3" + uuid + "\" value=\"" + (itemcount > 2? milist[2].MID.ToString() : "") + "\" />";

                media += "<input type=\"textbox\" id=\"b3_link_item_3" + uuid + "\" name=\"b3_link_item_3" + uuid + "\" value=\"" + (itemcount > 2 ? milist[2].Link : "") + "\" class=\"form-control\" placeholder=\"Link\" />";
                media += "</div>";
                //List 3
                //  ---------
                media += "<div style=\"clear:both\"></div>";

                media += "</div>";

                //item list

                media += "<div style=\"clear:both;height:70px;border-bottom:2px solid #eee;padding-top:20px;margin-top:20px\"></div>";
            }


            master_body.InnerHtml = media;
        }
    }