Beispiel #1
0
    void RenderJsonData()
    {
        List <ProductCategory> pcs = ProductCategories.GetCategoreisByProductID(productID);
        StringBuilder          sb1 = new StringBuilder();
        StringBuilder          sb2 = new StringBuilder();

        foreach (ProductCategory pc in pcs)
        {
            sb1.AppendFormat("[{0}]:", pc.CategoryID);
            sb2.AppendFormat(catHtml, pc.CategoryID, pc.CategoryName);
        }
        hfCategories.Value = sb1.ToString();
        hfCatHTML.Value    = sb2.ToString();
        sb1 = new StringBuilder();
        sb2 = new StringBuilder();
        List <ProductIndustry> pis = ProductIndustries.GetIndustriesByProductID(productID);

        foreach (ProductIndustry pi in pis)
        {
            sb1.AppendFormat("[{0}]:", pi.IndustryID);
            sb2.AppendFormat(indHtml, pi.IndustryID, pi.IndustryName);
        }
        hfIndustries.Value = sb1.ToString();
        hfIndHTML.Value    = sb2.ToString();
    }
        HtmlGenericControl BindIndustryList()
        {
            List <ProductIndustry> industriesTemp = ProductIndustries.GetProductIndustries();
            List <ProductIndustry> industries     = industriesTemp.GetRange(0, Math.Min(_Num, industriesTemp.Count));

            if (industries.Count == 0)
            {
                HtmlGenericControl p = new HtmlGenericControl("P");
                p.InnerText = "没有行业应用信息!";
                return(p);
            }

            HtmlGenericControl ul = new HtmlGenericControl("ul");

            ul.ID = "ulIndustryList";

            HtmlGenericControl li     = null;
            HtmlAnchor         anchor = null;

            foreach (var b in industries)
            {
                li               = new HtmlGenericControl("LI");
                anchor           = new HtmlAnchor();
                anchor.HRef      = GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-industry&ID=" + GlobalSettings.Encrypt(b.IndustryID.ToString());
                anchor.Target    = "_blank";
                anchor.InnerText = b.IndustryName;
                anchor.Title     = b.IndustryTitle;
                li.Controls.Add(anchor);

                ul.Controls.Add(li);
            }
            return(ul);
        }
    public override void OnPageLoaded()
    {
        string industryName = string.Empty, industryAbstract = string.Empty;
        string id = Request.QueryString["ID"];

        if (!string.IsNullOrEmpty(id))
        {
            int             pid = int.Parse(GlobalSettings.Decrypt(id));
            ProductIndustry pi  = ProductIndustries.GetProductIndustry(pid);
            if (null != pi)
            {
                industryName     = pi.IndustryName;
                industryAbstract = pi.IndustryAbstract;
            }
        }

        if (string.IsNullOrEmpty(industryName))
        {
            industryName = "所有行业";
            this.AddKeywords(industryName);
            this.AddDescription("分组显示所有行业列表,选择行业导航到对应行业的产品列表。");
            this.ShortTitle = industryName;
        }
        else
        {
            this.AddKeywords(industryName);
            this.AddDescription(string.Format("显示{0}行业的产品列表。{1}{2}", industryName, industryAbstract, string.Format(" 关键字: {0}", industryName)));
            this.ShortTitle = industryName;
        }
        this.SetTitle();

        this.AddJavaScriptInclude("scripts/pages/sortby.aspx.js", false, false);
    }
