Esempio n. 1
0
    protected void A_Collect(object sender, EventArgs e)
    {
        HtmlAnchor a       = sender as HtmlAnchor;
        string     goodsid = a.Attributes["collect"];

        List <Hi.Model.BD_DisCollect> list = new Hi.BLL.BD_DisCollect().GetList("",
                                                                                " disID='" + this.DisID + "' and compID='" + this.CompID + "' and goodsID='" + goodsid + "'", "");

        if (list.Count > 0)
        {
            if (new Hi.BLL.BD_DisCollect().delete(this.DisID, int.Parse(goodsid)))
            {
                page = Pagers.CurrentPageIndex.ToString();
                Bind();
            }
        }
        else
        {
            Hi.Model.BD_DisCollect collect = new Hi.Model.BD_DisCollect();
            collect.CompID       = this.CompID;
            collect.DisID        = this.DisID;
            collect.DisUserID    = this.UserID;
            collect.GoodsID      = int.Parse(goodsid);
            collect.IsEnabled    = 1;
            collect.CreateDate   = DateTime.Now;
            collect.CreateUserID = this.UserID;
            collect.ts           = DateTime.Now;
            if (new Hi.BLL.BD_DisCollect().Add(collect) > 0)
            {
                page = Pagers.CurrentPageIndex.ToString();
                Bind();
            }
        }
    }
Esempio n. 2
0
    public string CheckGoodsCollect(string compID, string goodsID)
    {
        string str = string.Empty;
        List <Hi.Model.BD_DisCollect> list = new Hi.BLL.BD_DisCollect().GetList("",
                                                                                " disID='" + this.DisID + "' and compID='" + compID + "' and goodsID='" + goodsID + "' and IsEnabled =1", "");

        str = list.Count > 0 ? "<a class=\"CanceldcGoods\" TipGoods='" + goodsID + "' runat=\"server\" style=\"cursor: pointer;\">取消收藏</a>" : "<a class=\"dcGoods\" TipGoods='" + goodsID + "' runat=\"server\" style=\"cursor: pointer;\">收藏</a>";
        return(str);
    }
Esempio n. 3
0
    public void Bind()
    {
        string goodsids = new Hi.BLL.BD_DisCollect().GetGoodsIDs(this.DisID);

        if (string.IsNullOrEmpty(goodsids))
        {
            goodsids = "0";
        }
        string strwhere = string.Empty;

        if (ViewState["strwhere"] != null)
        {
            strwhere += ViewState["strwhere"].ToString();
        }
        strwhere += " and isnull(dr,0)=0 and id in (" + goodsids + ") and IsEnabled=1 and ISOffline=1";


        Pager.PageSize = 12;

        //根据代理商ID获取可采购的商品ID集合
        List <Common.GoodsID> gl = Common.DisEnAreaGoodsID(this.DisID.ToString(), CompID.ToString());
        string GoodsId           = string.Empty;

        if (gl != null && gl.Count > 0)
        {
            foreach (Common.GoodsID item in gl)
            {
                GoodsId += item.goodsID + ",";
            }
            strwhere += " and ID not in(" + GoodsId.Substring(0, GoodsId.Length - 1) + ")";
        }
        else
        {
            //strwhere += " and ID=0";
        }

        //List<Hi.Model.BD_Goods> orders = new Hi.BLL.BD_Goods().GetList(Pager.PageSize, Pager.CurrentPageIndex, "CreateDate", true, strwhere, out pageCount, out Counts);

        string sql    = string.Format(@"select *,(select Inventory from BD_GoodsInfo where ID=g.ViewInfoID) infoInve,(select BarCode from BD_GoodsInfo where ID=g.ViewInfoID) BarCode from BD_Goods as g left join (select prod.GoodsID as proGoodsID from BD_Promotion as pro left join  BD_PromotionDetail as prod on pro.ID=prod.ProID where  pro.CompID={0} and ISNULL(pro.dr,0)=0
and (pro.ProStartTime<=GETDATE() and DATEADD(D,1,pro.ProEndTime)>GETDATE()) and ISNULL(pro.IsEnabled,0)=1 group by prod.GoodsID) as b on b.proGoodsID=g.ID
where 1=1 {1} and CompID= {0} and isnull(IsEnabled,0)=1 and IsOffline=1 and isnull(dr,0)=0 order by b.proGoodsID desc,g.CreateDate desc", this.CompID, strwhere);
        Pagger pagger = new Pagger(sql);

        Pager.RecordCount = pagger.getDataCount();
        DataTable dt = pagger.getData(Pager.PageSize, Pager.StartRecordIndex - 1);

        this.rptfavorite.DataSource = dt;
        this.rptfavorite.DataBind();
    }
