Esempio n. 1
0
        /// <summary>
        /// 面包屑
        /// </summary>
        /// <returns></returns>
        protected string GetBread()
        {
            StringBuilder sb   = new StringBuilder();
            Product       item = ProductService.GetModel(id);

            if (item != null)
            {
                sb.Append("<a href=\"/project_" + item.oneId + "_0_0_0_0_0_0_0.html\">All </a> ");
                if (item.twoId != 0)
                {
                    sb.Append("<span>></span>");
                    ProductType pt = ProductTypeService.GetModel(item.twoId);
                    if (pt != null)
                    {
                        sb.Append(" <a href=\"/project_" + item.oneId + "_" + item.twoId + "_0_0_0_0_0_0.html\">" + pt.typeName + "</a> ");
                    }
                    if (item.threeId != 0)
                    {
                        sb.Append("<span>></span>");
                        pt = ProductTypeService.GetModel(item.threeId);
                        if (pt != null)
                        {
                            sb.Append(" <a href=\"/project_" + item.oneId + "_" + item.twoId + "_" + item.threeId + "_0_0_0_0_0.html\">" + pt.typeName + "</a> ");
                        }
                    }
                }
                sb.Append("<span>></span>");
                sb.Append(" <a href=\"/project_" + item.oneId + "_" + item.twoId + "_" + item.threeId + "_" + item.productType + "_0_0_0_0.html\">" + item.productTypeName + "</a>");
            }

            return(sb.ToString());
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        protected string GetName(object id)
        {
            ProductType pt = ProductTypeService.GetModel(Convert.ToInt32(id));

            if (pt != null)
            {
                return(pt.typeName);
            }
            return("");
        }
Esempio n. 3
0
        /// <summary>
        /// 产品类别名称
        /// </summary>
        /// <returns></returns>
        protected string GetProductName(object productTypeId)
        {
            ProductType item = ProductTypeService.GetModel(Convert.ToInt32(productTypeId));

            if (item != null)
            {
                return(item.typeName);
            }
            return("");
        }
Esempio n. 4
0
        /// <summary>
        /// 控件行命令事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void repInfo_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int id = Convert.ToInt32(e.CommandArgument);

            if (e.CommandName.Equals("del"))
            {
                ProductTypeService.Delete(id);
                sp.InitBindData(repInfo, this.pager1, "ProductType", "id", sear());
            }
            if (e.CommandName.Equals("mod"))
            {
                ProductType item = ProductTypeService.GetModel(id);
                if (item != null)
                {
                    this.txtTypeName.Text = item.typeName;
                    ddlOne.SelectedValue  = item.oneId.ToString();
                    ddlTwo.Items.Clear();
                    DataSet ds = ProductTypeService.GetList("parentId = " + ddlOne.SelectedValue);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        ddlTwo.DataSource     = ds;
                        ddlTwo.DataTextField  = "typeName";
                        ddlTwo.DataValueField = "id";
                        ddlTwo.DataBind();
                    }
                    ddlTwo.Items.Insert(0, new ListItem("请选择", "0"));
                    ddlTwo.SelectedValue = item.twoId.ToString();

                    ddlThree.Items.Clear();
                    ds = ProductTypeService.GetList("parentId = " + ddlTwo.SelectedValue);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        ddlThree.DataSource     = ds;
                        ddlThree.DataTextField  = "typeName";
                        ddlThree.DataValueField = "id";
                        ddlThree.DataBind();
                    }
                    ddlThree.Items.Insert(0, new ListItem("请选择", "0"));
                    ddlThree.SelectedValue = item.threeId.ToString();
                    if (item.imgUrl != "")
                    {
                        lblUrl.Text     = item.imgUrl;
                        Button6.Visible = true;
                    }
                    lblUrl2.Text     = item.diaryImg;
                    ViewState["mod"] = id;
                    lblUrl3.Text     = item.remark;
                    txtNameEn.Text   = item.typeDesc;
                    ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "overKeyWordDiv();", true);
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 父类名称
        /// </summary>
        /// <param name="typeValue"></param>
        /// <returns></returns>
        protected string GetParentName(object typeValue)
        {
            int type = Convert.ToInt32(typeValue);

            if (type == 0)
            {
                return("根分类");
            }

            ProductType item = ProductTypeService.GetModel(type);

            if (item != null)
            {
                return(item.typeName);
            }
            return("");
        }
Esempio n. 6
0
        /// <summary>
        /// 绑定信息
        /// </summary>
        private void BindData()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("1=1");
            if (oneId != 0)
            {
                ProductType pt = ProductTypeService.GetModel(oneId);
                if (pt != null)
                {
                    ViewState["productName"] = pt.typeName;
                }
                sb.Append(" and oneId = " + oneId);
            }
            if (twoId != 0)
            {
                sb.Append(" and twoId = " + twoId);
            }
            if (threeId != 0)
            {
                sb.Append(" and threeId = " + threeId);
            }
            if (varietyId != 0)
            {
                sb.Append(" and varietyId = " + varietyId);
            }
            if (relieveId != 0)
            {
                sb.Append(" and relieveId = " + relieveId);
            }
            if (cookId != 0)
            {
                sb.Append(" and cookId = " + cookId);
            }
            if (keyword != "")
            {
                sb.Append(" and proName like '%" + keyword + "%'");
            }
            DataSet ds = ProductService.GetList(sb.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                repInfo.DataSource = ds;
                repInfo.DataBind();
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 绑定信息
        /// </summary>
        private void BindData()
        {
            Product item = ProductService.GetModel(id);

            if (item != null)
            {
                this.hidStoreCount.Value = item.proType.ToString();
                ViewState["proName"]     = item.proName;
                ViewState["proDesc"]     = item.proDesc;
                if (item.detailImg1 != "")
                {
                    ViewState["imgInfo"] = "<div class=\"guige\" style=\"text-align:center;\"> <img src='" + item.detailImg1 + "'></div>";
                }
                ViewState["productInfo"] = item.proContent;
                ViewState["specialInfo"] = item.advantage;

                ViewState["unitInfo"] = item.unit1;

                ViewState["price1"] = item.price1.ToString("0.00");
                if (item.proDesc != "")
                {
                    ViewState["goodInfo"] = "<div class=\"guige\">" + item.proDesc + ":" + item.stopTypeName + "</div>";
                }

                ViewState["productContent"] = item.ImgDesc;

                UserInfo user = UserInfoService.GetModel(item.useId);
                if (user != null)
                {
                    ViewState["shoperId"]   = user.id;
                    ViewState["shoperName"] = user.comName;
                }
                //相关产品
                DataSet ds = ProductService.GetList(16, "productType = " + item.productType, "id");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    //repXG.DataSource = ds;
                    //repXG.DataBind();
                }

                //推荐购买
                ProductType pt = ProductTypeService.GetModel(item.productType);
                if (pt != null)
                {
                    ds = ProductService.GetList(10, "productType in(select id from ProductType where parentId = " + pt.parentId + ") and id <> " + id, "id");
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        repTj.DataSource = ds;
                        repTj.DataBind();
                    }
                }
                else
                {
                    ds = ProductService.GetList(10, "productType = " + item.productType + " and id <> " + id, "id");
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        repTj.DataSource = ds;
                        repTj.DataBind();
                    }
                }

                ///bannner
                ds = ProductImgMobileService.GetList("productId = " + item.id + " and infoType = 1");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    repBanner.DataSource = ds;
                    repBanner.DataBind();
                }
            }
        }