Beispiel #4
0
        string RenderHTML()
        {
            if (_Cache.ContainsKey(_IndustryID))
            {
                return(_Cache[_IndustryID]);
            }
            List <ProductIndustry> inds = ProductIndustries.GetChildIndustries(0);
            StringBuilder          sb   = new StringBuilder();

            if (_IndustryID == 0)
            {
                return("<div class=\"" + _CssClass + "\"><span>暂无相关行业信息!</span></div>");
            }
            else
            {
                ProductIndustry pi = ProductIndustries.GetProductIndustry(_IndustryID);
                if (pi.ParentID == 0)
                {
                    return("<div class=\"" + _CssClass + "\"><span>此行业为顶级行业分类!</span></div>");
                }
                List <ProductIndustry> pis = ProductIndustries.GetChildIndustries(pi.ParentID);

                if (pis == null || pis.Count == 0 || (pis.Count == 1 && pis[0].IndustryID == _IndustryID))
                {
                    return("<div class=\"" + _CssClass + "\"><span>暂无相关行业信息!</span></div>");
                }
                sb.Append("<div class=\"" + _CssClass + "\">");
                ProductQuery            query;
                int                     count = 0;
                PagingDataSet <Product> __ps  = null;
                foreach (ProductIndustry p in pis)
                {
                    if (p.IndustryID != _IndustryID)
                    {
                        count            = 0;
                        query            = new ProductQuery();
                        query.IndustryID = p.IndustryID;
                        __ps             = Products.GetProducts(query);
                        if (__ps != null && __ps.Records != null)
                        {
                            count = Products.GetProducts(query).Records.Count;
                        }
                        sb.AppendFormat(_href, GlobalSettings.Encrypt(p.IndustryID.ToString()), p.IndustryName + "(" + count + ")");
                    }
                }
                sb.Append("</div>");
                if (!_Cache.ContainsKey(_IndustryID))
                {
                    lock (_lock)
                        if (!_Cache.ContainsKey(_IndustryID))
                        {
                            _Cache.Add(_IndustryID, sb.ToString());
                        }
                }
                return(sb.ToString());
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            List <ProductIndustry> industries = ProductIndustries.GetProductIndustries();

            rpTrade.DataSource = industries;
            rpTrade.DataBind();
        }
    }
Beispiel #6
0
        string RenderHTML()
        {
            List <ProductIndustry> inds = ProductIndustries.GetChildIndustries(0);
            string nav = GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-industry";

            if (inds == null || inds.Count == 0)
            {
                return("<div><span>没有显示的行业信息!</span></div>");
            }

            List <ProductIndustry> pis = null;
            ProductIndustry        pi  = null;
            StringBuilder          sb  = new StringBuilder();
            string indId    = null;
            int    curCount = inds.Count;

            inds = inds.GetRange(0, Math.Min(_Max, curCount));
            sb.AppendLine("<table cellpadding=\"0\" cellspacing=\"0\" class=\"" + _CssClass + "\">");
            for (int i = 0; i < inds.Count; i++)
            {
                pi    = inds[i];
                indId = GlobalSettings.Encrypt(pi.IndustryID.ToString());
                if (i % _Columns == 0)
                {
                    sb.AppendLine("<tr>");
                }

                sb.AppendLine("<td>");
                sb.AppendLine("<div><div><a href=\"" + nav + "&ID=" + indId + "\" target=\"_blank\">" + pi.IndustryName + "</a></div></div>");
                pis = ProductIndustries.GetChildIndustries(pi.IndustryID);
                for (int j = 0; j < pis.Count; j++)
                {
                    pi    = pis[j];
                    indId = GlobalSettings.Encrypt(pi.IndustryID.ToString());
                    sb.AppendLine("<a href=\"" + nav + "&ID=" + indId + "\" target=\"_blank\">" + pi.IndustryName + "</a>");
                    if (j != pis.Count - 1)
                    {
                        sb.Append("&nbsp;|&nbsp;");
                    }
                }
                sb.AppendLine("</td>");

                if (i % _Columns == _Columns - 1)
                {
                    sb.AppendLine("</tr>");
                }
            }
            sb.AppendLine("</table>");
            if (curCount > _Max)
            {
                sb.Append("<div class=\"list-more\"><a href=\"" + GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-industry\" title=\"查看全部。。。\"></a></div>");
            }
            return(sb.ToString());
        }
