예제 #1
0
    public static string LoadMasterPage(string urlRoot, string strSlugPage, HttpRequest request, Page pageContainer, PlaceHolder placeHolderMainContent, string lang)
    {
        //IList<SYS_PageLayout> list = new List<SYS_PageLayout>();
        string strMaster = "MasterPage.master";

        if (strSlugPage != string.Empty)
        {
            SYS_PageLayoutBSO _pageLayoutBSO = new SYS_PageLayoutBSO();
            SYS_PageLayout    _pageLayout    = new SYS_PageLayout();

            if (!AspNetCache.CheckCache("PageLayout_" + strSlugPage + "_" + lang.Replace("-", "_")))
            {
                _pageLayout = _pageLayoutBSO.GetSYS_PageLayoutBySlug(strSlugPage, lang);
                if (_pageLayout == null)
                {
                    _pageLayout = _pageLayoutBSO.GetSYS_PageLayoutBySlug("home", lang);
                }

                AspNetCache.SetCache("PageLayout_" + strSlugPage + "_" + lang.Replace("-", "_"), _pageLayout);
            }
            else
            {
                _pageLayout = (SYS_PageLayout)AspNetCache.GetCache("PageLayout_" + strSlugPage + "_" + lang.Replace("-", "_"));
            }


            if (_pageLayout != null)
            {
                SYS_TemplatePageBSO _templateBSO = new SYS_TemplatePageBSO();
                SYS_TemplatePage    _template    = new SYS_TemplatePage();

                if (!AspNetCache.CheckCache("Template_" + _pageLayout.TemplateId))
                {
                    _template = _templateBSO.GetSYS_TemplatePageById(_pageLayout.TemplateId);
                    AspNetCache.SetCache("Template_" + _pageLayout.TemplateId, _template);
                }
                else
                {
                    _template = (SYS_TemplatePage)AspNetCache.GetCache("Template_" + _pageLayout.TemplateId);
                }


                if (_template != null)
                {
                    strMaster = _template.MasterControl;
                }
            }
        }

        return(strMaster);
    }
예제 #2
0
    public static void AddWidgetPage(string urlRoot, string strSlugPage, HttpRequest request, Page pageContainer, PlaceHolder placeHolderMainContent)
    {
        //IList<SYS_PageLayout> list = new List<SYS_PageLayout>();

        if (strSlugPage != string.Empty)
        {
            SYS_PageLayoutBSO _pageLayoutBSO = new SYS_PageLayoutBSO();
            SYS_PageLayout    _pageLayout    = new SYS_PageLayout();

            if (!AspNetCache.CheckCache("PageLayout_" + strSlugPage + "_" + Language.language.Replace("-", "_")))
            {
                _pageLayout = _pageLayoutBSO.GetSYS_PageLayoutBySlug(strSlugPage, Language.language);
                if (_pageLayout == null)
                {
                    _pageLayout = _pageLayoutBSO.GetSYS_PageLayoutBySlug("home", Language.language);
                }

                AspNetCache.SetCache("PageLayout_" + strSlugPage + "_" + Language.language.Replace("-", "_"), _pageLayout);
            }
            else
            {
                _pageLayout = (SYS_PageLayout)AspNetCache.GetCache("PageLayout_" + strSlugPage + "_" + Language.language.Replace("-", "_"));
            }


            if (_pageLayout != null)
            {
                SYS_TemplatePageBSO _templateBSO = new SYS_TemplatePageBSO();
                SYS_TemplatePage    _template    = new SYS_TemplatePage();

                if (!AspNetCache.CheckCache("Template_" + _pageLayout.TemplateId))
                {
                    _template = _templateBSO.GetSYS_TemplatePageById(_pageLayout.TemplateId);
                    AspNetCache.SetCache("Template_" + _pageLayout.TemplateId, _template);
                }
                else
                {
                    _template = (SYS_TemplatePage)AspNetCache.GetCache("Template_" + _pageLayout.TemplateId);
                }


                if (_template != null)
                {
                    string  _path      = urlRoot + "Client/Skins/Templates/" + _template.TemplateControl;
                    Control objControl = (Control)pageContainer.LoadControl(_path);
                    placeHolderMainContent.Controls.Add(objControl);
                    AddWidgetPageLayout(objControl, _pageLayout.Id, urlRoot, pageContainer);
                }
            }
        }
    }
