コード例 #1
0
        public static DataTable get_DataTableRecords(String sCategory)
        {
            DataTable Data = new DataTable();

            Data.TableName = "CONTENT";
            Data.Columns.Add(new DataColumn("ID", typeof(int)));
            Data.Columns.Add(new DataColumn("TITLE", typeof(string)));
            Data.Columns.Add(new DataColumn("CATEGORY", typeof(string)));

            CRecords myRecs = new CRecords();

            String dataFileName = System.Configuration.ConfigurationManager.AppSettings["LegoWebFilesPhysicalPath"].ToString() + "File/Data/" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName + "\\" + sCategory + ".xml";

            if (File.Exists(dataFileName))
            {
                myRecs.load_File(dataFileName);
                if (myRecs.Count > 0)
                {
                    for (int i = myRecs.Count - 1; i >= 0; i--)
                    {
                        DataRow row = Data.NewRow();
                        row["ID"]       = myRecs.Record(i).Controlfields.Controlfield("001").Value;
                        row["TITLE"]    = myRecs.Record(i).Datafields.Datafield("245").Subfields.Subfield("a").Value;
                        row["CATEGORY"] = myRecs.Record(i).Controlfields.Controlfield("003").Value;
                        Data.Rows.Add(row);
                    }
                }
            }
            return(Data);
        }
コード例 #2
0
        public static CRecords get_LastDataRecords(String sCategory, int iNumberOfRecord)
        {
            CRecords myRecs  = new CRecords();
            CRecords retRecs = new CRecords();

            String dataFileName = System.Configuration.ConfigurationManager.AppSettings["LegoWebFilesPhysicalPath"].ToString() + "File/Data/" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName + "\\" + sCategory + ".xml";

            if (File.Exists(dataFileName))
            {
                myRecs.load_File(dataFileName);
            }
            else
            {
                myRecs.Save(dataFileName);
            }
            if (myRecs.Count <= iNumberOfRecord)
            {
                for (int i = myRecs.Count - 1; i >= 0; i--)
                {
                    retRecs.Add(myRecs.Record(i));
                }
            }
            else
            {
                for (int j = myRecs.Count - 1; j >= myRecs.Count - iNumberOfRecord; j--)
                {
                    retRecs.Add(myRecs.Record(j));
                }
            }
            return(retRecs);
        }
    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);
            }
        }
    }
コード例 #4
0
        public static CRecord get_DataRecord(String sCategory, string sID)
        {
            CRecords myRecs       = new CRecords();
            String   dataFileName = System.Configuration.ConfigurationManager.AppSettings["LegoWebFilesPhysicalPath"].ToString() + "File/Data/" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName + "\\" + sCategory + ".xml";

            if (File.Exists(dataFileName))
            {
                myRecs.load_File(dataFileName);
            }
            else
            {
                myRecs.Save(dataFileName);
            }
            if (myRecs.Count > 0)
            {
                switch (sID.ToLower())
                {
                case "first":
                    return(myRecs.Record(0));

                    break;

                case "last":
                    return(myRecs.Record(myRecs.Count - 1));

                    break;

                default:
                    int iID = int.Parse("0" + sID);
                    myRecs.Filter("001", sID, true);
                    if (myRecs.Count > 0)
                    {
                        return(myRecs.Record(0));
                    }
                    else
                    {
                        CRecord myRec = new CRecord();
                        myRec.load_File(FileTemplateDataProvider.get_WorkformTemplateFile(sCategory));
                        return(myRec);
                    }
                    break;
                }
            }
            else
            {
                CRecord myRec1 = new CRecord();
                myRec1.load_File(FileTemplateDataProvider.get_WorkformTemplateFile(sCategory));
                return(myRec1);
            }
        }
コード例 #5
0
        public static CRecords get_DataRecords(String sCategory)
        {
            CRecords myRecs       = new CRecords();
            String   dataFileName = System.Configuration.ConfigurationManager.AppSettings["LegoWebFilesPhysicalPath"].ToString() + "File/Data/" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName + "\\" + sCategory + ".xml";

            if (File.Exists(dataFileName))
            {
                myRecs.load_File(dataFileName);
            }
            else
            {
                myRecs.Save(dataFileName);
            }
            return(myRecs);
        }