Beispiel #7
0
        string RenderHTML()
        {
            if (_Cache.ContainsKey(_IndustryID))
            {
                return(_Cache[_IndustryID]);
            }
            List <ProductIndustry> inds = ProductIndustries.GetChildIndustries(0);

            StringBuilder sb = new StringBuilder();

            if (_IndustryID == 0)
            {
                return("<div class=\"" + _CssClass + "\"><span>暂无子行业信息!</span></div>");
            }
            else
            {
                string                 _indId = string.Empty;
                ProductIndustry        pi     = null;
                List <ProductIndustry> pis    = ProductIndustries.GetChildIndustries(_IndustryID);
                if (pis == null || pis.Count == 0)
                {
                    return("<div class=\"" + _CssClass + "\"><span>暂无子行业信息!</span></div>");
                }
                sb.Append("<div class=\"" + _CssClass + "\">");
                ProductQuery            query;
                int                     count = 0;
                PagingDataSet <Product> __ps  = null;
                for (int i = 0; i < pis.Count; i++)
                {
                    pi               = pis[i];
                    count            = 0;
                    query            = new ProductQuery();
                    query.IndustryID = pi.IndustryID;
                    __ps             = Products.GetProducts(query);
                    if (__ps != null && __ps.Records != null)
                    {
                        count = Products.GetProducts(query).Records.Count;
                    }
                    sb.AppendFormat(_href, GlobalSettings.Encrypt(pi.IndustryID.ToString()), pi.IndustryName + "(" + count + ")");
                }
                sb.Append("</div>");
                if (!_Cache.ContainsKey(_IndustryID))
                {
                    lock (_lock)
                        if (!_Cache.ContainsKey(_IndustryID))
                        {
                            _Cache.Add(_IndustryID, sb.ToString());
                        }
                }
            }
            return(sb.ToString());
        }
        string GenerateIndustry(ref bool result)
        {
            List <ProductIndustry> pbs = ProductIndustries.GetProductIndustries();
            SiteMapBuilder         smb = new SiteMapBuilder();

            foreach (ProductIndustry pb in pbs)
            {
                smb.AddLocalUrl("pages/view.aspx?product-industry&ID=" + GlobalSettings.Encrypt(pb.IndustryID.ToString()), DateTime.Now);
            }
            smb.Save(GlobalSettings.MapPath("~/sitemap/industries.xml"));
            result = true;
            return("成功生成/更新【产品品牌】地图!");
        }
    string GetCategories(int pId)
    {
        List <ProductIndustry> inds  = ProductIndustries.GetProductIndustries();
        List <ProductIndustry> _inds = new List <ProductIndustry>();

        foreach (ProductIndustry pi in inds)
        {
            if (pi.ParentID == pId)
            {
                _inds.Add(pi);
            }
        }
        return(Newtonsoft.Json.JavaScriptConvert.SerializeObject(_inds));
    }
    void BindIndustries()
    {
        List <ProductIndustry> pis = ProductIndustries.GetIndustriesByProductID(productID);
        string ids = string.Empty;
        string ns  = string.Empty;

        foreach (ProductIndustry p in pis)
        {
            ids += "[" + p.IndustryID + "]";
            ns  += "<li rel='" + p.IndustryID + "' title='" + p.IndustryTitle + "'>" + p.IndustryName +
                   "<a title='删除' href='javascript:void(0)' >&nbsp;</a>" +
                   "</li>";
        }
        hfTrade.Value     = ids;
        hfTradeList.Value = ns;
    }
    string GetNavigations(int pId)
    {
        List <ProductIndustry> _inds = new List <ProductIndustry>();

        if (pId != 0)
        {
            ProductIndustry pi = ProductIndustries.GetProductIndustry(pId);
            _inds.Add(pi);
            while (pi.ParentID != 0)
            {
                pi = ProductIndustries.GetProductIndustry(pi.ParentID);
                _inds.Add(pi);
            }
        }
        return(Newtonsoft.Json.JavaScriptConvert.SerializeObject(_inds));
    }
