Exemplo n.º 1
0
    /// <summary>
    /// 删除属性值
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public string DelValue(string id)
    {
        //查看该属性值是否被使用
        var ll = new Hi.BLL.BD_AttributeValues().GetModel(Convert.ToInt32(id));

        if (ll != null)
        {
            string valueName = ll.AttrValue;
            var    lll       = new Hi.BLL.BD_GoodsAttrsInfo().GetList("", "isnull(dr,0)=0 and compid=" + this.CompID + " and attrsInfoName='" + Common.NoHTML(valueName) + "'", "");
            if (lll.Count > 0)
            {
                return("ycz");
            }
        }
        string str = string.Empty;

        if (id != "" && id != null)
        {
            Hi.Model.BD_AttributeValues model = new Hi.BLL.BD_AttributeValues().GetModel(Convert.ToInt32(id));
            if (model != null)
            {
                model.ts         = DateTime.Now;
                model.modifyuser = this.UserID;
                model.dr         = 1;
                model.CompID     = this.CompID;
                bool bol = new Hi.BLL.BD_AttributeValues().Update(model);
                return("cg");
            }
        }
        return(str);
    }
Exemplo n.º 2
0
    /// <summary>
    /// 绑定产品信息
    /// </summary>
    /// <param name="id"></param>
    public void Bind(int id)//, int goodsInfoId)
    {
        Hi.Model.BD_Goods model = new Hi.BLL.BD_Goods().GetModel(id);
        if (model != null && model.dr == 0 && model.IsEnabled == 1)
        {
            if (goodsInfoId == 0)
            {
                List <Hi.Model.BD_GoodsInfo> l = new Hi.BLL.BD_GoodsInfo().GetList("", "isnull(dr,0)=0 and compid=" + this.CompID + " and goodsid=" + id, "");
                if (l.Count > 0)
                {
                    this.lblCode.InnerText      = l[0].BarCode.Trim();       //商品编号
                    this.lblInventory.InnerText = l[0].Inventory.ToString(); //商品库存.
                    goodsInfoId = l[0].ID;
                }
            }
            else
            {
                Hi.Model.BD_GoodsInfo model2 = new Hi.BLL.BD_GoodsInfo().GetModel(goodsInfoId);
                if (model2 != null)
                {
                    this.lblCode.InnerText      = model2.BarCode.Trim();       //商品编号
                    this.lblInventory.InnerText = model2.Inventory.ToString(); //商品库存.
                }
            }
            Hi.Model.SYS_GType model3 = new Hi.BLL.SYS_GType().GetModel(model.CategoryID);
            if (model3 != null)
            {
                this.lblCategory.InnerText = model3.TypeName.Trim(); //分类
            }
            GetZiDingYi(model);                                      //自定义字段
            // this.divTitle.InnerText = model.GoodsName.Trim();//biaot
            // this.divTitle.InnerHtml = model.GoodsName.Trim() + SelectGoods.ProType(zhek);//商品名称

            string zhek = Cuxiao(goodsInfoId.ToString());
            if (!Util.IsEmpty(zhek))
            {
                this.divTitle.InnerHtml = model.GoodsName + SelectGoods.ProType(zhek);//商品名称
            }
            else
            {
                this.divTitle.InnerHtml = model.GoodsName;
            }
            if (model.IsLS == 1)
            {
                this.isls.Visible         = true;
                this.lbllsprice.InnerText = "¥" + model.LSPrice.ToString("0.00");
            }
            else
            {
                this.isls.Visible = false;
            }
            this.divMemo.InnerHtml      = model.Title.Trim(); //描述
            this.lblHideInfo1.InnerText = model.HideInfo1;
            this.lblHideInfo2.InnerText = model.HideInfo2;    //描述
            this.lblUnit.InnerText      = model.Unit.Trim();  //计量单位
            // this.lblRecommend.InnerText = model.IsRecommended == 2 ? "推荐" : "否";//是否推荐
            if (model.IsRecommended == 2)
            {
                this.lblShow.InnerText      = "显示";
                this.lblRecommend.InnerText = "推荐";
            }
            else if (model.IsRecommended == 1)
            {
                this.lblShow.InnerText      = "显示";
                this.lblRecommend.InnerText = "不推荐";
            }
            else
            {
                this.lblShow.InnerText      = "不显示";
                this.lblRecommend.InnerText = "不推荐";
            }
            if (model.Details == "")
            {
                this.DivShow.InnerHtml = "<p style=\"padding-top: 20px; line-height: 40px; padding-left: 20px\">暂无数据</p>";
            }
            else
            {
                this.DivShow.InnerHtml = model.Details;
            }
            if (!string.IsNullOrEmpty(model.Pic))//有图片
            {
                LoginModel logUser  = HttpContext.Current.Session["UserModel"] as LoginModel;
                string     basePath = Common.GetWebConfigKey("OssImgPath") + "company/" + ((logUser != null) ? logUser.CompID.ToString() : "") + "/";
                string     surfix   = "?x-oss-process=style/resize400";
                this.imgPic.Src  = basePath + model.Pic + surfix;
                this.imgPic2.Src = basePath + model.Pic + surfix;
                this.imgPic.Attributes.Add("jqimg", basePath + model.Pic);
                this.imgPic2.Attributes.Add("bimg", basePath + model.Pic);
            }
            else
            {
                this.imgPic.Src  = "../../images/havenopicmax.gif"; //无图片
                this.imgPic2.Src = "../../images/havenopicmax.gif"; //无图片
                this.imgPic2.Attributes.Add("bimg", "../../images/havenopicmax.gif");
                this.imgPic.Attributes.Add("jqimg", "../../images/havenopicmax.gif");
            }
        }
        else
        {
            JScript.AlertMethod(this, "商品不存在或者已经被删除", JScript.IconOption.错误, "function(){location.href='GoodsInfoList.aspx';}");
            return;
        }
        string html = string.Empty;
        List <Hi.Model.BD_GoodsAttrs> ll = new Hi.BLL.BD_GoodsAttrs().GetList("", "isnull(dr,0)=0 and compId=" + this.CompID + " and goodsId=" + id.ToString(), "");

        if (ll.Count > 0)
        {
            int xy = 0;
            foreach (Hi.Model.BD_GoodsAttrs item in ll)
            {
                List <Hi.Model.BD_GoodsAttrsInfo> lll = new Hi.BLL.BD_GoodsAttrsInfo().GetList("", "isnull(dr,0)=0 and compId=" + this.CompID + " and attrsId=" + item.ID, "");
                if (lll.Count > 0)
                {
                    html += "<div class=\"li\"><i class=\"bt2\" tip=\"" + item.AttrsName + "\">" + item.AttrsName + ":</i><div class=\"fun\" style=\"display: inline;\">";
                    int count = 1;
                    foreach (Hi.Model.BD_GoodsAttrsInfo item2 in lll)
                    {
                        //Hi.Model.BD_GoodsInfo model4 = new Hi.BLL.BD_GoodsInfo().GetModel(goodsInfoId);
                        //if (xy == 0)
                        //{
                        //    html += "<a href=\"javascript:;\" class=\"" + (model4.Value1 == item2.AttrsInfoName.Trim() ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>";
                        //}
                        //else if (xy == 1)
                        //{
                        //    html += "<a href=\"javascript:;\" class=\"" + (model4.Value2 == item2.AttrsInfoName.Trim() ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>";
                        //}
                        //else if (xy == 2)
                        //{
                        //    html += "<a href=\"javascript:;\" class=\"" + (model4.Value3 == item2.AttrsInfoName.Trim() ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>";
                        //}
                        if (count == 1)
                        {
                            html += "<a href=\"javascript:;\" class=\"hover\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>";
                        }
                        else
                        {
                            html += "<a href=\"javascript:;\" class=\"\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>";
                        }
                        count++;
                    }
                    html += "</div></div>";
                }
                xy++;
            }
        }
        litAttrVaue.Text = html;
    }