コード例 #6
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);
        }
    }
コード例 #7
0
        public static void save_DataRecord(String sCategory, CRecord saveRecord)
        {
            saveRecord.Controlfields.Controlfield("005").Value = DateTime.Now.ToLongDateString();

            CRecords myRecs = new CRecords();

            String dataFileName = System.Configuration.ConfigurationManager.AppSettings["LegoWebFilesPhysicalPath"].ToString() + "File/Data/" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName + "\\" + sCategory + ".xml";

            if (File.Exists(dataFileName))
            {
                myRecs.load_File(dataFileName);
            }
            else
            {
                myRecs.Save(dataFileName);
            }
            CControlfield Cf  = new CControlfield();
            String        sID = "0";

            if (saveRecord.Controlfields.get_Controlfield("001", ref Cf))
            {
                if (Cf.Value == "")
                {
                    Cf.Value = "0";
                }
                sID = Cf.Value;
            }
            else
            {
                Cf       = new CControlfield();
                Cf.Tag   = "001";
                Cf.Value = "0";
                saveRecord.Controlfields.Add(Cf);
            }
            myRecs.Filter("001", sID, true);
            if (myRecs.Count > 0)
            {
                CRecord ptOldRec = myRecs.Record(0);
                myRecs.Replace(ref ptOldRec, ref saveRecord);
            }
            else
            {
                myRecs.Add(saveRecord);
            }
            myRecs.Save(dataFileName);
        }
コード例 #8
0
        public static int add_DataRecord(String sCategory, CRecord addRecord)
        {
            addRecord.Controlfields.Controlfield("005").Value = DateTime.Now.ToLongDateString();
            CRecords myRecs = new CRecords();

            String dataFileName = System.Configuration.ConfigurationManager.AppSettings["LegoWebFilesPhysicalPath"].ToString() + "File/Data/" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName + "\\" + sCategory + ".xml";

            if (File.Exists(dataFileName))
            {
                myRecs.load_File(dataFileName);
            }
            else
            {
                myRecs.Save(dataFileName);
            }
            int iID = 0;

            myRecs.Filter("001", iID.ToString(), true);
            while (myRecs.Count > 0)
            {
                iID++;
                myRecs.Refresh();
                myRecs.Filter("001", iID.ToString(), true);
            }
            CControlfield Cf = new CControlfield();

            if (addRecord.Controlfields.get_Controlfield("001", ref Cf))
            {
                Cf.Value = iID.ToString();
            }
            else
            {
                Cf       = new CControlfield();
                Cf.Tag   = "001";
                Cf.Value = iID.ToString();
                addRecord.Controlfields.Add(Cf);
            }
            myRecs.Add(addRecord);
            myRecs.Save(dataFileName);
            myRecs.Refresh();
            return(iID);
        }
コード例 #9
0
        public static CRecords get_DataRecords(String sCategory, String sSubCategory)
        {
            CRecords myRecs       = new CRecords();
            CRecords retRecs      = new CRecords();
            String   dataFileName = System.Configuration.ConfigurationManager.AppSettings["LegoWebFilesPhysicalPath"].ToString() + "File/Data/" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName + "\\" + sCategory + ".xml";

            if (File.Exists(dataFileName))
            {
                myRecs.load_File(dataFileName);
                myRecs.Filter("003", sCategory + "." + sSubCategory, true);
                for (int i = myRecs.Count; i < myRecs.Count; i++)
                {
                    retRecs.Add(myRecs.Record(i));
                }
            }
            else
            {
                myRecs.Save(dataFileName);
            }
            return(retRecs);
        }
