public static string get_NavigatePath(int iCategroryId, string postLink) { UrlQuery postURL = new UrlQuery(postLink); postURL.Remove("contentid"); postURL.Remove("mnuid"); postURL.Remove("catid"); string sNaviPath = ""; string sRootNaviFormat = "<span class='icon-11-arr-target navigator-text'><a href='{0}'>{1}</a></span>"; string sChildNaviFormat = "<span class='icon-11-arr-navigate navigator-text'><a href='{0}'>{1}</a></span>"; DataTable CatInfo = LegoWebSite.Buslgic.Categories.get_CATEGORY_BY_ID(iCategroryId).Tables[0]; int icatid = iCategroryId; string scatname = CatInfo.Rows[0]["CATEGORY_" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToUpper() + "_TITLE"].ToString(); int ipcatid = int.Parse(CatInfo.Rows[0]["PARENT_CATEGORY_ID"].ToString()); postURL.Set("catid", icatid.ToString()); sNaviPath = (ipcatid > 0 ? string.Format(sChildNaviFormat, postURL.AbsoluteUri, scatname) : string.Format(sRootNaviFormat, postURL.AbsoluteUri, scatname)); while (ipcatid > 0) { iCategroryId = ipcatid; CatInfo = LegoWebSite.Buslgic.Categories.get_CATEGORY_BY_ID(iCategroryId).Tables[0]; icatid = iCategroryId; scatname = CatInfo.Rows[0]["CATEGORY_" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToUpper() + "_TITLE"].ToString(); ipcatid = int.Parse(CatInfo.Rows[0]["PARENT_CATEGORY_ID"].ToString()); postURL.Set("catid", icatid.ToString()); sNaviPath = (ipcatid > 0 ? string.Format(sChildNaviFormat, postURL.AbsoluteUri, scatname) : string.Format(sRootNaviFormat, postURL.AbsoluteUri, scatname)) + sNaviPath; } return(sNaviPath); }
protected void vi_Click(object sender, EventArgs e) { UrlQuery myURL = new UrlQuery(Request.Url.AbsoluteUri); myURL.Set("locale", "vi-VN"); Response.Redirect(myURL.AbsoluteUri); }
private void contentNavigatorPageBind() { int meta_content_id = 0; int category_id = 0; int menu_id = 0; string lang_code = System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToUpper(); 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()); } //try to get category_id from menu_id if (category_id == 0 && menu_id > 0) { category_id = LegoWebSite.Buslgic.Categories.get_CATEGORY_ID_BY_MENU_ID(menu_id); } //try to get category_id from meta_content_id if (category_id == 0 && meta_content_id > 0) { category_id = LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_CATEGORY_ID(meta_content_id); } if (!LegoWebSite.Buslgic.Categories.is_CATEGORY_EXIST(category_id)) { this.litCatNaviContent.Text = "<H3>Category does not exist!</H3>"; return; } this.litCatNaviContent.Text = LegoWebSite.Buslgic.Categories.get_NavigatePath(category_id, Request.Url.AbsoluteUri); _contentNavigatorData.PageNumber = Convert.ToInt16(ViewState["contentNavigatorPageNumber"]); _contentNavigatorData.RecordsPerPage = (int)ViewState["contentNavigatorPageSize"]; _contentNavigatorData.PageCount = (int)ViewState["contentNavigatorPageCount"]; DataTable Data = _contentNavigatorData.get_Current_Page(category_id, lang_code); // Create DataColumn objects of data types. DataColumn colString = new DataColumn("CONTENT_HTML"); colString.DataType = System.Type.GetType("System.String"); Data.Columns.Add(colString); string sTemplateFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_template_name); for (int i = 0; i < Data.Rows.Count; i++) { string sContentXml = ""; CRecord myRec = new CRecord(); int icontentid = int.Parse(Data.Rows[i]["META_CONTENT_ID"].ToString()); string postURL = "ContentBrowser.aspx"; sContentXml = LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML(icontentid, 0); //no NTEXTS CONTENT_XML myRec.load_Xml(sContentXml); if (!String.IsNullOrEmpty(_default_post_page)) { postURL = _default_post_page; } else { int iCatId = int.Parse(myRec.Controlfields.Controlfield("002").Value.ToString()); //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(); } } } UrlQuery postQuery = new UrlQuery(postURL); postQuery.Set("contentid", icontentid.ToString()); myRec.Controlfields.Controlfield("001").Value = postQuery.AbsoluteUri; Data.Rows[i]["CONTENT_HTML"] = myRec.XsltFile_Transform(sTemplateFileName); } contentNavigatorRepeater.DataSource = Data; contentNavigatorRepeater.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { if (CommonUtility.GetInitialValue("contentid", null) != null) { int meta_content_id = int.Parse(CommonUtility.GetInitialValue("contentid", null).ToString()); if (meta_content_id > 0) { string spostURL = ResolveUrl("~/ContentBrowser.aspx"); UrlQuery myPost = new UrlQuery(spostURL); myPost.Set("contentid", meta_content_id.ToString()); Response.Redirect(myPost.AbsoluteUri); } } 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.litContentNavigatorBoxTop.Text = sBoxTop; this.litContentNavigatorBoxBottom.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.litContentNavigatorBoxTop.Text = sBoxTop; this.litContentNavigatorBoxBottom.Text = sBoxBottom; } } else { this.litContentNavigatorBoxTop.Text = "<div>"; this.litContentNavigatorBoxBottom.Text = "</div>"; } CommonUtility.InitializeGridParameters(ViewState, "contentNavigator", typeof(SortFields), 10, 100); ViewState["contentNavigatorPageNumber"] = 1; ViewState["contentNavigatorPageSize"] = _page_size; contentNavigatorBind(); } } catch (Exception ex) { throw ex; } }
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>"; } } }