Exemplo n.º 3
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 = "异常"
            });
        }
    }
Exemplo n.º 4
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>");
                }
            }
        }
    }
Exemplo n.º 5
0
    /// <summary>
    /// 绑定产品信息
    /// </summary>
    /// <param name="id"></param>
    public void Bind(int id, int goodsInfoId, int compId)
    {
        Hi.Model.BD_Goods model = new Hi.BLL.BD_Goods().GetModel(id);
        if (model != null && model.dr == 0 && model.IsEnabled == 1)
        {
            Hi.Model.BD_GoodsInfo model2 = new Hi.BLL.BD_GoodsInfo().GetModel(goodsInfoId);
            if (model2 != null)
            {
                this.lblCode.InnerText      = model2.BarCode.Trim();       //商品编号
                this.lblInventory.InnerText = model2.Inventory.ToString(); //库存
            }
            Hi.Model.BD_GoodsCategory model3 = new Hi.BLL.BD_GoodsCategory().GetModel(model.CategoryID);
            if (model3 != null)
            {
                this.lblCategory.InnerText = model3.CategoryName.Trim(); //分类
            }
            GetZiDingYi(model);                                          //自定义字段
            this.divTitle.InnerText     = model.GoodsName.Trim();        //biaot
            this.divMemo.InnerHtml      = model.Title.Trim();            //描述
            this.lblHideInfo1.InnerText = model.HideInfo1;
            this.lblHideInfo2.InnerText = model.HideInfo2;               //描述
            this.lblUnit.InnerText      = model.Unit.Trim();             //计量单位
            if (model.Details == "")
            {
                this.DivShow.InnerHtml = "<p style=\"padding-top: 20px; line-height: 40px; padding-left: 20px\">暂无数据</p>";
            }
            else
            {
                this.DivShow.InnerHtml = model.Details;
            }
            if (!string.IsNullOrEmpty(model.Pic))//有图片
            {
                this.imgPic.Src = Common.GetPicURL(model.Pic, "resize400");
                this.imgPic.Attributes.Add("jqimg", Common.GetPicURL(model.Pic));

                this.imgPic2.Src = Common.GetPicURL(model.Pic, "resize400");
                this.imgPic2.Attributes.Add("bimg", Common.GetPicURL(model.Pic));
            }
            else
            {
                this.imgPic.Src  = "../../images/havenopicmax.gif"; //无图片
                this.imgPic2.Src = "../../images/havenopicmax.gif"; //无图片
                this.imgPic2.Attributes.Add("bimg", "../../images/havenopicmax.gif");
                this.imgPic.Attributes.Add("jqimg", "../../images/havenopicmax.gif");
            }

            //add by hgh 设置商品是否首页显示
            this.labText.Text = model.IsFirstShow == true ? "是" : "否";
        }
        else
        {
            JScript.AlertMsg(this, "商品不存在或者已经被删除", "GoodsInfoList.aspx");
            return;
        }
        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=" + id.ToString(), "");

        if (ll.Count > 0)
        {
            int xy = 0;
            foreach (Hi.Model.BD_GoodsAttrs item in ll)
            {
                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\"><i class=\"bt2\" tip=\"" + item.AttrsName + "\">" + item.AttrsName + ":</i><div class=\"fun\">";
                    foreach (Hi.Model.BD_GoodsAttrsInfo item2 in lll)
                    {
                        Hi.Model.BD_GoodsInfo model4 = new Hi.BLL.BD_GoodsInfo().GetModel(goodsInfoId);
                        if (xy == 0)
                        {
                            html += "<a href=\"javascript:;\" class=\"" + (model4.Value1 == item2.AttrsInfoName.Trim() ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>";
                        }
                        else if (xy == 1)
                        {
                            html += "<a href=\"javascript:;\" class=\"" + (model4.Value2 == item2.AttrsInfoName.Trim() ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>";
                        }
                        else if (xy == 2)
                        {
                            html += "<a href=\"javascript:;\" class=\"" + (model4.Value3 == item2.AttrsInfoName.Trim() ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>";
                        }
                    }
                    html += "</div></div>";
                }
                xy++;
            }
        }
        litAttrVaue.Text = html;
    }
Exemplo 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>");
            }
        }
    }