Beispiel #12
0
    void BindIndustry(int pId)
    {
        List <ProductIndustry> pi = ProductIndustries.GetIndustriesByProductID(pId);

        if (pi.Count == 0)
        {
            ltIndustry.Text = "<ul><li><span>——</span></li></ul>";
        }
        else
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("<ul>");
            foreach (ProductIndustry p in pi)
            {
                sb.Append("<li><a target=\"_blank\" href=\"" + GlobalSettings.RelativeWebRoot +
                          "pages/view.aspx?product-industry&ID=" + GlobalSettings.Encrypt(p.IndustryID.ToString()) + "\">" + p.IndustryName + "</a></li>");
            }
            ltIndustry.Text = sb.ToString();
        }
    }
        string RenderIndustryHTML()
        {
            string ck = prefixInd + _FirstLetter;

            if (_Cache.ContainsKey(ck))
            {
                return(_Cache[ck]);
            }
            List <ProductIndustry> inds = ProductIndustries.GetIndustriesByPY(_FirstLetter);
            string nav = GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-industry";

            if (inds == null || inds.Count == 0)
            {
                return("<div><span>没有可显示的行业信息!</span></div>");
            }
            StringBuilder   sb = new StringBuilder();
            ProductIndustry pb = null;

            int    curCount = inds.Count;
            string catId    = string.Empty;

            sb.AppendLine("<table cellpadding=\"0\" cellspacing=\"0\" class=\"" + _CssClass + "\">");
            for (int i = 0; i < curCount; i++)
            {
                pb = inds[i];
                sb.Append("<tr><td>");
                catId = GlobalSettings.Encrypt(pb.IndustryID.ToString());
                sb.AppendLine("<div><a href=\"" + nav + "&ID=" + catId + "\" target=\"_blank\">" + pb.IndustryName + "</a></div>");
                sb.AppendLine("</td></tr>");
            }
            sb.AppendLine("</table>");
            if (!_Cache.ContainsKey(ck))
            {
                lock (_lock)
                    if (!_Cache.ContainsKey(ck))
                    {
                        _Cache.Add(ck, sb.ToString());
                    }
            }
            return(sb.ToString());
        }
    void BindData()
    {
        ProductIndustry industry = null;

        if (action == OperateType.Add)
        {
            industry          = new ProductIndustry();
            industry.ParentID = parentID;
        }
        else
        {
            industry     = ProductIndustries.GetProductIndustry(industryID);
            btnPost.Text = "更新";
        }

        if (industry.ParentID == 0)
        {
            parentRow.Visible = false;
        }
        else
        {
            parentRow.Visible  = true;
            lblParentName.Text = ProductIndustries.GetProductIndustry(industry.ParentID).IndustryName;
        }

        this.txtIndustryAbstract.Text = industry.IndustryAbstract;
        this.txtIndustryContent.Text  = industry.IndustryContent;
        this.txtIndustryName.Text     = industry.IndustryName;
        this.txtIndustryTitle.Text    = industry.IndustryTitle;
        this.txtDisplayOrder.Text     = industry.DisplayOrder.ToString();
        this.csIndustry.SelectedValue = industry.IndustryStatus;
        if (industry.File != null)
        {
            this.imgLogo.ImageUrl = SiteUrlManager.GetResizedImageUrl(industry.File, (int)imgLogo.Width.Value, (int)imgLogo.Height.Value);
        }
        else
        {
            this.imgLogo.ImageUrl = SiteUrlManager.GetNoPictureUrl((int)imgLogo.Width.Value, (int)imgLogo.Height.Value);
        }
    }
        string RenderHTML()
        {
            if (_Cache.ContainsKey(_IndustryID))
            {
                return(_Cache[_IndustryID]);
            }
            List <ProductIndustry> inds = ProductIndustries.GetChildIndustries(0);
            StringBuilder          sb   = new StringBuilder();

            if (_IndustryID == 0)
            {
                sb.Append("您的位置:<b>所有行业</b>");
            }
            else
            {
                ProductIndustry pi = ProductIndustries.GetProductIndustry(_IndustryID);
                sb.Append("<b>" + pi.IndustryName + "</b>");
                int parId = pi.ParentID;
                while (parId != 0)
                {
                    pi = ProductIndustries.GetProductIndustry(parId);
                    if (pi == null)
                    {
                        break;
                    }
                    sb.Insert(0, string.Format(_href, "&ID=" + GlobalSettings.Encrypt(pi.IndustryID.ToString()), pi.IndustryName) + ">>");
                    parId = pi.ParentID;
                }
                sb.Insert(0, "您的位置:" + string.Format(_href, "", "所有行业") + ">>");
                if (!_Cache.ContainsKey(_IndustryID))
                {
                    lock (_lock)
                        if (!_Cache.ContainsKey(_IndustryID))
                        {
                            _Cache.Add(_IndustryID, sb.ToString());
                        }
                }
            }
            return(sb.ToString());
        }
    protected void egvIndustries_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int industryID          = (int)egvIndustries.DataKeys[e.RowIndex].Value;
        DataActionStatus status = ProductIndustries.Delete(industryID);

        switch (status)
        {
        case DataActionStatus.RelationshipExist:
            throw new HHException(ExceptionType.Failed, "此行业信息下存在关联商品,无法直接删除(请先删除此行业信息下关联商品)!");

        case DataActionStatus.ChildExist:
            throw new HHException(ExceptionType.Failed, "此行业信息下存在子行业信息,无法直接删除(请先删除子行业信息)");

        case DataActionStatus.UnknownFailure:
            throw new HHException(ExceptionType.Failed, "删除行业信息失败,请确认此行业信息存在,并状态正常!");

        default:
        case DataActionStatus.Success:
            BindData();
            break;
        }
    }
 void BindData()
 {
     this.egvIndustries.DataSource = ProductIndustries.GetHierarchyIndustries();
     this.egvIndustries.DataBind();
 }
