protected void Page_Load(object sender, EventArgs e) { if (Page.RouteData.Values["GroupId"] != null) { id = Page.RouteData.Values["GroupId"] as string; } if (Page.RouteData.Values["Id"] != null) { chudeId = Page.RouteData.Values["Id"] as string; } if (!IsPostBack) { if (Microsoft.VisualBasic.Information.IsNumeric(id)) { List <Data.GroupProduct> listGroup = GroupProductService.GroupProduct_GetById(id); if (listGroup.Count > 0) { DataTable dt = GroupProductService.GroupProduct_GetByTop("", "Active = 1 AND Len(Level) > " + listGroup[0].Level.Length + " AND Left(Level,Len('" + listGroup[0].Level + "'))='" + listGroup[0].Level + "' AND Id <> " + id, ""); if (dt.Rows.Count > 0) { idU_ProductList.Visible = false; U_GroupProductList.Visible = true; U_GroupProductList.GroupProduct = dt; } else { idU_ProductList.Visible = true; U_GroupProductList.Visible = false; idU_ProductList.Level = listGroup[0].Level; idU_ProductList.ItemCount = listGroup[0].Items; } lblGroupName.Text = listGroup[0].Name; } } else if (Microsoft.VisualBasic.Information.IsNumeric(chudeId)) { DataTable chude = ChudeService.Chude_GetById(chudeId); if (chude.Rows.Count > 0) { lblGroupName.Text = chude.Rows[0]["Name"].ToString(); idU_ProductList.ChudeId = chudeId; } } if (Request.QueryString["key"] != null) { lblGroupName.Text = Request.QueryString["key"].ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { DataTable dtConfig = ConfigService.Config_GetByTop("1", "", ""); if (dtConfig.Rows.Count > 0) { Page.Title = dtConfig.Rows[0]["Title"].ToString(); Page.MetaDescription = dtConfig.Rows[0]["Description"].ToString(); Page.MetaKeywords = dtConfig.Rows[0]["Keyword"].ToString(); } //Giới thiệu về chúng tôi DataTable dt = PageService.Page_GetByTop("1", "Name like N'%giới thiệu%'", ""); if (dt.Rows.Count > 0) { sAboutName = dt.Rows[0]["Name"].ToString(); sContents = dt.Rows[0]["Description"].ToString(); sUrl = dt.Rows[0]["Link"].ToString(); } dt.Clear(); HttpCookie cookie = Request.Cookies[Consts.GUID_SHOPPING_CART]; DataTable dtGroup = GroupProductService.GroupProduct_GetByTop("", "Active=1 And Position=1", "Level, Ord"); DataTable dtTop = dtGroup.AsEnumerable().Take(2).CopyToDataTable(); for (int i = 0; i < dtGroup.Rows.Count; i++) { if (i < 2) { dtGroup.Rows[i].Delete(); } } dtGroup.AcceptChanges(); rptGroup.DataSource = StringClass.ModifyDataGroupProduct(dtTop); rptGroup.DataBind(); rptGroup01.DataSource = StringClass.ModifyDataGroupProduct(dtGroup); rptGroup01.DataBind(); } } catch (Exception ex) { MailSender.SendMail("", "", "Error System", ex.Message + "\n" + ex.StackTrace); } }
private void LoadDropDownListPageLink() { ddlLink.Items.Clear(); ddlLink.Items.Add(new ListItem("Trang chủ", "/")); DataTable dt = new DataTable(); dt = GroupNewsService.GroupNews_GetByTop("", "Active=1", "Level, Ord"); ddlLink.Items.Add(new ListItem("Tin tức", "#")); for (int i = 0; i < dt.Rows.Count; i++) { ddlLink.Items.Add(new ListItem(StringClass.ShowNameLevel(dt.Rows[i]["Name"].ToString(), dt.Rows[i]["Level"].ToString() + "00000"), PageHelper.GeneralGroupUrl(Consts.CON_TIN_TUC, dt.Rows[i]["Id"].ToString(), dt.Rows[i]["Name"].ToString()))); } List <Data.GroupImages> listG = GroupImagesService.GroupImages_GetByTop("", "Active=1", "Level, Ord"); ddlLink.Items.Add(new ListItem("Hình ảnh", "#")); if (listG.Count > 0) { for (int i = 0; i < listG.Count; i++) { ddlLink.Items.Add(new ListItem(StringClass.ShowNameLevel(listG[i].Name, listG[i].Level + "00000"), "/Thu-vien-anh/" + listG[i].Id + "/" + StringClass.NameToTag(listG[i].Name))); } } DataTable listGProduct = GroupProductService.GroupProduct_GetByTop("", "Active=1", "Level, Ord"); ddlLink.Items.Add(new ListItem("Sản phẩm", "#")); if (listGProduct.Rows.Count > 0) { for (int i = 0; i < listGProduct.Rows.Count; i++) { ddlLink.Items.Add(new ListItem(StringClass.ShowNameLevel(listGProduct.Rows[i]["Name"].ToString(), listGProduct.Rows[i]["Level"].ToString() + "00000"), PageHelper.GeneralGroupUrl(Consts.CON_SAN_PHAM, listGProduct.Rows[i]["Id"].ToString(), listGProduct.Rows[i]["Name"].ToString()))); } } DataTable listChude = ChudeService.Chude_GetByTop("", "Active=1", "Ord"); ddlLink.Items.Add(new ListItem("Chủ đề", "#")); if (listChude.Rows.Count > 0) { for (int i = 0; i < listChude.Rows.Count; i++) { ddlLink.Items.Add(new ListItem(StringClass.ShowNameLevel(listChude.Rows[i]["Name"].ToString(), "0000000000"), "/chu-de/chu-de-" + listChude.Rows[i]["Id"].ToString() + "/" + StringClass.NameToTag(listChude.Rows[i]["Name"].ToString()))); } } ddlLink.Items.Add(new ListItem("Liên hệ", "/lien-he")); ddlLink.DataBind(); }
private void LoadDropDownListGroupProduct() { ddlGroupProduct.Items.Clear(); drlnhom.Items.Clear(); ddlGroupProduct.Items.Add(new ListItem("--Chọn nhóm sản phẩm--", "")); drlnhom.Items.Add(new ListItem("--Chọn nhóm sản phẩm--", "")); DataTable dtGroup; dtGroup = GroupProductService.GroupProduct_GetByTop("", "Active = 1", "Level, Ord"); for (int i = 0; i < dtGroup.Rows.Count; i++) { DataRow row = dtGroup.Rows[i]; ddlGroupProduct.Items.Add(new ListItem(Common.StringClass.ShowNameLevel(row["Name"].ToString(), row["Level"].ToString()), row["Id"].ToString())); drlnhom.Items.Add(new ListItem(Common.StringClass.ShowNameLevel(row["Name"].ToString(), row["Level"].ToString()), row["Id"].ToString())); } ddlGroupProduct.DataBind(); drlnhom.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { string groupId = string.Empty; string level = string.Empty; int count = 0; string strUrl = string.Empty; List <GroupProduct> listG = GroupProductService.GroupProduct_GetByTop("", "Active=1", "Level, Ord"); if (listG.Count > 0) { for (int i = 0; i < listG.Count; i++) { if (listG[i].Level.Length == 5) { List <GroupProduct> listSub = listG.Where(l => l.Level.Length == 10 && l.Level.Substring(0, 5) == listG[i].Level).ToList(); ltrmenu.Text += "<div class='layered_filter'>\n"; ltrmenu.Text += "<div class='layered_subtitle_heading'>\n"; count = ProductService.Product_GetCount(listG[i].Level); ltrmenu.Text += "<input type='checkbox' class='checkbox' name='layer_id_attribute_group_" + (i + 1).ToString() + "' id='layered_id_attribute_group_" + (i + 1).ToString() + "' value='" + listG[i].Id + "' />\n"; ltrmenu.Text += "<label for='layer_id_attribute_group_" + (i + 1).ToString() + "'>\n"; strUrl = PageHelper.GeneralGroupUrl(Consts.CON_SAN_PHAM, listG[i].Id, listG[i].Name); ltrmenu.Text += "<a href='" + strUrl + "'>"; ltrmenu.Text += "<strong>" + listG[i].Name + "</strong>\n"; count = ProductService.Product_GetCount(listG[i].Level); ltrmenu.Text += "<span>(" + count.ToString() + ")</span></a>\n</label></div>\n"; if (listSub.Count > 0) { ltrmenu.Text += "<ul id='ul_layered_id_attribute_group_" + (i + 1).ToString() + "' class='col-lg-12 layered_filter_ul'>\n"; for (int j = 0; j < listSub.Count; j++) { ltrmenu.Text += "<li class='nomargin hiddable col-lg-12'>\n"; ltrmenu.Text += "<input type='checkbox' class='checkbox' name='layered_id_attribute_group_" + (j + 1).ToString() + "' id='layered_id_attribute_group_" + (j + 1).ToString() + "' value='" + listSub[j].Id + "' />\n"; ltrmenu.Text += "<label for='layered_id_attribute_group_" + (j + 1).ToString() + "'>\n"; strUrl = PageHelper.GeneralGroupUrl(Consts.CON_SAN_PHAM, listSub[j].Id, listSub[j].Name); ltrmenu.Text += "<a href='" + strUrl + "'>"; ltrmenu.Text += "<strong>" + listSub[j].Name + "</strong>\n"; count = ProductService.Product_GetCount(listSub[j].Level); ltrmenu.Text += "<span>(" + count.ToString() + ")</span></a>\n</label>\n</li>\n"; } ltrmenu.Text += "</ul>\n"; } ltrmenu.Text += "</div>\n"; } } } DataTable dtSub = GroupNewsService.GroupNews_GetByTop("", "Active=1 And left(Level,5)='" + level + "' And len(Level) = 10", "Level, Ord"); if (dtSub.Rows.Count > 0) { for (int i = 0; i < dtSub.Rows.Count; i++) { ltrmenu.Text += "<h3><a href='/" + dtSub.Rows[i]["Id"] + "/" + StringClass.NameToTag(dtSub.Rows[i]["Name"].ToString()) + ".aspx' title='" + dtSub.Rows[i]["Name"] + "'>" + dtSub.Rows[i]["Name"] + "</a></h3>"; DataTable dt3 = NewsService.News_GetByTop("5", "Active=1 And GroupNewsId='" + dtSub.Rows[i]["Id"] + "'", "Date Desc"); if (dt3.Rows.Count > 0) { ltrmenu.Text += "<div class='content-menu'><ul>"; for (int j = 0; j < dt3.Rows.Count; j++) { if ("1".Equals(dt3.Rows[j]["Index"].ToString())) { ltrmenu.Text += "<li><a href='/" + dtSub.Rows[i]["Id"] + "/" + StringClass.NameToTag(dtSub.Rows[i]["Name"].ToString()) + "/" + dt3.Rows[j]["Id"] + "/" + StringClass.NameToTag(dt3.Rows[j]["Name"].ToString()) + ".aspx' title='" + dt3.Rows[j]["Name"] + "'>" + dt3.Rows[j]["Name"] + "</a><img src='/Images/icon_hot.gif' style='margin-left:2px' /></li>"; } else { ltrmenu.Text += "<li><a href='/" + dtSub.Rows[i]["Id"] + "/" + StringClass.NameToTag(dtSub.Rows[i]["Name"].ToString()) + "/" + dt3.Rows[j]["Id"] + "/" + StringClass.NameToTag(dt3.Rows[j]["Name"].ToString()) + ".aspx' title='" + dt3.Rows[j]["Name"] + "'>" + dt3.Rows[j]["Name"] + "</a></li>"; } } ltrmenu.Text += "</ul></div>"; } } } } catch (Exception ex) { MailSender.SendMail("", "", "Error System", ex.Message); } } }