Esempio n. 4
0
    /// <summary>
    /// 获取某一分类产品信息,兼容了无属性的值,分类传-1
    /// </summary>
    /// <param name="JSon"></param>
    /// <returns></returns>
    public BD_GoodsCategory.ResultProductList GetProductsList(string JSon)
    {
        try
        {
            #region JSon取值

            string userID            = string.Empty;
            string disID             = string.Empty;
            string categoryID        = string.Empty; //分类ID
            string criticalProductID = string.Empty; //当前列表最临界点产品ID:初始-1
            string getType           = string.Empty; //方向
            string rows     = string.Empty;
            string sortType = string.Empty;
            string sort     = string.Empty;

            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString() != "" && JInfo["ResellerID"].ToString() != "" &&
                JInfo["CriticalProductID"].ToString() != "" &&
                JInfo["GetType"].ToString() != "" && JInfo["Rows"].ToString() != "" &&
                JInfo["SortType"].ToString() != "" && JInfo["Sort"].ToString() != "")
            {
                userID            = JInfo["UserID"].ToString();
                disID             = JInfo["ResellerID"].ToString();
                categoryID        = JInfo["ClassifyID"].ToString();
                criticalProductID = JInfo["CriticalProductID"].ToString();
                getType           = JInfo["GetType"].ToString();
                rows     = JInfo["Rows"].ToString();
                sortType = JInfo["SortType"].ToString();
                sort     = JInfo["Sort"].ToString();
            }
            else
            {
                return(new BD_GoodsCategory.ResultProductList()
                {
                    Result = "F", Description = "参数异常"
                });
            }

            Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(userID), out user, 0, int.Parse(disID == "" ? "0" : disID)))
            {
                return new BD_GoodsCategory.ResultProductList()
                       {
                           Result = "F", Description = "参数异常"
                       }
            }
            ;

            #endregion

            #region 模拟分页

            string strsql = string.Empty; //搜索sql
            Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetModel(int.Parse(disID));
            if (dis == null || dis.dr == 1 || dis.IsEnabled == 0)
            {
                return new BD_GoodsCategory.ResultProductList()
                       {
                           Result = "F", Description = "未找到经销商"
                       }
            }
            ;
            const string tabName = " [dbo].[BD_Goods]";      //表名
            sortType = sortType == "2" ? "SalePrice" : "ID"; //价格排序
            string strWhere = string.Empty;

            switch (categoryID)
            {
            case "-2":     //促销列表
            {
                List <Hi.Model.BD_Promotion> promotionList = new Hi.BLL.BD_Promotion().GetList("",
                                                                                               " compID='" + dis.CompID + "' and ProStartTime<='" + DateTime.Now + "' and ProEndTime >='" +
                                                                                               DateTime.Now + "' and IsEnabled=1", "");
                List <Hi.Model.BD_PromotionDetail> detailList = new List <BD_PromotionDetail>();
                if (promotionList != null && promotionList.Count > 0)
                {
                    detailList = new Hi.BLL.BD_PromotionDetail().GetList("",
                                                                         " ProID in(" + string.Join(",", promotionList.Select(p => p.ID)) + ")", "");
                }
                if (promotionList == null)
                {
                    return new BD_GoodsCategory.ResultProductList()
                           {
                               Result = "F", Description = "今天无促销"
                           }
                }
                ;
                if (detailList == null)
                {
                    return new BD_GoodsCategory.ResultProductList()
                           {
                               Result = "F", Description = "今天无促销"
                           }
                }
                ;
                var ienum = detailList.Select(p => p.GoodsID);
                if (ienum.Count() > 0)
                {
                    strWhere += " and ID in ( " + string.Join(",", ienum) + ")";
                }
            }
            break;

            case "-3":     //收藏列表
            {
                List <Hi.Model.BD_DisCollect> collects = new Hi.BLL.BD_DisCollect().GetList("",
                                                                                            "disID='" + disID + "' and dr=0", "");
                if (collects != null)
                {
                    strWhere += " and ID not in ( -1 ";
                    strWhere  = collects.Aggregate(strWhere, (current, goods) => current + ("," + goods.GoodsID)) +
                                ")";
                }
            }
            break;

            default:
                if (categoryID != "-1")     //全部
                {
                    strWhere += " and CategoryID in (" + Common.AllCategory(int.Parse(categoryID)) + ")";
                }
                break;
            }

            //商品可售区域判断
            List <Common.GoodsID> list = Common.DisEnAreaGoodsID(disID, dis.CompID.ToString());
            if (list != null)
            {
                strWhere += " and ID not in ( -1 ";
                strWhere  = list.Aggregate(strWhere, (current, goods) => current + ("," + goods.goodsID)) + ")";
            }
            strWhere += " and ISNULL(dr,0)=0 and isoffline=1 and IsEnabled = 1 and compid=" + dis.CompID;

            strsql = new Common().PageSqlString(criticalProductID, "ID", tabName, sortType,
                                                sort, strWhere, getType, rows);

            #endregion

            List <Hi.Model.BD_DisCollect> Colist = Common.GetDataSource <BD_DisCollect>("",
                                                                                        " and disID='" + disID + "' and compID='" + dis.CompID + "' and IsEnabled =1");
            List <Hi.Model.BD_GoodsInfo> infoAllList = new Hi.BLL.BD_GoodsInfo().GetList("",
                                                                                         " CompID='" + dis.CompID + "' and ISNULL(dr,0)=0 and IsEnabled=1 and isoffline=1", "");

            #region 赋值

            int CategoryID = 0;

            List <BD_GoodsCategory.Product> ProductList = new List <BD_GoodsCategory.Product>();
            DataTable dsList = SqlHelper.Query(SqlHelper.LocalSqlServer, strsql).Tables[0];
            if (dsList != null)
            {
                if (dsList.Rows.Count == 0)
                {
                    return new BD_GoodsCategory.ResultProductList()
                           {
                               Result = "F", Description = "未找到数据"
                           }
                }
                ;
                foreach (DataRow row in dsList.Rows)
                {
                    string SKUName = string.Empty;

                    BD_GoodsCategory.Product product = new BD_GoodsCategory.Product();
                    product.ProductID   = row["ID"].ToString(); //商品ID
                    product.ProductName = row["GoodsName"].ToString();
                    SKUName            += product.ProductName;
                    product.SalePrice   = decimal.Parse(row["SalePrice"].ToString()).ToString("0.00");
                    product.IsSale      = row["IsSale"].ToString();

                    List <Hi.Model.BD_DisCollect> alist = Colist != null && Colist.Count > 0
                        ? Colist.Where(p => p.GoodsID.ToString() == product.ProductID).ToList()
                        : null;
                    product.IsCollect = alist != null && alist.Count > 0 ? "1" : "0";
                    product.Title     = row["Title"].ToString();
                    //product.Details = row["Details"].ToString();
                    product.Title      = row["Title"].ToString();
                    product.Unit       = row["Unit"].ToString();
                    product.ClassifyID = row["CategoryID"].ToString();
                    CategoryID         = int.Parse(row["CategoryID"].ToString()); //类别ID

                    List <BD_GoodsCategory.Pic> Pic = new List <BD_GoodsCategory.Pic>();

                    #region List<Pic> Pic

                    if (row["Pic"].ToString() != "" && row["Pic"].ToString() != "X")
                    {
                        BD_GoodsCategory.Pic pic = new BD_GoodsCategory.Pic();
                        pic.ProductID = row["ID"].ToString();
                        pic.IsDeafult = "1";
                        pic.PicUrl    = ConfigurationManager.AppSettings["ImgViewPath"].ToString().Trim() + "GoodsImg/" +
                                        row["Pic"].ToString();
                        Pic.Add(pic);
                    }

                    Pic.AddRange(GetPicList(row["ID"].ToString()));

                    #endregion

                    product.ProductPicUrlList = Pic;

                    List <BD_GoodsCategory.SKU> SKUList = new List <BD_GoodsCategory.SKU>();
                    string strID = "0";

                    #region 通过 商品ID和属性值ID关联表,找到属性值

                    List <Hi.Model.BD_GoodsInfo> goodsInfoList = infoAllList != null && infoAllList.Count > 0
                        ? infoAllList.Where(p => p.GoodsID.ToString() == row["ID"].ToString()).ToList()
                        : null;
                    foreach (Hi.Model.BD_GoodsInfo goodsInfo in goodsInfoList)
                    {
                        if (!Common.IsOffline(goodsInfo.ID))
                        {
                            continue;
                        }

                        BD_GoodsCategory.SKU SKU = new BD_GoodsCategory.SKU();
                        //SKUID是GoodsInfoID,SKUName是GoodsName+各种属性值
                        SKU.SKUID     = goodsInfo.ID.ToString();
                        SKU.ProductID = goodsInfo.GoodsID.ToString();
                        SKU.BarCode   = goodsInfo.BarCode;
                        //SKUName = GoodsName + ValueInfo
                        SKU.SKUName = SKUName + " " + goodsInfo.ValueInfo;

                        SKU.ValueInfo = goodsInfo.ValueInfo;
                        SKU.SalePrice = goodsInfo.SalePrice.ToString("0.00");

                        int ProID = 0;   //暂时未用到 促销ID
                        SKU.IsPro = "0"; //默认不是促销价
                        decimal price = Common.GetProPrice(goodsInfo.GoodsID.ToString(), goodsInfo.ID.ToString(),
                                                           goodsInfo.CompID.ToString(), out ProID);
                        if (price == 0)
                        {
                            List <Hi.Model.BD_GoodsPrice> goodsPrice = new Hi.BLL.BD_GoodsPrice().GetList("",
                                                                                                          " GoodsInfoID='" + goodsInfo.ID + "' and ISNULL(dr,0)=0 and compid='" + goodsInfo.CompID +
                                                                                                          "' and IsEnabled=1", "");
                            SKU.TinkerPrice = goodsPrice.Count != 0
                                ? goodsPrice[0].TinkerPrice.ToString("0.00")
                                : goodsInfo.TinkerPrice.ToString("0.00");
                        }
                        else
                        {
                            SKU.IsPro       = "1"; //是促销价
                            SKU.ProInfo     = GetProInfo(ProID, goodsInfo.ID);
                            SKU.TinkerPrice = price.ToString("0.00");
                        }


                        List <BD_GoodsCategory.ProductAttValueID> ProductAttValueIDList = new List <BD_GoodsCategory.ProductAttValueID>();

                        List <Hi.Model.BD_GoodsAttrsInfo> attrList = new Hi.BLL.BD_GoodsAttrsInfo().GetList("", " GoodsID='" + goodsInfo.GoodsID + "' and ISNULL(dr,0)=0", "");
                        if (attrList == null)
                        {
                            return new BD_GoodsCategory.ResultProductList()
                                   {
                                       Result = "F", Description = "未找到商品属性名字"
                                   }
                        }
                        ;
                        List <Hi.Model.BD_GoodsAttrs> attrValList = new Hi.BLL.BD_GoodsAttrs().GetList("*", " CompID ='" + dis.CompID + "'", "");
                        foreach (Hi.Model.BD_GoodsAttrsInfo attribute in attrList)
                        {
                            strID += "," + attribute.AttrsID;

                            string[] args  = new[] { goodsInfo.ValueInfo };
                            string[] items = args[0].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                            foreach (string item in items)
                            {
                                string[] strs = item.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);

                                if (strs[1] == attribute.AttrsInfoName)
                                {
                                    BD_GoodsCategory.ProductAttValueID productAttValueID = new BD_GoodsCategory.ProductAttValueID()
                                    {
                                        ProductAttributeValueID = attribute.ID.ToString()//
                                    };
                                    ProductAttValueIDList.Add(productAttValueID);
                                }
                            }
                        }

                        SKU.ProductAttValueIDList = ProductAttValueIDList;
                        SKUList.Add(SKU);
                    }

                    #endregion

                    product.SKUList = SKUList;

                    List <BD_GoodsCategory.ProductAttribute> ProductAttributeList = new List <BD_GoodsCategory.ProductAttribute>();

                    #region 通过商品类别ID和属性ID关联表,找到属性ID

                    List <Hi.Model.BD_GoodsAttrs> val = new Hi.BLL.BD_GoodsAttrs().GetList("", " ID in (" + strID + ") and CompID='" + dis.CompID + "' and ISNULL(dr,0)=0", "");
                    if (val == null)
                    {
                        return new BD_GoodsCategory.ResultProductList()
                               {
                                   Result = "F", Description = "未找到商品属性"
                               }
                    }
                    ;

                    foreach (Hi.Model.BD_GoodsAttrs goodsAttr in val)
                    {
                        BD_GoodsCategory.ProductAttribute proAttr = new BD_GoodsCategory.ProductAttribute();

                        proAttr.ProductID            = row["ID"].ToString();
                        proAttr.ProductAttributeID   = goodsAttr.ID.ToString(); //属性ID
                        proAttr.ProductAttributeName = goodsAttr.AttrsName;     //属性名称

                        List <BD_GoodsCategory.ProductAttValue> ProductAttValueList = new List <BD_GoodsCategory.ProductAttValue>();

                        List <Hi.Model.BD_GoodsAttrsInfo> attrList = new Hi.BLL.BD_GoodsAttrsInfo().GetList("",
                                                                                                            " AttrsID='" + goodsAttr.ID + "' and CompID='" + dis.CompID + "' and ISNULL(dr,0)=0" +
                                                                                                            " and AttrsID in (" + strID + ")", "ID"); //todo:商品属性表修改咨询商品结构
                        if (attrList == null)
                        {
                            return new BD_GoodsCategory.ResultProductList()
                                   {
                                       Result = "F", Description = "未找到商品属性名字"
                                   }
                        }
                        ;
                        foreach (Hi.Model.BD_GoodsAttrsInfo attribute in attrList)
                        {
                            BD_GoodsCategory.ProductAttValue productAttValue = new BD_GoodsCategory.ProductAttValue();

                            productAttValue.ProductID           = row["ID"].ToString();
                            productAttValue.ProductAttributeID  = goodsAttr.ID.ToString();
                            productAttValue.ProductAttValueID   = attribute.ID.ToString();
                            productAttValue.ProductAttValueName = attribute.AttrsInfoName;

                            ProductAttValueList.Add(productAttValue);
                        }
                        proAttr.ProductAttValueList = ProductAttValueList;
                        ProductAttributeList.Add(proAttr);
                    }

                    #endregion

                    product.ProductAttributeList = ProductAttributeList;

                    ProductList.Add(product);
                }
            }

            #endregion

            return(new BD_GoodsCategory.ResultProductList()
            {
                Result = "T",
                Description = "获取成功",
                ClassifyID = categoryID,
                ProductList = ProductList
            });
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetResellerProductList :" + JSon);
            return(new BD_GoodsCategory.ResultProductList()
            {
                Result = "F", Description = "异常"
            });
        }
    }
