Exemplo n.º 1
0
        public string GetShopImg(object p)
        {
            M_Logo_Design desMod = new M_Logo_Design();
            B_Logo_Design desBll = new B_Logo_Design();

            desMod = desBll.SelReturnModel(DataConverter.CLng(p));
            return(desMod.PreviewImg.ToString());
        }
Exemplo n.º 2
0
        //根据传参将商品加入购物车后跳转(支持按商品ID,套装ID购买)
        private void AddToCart(M_UserInfo mu, M_Product proMod, int pronum)
        {
            if (pronum < 1)
            {
                pronum = 1;
            }
            if (proMod == null || proMod.ID < 1)
            {
                return;
            }                                               //商品不存在
            DataTable dt    = DBCenter.Sel(proMod.TableName, "ID=" + proMod.ItemID);
            int       tlpID = DataConvert.CLng(dt.Rows[0]["TlpID"]);
            //if (tlpID < 1) { function.WriteErrMsg("商品未绑定设计模板"); }
            //复制一份作为用户新建的记录
            B_Logo_Design desBll = new B_Logo_Design();
            M_Logo_Design desMod = desBll.SelReturnModel(tlpID);

            if (desMod == null)
            {
                desMod = new M_Logo_Design();
            }
            M_Cart_Addition addMod = new M_Cart_Addition();

            //if (desMod == null) { function.WriteErrMsg("商品未绑定模板"); }
            desMod.ID       = 0;
            desMod.ZType    = 0;
            desMod.CDate    = DateTime.Now;
            desMod.UserID   = mu.UserID;
            desMod.UserName = mu.UserName;
            //不经设计直接加入物车,则获取商品预览图片
            string imgUrl = function.GetImgUrl(proMod.Thumbnails);

            //if (File.Exists(function.VToP(imgUrl)))
            //{
            //    desMod.PreviewImg = "data:image/png;base64," + ImgToBase64(imgUrl);
            //}
            desMod.PreviewImg = imgUrl;
            desMod.ID         = desBll.Insert(desMod);
            //-----------------检测完成加入购物车
            M_Cart cartMod = new M_Cart();

            cartMod.Cartid     = CartCookID;
            cartMod.StoreID    = proMod.UserShopID;
            cartMod.ProID      = proMod.ID;
            cartMod.Pronum     = pronum;
            cartMod.userid     = mu.UserID;
            cartMod.Username   = mu.UserName;
            cartMod.FarePrice  = proMod.LinPrice.ToString();
            cartMod.AllMoney   = (proMod.LinPrice * cartMod.Pronum);
            cartMod.ProAttr    = desMod.ID.ToString();
            cartMod.Proname    = proMod.Proname;
            cartMod.Additional = JsonConvert.SerializeObject(addMod);
            int id = cartBll.insert(cartMod);
        }
Exemplo n.º 3
0
        public string GetShopImg(object p)
        {
            M_Logo_Design desMod = new M_Logo_Design();
            B_Logo_Design desBll = new B_Logo_Design();

            desMod = desBll.SelReturnModel(DataConverter.CLng(p));
            if (desMod == null || string.IsNullOrEmpty(desMod.PreviewImg))
            {
                return("");
            }
            return(desMod.PreviewImg);
        }