コード例 #10
0
        public static void increase_DownloadCount(String sCategory, int iIndex)
        {
            CRecords myRecs = new CRecords();

            String dataFileName = System.Configuration.ConfigurationManager.AppSettings["LegoWebFilesPhysicalPath"].ToString() + "File/Data/" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName + "\\" + sCategory + ".xml";

            if (File.Exists(dataFileName))
            {
                myRecs.load_File(dataFileName);
            }
            else
            {
                myRecs.Save(dataFileName);
            }
            if (iIndex < myRecs.Count)
            {
                CRecord myRec = myRecs.Record(iIndex);
                myRec.Datafields.Datafield("245").Subfields.Subfield("n").Value = (int.Parse("0" + myRec.Datafields.Datafield("245").Subfields.Subfield("n").Value) + 1).ToString();
            }
            myRecs.Save(dataFileName);
        }
コード例 #11
0
        public static void delete_DataRecord(String sCategory, string sID)
        {
            CRecords myRecs = new CRecords();

            String dataFileName = System.Configuration.ConfigurationManager.AppSettings["LegoWebFilesPhysicalPath"].ToString() + "File/Data/" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName + "\\" + sCategory + ".xml";

            if (File.Exists(dataFileName))
            {
                myRecs.load_File(dataFileName);
            }
            else
            {
                myRecs.Save(dataFileName);
            }
            myRecs.Filter("001", sID, true);
            if (myRecs.Count > 0)
            {
                myRecs.Remove(0);
            }
            myRecs.Save(dataFileName);
        }
    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);
        }
    }
コード例 #14
0
    protected void linkImportContentButton_Click(object sender, EventArgs e)
    {
        litErrorSpaceHolder.Text = "";
        //try
        //{
        divDefaultCategory.Visible = false;
        DataTable contentTable = create_ContentTable();

        if (String.IsNullOrEmpty(txtFileName.Text))
        {
            throw new Exception("You must select a source file!");
        }
        //chuyển đổi địa chỉ URL sang Physycal
        string sFileURL  = txtFileName.Text;
        string sFileName = sFileURL.Replace(System.Configuration.ConfigurationManager.AppSettings["LegoWebFilesVirtuaPath"], System.Configuration.ConfigurationManager.AppSettings["LegoWebFilesPhysicalPath"]);

        sFileName = sFileName.Replace("/", "\\");
        if (!System.IO.File.Exists(sFileName))
        {
            throw new Exception("Source file does not exists!");
        }
        else
        {
            divDefaultCategory.Visible = true;
        }

        CRecords myRecs = new CRecords();

        myRecs.load_File(sFileName);
        int iSkipCount = 0;

        for (int i = 0; i < myRecs.Count; i++)
        {
            CRecord myRec = new CRecord();
            myRec.load_Xml(myRecs.Record(i).OuterXml);

            if (myRec.get_LeaderValueByPos(6, 6) == "s")//system tables data
            {
                import_SystemTableData(myRec);
            }
            else
            {
                Int32 iID    = String.IsNullOrEmpty(myRecs.Record(i).Controlfields.Controlfield("001").Value) ? 0 : Int32.Parse(myRecs.Record(i).Controlfields.Controlfield("001").Value);
                Int32 iCatID = String.IsNullOrEmpty(myRecs.Record(i).Controlfields.Controlfield("002").Value) ? 0 : Int32.Parse(myRecs.Record(i).Controlfields.Controlfield("002").Value);
                switch (radioImportTypes.SelectedValue)
                {
                case "0":    //append
                    myRec.Controlfields.Controlfield("001").Value = "0";
                    switch (radioForceToDefaultCategory.SelectedValue)
                    {
                    case "0":        //auto detech category id
                        if (!LegoWebAdmin.BusLogic.Categories.is_CATEGORY_ID_EXIST(iCatID))
                        {
                            myRec.Controlfields.Controlfield("002").Value = dropCategories.SelectedValue;
                        }
                        break;

                    case "1":         //force to default category
                        myRec.Controlfields.Controlfield("002").Value = dropCategories.SelectedValue;
                        break;
                    }
                    LegoWebAdmin.BusLogic.MetaContents.save_META_CONTENTS_XML(myRec.OuterXml, this.Page.User.Identity.Name);
                    break;

                case "1":    //skip if ID exsist
                    if (!LegoWebAdmin.BusLogic.MetaContents.is_META_CONTENTS_EXIST(iID))
                    {
                        switch (radioForceToDefaultCategory.SelectedValue)
                        {
                        case "0":        //auto detech category id
                            if (!LegoWebAdmin.BusLogic.Categories.is_CATEGORY_ID_EXIST(iCatID))
                            {
                                myRec.Controlfields.Controlfield("002").Value = dropCategories.SelectedValue;
                            }
                            break;

                        case "1":         //force to default category
                            myRec.Controlfields.Controlfield("002").Value = dropCategories.SelectedValue;
                            break;
                        }
                        LegoWebAdmin.BusLogic.MetaContents.save_META_CONTENTS_XML(myRec.OuterXml, this.Page.User.Identity.Name);
                    }
                    else
                    {
                        iSkipCount++;
                    }
                    break;

                case "2":
                    switch (radioForceToDefaultCategory.SelectedValue)
                    {
                    case "0":        //auto detech category id
                        if (!LegoWebAdmin.BusLogic.Categories.is_CATEGORY_ID_EXIST(iCatID))
                        {
                            myRec.Controlfields.Controlfield("002").Value = dropCategories.SelectedValue;
                        }
                        break;

                    case "1":         //force to default category
                        myRec.Controlfields.Controlfield("002").Value = dropCategories.SelectedValue;
                        break;
                    }
                    LegoWebAdmin.BusLogic.MetaContents.save_META_CONTENTS_XML(myRec.OuterXml, this.Page.User.Identity.Name);
                    break;
                }
            }
        }

        litErrorSpaceHolder.Text = String.Format("Imports successfully {0} records, skips {1}!.", myRecs.Count.ToString(), iSkipCount.ToString());
//        }
//        catch (Exception ex)
//        {
//            String errorFomat = @"<dl id='system-message'>
//                                            <dd class='error message fade'>
//	                                            <ul>
//		                                            <li>{0}</li>
//	                                            </ul>
//                                            </dd>
//                                            </dl>";
//            litErrorSpaceHolder.Text = String.Format(errorFomat, ex.Message);

//        }
    }