Esempio n. 5
0
    /// <summary>
    /// 商品信息绑定
    /// </summary>
    public void Bind()
    {
        LoginModel logmodel = HttpContext.Current.Session["UserModel"] as LoginModel;

        Hi.Model.BD_Goods model = new Hi.BLL.BD_Goods().GetModel(goodsId);
        if (model != null)
        {
            GetZiDingYi(model);
            mKeyword.Content = string.IsNullOrWhiteSpace(model.Title) ? model.GoodsName : model.Title;
            string zhek = Cuxiao();
            if (!Util.IsEmpty(zhek))
            {
                this.lblGoodsName.InnerHtml = model.GoodsName + SelectGoods.ProType(zhek); //商品名称
                tiele_name = model.GoodsName;                                              //前台title显示
                if (hidGoodsInfoId.Value != null && hidGoodsInfoId.Value != "")
                {
                    Hi.Model.BD_GoodsInfo godosInfomodel = new Hi.BLL.BD_GoodsInfo().GetModel(Convert.ToInt32(hidGoodsInfoId.Value));
                    //add by hgh 未登录,原价不可见
                    //if (logmodel != null)
                    //{


                    if (Request["Comid"].ToString() == model.CompID.ToString())
                    {
                        this.YuanPrice.InnerHtml = "<s><i>原价:</i><b class=\"red\" id=\"B1\">" + decimal.Parse(string.Format("{0:N2}", Convert.ToDecimal(godosInfomodel.TinkerPrice).ToString())).ToString("#,##0.00") + "</b></s>";
                    }
                    else
                    {
                        string sysNameWhere = string.Format(" CompID={0} and Name='是否店铺开放价格'", Request["Comid"].ToInt(0));
                        List <Hi.Model.SYS_SysName> Sysl = new Hi.BLL.SYS_SysName().GetList("", sysNameWhere, "");
                        if (Sysl.Count > 0)
                        {
                            if (Sysl[0].Value == "1")
                            {
                                this.YuanPrice.InnerHtml = "<s><i>原价:</i><b class=\"red\" id=\"B1\">" + decimal.Parse(string.Format("{0:N2}", Convert.ToDecimal(godosInfomodel.TinkerPrice).ToString())).ToString("#,##0.00") + "</b></s>";
                            }
                        }
                    }
                    //}
                }
            }
            else
            {
                this.lblGoodsName.InnerHtml = model.GoodsName;
                tiele_name = model.GoodsName;//前台title显示
                this.YuanPrice.InnerHtml = "";
            }
            this.lblunit.InnerText       = model.Unit;
            this.lblGoodsTitle.InnerText = model.Title;//商品卖点
            hideInfo1 = model.HideInfo1;
            hideInfo2 = model.HideInfo2;
            if (!Util.IsEmpty(model.Details.Trim()))
            {
                this.lblGoodsDetali.InnerHtml = model.Details.Replace("<pre>", "<p>").Replace("</pre>", "</p>");//商品描述
            }
            if (!Util.IsEmpty(model.registeredCertificate.Trim()))
            {
                string url = Common.GetWebConfigKey("OssImgPath") + "UploadFile/" + model.registeredCertificate;
                this.lblGoodsDetali1.InnerHtml = "<img width=\"600\" src=\"" + url + "\"/>";
            }
            //this.lblPrice.InnerText = "¥" + decimal.Parse(string.Format("{0:N2}", Convert.ToDecimal(model.SalePrice.ToString()).ToString())).ToString("#,##0.00"); ;//商品价格
            if (model != null && !string.IsNullOrEmpty(model.Pic))
            {
                this.imgPic.Src = Common.GetPicURL(model.Pic, "resize400", compId.ToString());
                this.imgPic.Attributes.Add("jqimg", Common.GetPicURL(model.Pic, "", compId.ToString()));
            }
            else
            {
                imgPic.Src = "../images/Goods400x400.jpg";//无图片
                imgPic.Attributes.Add("jqimg", "../images/Goods400x400.jpg");
            }
            string html = string.Empty;
            List <Hi.Model.BD_GoodsAttrs> ll = new Hi.BLL.BD_GoodsAttrs().GetList("", "isnull(dr,0)=0 and compId=" + compId + " and goodsId=" + goodsId.ToString(), "");
            if (ll.Count > 0)
            {
                foreach (Hi.Model.BD_GoodsAttrs item in ll)
                {
                    int xy = 0;
                    List <Hi.Model.BD_GoodsAttrsInfo> lll = new Hi.BLL.BD_GoodsAttrsInfo().GetList("", "isnull(dr,0)=0 and compId=" + compId + " and attrsId=" + item.ID, "");
                    if (lll.Count > 0)
                    {
                        //add by hgh
                        if (item.AttrsName.Length > 4)
                        {
                            item.AttrsName = item.AttrsName.Substring(0, 4);
                        }
                        html += "<div class=\"li\"><div class=\"t\" tip=\"" + item.AttrsName + "\">" + item.AttrsName + ":</div><div class=\"n\">";
                        foreach (Hi.Model.BD_GoodsAttrsInfo item2 in lll)
                        {
                            if (goodsInfoId == 0)
                            {
                                html += "<a href=\"javascript:;\" class=\"" + (xy == 0 ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "<i class=\"xz-icon\"></i></a>";
                            }
                            else
                            {
                                Hi.Model.BD_GoodsInfo model2 = new Hi.BLL.BD_GoodsInfo().GetModel(goodsInfoId);
                                if (model2 != null)
                                {
                                    html += "<a href=\"javascript:;\" class=\"" + (model2.Value1 == item2.AttrsInfoName || model2.Value2 == item2.AttrsInfoName || model2.Value3 == item2.AttrsInfoName ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "<i class=\"xz-icon\"></i></a>";
                                }
                            }
                            xy++;
                        }
                        html += "</div></div>";
                    }
                }
            }
            litAttrVaue.InnerHtml = html;
            if (logmodel != null)
            {
                List <Hi.Model.BD_DisCollect> llll = new Hi.BLL.BD_DisCollect().GetList("", "isnull(dr,0)=0 and comPid=" + model.CompID + " and goodsId=" + goodsId + " and disId=" + logmodel.DisID, "");
                if (llll.Count > 0)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "showsc", "<script>$(function(){$(\".btn .keep\").html('<i class=\"sc-icon\" style=\"background-position:0 -73px;\"></i>取消收藏\');})</script>");
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "showsc", "<script>$(function(){$(\".btn .keep\").html('<i class=\"sc-icon\" ></i>加入收藏\');})</script>");
                }
            }
        }
    }