Beispiel #18
0
    private void InitialDataBind()
    {
        SiteSettings ss = HHContext.Current.SiteSettings;

        ltCopyRight.Text = ss.Copyright;

        StringBuilder       sbItems = new StringBuilder();
        List <ProductBrand> brands  = ProductBrands.GetProductBrands();

        foreach (ProductBrand item in brands)
        {
            sbItems.AppendFormat("<li><a href=\"http://www.ehuaho.com/pages/view.aspx?product-brand&ID={0}\" target=\"_blank\" title=\"{2}\">{1}</a></li>",
                                 GlobalSettings.Encrypt(item.BrandID.ToString()),
                                 GlobalSettings.SubString(item.BrandName, 10),
                                 item.BrandName);
        }
        ltBrand.Text = sbItems.ToString();

        List <ProductIndustry> inds = ProductIndustries.GetProductIndustries();

        sbItems.Remove(0, sbItems.Length);
        foreach (ProductIndustry item in inds)
        {
            sbItems.AppendFormat("<li><a href=\"http://www.ehuaho.com/pages/view.aspx?product-industry&ID={0}\" target=\"_blank\" title=\"{2}\">{1}</a></li>",
                                 GlobalSettings.Encrypt(item.IndustryID.ToString()),
                                 GlobalSettings.SubString(item.IndustryName, 10),
                                 item.IndustryName);
        }
        ltIndustry.Text = sbItems.ToString();

        ProductQuery q = new ProductQuery();

        q.PageIndex    = 0;
        q.PageSize     = int.MaxValue;
        q.HasPublished = true;
        List <Product> ps = Products.GetProductList(q);

        sbItems.Remove(0, sbItems.Length);
        foreach (Product item in ps)
        {
            sbItems.AppendFormat("<li><a href=\"http://www.ehuaho.com/pages/view.aspx?product-product&ID={0}\" target=\"_blank\" title=\"{2}\">{1}</a></li>",
                                 GlobalSettings.Encrypt(item.ProductID.ToString()),
                                 GlobalSettings.SubString(item.ProductName, 17),
                                 item.ProductName);
        }
        ltProduct.Text = sbItems.ToString();

        List <ProductCategory> cats = ProductCategories.GetCategories();

        sbItems.Remove(0, sbItems.Length);
        foreach (ProductCategory item in cats)
        {
            sbItems.AppendFormat("<li><a href=\"http://www.ehuaho.com/pages/view.aspx?product-category&ID={0}\" target=\"_blank\" title=\"{2}\">{1}</a></li>",
                                 GlobalSettings.Encrypt(item.CategoryID.ToString()),
                                 GlobalSettings.SubString(item.CategoryName, 10),
                                 item.CategoryName);
        }
        ltCategory.Text = sbItems.ToString();


        List <Article> ars = ArticleManager.GetAllArticles();

        sbItems.Remove(0, sbItems.Length);
        foreach (Article item in ars)
        {
            sbItems.AppendFormat("<li><a href=\"http://www.ehuaho.com/pages/view.aspx?news-newsdetail&ID={0}\" target=\"_blank\" title=\"{2}\">{1}</a></li>",
                                 GlobalSettings.Encrypt(item.ID.ToString()),
                                 GlobalSettings.SubString(item.Title, 10),
                                 item.Title);
        }
        ltNews.Text = sbItems.ToString();
        //ltCategory; ltIndustry; ltNews; ltProduct;
    }
    public void btnPost_Click(object sender, EventArgs e)
    {
        ProductIndustry industry = null;

        if (action == OperateType.Add)
        {
            industry          = new ProductIndustry();
            industry.ParentID = parentID;
        }
        else
        {
            industry = ProductIndustries.GetProductIndustry(industryID);
        }

        industry.IndustryAbstract = this.txtIndustryAbstract.Text.Trim();
        industry.IndustryContent  = this.txtIndustryContent.Text.Trim();
        industry.IndustryName     = this.txtIndustryName.Text.Trim();
        industry.IndustryTitle    = this.txtIndustryTitle.Text.Trim();
        industry.DisplayOrder     = Convert.ToInt32(this.txtDisplayOrder.Text);
        industry.IndustryStatus   = this.csIndustry.SelectedValue;
        if (fuLogo.PostedFile != null && fuLogo.PostedFile.ContentLength > 0)
        {
            industry.IndustryLogo = Path.GetFileName(fuLogo.PostedFile.FileName);
        }
        DataActionStatus status;

        if (action == OperateType.Add)
        {
            status = ProductIndustries.Create(industry, fuLogo.PostedFile.InputStream);
            switch (status)
            {
            case DataActionStatus.DuplicateName:
                mbMessage.ShowMsg("新增行业信息失败,存在同名行业信息!", Color.Red);
                break;

            case DataActionStatus.UnknownFailure:
                mbMessage.ShowMsg("新增行业信息失败,请联系管理员!", Color.Red);
                break;

            case DataActionStatus.Success:
            default:
                mbMessage.ShowMsg("新增行业信息成功,可继续填写新行业信息,若完成请返回!", Color.Navy);
                break;
            }
        }
        else
        {
            status = ProductIndustries.Update(industry, fuLogo.PostedFile.InputStream);
            switch (status)
            {
            case DataActionStatus.DuplicateName:
                mbMessage.ShowMsg("修改行业信息失败,存在同名行业信息!", Color.Red);
                break;

            case DataActionStatus.UnknownFailure:
                mbMessage.ShowMsg("修改行业信息失败,请联系管理员!", Color.Red);
                break;

            case DataActionStatus.Success:
            default:
                mbMessage.ShowMsg("修改行业信息成功,可继续修改行业信息,若完成请返回!", Color.Navy);
                break;
            }
        }
        if (status == DataActionStatus.Success)
        {
            BindData();
        }
    }
    public override void OnPageLoaded()
    {
        string letter = this.llCategory.FirstLetter, title = string.Empty;

        StringBuilder sbKeywords = new StringBuilder();

        switch (this.llCategory.LetterType)
        {
        case LettersType.Category:
            List <ProductCategory> listCategory = ProductCategories.GetCategoreisByPY(letter);
            if (null == listCategory || 0 == listCategory.Count)
            {
            }
            else
            {
                foreach (ProductCategory item in listCategory)
                {
                    sbKeywords.AppendFormat("{0},", item.CategoryName);
                }
            }
            title = "分类";
            break;

        case LettersType.Brand:
            List <ProductBrand> listBrand = ProductBrands.GetBrandsByPY(letter);
            if (null == listBrand || 0 == listBrand.Count)
            {
            }
            else
            {
                foreach (ProductBrand item in listBrand)
                {
                    sbKeywords.AppendFormat("{0},", item.BrandName);
                }
            }
            title = "品牌";
            break;

        case LettersType.Industry:
            List <ProductIndustry> listIndustry = ProductIndustries.GetIndustriesByPY(letter);
            if (null == listIndustry || 0 == listIndustry.Count)
            {
            }
            else
            {
                foreach (ProductIndustry item in listIndustry)
                {
                    sbKeywords.AppendFormat("{0},", item.IndustryName);
                }
            }
            title = "行业";
            break;
        }

        string keywords = sbKeywords.ToString().TrimEnd(',');

        if (string.IsNullOrEmpty(keywords))
        {
            //this.AddKeywords(keywords);
            this.AddDescription(string.Format("按照首字母进行{0}检索,首字母是{1}", title, letter.ToUpper()));

            this.ShortTitle = string.Format("首字母{0}检索{1}", title, letter.ToUpper());
        }
        else
        {
            this.AddKeywords(keywords);
            this.AddDescription(string.Format("按照首字母进行{0}检索,首字母是{1},符合条件的{0}列表如下: {2}", title, letter.ToUpper(), keywords));

            this.ShortTitle = string.Format("首字母{0}检索{1} - {2}", title, letter.ToUpper(), keywords);
        }
        this.SetTitle();
    }
    private void BindData()
    {
        ProductQuery query = ProductQuery.GetQueryFromQueryString(Request.QueryString);

        query.CompanyID = Profile.AccountInfo.CompanyID;

        lnkAll.CssClass = "active";
        lblTip.Text     = "“全部”";

        if (query.HasPictures.HasValue)
        {
            if (query.HasPictures.Value)
            {
                lnkAll.CssClass     = "";
                lnkPicture.CssClass = "active";
                lblTip.Text         = "“有图”";
            }
            else
            {
                lnkAll.CssClass       = "";
                lnkNoPicture.CssClass = "active";
                lblTip.Text           = "“无图”";
            }
        }

        if (query.HasPrice.HasValue)
        {
            if (query.HasPrice.Value)
            {
                lnkAll.CssClass    = "";
                lnkPriced.CssClass = "active";
                lblTip.Text        = "“已报价”";
            }
            else
            {
                lnkAll.CssClass      = "";
                lnkNoPriced.CssClass = "active";
                lblTip.Text          = "“未报价”";
            }
        }

        if (query.HasPublished.HasValue)
        {
            if (query.HasPublished.Value)
            {
                lnkAll.CssClass       = "";
                lnkPublished.CssClass = "active";
                lblTip.Text           = "“已发布”";
            }
            else
            {
                lnkAll.CssClass          = "";
                lnkUnPublishied.CssClass = "active";
                lblTip.Text = "“未发布”";
            }
        }

        bool flag = false;

        if (!GlobalSettings.IsNullOrEmpty(query.ProductNameFilter))
        {
            txtProductName.Text = query.ProductNameFilter;
            lblTip.Text         = "名称中包含“" + query.ProductNameFilter + "”";
            flag = true;
        }

        //BrandID
        ddlBrands.DataSource     = ProductBrands.GetProductBrands();
        ddlBrands.DataTextField  = "BrandName";
        ddlBrands.DataValueField = "BrandID";
        ddlBrands.DataBind();
        ddlBrands.Items.Insert(0, new ListItem("=所有品牌=", "0"));

        if (query.BrandID.HasValue && query.BrandID.Value != 0)
        {
            ListItem item = ddlBrands.Items.FindByValue(query.BrandID.Value.ToString());
            if (item != null)
            {
                item.Selected = true;
                if (flag)
                {
                    lblTip.Text = lblTip.Text + ",品牌为“" + ProductBrands.GetProductBrand(query.BrandID.Value).BrandName + "”";
                }
                else
                {
                    lblTip.Text = "品牌为“" + ProductBrands.GetProductBrand(query.BrandID.Value).BrandName + "”";
                    flag        = true;
                }
            }
        }

        //CategoryID
        ddlCategory.DataSource     = ProductCategories.GetValueRange();
        ddlCategory.DataTextField  = "Text";
        ddlCategory.DataValueField = "Name";
        ddlCategory.DataBind();
        ddlCategory.Items.Insert(0, new ListItem("=所有分类=", "0"));

        if (query.CategoryID.HasValue && query.CategoryID.Value != 0)
        {
            ListItem item = ddlCategory.Items.FindByValue(query.CategoryID.Value.ToString());
            if (item != null)
            {
                item.Selected = true;
                if (flag)
                {
                    lblTip.Text = lblTip.Text + ",分类为“" + ProductCategories.GetCategory(query.CategoryID.Value).CategoryName + "”";
                }
                else
                {
                    lblTip.Text = "分类为“" + ProductCategories.GetCategory(query.CategoryID.Value).CategoryName + "”";
                    flag        = true;
                }
            }
        }

        //IndustryID
        ddlIndustry.DataSource     = ProductIndustries.GetHierarchyIndustries();
        ddlIndustry.DataTextField  = "IndustryName";
        ddlIndustry.DataValueField = "IndustryID";
        ddlIndustry.DataBind();
        ddlIndustry.Items.Insert(0, new ListItem("=所有行业=", "0"));

        if (query.IndustryID.HasValue && query.IndustryID.Value != 0)
        {
            ListItem item = ddlIndustry.Items.FindByValue(query.IndustryID.Value.ToString());
            if (item != null)
            {
                item.Selected = true;
                if (flag)
                {
                    lblTip.Text = lblTip.Text + ",行业为“" + ProductIndustries.GetProductIndustry(query.IndustryID.Value).IndustryName + "”";
                }
                else
                {
                    lblTip.Text = "行业为“" + ProductIndustries.GetProductIndustry(query.IndustryID.Value).IndustryName + "”";
                    flag        = true;
                }
            }
        }

        query.PageSize       = egvProducts.PageSize;
        query.PageIndex      = egvProducts.PageIndex;
        query.ProductOrderBy = ProductOrderBy.DataCreated;
        query.SortOrder      = SortOrder.Descending;

        List <Product> products = Products.GetProductList(query);

        egvProducts.DataSource = products;
        egvProducts.DataBind();
    }