/// <summary> /// 商品标签 /// </summary> /// <returns></returns> public void GetGoodsLabels() { string CompID = Request["comid"]; //企业ID string goodsid = !string.IsNullOrEmpty(goodsId.ToString()) ? goodsId.ToString() : Request["goodsId"]; //商品ID string[] list = { }; List <Hi.Model.BD_GoodsLabels> ll = new Hi.BLL.BD_GoodsLabels().GetList("", "isnull(dr,0)=0 and compid=" + CompID + " and goodsId=" + goodsid, ""); string html = ""; foreach (Hi.Model.BD_GoodsLabels item in ll) { html += "<i class=\"t productLabelItem cur\">" + item.LabelName + "</i>"; } this.DivLabel.InnerHtml = html; }
/// <summary> /// 商品标签 /// </summary> /// <returns></returns> public void GetGoodsLabels(int keyId) { string[] list = { }; StringBuilder str = new StringBuilder(); List <Hi.Model.SYS_SysName> l = new Hi.BLL.SYS_SysName().GetList("", "isnull(dr,0)=0 and compid=" + this.CompID + " and name='商品标签管理'", ""); if (l.Count > 0) { foreach (Hi.Model.SYS_SysName item in l) { string labelname = item.Value; if (labelname.Trim() != "") { list = labelname.Split(','); } } List <Hi.Model.BD_GoodsLabels> ll = new Hi.BLL.BD_GoodsLabels().GetList("", "isnull(dr,0)=0 and compid=" + this.CompID + " and goodsId=" + keyId, ""); for (int i = 0; i < list.Length; i++) { if (keyId != 0) { if (ll.Count > 0) { int z = 0;//不相同的情况 foreach (Hi.Model.BD_GoodsLabels item in ll) { if (list[i] == item.LabelName) { str.Append("<label class=\"productLabelItem checked\"><input type=\"checkbox\" name=\"labelcheckbox\" value=\"" + list[i] + "\" style=\"display: none\" checked=\"checked\" />" + list[i] + "</label></ItemTemplate>"); break; } z++; } if (z == ll.Count) { str.Append("<label class=\"productLabelItem\"><input type=\"checkbox\" name=\"labelcheckbox\" value=\"" + list[i] + "\" style=\"display: none\" />" + list[i] + "</label></ItemTemplate>"); } } } else { str.Append("<label class=\"productLabelItem\"><input type=\"checkbox\" name=\"labelcheckbox\" value=\"" + list[i] + "\" style=\"display: none\" />" + list[i] + "</label></ItemTemplate>"); } } } this.DivLabel.InnerHtml = str.ToString(); }