Esempio n. 6
0
    //public void Download_Click(object sender, EventArgs e)
    //{
    //    LinkButton bt = sender as LinkButton;
    //    string fileName = bt.Attributes["fileName"];
    //    string filePath = Server.MapPath("../UploadFile/") + fileName;
    //    if (File.Exists(filePath))
    //    {
    //        FileInfo file = new FileInfo(filePath);
    //        Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8"); //解决中文乱码
    //        Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(file.Name.Substring(0, file.Name.LastIndexOf("_")) + Path.GetExtension(file.Name))); //解决中文文件名乱码
    //        Response.AddHeader("Content-length", file.Length.ToString());
    //        Response.ContentType = "appliction/octet-stream";
    //        Response.WriteFile(file.FullName);
    //        Response.Flush();
    //        Response.End();
    //    }
    //    else
    //    {
    //        JScript.AlertMsgOne(this, "附件不存在!", JScript.IconOption.错误);
    //    }
    //}


    /// <summary>
    /// 附件绑定
    /// </summary>
    //public void DataBindLink()
    //{
    //    string goodsId = Request.QueryString["goodsId"];
    //    if (!string.IsNullOrWhiteSpace(goodsId))
    //    {
    //        //string gid = Common.DesDecrypt(Request["goodsId"], Common.EncryptKey);
    //        Hi.Model.BD_Goods model = new Hi.BLL.BD_Goods().GetModel(Convert.ToInt32(goodsId));
    //        if (model != null && model.CompID == this.CompID)
    //        {
    //            if (!string.IsNullOrEmpty(model.registeredCertificate))
    //            {
    //                LinkButton linkFile = new LinkButton();
    //                linkFile.Click += new EventHandler(Download_Click);

    //                if (model.registeredCertificate.LastIndexOf("_") != -1)
    //                {
    //                    string text = model.registeredCertificate.Substring(0, model.registeredCertificate.LastIndexOf("_")) + Path.GetExtension(model.registeredCertificate);
    //                    if (text.Length < 15)
    //                        linkFile.Text = text;
    //                    else
    //                    {
    //                        linkFile.Text = text.Substring(0, 15) + "...";
    //                    }
    //                    linkFile.Attributes.Add("title", text);
    //                }
    //                else
    //                {
    //                    string text = model.registeredCertificate.Substring(0, model.registeredCertificate.LastIndexOf("-")) + Path.GetExtension(model.registeredCertificate);
    //                    if (text.Length < 15)
    //                        linkFile.Text = text;
    //                    else
    //                    {
    //                        linkFile.Text = text.Substring(0, 15) + "...";
    //                    }
    //                    linkFile.Attributes.Add("title", text);
    //                }
    //                linkFile.Style.Add("text-decoration", "underline");
    //                linkFile.Attributes.Add("fileName", model.registeredCertificate);
    //                HtmlGenericControl div = new HtmlGenericControl("div");
    //                div.Controls.Add(linkFile);
    //                UpFileText2.Controls.Add(div);

    //            }
    //        }

    //    }
    //}



    /// <summary>
    /// 商品信息绑定
    /// </summary>
    public void Bind()
    {
        Hi.Model.BD_Goods model = new Hi.BLL.BD_Goods().GetModel(goodsId);
        if (model != null)
        {
            GetZiDingYi(model);
            string zhek = Cuxiao();
            if (!Util.IsEmpty(zhek))
            {
                this.lblGoodsName.InnerHtml = model.GoodsName + SelectGoods.ProType(zhek); //商品名称
                tiele_name = model.GoodsName;                                              //前台title显示
                Hi.Model.BD_GoodsInfo godosInfomodel = new Hi.BLL.BD_GoodsInfo().GetModel(goodsInfoId);
                if (this.CompID.ToString() == model.CompID.ToString())
                {
                    this.YuanPrice.InnerHtml = "<s><i>原价:</i><b class=\"red\" id=\"B1\">¥" + decimal.Parse(string.Format("{0:N2}", Convert.ToDecimal(godosInfomodel.TinkerPrice).ToString())).ToString("#,##0.00") + "</b></s>";
                }
            }
            else
            {
                this.lblGoodsName.InnerHtml = model.GoodsName;
                tiele_name = model.GoodsName;//前台title显示
                this.YuanPrice.InnerHtml = "";
            }
            this.lblunit.InnerText       = model.Unit;
            this.lblGoodsTitle.InnerText = model.Title;//商品卖点
            hideInfo1 = model.HideInfo1;
            hideInfo2 = model.HideInfo2;
            if (!Util.IsEmpty(model.Details.Trim()))
            {
                this.lblGoodsDetali.InnerHtml = model.Details;//商品描述
            }
            if (!Util.IsEmpty(model.registeredCertificate.Trim()))
            {
                string url = Common.GetWebConfigKey("OssImgPath") + "/UploadFile/" + model.registeredCertificate;
                this.lblGoodsDetali1.InnerHtml = "<img width=\"600\" src=\"" + url + "\"/>";
            }

            if (model != null && !string.IsNullOrEmpty(model.Pic))
            {
                this.imgPic.Src = Common.GetPicURL(model.Pic, "resize400");
                this.imgPic.Attributes.Add("jqimg", Common.GetPicURL(model.Pic));
            }

            //this.lblPrice.InnerText = "¥" + decimal.Parse(string.Format("{0:N2}", Convert.ToDecimal(model.SalePrice.ToString()).ToString())).ToString("#,##0.00"); ;//商品价格

            string html = string.Empty;
            List <Hi.Model.BD_GoodsAttrs> ll = new Hi.BLL.BD_GoodsAttrs().GetList("", "isnull(dr,0)=0 and compId=" + compID + " and goodsId=" + goodsId.ToString(), "");
            if (ll.Count > 0)
            {
                foreach (Hi.Model.BD_GoodsAttrs item in ll)
                {
                    int xy = 0;
                    List <Hi.Model.BD_GoodsAttrsInfo> lll = new Hi.BLL.BD_GoodsAttrsInfo().GetList("", "isnull(dr,0)=0 and compId=" + compID + " and attrsId=" + item.ID, "");
                    if (lll.Count > 0)
                    {
                        html += "<div class=\"li\"><div class=\"t\" tip=\"" + item.AttrsName + "\">" + item.AttrsName + ":</div><div class=\"n\">";
                        foreach (Hi.Model.BD_GoodsAttrsInfo item2 in lll)
                        {
                            if (goodsInfoId == 0)
                            {
                                html += "<a href=\"javascript:;\" class=\"" + (xy == 0 ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "<i class=\"xz-icon\"></i></a>";
                            }
                            else
                            {
                                Hi.Model.BD_GoodsInfo model2 = new Hi.BLL.BD_GoodsInfo().GetModel(goodsInfoId);
                                if (model2 != null)
                                {
                                    html += "<a href=\"javascript:;\" class=\"" + (model2.Value1 == item2.AttrsInfoName || model2.Value2 == item2.AttrsInfoName || model2.Value3 == item2.AttrsInfoName ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "<i class=\"xz-icon\"></i></a>";
                                }
                            }
                            xy++;
                        }
                        html += "</div></div>";
                    }
                }
            }
            litAttrVaue.InnerHtml = html;
            List <Hi.Model.BD_DisCollect> llll = new Hi.BLL.BD_DisCollect().GetList("", "isnull(dr,0)=0 and comPid=" + model.CompID + " and goodsId=" + goodsId + " and disId=" + this.DisID, "");
            if (llll.Count > 0)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "showsc", "<script>$(function(){$(\".btns .keep\").html('<i class=\"sc-icon\" style=\"background-position:0 -73px;\"></i>取消收藏\');})</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "showsc", "<script>$(function(){$(\".btns .keep\").html('<i class=\"sc-icon\" ></i>加入收藏\');})</script>");
            }
        }
    }