protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (!String.IsNullOrEmpty(_box_css_name))
            {
                if (_box_css_name.IndexOf("-title-") > 0)
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"title\">{1}</div><div class=\"m\"><div class=\"clearfix\">", _box_css_name, LegoWebSite.Buslgic.CommonParameters.asign_COMMON_PARAMETER(this.Title));
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litBoxTop.Text    = sBoxTop;
                    this.litBoxBottom.Text = sBoxBottom;
                }
                else
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"m\"><div class=\"clearfix\">", _box_css_name);
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litBoxTop.Text    = sBoxTop;
                    this.litBoxBottom.Text = sBoxBottom;
                }
            }
            DataTable cntData = LegoWebSite.Buslgic.MetaContents.get_MOST_READ_CONTENTS(_category_id, _number_of_record, System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToLower());
            if (cntData.Rows.Count > 0)
            {
                CRecord   myRec = new CRecord();
                CSubfield Sf    = new CSubfield();

                string   sTemplateFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_template_name);
                UrlQuery myPost            = new UrlQuery();
                if (!String.IsNullOrEmpty(_default_post_page))
                {
                    myPost = new UrlQuery(_default_post_page);
                }
                CRecords outRecs = new CRecords();

                for (int i = 0; i < cntData.Rows.Count; i++)
                {
                    int meta_content_id = (int)cntData.Rows[i]["META_CONTENT_ID"];
                    myRec.load_Xml(LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML(meta_content_id, 0));
                    if (myRec.Datafields.Datafield("245").Subfields.get_Subfield("n", ref Sf))
                    {
                        Sf.Value = cntData.Rows[i]["READ_COUNT"].ToString();
                    }
                    else
                    {
                        Sf.ReConstruct();
                        Sf.Code  = "n";
                        Sf.Value = cntData.Rows[i]["READ_COUNT"].ToString();
                        myRec.Datafields.Datafield("245").Subfields.Add(Sf);
                    }
                    myPost.Set("contentid", cntData.Rows[i]["META_CONTENT_ID"].ToString());
                    myRec.Controlfields.Controlfield("001").Value = myPost.AbsoluteUri;
                    outRecs.Add(myRec);
                }
                this.litContent.Text = outRecs.XsltFile_Transform(sTemplateFileName);
            }
        }
    }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (!String.IsNullOrEmpty(_box_css_name))
            {
                if (_box_css_name.IndexOf("-title-") > 0)
                {
                    DataTable catData = LegoWebSite.Buslgic.Categories.get_CATEGORY_BY_ID(_category_id).Tables[0];
                    if (catData.Rows.Count > 0)
                    {
                        this.Title = catData.Rows[0]["CATEGORY_" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToUpper() + "_TITLE"].ToString();
                    }
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"title\"><a href=\"contentnavigator.aspx?catid={1}\">{2}</a></div><div class=\"m\"><div class=\"clearfix\">", _box_css_name, _category_id.ToString(), this.Title);
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litBoxTop.Text    = sBoxTop;
                    this.litBoxBottom.Text = sBoxBottom;
                }
                else
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"m\"><div class=\"clearfix\">", _box_css_name);
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litBoxTop.Text    = sBoxTop;
                    this.litBoxBottom.Text = sBoxBottom;
                }
            }

            DataTable cntData = LegoWebSite.Buslgic.MetaContents.get_TOP_CONTENTS_OF_CATEGORY(_category_id, _number_of_record, System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToLower());

            UrlQuery myPost = new UrlQuery();
            if (!String.IsNullOrEmpty(_default_post_page))
            {
                myPost = new UrlQuery(_default_post_page);
            }
            string   sTemplateFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_template_name);
            CRecords ouRecs            = new CRecords();
            for (int i = 0; i < cntData.Rows.Count; i++)
            {
                CRecord myRec = new CRecord();
                myRec.load_Xml(LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML((int)cntData.Rows[i]["META_CONTENT_ID"], 0));
                myPost.Set("contentid", cntData.Rows[i]["META_CONTENT_ID"].ToString());
                myRec.Controlfields.Controlfield("001").Value = myPost.AbsoluteUri;
                ouRecs.Add(myRec);
            }
            this.litContent.Text = ouRecs.XsltFile_Transform(sTemplateFileName);
        }
    }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int    meta_content_id = 0;
        int    category_id     = 0;
        int    menu_id         = 0;
        string sLangCode       = System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToLower();

        if (!IsPostBack)
        {
            //set round boxs

            if (!String.IsNullOrEmpty(_navibox_css_name))
            {
                if (_navibox_css_name.IndexOf("-title-") > 0)
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"title\">{1}</div><div class=\"m\"><div class=\"clearfix\">", _navibox_css_name, LegoWebSite.Buslgic.CommonParameters.asign_COMMON_PARAMETER(_navibox_title));
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litCatNaviBoxTop.Text    = sBoxTop;
                    this.litCatNaviBoxBottom.Text = sBoxBottom;
                }
                else
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"m\"><div class=\"clearfix\">", _navibox_css_name);
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litCatNaviBoxTop.Text    = sBoxTop;
                    this.litCatNaviBoxBottom.Text = sBoxBottom;
                }
            }
            else
            {
                this.litCatNaviBoxTop.Text    = "<div>";
                this.litCatNaviBoxBottom.Text = "</div>";
            }


            if (!String.IsNullOrEmpty(_contentbox_css_name))
            {
                if (_contentbox_css_name.IndexOf("-title-") > 0)
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"title\">{1}</div><div class=\"m\"><div class=\"clearfix\">", _contentbox_css_name, LegoWebSite.Buslgic.CommonParameters.asign_COMMON_PARAMETER(_contentbox_title));
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litContentBrowserBoxTop.Text    = sBoxTop;
                    this.litContentBrowserBoxBottom.Text = sBoxBottom;
                }
                else
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"m\"><div class=\"clearfix\">", _contentbox_css_name);
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litContentBrowserBoxTop.Text    = sBoxTop;
                    this.litContentBrowserBoxBottom.Text = sBoxBottom;
                }
            }
            else
            {
                this.litContentBrowserBoxTop.Text    = "<div>";
                this.litContentBrowserBoxBottom.Text = "</div>";
            }


            if (!String.IsNullOrEmpty(_relatedbox_css_name))
            {
                if (_relatedbox_css_name.IndexOf("-title-") > 0)
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"title\">{1}</div><div class=\"m\"><div class=\"clearfix\">", _relatedbox_css_name, LegoWebSite.Buslgic.CommonParameters.asign_COMMON_PARAMETER(_relatedbox_title));
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litRelatedContentBoxTop.Text    = sBoxTop;
                    this.litRelatedContentBoxBottom.Text = sBoxBottom;
                }
                else
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"m\"><div class=\"clearfix\">", _relatedbox_css_name);
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litRelatedContentBoxTop.Text    = sBoxTop;
                    this.litRelatedContentBoxBottom.Text = sBoxBottom;
                }
            }
            else
            {
                this.litRelatedContentBoxTop.Text    = "<div>";
                this.litRelatedContentBoxBottom.Text = "</div>";
            }

            //try to find meta_content_id in order of: meta_content_id; category_id->get top 1 meta_content_id of; menu_id->category_id->get top 1 meta_content_id of

            if (CommonUtility.GetInitialValue("contentid", null) != null)
            {
                meta_content_id = int.Parse(CommonUtility.GetInitialValue("contentid", null).ToString());
            }

            if (CommonUtility.GetInitialValue("catid", null) != null)
            {
                category_id = int.Parse(CommonUtility.GetInitialValue("catid", null).ToString());
            }

            if (CommonUtility.GetInitialValue("mnuid", null) != null)
            {
                menu_id = int.Parse(CommonUtility.GetInitialValue("mnuid", 0).ToString());
            }

            if (meta_content_id <= 0)
            {
                if (category_id > 0)
                {
                    if (!LegoWebSite.Buslgic.Categories.is_CATEGORY_EXIST(category_id))
                    {
                        this.litContentBrowserContent.Text = "<H3>" + Resources.strings.DataIsNotAvailable + "</H3>";
                        return;
                    }
                    else
                    {
                        DataTable top1Data = LegoWebSite.Buslgic.MetaContents.get_TOP_CONTENTS_OF_CATEGORY(category_id, 1, sLangCode);
                        if (top1Data.Rows.Count > 0)
                        {
                            meta_content_id = (int)top1Data.Rows[0]["META_CONTENT_ID"];
                            category_id     = (int)top1Data.Rows[0]["CATEGORY_ID"];
                        }
                        else
                        {
                            this.litContentBrowserContent.Text = "<H3>" + Resources.strings.DataIsNotAvailable + "</H3>";
                            return;
                        }
                    }
                }
                else if (menu_id > 0)
                {
                    category_id = LegoWebSite.Buslgic.Categories.get_CATEGORY_ID_BY_MENU_ID(menu_id);
                    if (!LegoWebSite.Buslgic.Categories.is_CATEGORY_EXIST(category_id))
                    {
                        this.litContentBrowserContent.Text = "<H3>" + Resources.strings.DataIsNotAvailable + "</H3>";
                        return;
                    }
                    else
                    {
                        DataTable top1Data = LegoWebSite.Buslgic.MetaContents.get_TOP_CONTENTS_OF_CATEGORY(category_id, 1, sLangCode);
                        if (top1Data.Rows.Count > 0)
                        {
                            meta_content_id = (int)top1Data.Rows[0]["META_CONTENT_ID"];
                            category_id     = (int)top1Data.Rows[0]["CATEGORY_ID"];//change to specific content's category
                        }
                        else
                        {
                            this.litContentBrowserContent.Text = "<H3>" + Resources.strings.DataIsNotAvailable + "</H3>";
                            return;
                        }
                    }
                }
                else
                {
                    this.litContentBrowserContent.Text = "<H3>" + Resources.strings.DataIsNotAvailable + "</H3>";
                    return;
                }
            }

            if (!LegoWebSite.Buslgic.MetaContents.is_META_CONTENTS_EXIST(meta_content_id))
            {
                litContentBrowserContent.Text = "<H3>meta_content_id is not available!</H3>";
                return;
            }
            if (category_id == 0)
            {
                category_id = LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_CATEGORY_ID(meta_content_id);
            }
            //Display Navigator Info
            this.litCatNaviContent.Text = LegoWebSite.Buslgic.Categories.get_NavigatePath(category_id, (String.IsNullOrEmpty(_default_post_page) == true ? Request.Url.AbsoluteUri:_default_post_page));
            #region verify access right
            //verify access right
            int iAccessLevel = LegoWebSite.Buslgic.MetaContents.get_ACCESS_LEVEL(meta_content_id);
            switch (iAccessLevel)
            {
            case 1:     //need logedin
                if (!Page.User.Identity.IsAuthenticated)
                {
                    this.litContentBrowserContent.Text = "<span><b>Only registered users can view details</b></span>";
                    return;
                }
                break;

            case 2:
                if (!Page.User.Identity.IsAuthenticated)
                {
                    this.litContentBrowserContent.Text = "<span><b>Only registered users can view details</b></span>";
                    return;
                }
                else //verify user roles
                {
                    string[] sAllowAccessRoles = LegoWebSite.Buslgic.MetaContents.get_ACCESS_ROLES(meta_content_id);
                    string[] sUserRoles        = Roles.GetRolesForUser(Page.User.Identity.Name);
                    bool     bAllowAccess      = false;
                    if (sUserRoles != null && sUserRoles.Length > 0 && sAllowAccessRoles != null && sAllowAccessRoles.Length > 0)
                    {
                        for (int x = 0; x < sUserRoles.Length; x++)
                        {
                            for (int y = 0; y < sAllowAccessRoles.Length; y++)
                            {
                                if (sUserRoles[x] == sAllowAccessRoles[y])
                                {
                                    bAllowAccess = true;
                                    break;
                                }
                            }
                            if (bAllowAccess)
                            {
                                break;
                            }
                        }
                    }
                    if (!bAllowAccess)
                    {
                        this.litContentBrowserContent.Text = "<span><b>You are not authorized to view details</b></span>";
                        return;
                    }
                }
                break;
            }
            #endregion verify access right
            //auhorized
            //Display Content Details
            CRecord myRec = new CRecord();
            myRec.load_Xml(LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML(meta_content_id, 1));
            string sTemplateFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(LegoWebSite.Buslgic.Categories.get_CATEGORY_TEMPLATE_NAME(category_id));

            //find linked contents list
            CDatafields Dfs = myRec.Datafields;
            Dfs.Filter("780");
            int      iLinkedCount = Dfs.Count;
            int[]    linkedIDs    = new int[iLinkedCount + 1];
            UrlQuery linkPost     = new UrlQuery();
            if (!String.IsNullOrEmpty(_default_post_page))
            {
                linkPost = new UrlQuery(_default_post_page);
            }
            for (int i = 0; i < iLinkedCount; i++)
            {
                linkedIDs[i] = int.Parse(Dfs.Datafield(i).Subfields.Subfield("w").Value);
                //change link content id to link url
                linkPost.Set("contentid", linkedIDs[i].ToString());
                Dfs.Datafield(i).Subfields.Subfield("w").Value = linkPost.AbsoluteUri;
            }
            this.litContentBrowserContent.Text = myRec.XsltFile_Transform(sTemplateFileName);
            //increase read count
            LegoWebSite.Buslgic.MetaContents.increase_READ_COUNT(meta_content_id);
            //exception ids
            linkedIDs[iLinkedCount] = meta_content_id;//last id is current meta_content_id

            DataTable relData = LegoWebSite.Buslgic.MetaContents.get_TOP_RELATED_CONTENTS(category_id, _number_of_record, sLangCode, linkedIDs);
            if (relData.Rows.Count > 0)
            {
                CRecords outRecs = new CRecords();
                sTemplateFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_related_content_template);
                for (int i = 0; i < relData.Rows.Count; i++)
                {
                    meta_content_id = (int)relData.Rows[i]["META_CONTENT_ID"];
                    myRec.load_Xml(LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML(meta_content_id, 1));
                    linkPost.Set("contentid", meta_content_id.ToString());
                    myRec.Controlfields.Controlfield("001").Value = linkPost.AbsoluteUri;
                    outRecs.Add(myRec);
                }
                this.litRelatedContentContent.Text = outRecs.XsltFile_Transform(sTemplateFileName);
            }
            else
            {
                this.litRelatedContentContent.Text = "";
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (_category_id == 0)
            {
                this.litTabControlTitle.Text = "Category id prarameter is not set!";
                return;
            }

            DataTable catData = LegoWebSite.Buslgic.Categories.get_CATEGORY_BY_ID(_category_id).Tables[0];

            string TitleRoot = catData.Rows[0]["CATEGORY_" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToUpper() + "_TITLE"].ToString();
            if (catData.Rows.Count > 0)
            {
                this.litTabControlTitle.Text = "<a href ='ContentNavigator.aspx?catid=" + int.Parse(catData.Rows[0]["CATEGORY_ID"].ToString()) + "'>" + TitleRoot + "</a>";
            }

            UrlQuery myPost = new UrlQuery();
            if (!String.IsNullOrEmpty(_default_post_page))
            {
                myPost = new UrlQuery(_default_post_page);
            }
            String sTabContents = "";

            DataTable tblTabCate = LegoWebSite.Buslgic.Categories.get_CATEGORY_CHILREN(_category_id).Tables[0];

            string stabs = "";
            stabs += "<div class='container'><ul>";
            for (int i = 0; i < tblTabCate.Rows.Count; i++)
            {
                stabs += "<li>";
                stabs += "<a  href='#" + tblTabCate.Rows[i]["CATEGORY_ID"].ToString() + "'><span>" + tblTabCate.Rows[i]["CATEGORY_" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToUpper() + "_TITLE"].ToString() + "</span></a>";
                stabs += "</li>";

                sTabContents += "<div id='" + tblTabCate.Rows[i]["CATEGORY_ID"].ToString() + "'>";

                //get content by tab menu
                DataTable tabDataContent = LegoWebSite.Buslgic.MetaContents.get_TOP_CONTENTS_OF_CATEGORY(int.Parse(tblTabCate.Rows[i]["CATEGORY_ID"].ToString()), _number_of_record, System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToLower());
                CRecord   myRec          = new CRecord();
                if (tabDataContent.Rows.Count == 1)
                {
                    myRec = new CRecord();
                    string sTemplateFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_left_template_name);
                    myRec.load_Xml(LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML((int)tabDataContent.Rows[0]["META_CONTENT_ID"], 0));
                    myPost.Set("contentid", tabDataContent.Rows[0]["META_CONTENT_ID"].ToString());
                    myRec.Controlfields.Controlfield("001").Value = myPost.AbsoluteUri;
                    sTabContents += "<div style='float:left;width:100%;'>" + myRec.XsltFile_Transform(sTemplateFileName) + "</div>";
                }
                else if (tabDataContent.Rows.Count > 1)
                {
                    myRec = new CRecord();

                    string sTempLeftFileName  = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_left_template_name);
                    string sTempRightFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_right_template_name);

                    myRec.load_Xml(LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML((int)tabDataContent.Rows[0]["META_CONTENT_ID"], 0));
                    myPost.Set("contentid", tabDataContent.Rows[0]["META_CONTENT_ID"].ToString());
                    myRec.Controlfields.Controlfield("001").Value = myPost.AbsoluteUri;
                    sTabContents += "<div style='float:left;width:50%;'>" + myRec.XsltFile_Transform(sTempLeftFileName) + "</div>";

                    sTabContents += "<div style='float:right;width:47%;'>";
                    CRecords outRecs = new CRecords();
                    for (int j = 1; j < tabDataContent.Rows.Count; j++)
                    {
                        myRec.load_Xml(LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML((int)tabDataContent.Rows[j]["META_CONTENT_ID"], 0));
                        myPost.Set("contentid", tabDataContent.Rows[j]["META_CONTENT_ID"].ToString());
                        myRec.Controlfields.Controlfield("001").Value = myPost.AbsoluteUri;
                        outRecs.Add(myRec);
                    }
                    sTabContents += outRecs.XsltFile_Transform(sTempRightFileName);
                    sTabContents += "</div>";
                }
                sTabContents += "</div>";
            }
            stabs            += "</ul>";
            stabs            += sTabContents;
            stabs            += "</div>";
            this.litTabs.Text = stabs;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DataTable catData = LegoWebSite.Buslgic.Categories.get_CATEGORY_BY_ID(_category_id).Tables[0];
            if (catData.Rows.Count > 0)
            {
                this.Title = catData.Rows[0]["CATEGORY_" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToUpper() + "_TITLE"].ToString();
            }
            else
            {
                this.litContent.Text = "<H3>category_id is not vailable!</H3>";
                return;
            }

            if (!String.IsNullOrEmpty(_box_css_name))
            {
                if (_box_css_name.IndexOf("-title-") > 0)
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"title\">{1}</div><div class=\"m\"><div class=\"clearfix\">", _box_css_name, LegoWebSite.Buslgic.CommonParameters.asign_COMMON_PARAMETER(this.Title));
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litBoxTop.Text    = sBoxTop;
                    this.litBoxBottom.Text = sBoxBottom;
                }
                else
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"m\"><div class=\"clearfix\">", _box_css_name);
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litBoxTop.Text    = sBoxTop;
                    this.litBoxBottom.Text = sBoxBottom;
                }
            }

            string   slidescroll = @"<script language='javascript' type='text/javascript'>
            $(function() {
                $('.webwidget_scroller_amazon').webwidget_scroller_amazon({
                    scroller_title_show: 'enable',//enable  disable
                    scroller_time_interval: '4000',
                    scroller_window_background_color: 'none',
                    scroller_window_padding: '5',
                    scroller_border_size: '0',
                    scroller_border_color: '#CCC',
                    scroller_images_width: '" + _image_width.ToString() + @"',
                    scroller_images_height: '" + _image_height.ToString() + @"',
                    scroller_title_size: '12',
                    scroller_title_color: 'black',
                    scroller_show_count: '" + _page_size.ToString() + @"',
                    directory: 'images'
                });
            });
            </script>";
            UrlQuery myPost      = new UrlQuery();
            if (!String.IsNullOrEmpty(_default_post_page))
            {
                myPost = new UrlQuery(_default_post_page);
            }
            string    sTemplateFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_template_name);
            CRecords  outRecs           = new CRecords();
            CRecord   myRec             = new CRecord();
            DataTable cntData           = LegoWebSite.Buslgic.MetaContents.get_TOP_CONTENTS_OF_CATEGORY(_category_id, _number_of_record, System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToLower());
            for (int i = 0; i < cntData.Rows.Count; i++)
            {
                myRec = new CRecord();
                myRec.load_Xml(LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML((int)cntData.Rows[i]["META_CONTENT_ID"], 0));
                myPost.Set("contentid", cntData.Rows[i]["META_CONTENT_ID"].ToString());
                myRec.Controlfields.Controlfield("001").Value = myPost.AbsoluteUri;
                outRecs.Add(myRec);
            }
            this.litContent.Text += "<div id='webwidget_scroller_amazon' class='webwidget_scroller_amazon'><div class='webwidget_scroller_simple2_mask'> <ul>";
            this.litContent.Text += outRecs.XsltFile_Transform(sTemplateFileName);
            this.litContent.Text += "</ul></div><ul class='webwidget_scroller_simple2_nav'><li></li> <li></li></ul><div style='clear: both'></div></div>";
            Page.RegisterStartupScript("slidesroll", slidescroll);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (!String.IsNullOrEmpty(_box_css_name))
            {
                if (_box_css_name.IndexOf("-title-") > 0)
                {
                    if (_section_id > 0)
                    {
                        DataTable secData = LegoWebSite.Buslgic.Sections.get_SECTION_BY_ID(_section_id).Tables[0];
                        if (secData.Rows.Count > 0)
                        {
                            this.Title = secData.Rows[0]["SECTION_" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToUpper() + "_TITLE"].ToString();
                        }
                    }
                    else
                    {
                        DataTable catData = LegoWebSite.Buslgic.Categories.get_CATEGORY_BY_ID(_category_id).Tables[0];
                        if (catData.Rows.Count > 0)
                        {
                            this.Title = catData.Rows[0]["CATEGORY_" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToUpper() + "_TITLE"].ToString();
                        }
                    }
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"title\">{1}</div><div class=\"m\"><div class=\"clearfix\">", _box_css_name, LegoWebSite.Buslgic.CommonParameters.asign_COMMON_PARAMETER(this.Title));
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litBoxTop.Text    = sBoxTop;
                    this.litBoxBottom.Text = sBoxBottom;
                }
                else
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"m\"><div class=\"clearfix\">", _box_css_name);
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litBoxTop.Text    = sBoxTop;
                    this.litBoxBottom.Text = sBoxBottom;
                }
            }

            DataTable cntData = null;

            if (_section_id > 0)
            {
                cntData = LegoWebSite.Buslgic.MetaContents.get_TOP_NEWS_BY_SECTION(_section_id, _number_of_record, System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToLower(), _important_level);
            }
            else
            {
                cntData = LegoWebSite.Buslgic.MetaContents.get_TOP_NEWS_BY_CATEGORY(_category_id, _number_of_record, System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToLower(), _important_level);
            }

            if (cntData.Rows.Count > 0)
            {
                string   sTemplateFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_template_name);
                CRecords outRecs           = new CRecords();
                UrlQuery myPost            = new UrlQuery();
                string   postURL           = String.IsNullOrEmpty(_default_post_page) ? Request.Url.AbsolutePath : _default_post_page;
                CRecord  myRec             = new CRecord();
                for (int i = 0; i < cntData.Rows.Count; i++)
                {
                    myRec.load_Xml(LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML((int)cntData.Rows[i]["META_CONTENT_ID"], 0));
                    int iCatId = (int)cntData.Rows[i]["CATEGORY_ID"];

                    //try to findout related menuid to get postURL
                    int iMnuId       = 0;
                    int iParentCatId = -1;
                    while (iMnuId == 0 && iParentCatId != 0)
                    {
                        DataTable CatTable = LegoWebSite.Buslgic.Categories.get_CATEGORY_BY_ID(iCatId).Tables[0];
                        iParentCatId = int.Parse(CatTable.Rows[0]["PARENT_CATEGORY_ID"].ToString());
                        iCatId       = iParentCatId;
                        iMnuId       = int.Parse(CatTable.Rows[0]["MENU_ID"].ToString());
                    }
                    if (iMnuId > 0)
                    {
                        DataTable MenuTable = LegoWebSite.Buslgic.Menus.get_MENUS_BY_MENU_ID(iMnuId).Tables[0];
                        if (MenuTable.Rows.Count > 0)
                        {
                            postURL = MenuTable.Rows[0]["MENU_LINK_URL"].ToString();
                        }
                    }
                    myPost = new UrlQuery(postURL);
                    myPost.Set("contentid", cntData.Rows[i]["META_CONTENT_ID"].ToString());
                    myRec.Controlfields.Controlfield("001").Value = myPost.AbsoluteUri;
                    outRecs.Add(myRec);
                }
                this.litContent.Text = outRecs.XsltFile_Transform(sTemplateFileName);
            }
            else
            {
                this.litContent.Text = "<H3>" + Resources.strings.DataIsNotAvailable + "</H3>";
            }
        }
    }