Exemplo n.º 7
0
    /// <summary>
    /// 删除GOods以及goodsinfo表
    /// </summary>
    /// <param name="Tran"></param>
    private void DelGoods()
    {
        SqlTransaction Tran = DBUtility.SqlHelper.CreateStoreTranSaction();

        try
        {
            foreach (RepeaterItem row in this.rptGoodsInfo.Items)
            {
                CheckBox cb = row.FindControl("CB_SelItem") as CheckBox;
                if (cb != null && cb.Checked)
                {
                    HiddenField fld  = row.FindControl("HF_Id") as HiddenField;
                    HiddenField fld2 = row.FindControl("HF_GoodsId") as HiddenField;
                    if (fld != null && fld2 != null)
                    {
                        int goodsId     = Convert.ToInt32(fld2.Value);
                        int goodsinfoId = Convert.ToInt32(fld.Value);
                        Hi.Model.BD_GoodsInfo model2 = new Hi.BLL.BD_GoodsInfo().GetModel(goodsinfoId, Tran);
                        if (model2 != null)
                        {
                            model2.ts         = DateTime.Now;
                            model2.modifyuser = this.UserID;
                            model2.dr         = 1;
                            model2.CompID     = this.CompID;
                            bool bol = new Hi.BLL.BD_GoodsInfo().Update(model2, Tran);
                        }

                        List <Hi.Model.BD_GoodsInfo> ll = new Hi.BLL.BD_GoodsInfo().GetList("", "isnull(dr,0)=0 and compid=" + this.CompID + " and   goodsId=" + goodsId, "", Tran);
                        if (ll.Count == 0)
                        {
                            Hi.Model.BD_Goods model = new Hi.BLL.BD_Goods().GetModel(goodsId, Tran);
                            if (model != null)
                            {
                                model.ts         = DateTime.Now;
                                model.modifyuser = this.UserID;
                                model.dr         = 1;
                                model.CompID     = this.CompID;
                                bool bol = new Hi.BLL.BD_Goods().Update(model, Tran);
                            }
                            List <Hi.Model.BD_GoodsAttrs> lll = new Hi.BLL.BD_GoodsAttrs().GetList("", "isnull(dr,0)=0 and goodsid=" + goodsId + " and compid=" + this.CompID, "", Tran);
                            if (lll.Count > 0)
                            {
                                foreach (Hi.Model.BD_GoodsAttrs item in lll)
                                {
                                    Hi.Model.BD_GoodsAttrs attsmodel = new Hi.BLL.BD_GoodsAttrs().GetModel(item.ID);
                                    if (attsmodel != null)
                                    {
                                        attsmodel.ts         = DateTime.Now;
                                        attsmodel.modifyuser = this.UserID;
                                        attsmodel.dr         = 1;
                                        attsmodel.CompID     = this.CompID;
                                        bool bol = new Hi.BLL.BD_GoodsAttrs().Update(attsmodel, Tran);
                                    }
                                    List <Hi.Model.BD_GoodsAttrsInfo> llll = new Hi.BLL.BD_GoodsAttrsInfo().GetList("", "isnull(dr,0)=0 and goodsid=" + goodsId + " and compid=" + this.CompID + " and attrsid=" + item.ID, "", Tran);
                                    if (llll.Count > 0)
                                    {
                                        foreach (Hi.Model.BD_GoodsAttrsInfo item2 in llll)
                                        {
                                            Hi.Model.BD_GoodsAttrsInfo attsinfomodel = new Hi.BLL.BD_GoodsAttrsInfo().GetModel(item2.ID);
                                            if (attsmodel != null)
                                            {
                                                attsinfomodel.ts         = DateTime.Now;
                                                attsinfomodel.modifyuser = this.UserID;
                                                attsinfomodel.dr         = 1;
                                                attsinfomodel.CompID     = this.CompID;
                                                bool bol = new Hi.BLL.BD_GoodsAttrsInfo().Update(attsinfomodel, Tran);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            Tran.Commit();
        }
        catch (Exception)
        {
            if (Tran != null)
            {
                if (Tran.Connection != null)
                {
                    Tran.Rollback();
                }
            }
        }
        finally
        {
            DBUtility.SqlHelper.ConnectionClose();
        }
    }