private string GetItemTags(string sku, AspxCommonInfo aspxCommonObj)
    {
        StringBuilder       itemTags    = new StringBuilder();
        StringBuilder       tagNames    = new StringBuilder();
        StringBuilder       myTags      = new StringBuilder();
        StringBuilder       userTags    = new StringBuilder();
        StringBuilder       bindTag     = new StringBuilder();
        StringBuilder       popularTag  = new StringBuilder();
        List <ItemTagsInfo> lstItemTags = AspxTagsController.GetItemTags(itemSKU, aspxCommonObj);

        foreach (ItemTagsInfo item in lstItemTags)
        {
            if (tagNames.ToString().IndexOf(item.Tag) == -1)
            {
                itemTags.Append(item.Tag + "(" + item.TagCount + "), ");
                tagNames.Append(item.Tag);
            }

            if (item.AddedBy == aspxCommonObj.UserName)
            {
                if (userTags.ToString().IndexOf(item.Tag) == -1)
                {
                    myTags.Append(item.Tag);
                    myTags.Append("<button type=\"button\" class=\"cssClassCross\" value=");
                    myTags.Append(item.ItemTagID);
                    myTags.Append(" onclick =ItemDetail.DeleteMyTag(this)><span>");
                    myTags.Append(getLocale("x"));
                    myTags.Append("</span></button>, ");

                    userTags.Append(item.Tag);
                }
            }

            bindTag.Append("$('#divItemTags').html('");
            bindTag.Append(itemTags.ToString().Substring(0, itemTags.Length - 2));
            bindTag.Append("');");
            if (myTags.Length > 2)
            {
                bindTag.Append("$('#divMyTags').html('");
                bindTag.Append(myTags.ToString().Substring(0, myTags.Length - 2));
                bindTag.Append("');");
            }
        }
        if (!String.IsNullOrEmpty(itemTags.ToString()))
        {
            popularTag.Append("<h2>");
            bindTag.Append(getLocale("PopularTags:"));
            bindTag.Append("");
            popularTag.Append("</h2><div id=\"divItemTags\" class=\"cssClassPopular-Itemstags\">");
            popularTag.Append(itemTags.ToString().Substring(0, itemTags.Length - 2));
            popularTag.Append("</div>");
            bindTag.Append("$('#popularTag').html('");
            bindTag.Append(popularTag);
            bindTag.Append("')");
        }
        string tag = GetScriptRun(bindTag.ToString());

        return(tag);
    }
Пример #2
0
    private string GetItemTags(string sku)
    {
        string              itemTags    = string.Empty;
        string              tagNames    = string.Empty;
        string              myTags      = string.Empty;
        string              userTags    = string.Empty;
        StringBuilder       bindTag     = new StringBuilder();
        StringBuilder       popularTag  = new StringBuilder();
        List <ItemTagsInfo> lstItemTags = AspxTagsController.GetItemTags(itemSKU, aspxCommonObj);

        foreach (ItemTagsInfo item in lstItemTags)
        {
            if (tagNames.IndexOf(item.Tag) == -1)
            {
                itemTags += item.Tag + "(" + item.TagCount + "), ";
                tagNames += item.Tag;
            }

            if (item.AddedBy == GetUsername)
            {
                if (userTags.IndexOf(item.Tag) == -1)
                {
                    myTags += item.Tag + "<button type=\"button\" class=\"cssClassCross\" value=" + item.ItemTagID +
                              " onclick =ItemDetail.DeleteMyTag(this)><span>" + getLocale("x") + "</span></button>, ";
                    userTags += item.Tag;
                }
            }

            bindTag.Append("$('#divItemTags').html('" + itemTags.Substring(0, itemTags.Length - 2) + "');");
            if (myTags.Length > 2)
            {
                bindTag.Append("$('#divMyTags').html('" + myTags.Substring(0, myTags.Length - 2) + "');");
            }
        }
        if (itemTags != "" && itemTags != null)
        {
            popularTag.Append("<h2>" + getLocale("Popular Tags:") + "");
            popularTag.Append("</h2><div id=\"divItemTags\" class=\"cssClassPopular-Itemstags\">");
            popularTag.Append(itemTags.Substring(0, itemTags.Length - 2));
            popularTag.Append("</div>");
            bindTag.Append("$('#popularTag').html('" + popularTag + "')");
        }
        string tag = GetScriptRun(bindTag.ToString());

        return(tag);
    }