コード例 #15
0
    protected void btnAnalyse_Click(object sender, EventArgs e)
    {
        litErrorSpaceHolder.Text = "";
        try
        {
            divDefaultCategory.Visible = false;
            DataTable contentTable = create_ContentTable();
            if (String.IsNullOrEmpty(txtFileName.Text))
            {
                throw new Exception("You must select a source file!");
            }
            //chuyển đổi địa chỉ URL sang Physycal
            string sFileURL  = txtFileName.Text;
            string sFileName = sFileURL.Replace(System.Configuration.ConfigurationManager.AppSettings["LegoWebFilesVirtuaPath"], System.Configuration.ConfigurationManager.AppSettings["LegoWebFilesPhysicalPath"]);
            sFileName = sFileName.Replace("/", "\\");
            if (!System.IO.File.Exists(sFileName))
            {
                throw new Exception("File doest not exists!");
            }
            else
            {
                divDefaultCategory.Visible = true;
            }

            CRecords myRecs = new CRecords();
            myRecs.load_File(sFileName);
            for (int i = 0; i < myRecs.Count; i++)
            {
                DataRow row = contentTable.NewRow();
                if (myRecs.Record(i).get_LeaderValueByPos(6, 6) == "s")//system tables data
                {
                    row["META_CONTENT_ID"]    = 0;
                    row["META_CONTENT_TITLE"] = myRecs.Record(i).Datafields.Datafield("245").Subfields.Subfield("a").Value;
                    row["LANG_CODE"]          = "";
                    row["CATEGORY_ID"]        = 0;
                }
                else
                {
                    row["META_CONTENT_ID"]    = String.IsNullOrEmpty(myRecs.Record(i).Controlfields.Controlfield("001").Value) ? 0 : Int32.Parse(myRecs.Record(i).Controlfields.Controlfield("001").Value);
                    row["META_CONTENT_TITLE"] = myRecs.Record(i).Datafields.Datafield("245").Subfields.Subfield("a").Value;
                    row["LANG_CODE"]          = myRecs.Record(i).Controlfields.Controlfield("008").get_ValueByPos(35, 36);
                    row["CATEGORY_ID"]        = String.IsNullOrEmpty(myRecs.Record(i).Controlfields.Controlfield("002").Value) ? 0 : Int32.Parse(myRecs.Record(i).Controlfields.Controlfield("002").Value);
                }
                contentTable.Rows.Add(row);
            }

            metaContentRepeater.DataSource = contentTable;
            metaContentRepeater.DataBind();
        }
        catch (Exception ex)
        {
            String errorFomat = @"<dl id='system-message'>
                                            <dd class='error message fade'>
	                                            <ul>
		                                            <li>{0}</li>
	                                            </ul>
                                            </dd>
                                            </dl>";
            litErrorSpaceHolder.Text = String.Format(errorFomat, ex.Message);
        }
    }
    protected void linkExportButton_Click(object sender, EventArgs e)
    {
        CRecords      exRecs = new CRecords();
        CRecord       myRec  = new CRecord();
        CControlfield Cf     = new CControlfield();
        CDatafield    Df     = new CDatafield();
        CSubfield     Sf     = new CSubfield();

        DataTable tbData = new DataTable();

        try
        {
            switch (radioFilterType.SelectedValue)
            {
            case "0":
                int iSectionID  = 0;
                int iCategoryID = 0;
                if (dropSections.SelectedValue != null)
                {
                    iSectionID = int.Parse(dropSections.SelectedValue.ToString());
                }
                if (dropCategories.SelectedValue != null)
                {
                    iCategoryID = int.Parse(dropCategories.SelectedValue.ToString());
                }

                tbData = LegoWebAdmin.BusLogic.MetaContents.get_META_CONTENT_BY_CATEGORY_ID(iCategoryID, iSectionID).Tables[0];

                for (int i = 0; i < tbData.Rows.Count; i++)
                {
                    string sXmlContent = LegoWebAdmin.BusLogic.MetaContents.get_META_CONTENT_MARCXML(Int16.Parse(tbData.Rows[i]["META_CONTENT_ID"].ToString()), 1);
                    myRec.load_Xml(sXmlContent);
                    exRecs.Add(myRec);
                }
                break;

            case "1":

                int iFromID = String.IsNullOrEmpty(txtFromId.Text) ? 0 : int.Parse(txtFromId.Text);
                int iToID   = String.IsNullOrEmpty(txtToId.Text) ? 0 : int.Parse(txtToId.Text);
                tbData = LegoWebAdmin.BusLogic.MetaContents.get_META_CONTENT_BY_ID(iFromID, iToID).Tables[0];

                for (int i = 0; i < tbData.Rows.Count; i++)
                {
                    string sXmlContent = LegoWebAdmin.BusLogic.MetaContents.get_META_CONTENT_MARCXML(Int16.Parse(tbData.Rows[i]["META_CONTENT_ID"].ToString()), 1);
                    myRec.load_Xml(sXmlContent);
                    exRecs.Add(myRec);
                }

                break;

            case "2":
                //create each system table one MarcRecord
                //leader 06 = s mean system table data record
                //001 value is TABLE NAME

                //LEGOWEB_COMMON_PARAMETERS
                myRec = new CRecord();
                myRec.set_LeaderValueByPos("s", 6, 6);
                Cf       = new CControlfield();
                Cf.Tag   = "001";
                Cf.Value = "LEGOWEB_COMMON_PARAMETERS";
                myRec.Controlfields.Add(Cf);

                Df               = new CDatafield();
                Df.Tag           = "245";
                Df.SubfieldsText = "$aLEGOWEB_COMMON_PARAMETERS TABLE DATA";
                myRec.Datafields.Add(Df);

                tbData = LegoWebAdmin.BusLogic.CommonParameters.get_LEGOWEB_COMMON_PARAMETERS().Tables[0];

                foreach (DataRow row in tbData.Rows)
                {
                    //a PARAMETER_NAME	nvarchar(50)	Unchecked
                    //b PARAMETER_TYPE	smallint	Checked
                    //c PARAMETER_VI_VALUE	nvarchar(255)	Checked
                    //d PARAMETER_EN_VALUE	nvarchar(255)	Checked
                    //e PARAMETER_DESCRIPTION	nvarchar(255)	Checked
                    Df               = new CDatafield();
                    Df.Tag           = "650";
                    Df.SubfieldsText = String.Format("$a{0}$b{1}$c{2}$d{3}$e{4}", row["PARAMETER_NAME"].ToString(), row["PARAMETER_TYPE"].ToString(), row["PARAMETER_VI_VALUE"].ToString(), row["PARAMETER_EN_VALUE"].ToString(), row["PARAMETER_DESCRIPTION"].ToString());
                    myRec.Datafields.Add(Df);
                }

                exRecs.Add(myRec);

                //LEGOWEB_SECTIONS
                myRec = new CRecord();
                myRec.set_LeaderValueByPos("s", 6, 6);
                Cf       = new CControlfield();
                Cf.Tag   = "001";
                Cf.Value = "LEGOWEB_SECTIONS";
                myRec.Controlfields.Add(Cf);

                Df               = new CDatafield();
                Df.Tag           = "245";
                Df.SubfieldsText = "$aLEGOWEB_SECTIONS TABLE DATA";
                myRec.Datafields.Add(Df);

                tbData = LegoWebAdmin.BusLogic.Sections.get_LEGOWEB_SECTIONS().Tables[0];

                foreach (DataRow row in tbData.Rows)
                {
                    //a SECTION_ID	int	Unchecked
                    //b SECTION_VI_TITLE	nvarchar(250)	Unchecked
                    //c SECTION_EN_TITLE	nvarchar(250)	Checked
                    Df               = new CDatafield();
                    Df.Tag           = "650";
                    Df.SubfieldsText = String.Format("$a{0}$b{1}$c{2}", row["SECTION_ID"].ToString(), row["SECTION_VI_TITLE"].ToString(), row["SECTION_EN_TITLE"].ToString());
                    myRec.Datafields.Add(Df);
                }

                exRecs.Add(myRec);

                //LEGOWEB_CATEGORIES
                myRec = new CRecord();
                myRec.set_LeaderValueByPos("s", 6, 6);
                Cf       = new CControlfield();
                Cf.Tag   = "001";
                Cf.Value = "LEGOWEB_CATEGORIES";
                myRec.Controlfields.Add(Cf);

                Df               = new CDatafield();
                Df.Tag           = "245";
                Df.SubfieldsText = "$aLEGOWEB_CATEGORIES TABLE DATA";
                myRec.Datafields.Add(Df);

                tbData = LegoWebAdmin.BusLogic.Categories.get_LEGOWEB_CATEGORIES().Tables[0];

                foreach (DataRow row in tbData.Rows)
                {
                    //a CATEGORY_ID	int	Unchecked
                    //b PARENT_CATEGORY_ID	int	Checked
                    //c SECTION_ID	int	Unchecked
                    //d CATEGORY_VI_TITLE	nvarchar(250)	Unchecked
                    //e CATEGORY_EN_TITLE	nvarchar(250)	Checked
                    //f CATEGORY_ALIAS	nvarchar(250)	Checked
                    //g CATEGORY_TEMPLATE_NAME	nvarchar(50)	Checked
                    //h CATEGORY_IMAGE_URL	nvarchar(250)	Checked
                    //i MENU_ID	int	Unchecked
                    //j IS_PUBLIC	bit	Checked
                    //k ADMIN_LEVEL	smallint	Checked
                    //l ADMIN_ROLES	nvarchar(250)	Checked
                    //m SEO_TITLE	nvarchar(100)	Checked
                    //n SEO_DESCRIPTION	nvarchar(255)	Checked
                    //o SEO_KEYWORDS	nvarchar(255)	Checked
                    //p ORDER_NUMBER smallint
                    //q SORT_CONTENT_BY smallint -- since 10-03-2012
                    Df               = new CDatafield();
                    Df.Tag           = "650";
                    Df.SubfieldsText = String.Format("$a{0}$b{1}$c{2}$d{3}$e{4}$f{5}$g{6}$h{7}$i{8}$j{9}$k{10}$l{11}$m{12}$n{13}$o{14}$p{15}$q{16}", row["CATEGORY_ID"].ToString(), row["PARENT_CATEGORY_ID"].ToString(), row["SECTION_ID"].ToString(), row["CATEGORY_VI_TITLE"].ToString(), row["CATEGORY_EN_TITLE"].ToString(), row["CATEGORY_ALIAS"].ToString(), row["CATEGORY_TEMPLATE_NAME"].ToString(), row["CATEGORY_IMAGE_URL"].ToString(), row["MENU_ID"].ToString(), row["IS_PUBLIC"].ToString(), row["ADMIN_LEVEL"].ToString(), row["ADMIN_ROLES"].ToString(), row["SEO_TITLE"].ToString(), row["SEO_DESCRIPTION"].ToString(), row["SEO_KEYWORDS"].ToString(), row["ORDER_NUMBER"].ToString(), row["SORT_CONTENT_BY"].ToString());
                    myRec.Datafields.Add(Df);
                }

                exRecs.Add(myRec);

                //LEGOWEB_MENU_TYPES
                myRec = new CRecord();
                myRec.set_LeaderValueByPos("s", 6, 6);
                Cf       = new CControlfield();
                Cf.Tag   = "001";
                Cf.Value = "LEGOWEB_MENU_TYPES";
                myRec.Controlfields.Add(Cf);

                Df               = new CDatafield();
                Df.Tag           = "245";
                Df.SubfieldsText = "$aLEGOWEB_MENU_TYPES TABLE DATA";
                myRec.Datafields.Add(Df);

                tbData = LegoWebAdmin.BusLogic.MenuTypes.get_LEGOWEB_MENU_TYPES().Tables[0];

                foreach (DataRow row in tbData.Rows)
                {
                    //a MENU_TYPE_ID	smallint	Unchecked
                    //b MENU_TYPE_VI_TITLE	nvarchar(50)	Unchecked
                    //c MENU_TYPE_EN_TITLE	nvarchar(50)	Unchecked
                    //d MENU_TYPE_DESCRIPTION	nvarchar(250)	Checked
                    Df               = new CDatafield();
                    Df.Tag           = "650";
                    Df.SubfieldsText = String.Format("$a{0}$b{1}$c{2}$d{3}", row["MENU_TYPE_ID"].ToString(), row["MENU_TYPE_VI_TITLE"].ToString(), row["MENU_TYPE_EN_TITLE"].ToString(), row["MENU_TYPE_DESCRIPTION"].ToString());
                    myRec.Datafields.Add(Df);
                }

                exRecs.Add(myRec);


                //LEGOWEB_MENUS
                myRec = new CRecord();
                myRec.set_LeaderValueByPos("s", 6, 6);
                Cf       = new CControlfield();
                Cf.Tag   = "001";
                Cf.Value = "LEGOWEB_MENUS";
                myRec.Controlfields.Add(Cf);

                Df               = new CDatafield();
                Df.Tag           = "245";
                Df.SubfieldsText = "$aLEGOWEB_MENUS TABLE DATA";
                myRec.Datafields.Add(Df);

                tbData = LegoWebAdmin.BusLogic.Menus.get_LEGOWEB_MENUS().Tables[0];

                foreach (DataRow row in tbData.Rows)
                {
                    //a MENU_ID	int	Unchecked
                    //b PARENT_MENU_ID	int	Unchecked
                    //c MENU_TYPE_ID	int	Unchecked
                    //d MENU_VI_TITLE	nvarchar(50)	Checked
                    //e MENU_EN_TITLE	nvarchar(50)	Checked
                    //f MENU_IMAGE_URL	nvarchar(250)	Checked
                    //g MENU_LINK_URL	nvarchar(50)	Checked
                    //h BROWSER_NAVIGATE	tinyint	Unchecked
                    //i IS_PUBLIC	bit	Unchecked
                    //j ORDER_NUMBER smallint
                    Df               = new CDatafield();
                    Df.Tag           = "650";
                    Df.SubfieldsText = String.Format("$a{0}$b{1}$c{2}$d{3}$e{4}$f{5}$g{6}$h{7}$i{8}$j{9}", row["MENU_ID"].ToString(), row["PARENT_MENU_ID"].ToString(), row["MENU_TYPE_ID"].ToString(), row["MENU_VI_TITLE"].ToString(), row["MENU_EN_TITLE"].ToString(), row["MENU_IMAGE_URL"].ToString(), row["MENU_LINK_URL"].ToString(), row["BROWSER_NAVIGATE"].ToString(), row["IS_PUBLIC"].ToString(), row["ORDER_NUMBER"].ToString());
                    myRec.Datafields.Add(Df);
                }

                exRecs.Add(myRec);

                //#region KIPOS TABLES

                //myRec = new CRecord();
                //myRec.set_LeaderValueByPos("s", 6, 6);
                //Cf = new CControlfield();
                //Cf.Tag = "001";
                //Cf.Value = "CAT_DMD_CATEGORY";
                //myRec.Controlfields.Add(Cf);

                //Df = new CDatafield();
                //Df.Tag = "245";
                //Df.SubfieldsText = "$aCAT_DMD_CATEGORY";
                //myRec.Datafields.Add(Df);

                //tbData = LegoWebAdmin.BusLogic.Menus.get_LEGOWEB_MENUS().Tables[0];

                //foreach (DataRow row in tbData.Rows)
                //{
                //    //a MENU_ID	int	Unchecked
                //    //b PARENT_MENU_ID	int	Unchecked
                //    //c MENU_TYPE_ID	int	Unchecked
                //    //d MENU_VI_TITLE	nvarchar(50)	Checked
                //    //e MENU_EN_TITLE	nvarchar(50)	Checked
                //    //f MENU_IMAGE_URL	nvarchar(250)	Checked
                //    //g MENU_LINK_URL	nvarchar(50)	Checked
                //    //h BROWSER_NAVIGATE	tinyint	Unchecked
                //    //i IS_PUBLIC	bit	Unchecked
                //    //j ORDER_NUMBER smallint
                //    Df = new CDatafield();
                //    Df.Tag = "650";
                //    Df.SubfieldsText = String.Format("$a{0}$b{1}$c{2}$d{3}$e{4}$f{5}$g{6}$h{7}$i{8}$j{9}", row["MENU_ID"].ToString(), row["PARENT_MENU_ID"].ToString(), row["MENU_TYPE_ID"].ToString(), row["MENU_VI_TITLE"].ToString(), row["MENU_EN_TITLE"].ToString(), row["MENU_IMAGE_URL"].ToString(), row["MENU_LINK_URL"].ToString(), row["BROWSER_NAVIGATE"].ToString(), row["IS_PUBLIC"].ToString(), row["ORDER_NUMBER"].ToString());
                //    myRec.Datafields.Add(Df);
                //}

                //exRecs.Add(myRec);
                //#endregion KIPOS TABLES
                break;
            }

            if (exRecs.Count <= 0)
            {
                throw new Exception("No data to export!");
            }
            Response.ContentType = "APPLICATION/OCTET-STREAM";
            //set the filename
            Response.AddHeader("Content-Disposition", "attachment;filename=\"legowebdata.xml\"");
            String outStream = exRecs.OuterXml;
            Response.Write(outStream);
            Response.End();
        }
        catch (Exception ex)
        {
            String errorFomat = @"<dl id='system-message'>
                                            <dd class='error message fade'>
	                                            <ul>
		                                            <li>{0}</li>
	                                            </ul>
                                            </dd>
                                            </dl>";
            litErrorSpaceHolder.Text = String.Format(errorFomat, ex.Message);
        }
    }
コード例 #17
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 (!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>";
            }
        }
    }