public static string GetPathTreeNameUrl(int categoryID, int langInt, string langId) { string result = string.Empty, id = string.Empty, pathTreeSub = string.Empty; try { ProductCategoryBLL pcBll = new ProductCategoryBLL(); IList <PNK_ProductCategory> lst = pcBll.GetList(langInt, string.Empty, string.Empty, categoryID, int.MinValue, false, string.Empty, 1, 9999, out total); if (total > 0) { string pathTree = lst[0].PathTree; int level = pathTree.Count(i => i.Equals('.')); for (int i = 1; i <= level; i++) { pathTreeSub = pathTree.Split('.')[i]; id = pathTreeSub.Split('-')[1]; lst = pcBll.GetList(langInt, string.Empty, string.Empty, int.Parse(id), int.MinValue, false, string.Empty, 1, 9999, out total); result = result + (total > 0 ? lst[0].ProductCategoryDesc.NameUrl : string.Empty) + "/"; if (i == 1) { result = result + langId + "/"; } } result = result == "" ? "" : result.Remove(result.LastIndexOf('/'), 1); } } catch (Exception ex) { Write2Log.WriteLogs("Home Page", "GetPathTreeNameUrl", ex.Message); } return(result); }
/// <summary> /// 分类管理返回表格Json /// </summary> /// <returns></returns> public ActionResult GridListJson() { DataTable listData = _productCategoryBLL.GetList(); var jsonData = new { rows = listData, }; return(Content(jsonData.ToJson())); }
/// <summary> /// Get Image theo sản phẩm /// </summary> /// <param name="data"></param> /// <returns></returns> public static string ImagePathByFont(PNK_Product data) { string result = string.Empty, id = string.Empty, pathTreeSub = string.Empty, LangId = data.ProductDesc.LangId == 1 ? "vn" : "eng"; //pathTreeSub = GetPathTreeNameUrl(data.ProductDesc.Id, data.ProductDesc.LangId, LangId); ProductCategoryBLL pcBll = new ProductCategoryBLL(); IList <PNK_ProductCategory> lst = pcBll.GetList(data.ProductDesc.LangId, string.Empty, string.Empty, data.CategoryId, int.MinValue, false, string.Empty, 1, 9999, out total); if (total > 0) { string pathTree = lst[0].PathTree; int level = pathTree.Count(i => i.Equals('.')); StringBuilder sbBreadrum = new StringBuilder(); for (int i = 1; i <= level; i++) { pathTreeSub = pathTree.Split('.')[i]; id = pathTreeSub.Split('-')[1]; lst = pcBll.GetList(data.ProductDesc.LangId, string.Empty, string.Empty, int.Parse(id), int.MinValue, false, string.Empty, 1, 9999, out total); result = result + (total > 0 ? lst[0].ProductCategoryDesc.NameUrl : string.Empty) + "/"; sbBreadrum.AppendFormat("<li><a href=\"{0}\">{1}</a></li>", LinkHelper.GetLink(lst[0].ProductCategoryDesc.NameUrl, LangId), lst[0].ProductCategoryDesc.Name); } result = sbBreadrum.ToString(); } string imagePath = data.Image == "" ? "breadcrumb-bg.jpg" : data.Image; int imageType = data.ImageType; switch (imageType) { case 1: StringBuilder sb = new StringBuilder(); sb.AppendFormat("<section id=\"title-wrapper\" style=\"background-image: url({0});\">", WebUtils.GetUrlImage(ConfigurationManager.AppSettings["ProductUpload"], "breadcrumb-bg.jpg")); sb.Append("<div class=\"container\">"); sb.Append("<div class=\"row\">"); sb.Append(" <div class=\"col-md-12\">"); sb.Append("<div class=\"title-holder\">"); sb.Append(" <div class=\"title-holder-cell text-left\">"); sb.Append("<h2 class=\"page-title col-sm-8\"><span class='text-uppercase'>" + data.ProductDesc.Title + "</span></h2>"); sb.AppendFormat("<ol class=\"breadcrumb pull-right\"><li><a href=\"{0}\">Home</a></li>", WebUtils.RedirectHomePage()); sb.Append(result); sb.Append("</ol>"); sb.Append("</div></div></div></div></div></section>"); result = sb.ToString(); break; case 2: result = data.ImageFont; break; } return(result); }
private void InitPage() { template_path = WebUtils.GetWebPath(); pageName = Utils.GetParameter("page", "home"); cid = Utils.GetParameter("cid", string.Empty); cidsub = Utils.GetParameter("cidsub", string.Empty); id = Utils.GetParameter("id", string.Empty); if (pageName == "tim-kiem" || pageName == "search") { this.records = DBConvert.ParseString(totalSearch); this.pager.PageSize = DBConvert.ParseInt(ConfigurationManager.AppSettings["pageSizeCate"]); this.pager.ItemCount = totalSearch; this.rptResult.DataSource = lstSearch; this.rptResult.DataBind(); //Set header ProductCategoryBLL pcBll = new ProductCategoryBLL(); IList <PNK_ProductCategory> lst = pcBll.GetList(LangInt, string.Empty, "1", DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdTemplate"]), int.MinValue, false, string.Empty, 1, 1, out total); if (total > 0) { ltrCateNameTitle.Text = lst[0].ProductCategoryDesc.Name; ltrCategoryBrief.Text = lst[0].ProductCategoryDesc.Brief; } } else { GetProduct(); } }
/// <summary> /// Blog cuối cùng /// </summary> private void GetLastBlog() { ProductBLL pcBll = new ProductBLL(); DataTable dtb = DBHelper.ExcuteFromCmd("SELECT * FROM dbo.fc_GetAllChildProductCategory(" + DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdLastBlog"]) + ",1)", null); string[] array = dtb.AsEnumerable() .Select(row => row.Field <Int32>("id").ToString()) .ToArray(); string idFirst = string.Join(",", array); IList <PNK_Product> lst = pcBll.GetList(LangInt, string.Empty, "1", idFirst, string.Empty, string.Empty, string.Empty, 1, 4, out total); if (total > 0) { rptLastBlog.DataSource = lst.OrderByDescending(m => m.PostDate); rptLastBlog.DataBind(); ltrLastBlogCateName.Text = lst[0].CategoryNameDesc; } ProductCategoryBLL pcBllCate = new ProductCategoryBLL(); IList <PNK_ProductCategory> lstCate = pcBllCate.GetList(LangInt, string.Empty, "1", DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdLastBlog"]), int.MinValue, false, string.Empty, 1, 1, out total); if (lstCate.Count > 0) { ltrLastBlogCateName.Text = lstCate[0].ProductCategoryDesc.Name; hypLastBlogCateName.HRef = LinkHelper.GetLink(lstCate[0].ProductCategoryDesc.NameUrl, LangId); } }
private void GetPageName(string pageName) { try { cid = Utils.GetParameter("cid", string.Empty); cidsub = Utils.GetParameter("cidsub", string.Empty); id = Utils.GetParameter("id", string.Empty); if (pageName == "booking") { pagePath = "Pages/BookingManagement/Booking.ascx"; Session["level"] = 1; } else { string cateName = string.Empty; ProductCategoryBLL pcBllCate = new ProductCategoryBLL(); cateName = Common.UtilityLocal.GetCateNameByLevel(pageName, cid, cidsub, id); IList <PNK_ProductCategory> lstCate = pcBllCate.GetList(LangInt, cateName, string.Empty, int.MinValue, false, "p.ordering", 1, 9999, out total); if (total > 0) { pagePath = lstCate[0].Page; Session["level"] = lstCate[0].PathTree.Count(i => i.Equals('.')); } if (lstCate == null || total == 0) { ProductBLL pcBll = new ProductBLL(); cid = cid != LocalizationUtility.GetText("linkCate", Ci) ? cid : string.Empty; cidsub = cidsub != LocalizationUtility.GetText("linktmp", Ci) ? cidsub : string.Empty; IList <PNK_Product> lst = pcBll.GetList(LangInt, cidsub, string.Empty, string.Empty, id, null, string.Empty, 1, 9999, out total); if (total > 0) { //set page đặc biệt khi level=4 mà thiếu cid, cidsub if (cid == LocalizationUtility.GetText("linkCate", Ci) || cid == LocalizationUtility.GetText("linktmp", Ci)) { lst = lst.Where(p => p.ProductDesc.TitleUrl == id && p.CategoryUrlDesc == pageName).ToList(); } else { lst = lst.Where(p => p.ProductDesc.TitleUrl == id).ToList(); } if (lst.Count > 0) { string pagePathProduct = Common.UtilityLocal.GetPathTreeNameUrl(lst[0].Id, LangInt, LangId); pagePath = lst[0].Page; Session["level"] = 3; } } } } contentView = (UserControl)Page.LoadControl(pagePath); phdContent.Controls.Add(contentView); } catch (Exception ex) { Write2Log.WriteLogs("default.aspx", "GetPageName", ex.Message + "/" + cid + "/" + cidsub + "/" + id); } }
/// <summary> /// Dịch vụ /// </summary> private void GetService() { ProductBLL pcBll = new ProductBLL(); DataTable dtb = DBHelper.ExcuteFromCmd("SELECT * FROM dbo.fc_GetAllChildProductCategory(" + DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdService"]) + ",1)", null); string[] array = dtb.AsEnumerable() .Select(row => row.Field <Int32>("id").ToString()) .ToArray(); string idFirst = string.Join(",", array); IList <PNK_Product> lst = pcBll.GetList(LangInt, string.Empty, "1", idFirst, string.Empty, string.Empty, "1", 1, 6, out total); if (total > 0) { this.rptServiceLeft.DataSource = lst; this.rptServiceLeft.DataBind(); } total = 0; ProductCategoryBLL pcBllCate = new ProductCategoryBLL(); IList <PNK_ProductCategory> lstCate = pcBllCate.GetList(LangInt, string.Empty, null, DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdService"]), int.MinValue, false, string.Empty, 1, 1, out total); if (lst.Count > 0) { ltrServiceHeader.Text = lstCate[0].ProductCategoryDesc.Name; } }
private void GenerateMenuProduct() { IList <PNK_ProductCategory> lstParent; int total; ProductCategoryBLL ncBll = new ProductCategoryBLL(); lstAll = ncBll.GetList(Constant.DB.LangId, string.Empty, 1, 300, out total); if (total > 0) { //Lấy danh sách danh mục cha có ParentID==0 gán vào menu cha lstParent = lstAll.Where(m => m.ParentId == 0 && m.Id != 2229 && m.Id != 2222 && m.Id != 2220 && m.Id != 2207 && m.Id != 124 && m.Id != 73 && m.Id != 64 && m.Id != 64 && m.Id != 42 && m.Id != DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdHome"]) ).ToList(); if (lstParent.Count() > 0) { rptResult.DataSource = lstParent; rptResult.DataBind(); } } }
/// <summary> /// ishHot=true,cateid=sanphamID /// </summary> private void GetDetail() { ProductCategoryBLL pcBllCate = new ProductCategoryBLL(); IList <PNK_ProductCategory> lstCate = pcBllCate.GetList(LangInt, pageName, "1", int.MinValue, true, "p.ordering", 1, 1000, out total); if (lstCate.Count > 0) { ltrProductRelate.Text = string.Format("{0} {1}", lstCate[0].ProductCategoryDesc.Name, LocalizationUtility.GetText("ltrProductRelate", Ci)); hypAll.HRef = LinkHelper.GetLink(lstCate[0].ProductCategoryDesc.NameUrl, LangId); categoryID = lstCate[0].Id.ToString(); DataTable dtb = DBHelper.ExcuteFromCmd("SELECT * FROM dbo.fc_GetAllChildProductCategory(" + categoryID + ",1)", null); string[] array = dtb.AsEnumerable() .Select(row => row.Field <Int32>("id").ToString()) .ToArray(); string idFirst = string.Join(",", array); ProductBLL pcBll = new ProductBLL(); IList <PNK_Product> lst = pcBll.GetListRelate(LangInt, string.Empty, idFirst, id, 1, 9999, out total); if (lst.Count > 0) { this.rptResult.DataSource = lst; this.rptResult.DataBind(); } } }
private void GetConstruction() { try { ProductBLL pcBll = new ProductBLL(); DataTable dtb = DBHelper.ExcuteFromCmd("SELECT * FROM dbo.fc_GetAllChildProductCategory(" + ConfigurationManager.AppSettings["parentIdTemplate"] + ",1)", null); if (dtb != null && dtb.Rows.Count > 0) { string[] array = dtb.AsEnumerable() .Select(row => row.Field <Int32>("id").ToString()) .ToArray(); string idFirst = string.Join(",", array); IList <PNK_Product> lst = pcBll.GetList(LangInt, string.Empty, "1", idFirst, string.Empty, string.Empty, string.Empty, 1, 2, out total); if (lst.Count > 0) { this.rptConstruction.DataSource = lst; this.rptConstruction.DataBind(); } } ProductCategoryBLL pcBllCate = new ProductCategoryBLL(); IList <PNK_ProductCategory> lstCate = pcBllCate.GetList(LangInt, string.Empty, "1", DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdTemplate"]), int.MinValue, false, string.Empty, 1, 1, out total); if (lstCate.Count > 0) { ltrConstructionCateName.Text = lstCate[0].ProductCategoryDesc.Name; } } catch (Exception ex) { Write2Log.WriteLogs("home", "GetProject", ex.Message); } }
private string GetProductCategory() { ProductCategoryBLL pcBll = new ProductCategoryBLL(); IList <PNK_ProductCategory> lst = null; if (cidsub != string.Empty && cid != string.Empty && id != string.Empty) { lst = pcBll.GetList(LangInt, pageName, string.Empty, int.MinValue, true, "p.ordering", 1, 1000, out total); //Gen html image category ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0]); } else if (cidsub != string.Empty && cid != string.Empty) { lst = pcBll.GetList(LangInt, cid, string.Empty, int.MinValue, true, "p.ordering", 1, 1000, out total); if (total > 0) { //lần 2 truyền parentID vào để lấy ds con lst = pcBll.GetList(LangInt, string.Empty, string.Empty, lst[0].Id, false, "p.ordering", 1, 1000, out total); //Gen html image category ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0]); } } else if (cidsub == string.Empty && cid != string.Empty) { lst = pcBll.GetList(LangInt, cid, string.Empty, int.MinValue, true, "p.ordering", 1, 1000, out total); if (total > 0) { //Gen html image category ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0]); } } else if (cid == string.Empty) { //lần đầu lấy parentID lst = pcBll.GetList(LangInt, pageName, string.Empty, int.MinValue, true, "p.ordering", 1, 1000, out total); if (total > 0) { //Gen html image category ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0]); } } return(string.Empty); }
private void InitPage() { try { this.template_path = WebUtils.GetWebPath(); pageName = Utils.GetParameter("page", "home"); cid = Utils.GetParameter("cid", string.Empty); cidsub = Utils.GetParameter("cidsub", string.Empty); id = Utils.GetParameter("id", string.Empty); //string pathUsc = pageName; //switch (pageName) //{ // case "home": // case "trang-chu": // pathUsc = "Pages/home.ascx"; // break; // default: // pathUsc = "Controls/block_breakumb.ascx"; // break; //} //UserControl contentView = (UserControl)Page.LoadControl(pathUsc); //childContent.Controls.Add(contentView); ProductCategoryBLL pcBllCate = new ProductCategoryBLL(); IList <PNK_ProductCategory> lstCate = pcBllCate.GetList(1, pageName, string.Empty, int.MinValue, false, "p.ordering", 1, 9999, out total); if (total > 0) { string pagePath = lstCate[0].PageDetail.ToLower(); if (pagePath.Contains("template") && id != string.Empty && cidsub != "page") { top_menu.Visible = footer.Visible = main.Visible = false; } } } catch (Exception ex) { } ConfigurationBLL pcBll = new ConfigurationBLL(); IList <PNK_Configuration> lst = pcBll.GetList(); if (lst != null && lst.Count > 0) { foreach (PNK_Configuration item in lst) { if (item.Key_name == Constant.Configuration.config_vchat) { // WebUtils.IncludeJSScript(this.Page, item.Value_name); } } } }
private void GetProductCategory() { ProductCategoryBLL pcBll = new ProductCategoryBLL(); IList <PNK_ProductCategory> lst = pcBll.GetList(LangInt, string.Empty, string.Empty, DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdLastBlog"]), false, "p.ordering", 1, 1000, out total); if (total > 0) { rptCategory.DataSource = lst; rptCategory.DataBind(); } }
private void GetSubMenu(string categoryId, Repeater rptSub) { ProductCategoryBLL pcBll = new ProductCategoryBLL(); IList <PNK_ProductCategory> lst = pcBll.GetList(LangInt, string.Empty, "1", int.Parse(categoryId), false, "p.ordering", 1, 9999, out total); lst = lst.Where(m => m.ThumbnailImage == "1").ToList(); if (lst.Count > 0) { rptSub.DataSource = lst; rptSub.DataBind(); } }
private void CategoryHtml(string categoryId) { if (categoryId != string.Empty) { ProductCategoryBLL pcBll = new ProductCategoryBLL(); IList <PNK_ProductCategory> lst = pcBll.GetList(LangInt, string.Empty, "1", DBConvert.ParseInt(categoryId), true, "p.ordering", 1, 1000, out total); if (total > 0) { rptCategory.DataSource = lst; rptCategory.DataBind(); } } }
public string GetCategoryPageDetail(int id) { int total; string result = string.Empty; ProductCategoryBLL pcBll = new ProductCategoryBLL(); IList <PNK_ProductCategory> lst = pcBll.GetList(1, string.Empty, string.Empty, id, int.MinValue, false, string.Empty, 1, 100, out total); if (total > 0) { result = lst[0].PageDetail; } return(result); }
private void SetHeader() { //Set header ProductCategoryBLL pcBll = new ProductCategoryBLL(); IList <PNK_ProductCategory> lst = pcBll.GetList(LangInt, pageName, string.Empty, int.MinValue, int.MinValue, false, string.Empty, 1, 1, out total); if (total > 0) { //Gen html image category ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0]); WebUtils.SeoPage(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaDecription, lst[0].ProductCategoryDesc.MetaKeyword, this.Page); WebUtils.SeoTagH(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, Controls); } }
private void GetDataDropDownCategory(DropDownList drp, int categoryId, string title) { ProductCategoryBLL pcBll = new ProductCategoryBLL(); drp.Items.Clear(); drp.Items.Add(new ListItem(title, "-1")); IList <PNK_ProductCategory> lst = pcBll.GetList(LangInt, string.Empty, string.Empty, categoryId, false, "p.ordering", 1, 1000, out total); if (lst != null && lst.Count > 0) { foreach (PNK_ProductCategory item in lst) { drp.Items.Add(new ListItem(item.ProductCategoryDesc.Name, DBConvert.ParseString(item.Id))); } } }
/// <summary> /// getDataDropDownCategory /// </summary> /// <param name="_drp"></param> private void GetDataDropDownCategory(DropDownList _drp) { int total; string strTemp; _drp.Items.Clear(); _drp.Items.Add(new ListItem(Constant.UI.admin_Category, Constant.DSC.IdRootProductCategory.ToString())); IList <PNK_ProductCategory> lst = pcBll.GetList(Constant.DB.LangId, string.Empty, 1, 300, out total); if (lst != null && lst.Count > 0) { foreach (PNK_ProductCategory item in lst) { strTemp = Utils.GetScmplit(item.ProductCategoryDesc.Name, item.PathTree); _drp.Items.Add(new ListItem(strTemp, DBConvert.ParseString(item.Id))); } } }
private void GetMenu() { string strTemp = string.Empty; drpDestination.Items.Clear(); drpDestination.Items.Add(new ListItem("Where would you like to go?", string.Empty)); ProductCategoryBLL pcBll = new ProductCategoryBLL(); lstAll = pcBll.GetList(LangInt, string.Empty, "1", int.Parse(ConfigurationManager.AppSettings["parentIdCyclingTour"]), false, "p.ordering", 1, 1000, out total); if (total > 0) { foreach (PNK_ProductCategory item in lstAll) { drpDestination.Items.Add(new ListItem(item.ProductCategoryDesc.Name, item.ProductCategoryDesc.NameUrl)); } } }
//Bind drop cate private void BindCategory() { string strTemp; drpCategory.Items.Clear(); drpCategory.Items.Add(new ListItem(LocalizationUtility.GetText("ltrAll", Ci), ConfigurationManager.AppSettings["parentIdTemplate"])); ProductCategoryBLL ncBll = new ProductCategoryBLL(); IList <PNK_ProductCategory> lst = ncBll.GetList(LangInt, string.Empty, string.Empty, int.Parse(ConfigurationManager.AppSettings["parentIdTemplate"]), false, "p.ordering", 1, 1000, out total); if (lst != null && lst.Count > 0) { foreach (PNK_ProductCategory item in lst) { strTemp = item.ProductCategoryDesc.Name; drpCategory.Items.Add(new ListItem(strTemp, DBConvert.ParseString(item.Id))); } } }
private void GetMenu() { ProductCategoryBLL pcBll = new ProductCategoryBLL(); IList <PNK_ProductCategory> lstAll = pcBll.GetList(LangInt, string.Empty, string.Empty, 0, false, "p.ordering", 1, 1000, out total); if (total > 0) { //Lấy danh sách danh mục cha có ParentID==0 gán vào menu cha lstAll = lstAll.Where(m => m.ParentId == 0 && m.Id != DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdHome"]) && m.SmallImage == "1" ).ToList(); if (lstAll.Count() > 0) { rptResult.DataSource = lstAll; rptResult.DataBind(); } } }
private void GetMenu() { ProductCategoryBLL pcBll = new ProductCategoryBLL(); lstAll = pcBll.GetList(LangInt, string.Empty, "1", int.MinValue, true, "p.ordering", 1, 1000, out total); if (total > 0) { lstParent = lstAll.Where(m => m.ParentId == 0 && m.Id != DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdHome"]) && m.ThumbnailImage == "1" ).ToList(); if (lstParent.Count() > 0) { rptResult.DataSource = lstParent; rptResult.DataBind(); } } }
/// <summary> /// getDataDropDownCategory /// </summary> /// <param name="_drp"></param> public static void GetDataDropDownCategory(DropDownList _drp) { int totalrow; string strTemp; _drp.Items.Clear(); _drp.Items.Add(new ListItem(Constant.UI.admin_Category, Constant.DSC.IdRootProductCategory.ToString())); ProductCategoryBLL ncBll = new ProductCategoryBLL(); IList <PNK_ProductCategory> lst = ncBll.GetList(Constant.DB.LangId, string.Empty, 1, 300, out totalrow); if (lst != null && lst.Count > 0) { foreach (PNK_ProductCategory item in lst) { strTemp = Utils.GetScmplit(item.ProductCategoryDesc.Name, item.PathTree); _drp.Items.Add(new ListItem(strTemp, DBConvert.ParseString(item.Id))); } } //_drp.SelectedIndex = _drp.Items.IndexOf(_drp.Items.FindByValue(ConfigurationManager.AppSettings["parentIdLeture"])); }
private void GetProject() { try { ProductBLL pcBll = new ProductBLL(); DataTable dtb = DBHelper.ExcuteFromCmd("SELECT * FROM dbo.fc_GetAllChildProductCategory(" + ConfigurationManager.AppSettings["parentIdProject"] + ",1)", null); if (dtb != null && dtb.Rows.Count > 0) { string[] array = dtb.AsEnumerable() .Select(row => row.Field <Int32>("id").ToString()) .ToArray(); string idFirst = string.Join(",", array); IList <PNK_Product> lst = pcBll.GetList(LangInt, string.Empty, "1", idFirst, string.Empty, string.Empty, string.Empty, 1, 6, out total); if (lst.Count > 0) { this.rptProject.DataSource = lst; this.rptProject.DataBind(); } } ProductCategoryBLL pcBllCate = new ProductCategoryBLL(); IList <PNK_ProductCategory> lstCate = pcBllCate.GetList(LangInt, string.Empty, string.Empty, DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdProject"]), int.MinValue, false, string.Empty, 1, 1, out total); if (lstCate.Count > 0) { ltrCateName.Text = string.Format("{0} {1}", lstCate[0].ProductCategoryDesc.Name, LocalizationUtility.GetText("ltrWorking", Ci));// lstCate[0].ProductCategoryDesc.Name; //ltrCateBrief.Text = lstCate[0].ProductCategoryDesc.Brief; hypContinusProject.HRef = LinkHelper.GetLink(lstCate[0].ProductCategoryDesc.NameUrl, LangId); //ltrContinusProject.Text = LocalizationUtility.GetText("ltrContinus", Ci); } } catch (Exception ex) { Write2Log.WriteLogs("home", "GetProject", ex.Message); } }
private void GetPageName() { try { if (cid == int.MinValue) { GetCategoryName(); } else { //Set tên danh mục xMLConfig = GetCategoryName(); //Set tên sản phẩm switch (pageName.Split('_')[1]) { //Nếu là nhóm sản phẩm thì lấy tên nhóm sản phẩm cần chỉnh sửa case "productcategory": ProductCategoryBLL productCategoryBLL = new ProductCategoryBLL(); IList <PNK_ProductCategory> lst = productCategoryBLL.GetList(LangInt, string.Empty, string.Empty, cid, int.MinValue, false, string.Empty, 1, 100, out total); if (total > 0) { ltrHeader.Text = ltrProduct.Text = lst[0].ProductCategoryDesc.Name; //Set SEO title = string.Format("{0}-{1}", ltrCategory.Text, lst[0].ProductCategoryDesc.Name); WebUtils.SeoPage(title, title, title, this.Page); } break; //Nếu là sản phẩm thì lấy tên sản phẩm cần chỉnh sửa case "product": Generic <PNK_ProductDesc> genericProductDesc = new Generic <PNK_ProductDesc>(); IList <PNK_ProductDesc> lstProductDesc = genericProductDesc.GetAllBy(new PNK_ProductDesc(), string.Format(" where mainid = {0} AND LangId={1}", id, LangInt), null); if (lstProductDesc != null && lstProductDesc.Count > 0) { ltrHeader.Text = ltrProduct.Text = lstProductDesc[0].Title; //Set SEO title = string.Format("{0}-{1}", ltrCategory.Text, lstProductDesc[0].Title); WebUtils.SeoPage(title, title, title, this.Page); } break; //Nếu là banner thì lấy tên sản phẩm cần chỉnh sửa case "slider": Generic <PNK_Banner> genericBanner = new Generic <PNK_Banner>(); IList <PNK_Banner> lstBanner = genericBanner.GetAllBy(new PNK_Banner(), string.Format(" where ID = {0}", cid), null); if (lstBanner != null && lstBanner.Count > 0) { ltrHeader.Text = ltrProduct.Text = lstBanner[0].Name; //Set SEO title = string.Format("{0}-{1}", ltrCategory.Text, lstBanner[0].Name); WebUtils.SeoPage(title, title, title, this.Page); } break; //Nếu là user case "user": Generic <PNK_User> genericUser = new Generic <PNK_User>(); IList <PNK_User> lstUser = genericUser.GetAllBy(new PNK_User(), string.Format(" where ID = {0}", cid), null); if (lstUser != null && lstUser.Count > 0) { ltrHeader.Text = ltrProduct.Text = lstUser[0].FullName; //Set SEO title = string.Format("{0}-{1}", ltrCategory.Text, lstUser[0].FullName); WebUtils.SeoPage(title, title, title, this.Page); } break; ////Nếu là user //case "page": // Generic<PNK_Configuration> genericConfiguration = new Generic<PNK_Configuration>(); // IList<PNK_Configuration> lstConfiguration = genericConfiguration.GetAllBy(new PNK_Configuration(), string.Format(" where ID = {0}", cid), null); // if (lstConfiguration != null && lstConfiguration.Count > 0) // { // ltrHeader.Text = ltrProduct.Text = lstConfiguration[0].FullName; // } // break; } } } catch (Exception ex) { Write2Log.WriteLogs("GetPageName", "breakumb", ex.Message); } }
/// <summary> /// /// </summary> /// <param name="pageName"></param> /// <param name="cid"></param> /// <param name="cidsub"></param> /// <param name="id"></param> /// <param name="LangInt"></param> /// <param name="level"></param> /// <returns>Dictionary<string, object> ProductCategoryBLL</returns> public static Dictionary <string, object> GetProductCategory(string pageName, string cid, string cidsub, string id, int LangInt, string level) { Dictionary <string, object> dic = new Dictionary <string, object>(); ProductCategoryBLL pcBll = new ProductCategoryBLL(); IList <PNK_ProductCategory> lst = null; IList <PNK_ProductCategory> lst2 = null; IList <PNK_ProductCategory> lst3 = null; if (level != null) { string cateName = Common.UtilityLocal.GetCateNameByLevel(pageName, cid, cidsub, id); switch (level) { case "1": lst = pcBll.GetList(LangInt, cateName, string.Empty, int.MinValue, true, "p.ordering", 1, 1000, out total); if (lst.Count > 0) { lst2 = lst; //lst2 = pcBll.GetList(LangInt, cid, string.Empty, lst[0].Id, false, "p.ordering", 1, 1000, out total); } break; case "2": lst = pcBll.GetList(LangInt, pageName, string.Empty, int.MinValue, false, "p.ordering", 1, 1000, out total); if (lst.Count > 0) { lst2 = pcBll.GetList(LangInt, cid, "1", int.MinValue, lst[0].Id, 1, true, "p.ordering", 1, 1000, out total); //lst2 = pcBll.GetList(LangInt, cid, string.Empty, lst[0].Id, true, "p.ordering", 1, 1000, out total); //if (lst2.Count > 0) //{ // lst2 = pcBll.GetList(LangInt, string.Empty, string.Empty, lst2[0].Id, true, "p.ordering", 1, 1000, out total); //} } break; case "3": lst = pcBll.GetList(LangInt, pageName, string.Empty, int.MinValue, false, "p.ordering", 1, 1000, out total); if (lst.Count > 0) { lst2 = pcBll.GetList(LangInt, cid, string.Empty, lst[0].Id, true, "p.ordering", 1, 1000, out total); if (lst2.Count > 0) { int parentID = lst2[0].Id; //if (cidsub != LocalizationUtility.GetText("linktmp", Ci)) //{ // lst2 = pcBll.GetList(LangInt, cidsub, "1", int.MinValue, parentID, 1, true, "p.ordering", 1, 1000, out total); //} } } break; case "4": lst = pcBll.GetList(LangInt, pageName, string.Empty, int.MinValue, false, "p.ordering", 1, 1000, out total); if (lst.Count > 0) { lst2 = pcBll.GetList(LangInt, cid, string.Empty, lst[0].Id, false, "p.ordering", 1, 1000, out total); if (lst2.Count > 0) { lst2 = pcBll.GetList(LangInt, cidsub, "1", int.MinValue, lst2[0].Id, 1, true, "p.ordering", 1, 1000, out total); if (lst2.Count > 0) { lst2 = pcBll.GetList(LangInt, id, "1", int.MinValue, lst2[0].Id, 1, true, "p.ordering", 1, 1000, out total); } } } break; case "tim-kiem": case "search": lst2 = pcBll.GetList(LangInt, cid, string.Empty, int.MinValue, true, "p.ordering", 1, 1000, out total); //if (lst.Count > 0) //{ // lst2 = pcBll.GetList(LangInt, cid, string.Empty, lst[0].Id, false, "p.ordering", 1, 1000, out total); //} break; } } dic.Add("DictProductCategory", lst2); dic.Add("DictProductCategory_Total", total); return(dic); }
private string GetProductCategory() { ProductCategoryBLL pcBll = new ProductCategoryBLL(); IList <PNK_ProductCategory> lst = null; IList <PNK_ProductCategory> lst2 = null; if (cidsub != string.Empty && cid != string.Empty && id != string.Empty) { lst = pcBll.GetList(LangInt, cid, string.Empty, int.MinValue, true, "p.ordering", 1, 1000, out total); //ltrCateNameTitle.Text = lst[0].ProductCategoryDesc.Name; categoryID = lst[0].ProductCategoryDesc.Id.ToString(); WebUtils.SeoPage(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaDecription, lst[0].ProductCategoryDesc.MetaKeyword, this.Page); WebUtils.SeoTagH(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, Controls); } else if (cidsub != string.Empty && cid != string.Empty) { lst = pcBll.GetList(LangInt, cid, string.Empty, int.MinValue, true, "p.ordering", 1, 1000, out total); if (total > 0) { //lần 2 truyền parentID vào để lấy ds con lst = pcBll.GetList(LangInt, string.Empty, string.Empty, lst[0].Id, false, "p.ordering", 1, 1000, out total); WebUtils.SeoPage(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaDecription, lst[0].ProductCategoryDesc.MetaKeyword, this.Page); WebUtils.SeoTagH(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, Controls); //Chỉ có 1 menu cha if (total > 0) { //Gen html image category ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0]); //ltrCateNameTitle.Text = lst[0].ProductCategoryDesc.Name; categoryID = lst[0].ProductCategoryDesc.Id.ToString(); } else { categoryID = null; } } } else if (Session["level"] != null) { string level = Session["level"].ToString(); switch (level) { case "1": lst = pcBll.GetList(LangInt, pageName, string.Empty, int.MinValue, true, "p.ordering", 1, 1000, out total); if (total > 0) { lst2 = pcBll.GetList(LangInt, cid, string.Empty, lst[0].Id, true, "p.ordering", 1, 1000, out total); if (lst2.Count > 0) { //Gen html image category ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0]); categoryID = lst2[0].ProductCategoryDesc.Id.ToString(); } else { //Nếu không cấp con của cấp 1 thì lấy luôn cấp 1 categoryID = lst[0].ProductCategoryDesc.Id.ToString(); } } break; case "2": lst = pcBll.GetList(LangInt, pageName, string.Empty, int.MinValue, true, "p.ordering", 1, 1000, out total); if (total > 0) { lst2 = pcBll.GetList(LangInt, cid, string.Empty, lst[0].Id, true, "p.ordering", 1, 1000, out total); if (lst2.Count > 0) { //Gen html image category ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0]); categoryID = lst2[0].ProductCategoryDesc.Id.ToString(); } } break; } } else if (cidsub == string.Empty && cid != string.Empty) { lst = pcBll.GetList(LangInt, cid, string.Empty, int.MinValue, true, "p.ordering", 1, 1000, out total); lst = lst.Where(m => m.ProductCategoryDesc.NameUrl == cid).ToList(); WebUtils.SeoPage(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaDecription, lst[0].ProductCategoryDesc.MetaKeyword, this.Page); WebUtils.SeoTagH(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, Controls); IList <PNK_ProductCategory> lstSub = pcBll.GetList(LangInt, string.Empty, string.Empty, lst[0].Id, false, "p.ordering", 1, 1000, out total); if (lstSub.Count > 0) { //Gen html image category ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0]); //ltrCateNameTitle.Text = lst[0].ProductCategoryDesc.Name; categoryID = lst[0].ProductCategoryDesc.Id.ToString(); } else { categoryID = null; } } else if (cid == string.Empty) { //lần đầu lấy parentID //Xài chung với home, nên set if (pageName == "trang-chu" || pageName == "home") { lst = pcBll.GetList(LangInt, string.Empty, string.Empty, DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdChoose"]), int.MinValue, true, string.Empty, 1, 1000, out total); } else { lst = pcBll.GetList(LangInt, pageName, string.Empty, int.MinValue, true, "p.ordering", 1, 1000, out total); WebUtils.SeoPage(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaDecription, lst[0].ProductCategoryDesc.MetaKeyword, this.Page); WebUtils.SeoTagH(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, Controls); } //lần 2 truyền parentID vào để lấy ds con lst2 = pcBll.GetList(LangInt, string.Empty, string.Empty, lst[0].Id, false, "p.ordering", 1, 1000, out total); //lst = lst2.Count > 0 ? lst2 : lst; if (lst.Count > 0) { //Gen html image category ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0]); //ltrCateNameTitle.Text = lst[0].ProductCategoryDesc.Name; categoryID = lst[0].Id.ToString(); } else { //Gen html image category ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0]); //ltrCateNameTitle.Text = lst2[0].ProductCategoryDesc.Name; categoryID = lst2[0].ParentId.ToString(); parentID = lst2[0].ParentId.ToString(); } } return(categoryID); }
private string GetProductCategory() { ProductCategoryBLL pcBll = new ProductCategoryBLL(); IList <PNK_ProductCategory> lst = null; IList <PNK_ProductCategory> lst2 = null; if (cidsub != string.Empty && cid != string.Empty && id != string.Empty) { lst = pcBll.GetList(LangInt, cid, string.Empty, int.MinValue, true, "p.ordering", 1, 1000, out total); //ltrCateName.Text = lst[0].ProductCategoryDesc.Name; categoryID = lst[0].ProductCategoryDesc.Id.ToString(); WebUtils.SeoPage(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaDecription, lst[0].ProductCategoryDesc.MetaKeyword, this.Page); WebUtils.SeoTagH(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, Controls); //Gen html image category ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0]); } else if (cidsub != string.Empty && cid != string.Empty) { lst = pcBll.GetList(LangInt, cid, string.Empty, int.MinValue, true, "p.ordering", 1, 1000, out total); if (total > 0) { //lần 2 truyền parentID vào để lấy ds con lst = pcBll.GetList(LangInt, string.Empty, string.Empty, lst[0].Id, false, "p.ordering", 1, 1000, out total); WebUtils.SeoPage(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaDecription, lst[0].ProductCategoryDesc.MetaKeyword, this.Page); WebUtils.SeoTagH(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, Controls); //Gen html image category ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0]); //Chỉ có 1 menu cha if (total > 0) { categoryID = lst[0].ProductCategoryDesc.Id.ToString(); } else { categoryID = null; } } } else if (cidsub == string.Empty && cid != string.Empty) { lst = pcBll.GetList(LangInt, cid, string.Empty, int.MinValue, true, "p.ordering", 1, 1000, out total); if (total > 0) { WebUtils.SeoPage(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaDecription, lst[0].ProductCategoryDesc.MetaKeyword, this.Page); WebUtils.SeoTagH(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, Controls); //IList<PNK_ProductCategory> lstSub = pcBll.GetList(LangInt, string.Empty, string.Empty, lst[0].Id, false, "p.ordering", 1, 1000, out total); //Gen html image category ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0]); if (lst.Count > 1) { //ltrCateNameTitle.Text = lst[0].ProductCategoryDesc.Name; categoryID = lst[0].ProductCategoryDesc.Id.ToString(); } else if (lst.Count == 1) { //ltrCateNameTitle.Text = lst[0].ProductCategoryDesc.Name; categoryID = lst[0].ProductCategoryDesc.Id.ToString(); } else { categoryID = null; } } } else if (cid == string.Empty) { //lần đầu lấy parentID lst = pcBll.GetList(LangInt, pageName, string.Empty, int.MinValue, true, "p.ordering", 1, 1000, out total); if (total > 0) { WebUtils.SeoPage(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaDecription, lst[0].ProductCategoryDesc.MetaKeyword, this.Page); WebUtils.SeoTagH(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, Controls); //Gen html image category ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0]); if (lst.Count > 0) { //lần 2 truyền parentID vào để lấy ds con lst2 = pcBll.GetList(LangInt, string.Empty, string.Empty, lst[0].Id, false, "p.ordering", 1, 1000, out total); //ltrCateNameTitle.Text = lst[0].ProductCategoryDesc.Name; //ltrCategoryBrief.Text = lst[0].ProductCategoryDesc.Brief; categoryID = lst[0].Id.ToString(); } else { //lần 2 truyền parentID vào để lấy ds con lst2 = pcBll.GetList(LangInt, string.Empty, string.Empty, lst[0].Id, false, "p.ordering", 1, 1000, out total); //ltrCateNameTitle.Text = lst2[0].ProductCategoryDesc.Name; //ltrCategoryBrief.Text = lst[0].ProductCategoryDesc.Brief; categoryID = lst2[0].ParentId.ToString(); } } } return(categoryID); }
private string GetProductCategory() { ProductCategoryBLL pcBll = new ProductCategoryBLL(); IList <PNK_ProductCategory> lst = null; IList <PNK_ProductCategory> lst2 = null; if (cidsub != string.Empty && cid != string.Empty && id != string.Empty) { lst = pcBll.GetList(LangInt, cid, "1", int.MinValue, true, "p.ordering", 1, 1000, out total); //ltrCategoryBrief.Text = lst[0].ProductCategoryDesc.Brief; categoryID = lst[0].ProductCategoryDesc.Id.ToString(); CategoryHtml(lst); WebUtils.SeoPage(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaDecription, lst[0].ProductCategoryDesc.MetaKeyword, this.Page); WebUtils.SeoTagH(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, Controls); //Gen html image category ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0]); } else if (cidsub != string.Empty && cid != string.Empty) { lst = pcBll.GetList(LangInt, cid, "1", int.MinValue, true, "p.ordering", 1, 1000, out total); if (total > 0) { CategoryHtml(lst); //lần 2 truyền parentID vào để lấy ds con lst = pcBll.GetList(LangInt, string.Empty, string.Empty, lst[0].Id, false, "p.ordering", 1, 1000, out total); WebUtils.SeoPage(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaDecription, lst[0].ProductCategoryDesc.MetaKeyword, this.Page); WebUtils.SeoTagH(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, Controls); //Gen html image category ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0]); //Chỉ có 1 menu cha if (total > 0) { CategoryHtml(lst); //ltrCategoryBrief.Text = lst[0].ProductCategoryDesc.Brief; categoryID = lst[0].ProductCategoryDesc.Id.ToString(); } else { categoryID = null; } } } else if (cidsub == string.Empty && cid != string.Empty) { lst = pcBll.GetList(LangInt, cid, "1", int.MinValue, true, "p.ordering", 1, 1000, out total); WebUtils.SeoPage(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaDecription, lst[0].ProductCategoryDesc.MetaKeyword, this.Page); WebUtils.SeoTagH(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, Controls); //Gen html image category ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0]); //IList<PNK_ProductCategory> lstSub = pcBll.GetList(LangInt, string.Empty, string.Empty, lst[0].Id, false, "p.ordering", 1, 1000, out total); if (lst.Count > 1) { CategoryHtml(lst); // ltrCategoryBrief.Text = lst[0].ProductCategoryDesc.Brief; categoryID = lst[0].ProductCategoryDesc.Id.ToString(); } else if (lst.Count == 1) { CategoryHtml(lst); // ltrCategoryBrief.Text = lst[0].ProductCategoryDesc.Brief; categoryID = lst[0].ProductCategoryDesc.Id.ToString(); } else { categoryID = null; } } else if (cid == string.Empty) { //lần đầu lấy parentID if (pageName == "home" || pageName == "trang-chu") { lst2 = pcBll.GetList(LangInt, string.Empty, "1", DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdTemplate"]), false, "p.ordering", 1, 6, out total); if (lst2.Count > 0) { CategoryHtml(lst2); categoryID = lst2[0].ParentId.ToString(); } //Get catename lst = pcBll.GetList(LangInt, string.Empty, "1", DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdTemplate"]), int.MinValue, false, string.Empty, 1, 1, out total); if (lst.Count > 0) { ltrCateName.Text = lst[0].ProductCategoryDesc.Name; ltrCateBrief.Text = lst[0].ProductCategoryDesc.Brief; } } else { lst = pcBll.GetList(LangInt, pageName, "1", int.MinValue, true, "p.ordering", 1, 1000, out total); WebUtils.SeoPage(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaDecription, lst[0].ProductCategoryDesc.MetaKeyword, this.Page); WebUtils.SeoTagH(lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, lst[0].ProductCategoryDesc.MetaTitle, Controls); //Gen html image category ltrHeaderCategory.Text = Common.UtilityLocal.ImagePathByFont(lst[0]); //lần 2 truyền parentID vào để lấy ds con lst2 = pcBll.GetList(LangInt, string.Empty, string.Empty, lst[0].Id, false, "p.ordering", 1, 1000, out total); //lst = lst2.Count > 0 ? lst2 : lst; if (lst.Count > 0) { // lst2 = lst2.Where(m => m.Id == DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdWebCompany"]) || m.Id == DBConvert.ParseInt(ConfigurationManager.AppSettings["parentIdWebShop"])).ToList(); CategoryHtml(lst2); ltrCateName.Text = lst[0].ProductCategoryDesc.Name; ltrCateBrief.Text = lst[0].ProductCategoryDesc.Brief; categoryID = lst[0].Id.ToString(); } else { CategoryHtml(lst2); ltrCateName.Text = lst2[0].ProductCategoryDesc.Name; ltrCateBrief.Text = lst[0].ProductCategoryDesc.Brief; categoryID = lst2[0].ParentId.ToString(); } } } return(categoryID); }