예제 #3
0
    public static void GetNavigation(string strSlugPage, string g, string cId, string Id, string urlRoot)
    {
        if (strSlugPage != string.Empty)
        {
            SYS_PageLayoutBSO _pageLayoutBSO = new SYS_PageLayoutBSO();
            SYS_PageLayout    _pageLayout    = new SYS_PageLayout();

            if (!AspNetCache.CheckCache("PageLayout_" + strSlugPage + "_" + Language.language.Replace("-", "_")))
            {
                _pageLayout = _pageLayoutBSO.GetSYS_PageLayoutBySlug(strSlugPage, Language.language);
                if (_pageLayout == null)
                {
                    _pageLayout = _pageLayoutBSO.GetSYS_PageLayoutBySlug("home", Language.language);
                }

                AspNetCache.SetCache("PageLayout_" + strSlugPage + "_" + Language.language.Replace("-", "_"), _pageLayout);
            }
            else
            {
                _pageLayout = (SYS_PageLayout)AspNetCache.GetCache("PageLayout_" + strSlugPage + "_" + Language.language.Replace("-", "_"));
            }

            Navigation.TitleName = _pageLayout.PageName;
            Navigation.TitleCate = "<li><a href='" + urlRoot + "'>Trang chủ</a></li>";

            CateNewsGroupBSO cateNewsgroupBSO = new CateNewsGroupBSO();
            NewsGroupBSO     newsgroupBSO     = new NewsGroupBSO();
            CateNewsBSO      catenewsBSO      = new CateNewsBSO();


            if (strSlugPage == "du-an")
            {
                if (!String.IsNullOrEmpty(Id))
                {
                    Navigation.TitleName = "Thông tin dự án";

                    string cate = "<li><a href='" + urlRoot + "c2/du-an-c/du-an-1.aspx'>Dự án";
                    cate += "</a></li>";
                    Navigation.TitleCate  = "<li><a href='" + urlRoot + "Default.aspx'>" + Resources.resource.T_home + "</a></li>";
                    Navigation.TitleCate += cate;
                }
            }
            else
            if (strSlugPage == "detailvideos")
            {
                if (!String.IsNullOrEmpty(cId))
                {
                    VideosCateBSO videosCateBSO = new VideosCateBSO();
                    VideosCate    videoCate     = videosCateBSO.GetVideosCateById(Convert.ToInt32(cId));

                    Navigation.TitleName = "<a href='" + urlRoot + "thu-vien-video" + "-" + videoCate.VideosCateID + ".aspx'>" + videoCate.VideosCateName + "</a>";

                    string cate = "<li><a href='" + urlRoot + "thu-vien-video.aspx'>Thư viện Video";
                    string s1   = "";
                    while (videoCate.ParentCateID != 0)
                    {
                        int pId = videoCate.ParentCateID;
                        videoCate = videosCateBSO.GetVideosCateById(pId);
                        s1        = "<li><a href='" + urlRoot + "thu-vien-video/" + videoCate.VideosCateName + "-" + videoCate.VideosCateID + ".aspx'>" + videoCate.VideosCateName + "</a></li>" + s1;
                    }

                    //   cate += "Video"; //Sửa lại
                    cate += "</a></li>";
                    cate += s1;
                    Navigation.TitleCate  = "<li><a href='" + urlRoot + "Default.aspx'>" + Resources.resource.T_home + "</a></li>";
                    Navigation.TitleCate += cate;
                }
            }
            else
            if (strSlugPage == "detailalbums")
            {
                if (!String.IsNullOrEmpty(cId))
                {
                    AlbumsCateBSO albumsCateBSO = new AlbumsCateBSO();
                    AlbumsCate    videoCate     = albumsCateBSO.GetAlbumsCateById(Convert.ToInt32(cId));

                    Navigation.TitleName = "<a href='" + urlRoot + "thu-vien-video" + "-" + videoCate.AlbumsCateID + ".aspx'>" + videoCate.AlbumsCateName + "</a>";

                    string cate = "<li><a href='" + urlRoot + "thu-vien-video.aspx'>Thư viện Video";
                    string s1   = "";
                    while (videoCate.ParentCateID != 0)
                    {
                        int pId = videoCate.ParentCateID;
                        videoCate = albumsCateBSO.GetAlbumsCateById(pId);
                        s1        = "<li><a href='" + urlRoot + "thu-vien-video/" + videoCate.AlbumsCateName + "-" + videoCate.AlbumsCateID + ".aspx'>" + videoCate.AlbumsCateName + "</a></li>" + s1;
                    }

                    //   cate += "Video"; //Sửa lại
                    cate += "</a></li>";
                    cate += s1;
                    Navigation.TitleCate  = "<li><a href='" + urlRoot + "Default.aspx'>" + Resources.resource.T_home + "</a></li>";
                    Navigation.TitleCate += cate;
                }
            }
            else
            if (strSlugPage == "dh")
            {
                if (!String.IsNullOrEmpty(g))
                {
                    Navigation.TitleName = "<a href='" + urlRoot + "tim-truong/0-0-0-0-0-0-0/search.aspx'>Thông tin trường</a>";

                    Navigation.TitleCate = "<li><a href='" + urlRoot + "Default.aspx'>" + Resources.resource.T_home + "</a></li>";
                }
            }
            else
            if (strSlugPage == "dang-ky-ts")
            {
                if (!String.IsNullOrEmpty(g))
                {
                    Navigation.TitleName = "<a href='" + urlRoot + "c2/dh-dk/Dang-ky-tuyen-sinh-truc-tuyen-20.aspx'>Trang Đăng ký tuyển sinh</a>";

                    Navigation.TitleCate = "<li><a href='" + urlRoot + "Default.aspx'>" + Resources.resource.T_home + "</a></li>";
                }
            }
            else
            if (strSlugPage == "dh-dk")
            {
                if (!String.IsNullOrEmpty(g))
                {
                    Navigation.TitleName = "<a href='" + urlRoot + "c2/dh-dk/Dang-ky-tuyen-sinh-truc-tuyen-20.aspx'>Trang Đăng ký tuyển sinh</a>";

                    Navigation.TitleCate = "<li><a href='" + urlRoot + "Default.aspx'>" + Resources.resource.T_home + "</a></li>";
                }
            }
            else
            if (!String.IsNullOrEmpty(Id))
            {
                NewsGroup newsgroup = newsgroupBSO.GetNewsGroupById(Convert.ToInt32(Id));
                if (newsgroup != null && newsgroup.CateNewsID > 0)
                {
                    CateNews      catenews      = catenewsBSO.GetCateNewsById(newsgroup.CateNewsID);
                    CateNewsGroup cateNewsGroup = cateNewsgroupBSO.GetCateNewsGroupByGroupCate(catenews.GroupCate, Language.language);

                    Navigation.TitleName = "<a href='" + urlRoot + "c3/" + catenewsBSO.GetSlugByCateId(catenews.CateNewsID) + "/" + GetString(catenews.CateNewsName) + "-" + catenews.GroupCate + "-" + catenews.CateNewsID + ".aspx'>" + catenews.CateNewsName + "</a>";

                    string cate = "<li><a href='" + urlRoot + "c2/" + cateNewsgroupBSO.GetSlugById(cateNewsGroup.CateNewsGroupID) + "/" + GetString(cateNewsGroup.CateNewsGroupName) + "-" + catenews.GroupCate + ".aspx'>";
                    string s1   = "";
                    while (catenews.ParentNewsID != 0)
                    {
                        int pId = catenews.ParentNewsID;
                        catenews = catenewsBSO.GetCateNewsById(pId);
                        s1       = "<li><a href='" + urlRoot + "c3/" + catenewsBSO.GetSlugByCateId(catenews.CateNewsID) + "/" + GetString(catenews.CateNewsName) + "-" + catenews.GroupCate + "-" + catenews.CateNewsID + ".aspx'>" + catenews.CateNewsName + "</a></li>" + s1;
                    }

                    cate += cateNewsGroup.CateNewsGroupName.ToString();                         //Sửa lại
                    cate += "</a></li>";
                    cate += s1;
                    Navigation.TitleCate  = "<li><a href='" + urlRoot + "Default.aspx'>" + Resources.resource.T_home + "</a></li>";
                    Navigation.TitleCate += cate;
                }
            }
            else
            {
                if (!String.IsNullOrEmpty(cId) && !String.IsNullOrEmpty(g))
                {
                    CateNews      cateNewsById     = catenewsBSO.GetCateNewsById(Convert.ToInt32(cId));
                    CateNewsGroup groupByGroupCate = cateNewsgroupBSO.GetCateNewsGroupByGroupCate(Convert.ToInt32(g), Language.language);

                    if (groupByGroupCate != null && cateNewsById != null)
                    {
                        Navigation.TitleName = cateNewsById.CateNewsName;

                        string cate = "<li><a href='" + urlRoot + "c2/" + cateNewsgroupBSO.GetSlugById(groupByGroupCate.CateNewsGroupID) + "/" + GetString(groupByGroupCate.CateNewsGroupName) + "-" + cateNewsById.GroupCate + ".aspx' title='" + groupByGroupCate.CateNewsGroupName + "'>";
                        string s1   = "";
                        while (cateNewsById.ParentNewsID != 0)
                        {
                            int parentNewsId = cateNewsById.ParentNewsID;
                            cateNewsById = catenewsBSO.GetCateNewsById(parentNewsId);
                            s1           = "<li><a href='" + urlRoot + "c3/" + catenewsBSO.GetSlugByCateId(cateNewsById.CateNewsID) + "/" + GetString(cateNewsById.CateNewsName) + "-" + cateNewsById.GroupCate + "-" + cateNewsById.CateNewsID + ".aspx' title='" + cateNewsById.CateNewsName + "'>" + cateNewsById.CateNewsName + "</a></li>" + s1;
                        }

                        cate += groupByGroupCate.CateNewsGroupName.ToString() + "</a></li>" + s1;
                        Navigation.TitleCate  = "<li><a href='" + urlRoot + "Default.aspx'>" + Resources.resource.T_home + "</a></li>";
                        Navigation.TitleCate += cate;
                    }
                }
                else
                {
                    if (!String.IsNullOrEmpty(g))
                    {
                        CateNewsGroup groupByGroupCate = cateNewsgroupBSO.GetCateNewsGroupByGroupCate(Convert.ToInt32(g), Language.language);
                        Navigation.TitleCate = "<li><a href='" + urlRoot + "Default.aspx'>" + Resources.resource.T_home + "</a></li>";
                        if (groupByGroupCate != null)
                        {
                            Navigation.TitleName = groupByGroupCate.CateNewsGroupName;
                        }
                    }
                }
            }
        }
    }