Пример #1
0
        //public string GetWeiXinAccessToken()
        //{
        //    return WeiXinBLL.GetWeiXinAccessToken();
        //}
        //public string GetWeiXinJsticket()
        //{
        //    return WeiXinBLL.GetWeiXinJsticket();
        //}
        //public string GetWeiXinGetSignature()
        //{
        //    string ticket = FormString.SafeQ("ticket", 200);
        //    string noncestr = FormString.SafeQ("noncestr", 200);
        //    long times = FormString.LongIntSafeQ("timestamp");
        //    string url = FormString.SafeQ("url",200 );
        //    return WeiXinBLL.GetSignature(ticket,   noncestr, times,   url);
        //}

        //public string GetWeiXinAPPId()
        //{
        //    return WeiXinBLL.APPId;
        //}

        #endregion


        #region 询价
        public string GetXunJiaMsg()
        {
            ResultObj         result = new ResultObj();
            int               _pdid  = FormString.IntSafeQ("pdid");
            MemberLoginEntity member = CookieBLL.GetLoginCookie();

            if (member != null && member.MemId > 0)
            {
                VWXunJiaObj               _obj  = new VWXunJiaObj();
                VWProductEntity           vwp   = ProductBLL.Instance.GetProVWByDetailId(_pdid);
                VWProductNomalParamEntity vwpa  = ProductExtBLL.Instance.GetProductNormalParamById(vwp.ProductId);
                MemStoreEntity            store = StoreBLL.Instance.GetStoreByMemId(member.MemId);
                _obj.Product     = vwp;
                _obj.ProductExt  = vwpa;
                _obj.MobilePhone = store.MobilePhone;
                _obj.MemId       = store.MemId;
                result.Status    = (int)CommonStatus.Success;
                result.Obj       = _obj;
            }
            else
            {
                result.Status = (int)CommonStatus.NeedLogin;
            }
            string liststr = JsonJC.ObjectToJson(result);

            return(liststr);
        }
Пример #2
0
        /// <summary>
        /// 插入一条记录到表InquiryRecords,如果表中存在自增字段,则返回值为新记录的自增字段值,否则返回0。
        /// 该方法提供给界面等UI层调用
        /// </summary>
        /// <param name="inquiryRecords">要添加的InquiryRecords数据实体对象</param>
        public int AddInquiryRecords(InquiryRecordsEntity inquiryRecords)
        {
            int result = InquiryRecordsDA.Instance.AddInquiryRecords(inquiryRecords);

            if (result > 0)
            {
                VWProductEntity P     = ProductBLL.Instance.GetProVWByDetailId(inquiryRecords.ProductDetailId);
                EmailSendEntity email = new EmailSendEntity();
                email.CreateTime = DateTime.Now;
                email.Body       = "产品名称:" + P.AdTitle + "</br>用户联系手机:" + inquiryRecords.MobilePhone + "</br>备注:" + inquiryRecords.Remark;
                var emailsendstr = System.Configuration.ConfigurationManager.AppSettings["SendMailManager"];
                if (emailsendstr == null || string.IsNullOrEmpty(emailsendstr.ToString()))
                {
                    email.Email = "[email protected];";
                }
                else
                {
                    email.Email = emailsendstr.ToString();
                }
                email.Title  = "客户询价";
                email.Status = 0;
                EmailSendBLL.Instance.AddEmailSend(email);
            }
            return(result);
        }
Пример #3
0
        public ActionResult ProductPropertyEdit(int pid)
        {
            VWProductEntity _vwproductentity = new VWProductEntity();

            _vwproductentity = ProductBLL.Instance.GetProductVW(pid);
            ViewBag.Product  = _vwproductentity;
            return(View());
        }
Пример #4
0
        public ActionResult AddToCart()
        {
            int             _pdid  = QueryString.IntSafeQ("pdid");
            int             _num   = QueryString.IntSafeQ("num");
            VWProductEntity entity = new VWProductEntity();

            entity            = ProductBLL.Instance.GetProVWByDetailId(_pdid);
            ViewBag.IsAhaTake = entity.IsAhmTake;
            ViewBag.Num       = _num;
            ViewBag.Entity    = entity;
            return(View());
        }
Пример #5
0
        public IList <VWProductEntity> GetProductsByClassId(int classid)
        {
            IList <VWProductEntity>     productlist = new List <VWProductEntity>();
            IList <ClassesMenuADEntity> listmenu    = ClassesMenuADDA.Instance.GetClassesMenuADAll(classid, (int)ClassesAdShowType.Product);

            foreach (ClassesMenuADEntity entity in listmenu)
            {
                VWProductEntity product = ProductBLL.Instance.GetProVWByDetailId(entity.BrandOrProductId);
                productlist.Add(product);
            }
            return(productlist);
        }
Пример #6
0
        ///// <summary>
        ///// 获得数据列表
        ///// </summary>
        public IList <VWMemFavoritesEntity> GetVWMemFavoritesList(int pageIndex, int pageSize, ref int recordCount, int memid, int isactive)
        {
            IList <VWMemFavoritesEntity> list = MemFavoritesDA.Instance.GetVWMemFavoritesList(pageIndex, pageSize, ref recordCount, memid, isactive);

            if (list != null && list.Count > 0)
            {
                foreach (VWMemFavoritesEntity entity in list)
                {
                    VWProductEntity _vwentity = new VWProductEntity();
                    _vwentity            = ProductBLL.Instance.GetProVWByDetailId(entity.ProductDetailId);
                    entity.ProductEntity = _vwentity;
                }
            }
            return(list);
        }
Пример #7
0
//        public IList<VWProductStyleEntity> GetCmsTemProductByCmsid(int cmsid)
//        {
//            string sql = @"SELECT    b.[Id],[CmsContentId],a.[ProductId],a.[Sort],b.AdTitle,b.PicUrl,b.ClassId,b.Price
//,b.BrandId,b.MarketPrice,b.TradePrice from
//dbo.[CmsTemProduct] a WITH(NOLOCK) INNER JOIN dbo.Product b WITH(NOLOCK)
//ON a.ProductId=b.Id where a.CmsContentId=@CmsContentId ORDER BY a.Sort DESC ,a.id     ";
//            IList<VWProductStyleEntity> entityList = new List<VWProductStyleEntity>();
//            DbCommand cmd = db.GetSqlStringCommand(sql);
//            db.AddInParameter(cmd, "@CmsContentId", DbType.Int32, cmsid);
//            using (IDataReader reader = db.ExecuteReader(cmd))
//            {
//                while (reader.Read())
//                {
//                    VWProductStyleEntity entity = new VWProductStyleEntity();
//                    entity.ProductId = StringUtils.GetDbInt(reader["ProductId"]);
//                    entity.Sort = StringUtils.GetDbInt(reader["Sort"]);
//                    entity.AdTitle = StringUtils.GetDbString(reader["AdTitle"]);
//                    entity.ClassId = StringUtils.GetDbInt(reader["ClassId"]);
//                    entity.PicUrl = StringUtils.GetDbString(reader["PicUrl"]);
//                    entity.Price = StringUtils.GetDbDecimal(reader["Price"]);
//                    entity.BrandId = StringUtils.GetDbInt(reader["BrandId"]);
//                    entity.MarketPrice = StringUtils.GetDbDecimal(reader["MarketPrice"]);
//                    entity.TradePrice = StringUtils.GetDbDecimal(reader["TradePrice"]);
//                    entityList.Add(entity);
//                }
//            }
//            return entityList;
//        }



        public IList <VWProductEntity> GetCmsTemProductByCmsid(int cmsid)
        {
            string sql = @"Select ProductId from dbo.CmsTemProduct where CmsContentId= @CmsContentId";
            IList <VWProductEntity> entityList = new List <VWProductEntity>();
            DbCommand cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "@CmsContentId", DbType.Int32, cmsid);
            using (IDataReader reader = db.ExecuteReader(cmd))
            {
                while (reader.Read())
                {
                    VWProductEntity entity = new VWProductEntity();
                    entity.ProductId = StringUtils.GetDbInt(reader["ProductId"]);
                    entityList.Add(entity);
                }
            }
            return(entityList);
        }
Пример #8
0
        public VWProductEntity GetProVWByDetailId(int productdetailid, bool iscache = false)
        {
            VWProductEntity _obj = new VWProductEntity();

            if (!iscache)
            {
                _obj = ProductDA.Instance.GetProVWByDetailId(productdetailid);
                _obj.CGMemNickName = MemberInfoBLL.Instance.GetNickNameByMemId(_obj.CGMemId);
                if (_obj != null && _obj.Unit > 0)
                {
                    _obj.UnitName = DicUnitEnumBLL.Instance.GetDicUnitEnum(_obj.Unit).Name;
                }
                else
                {
                    _obj.UnitName = "件";
                }
            }
            else
            {
                string _cachekey = "GetProVWByDetailId_" + productdetailid.ToString();
                object _objcache = MemCache.GetCache(_cachekey);
                if (_objcache == null)
                {
                    _obj = ProductDA.Instance.GetProVWByDetailId(productdetailid);
                    _obj.CGMemNickName = MemberInfoBLL.Instance.GetNickNameByMemId(_obj.CGMemId);
                    if (_obj != null && _obj.Unit > 0)
                    {
                        _obj.UnitName = DicUnitEnumBLL.Instance.GetDicUnitEnum(_obj.Unit).Name;
                    }
                    else
                    {
                        _obj.UnitName = "件";
                    }
                    MemCache.AddCache(_cachekey, _obj);
                }
                else
                {
                    _obj = (VWProductEntity)_objcache;
                }
            }
            return(_obj);
        }
Пример #9
0
        public VWProductEntity GetProductVW(int productid, bool iscache = false)
        {
            VWProductEntity _obj = new VWProductEntity();

            if (!iscache)
            {
                _obj = ProductDA.Instance.GetProductVW(productid);
                if (_obj != null && _obj.Unit > 0)
                {
                    _obj.UnitName = DicUnitEnumBLL.Instance.GetDicUnitEnum(_obj.Unit).Name;
                }
                else
                {
                    _obj.UnitName = "件";
                }
            }
            else
            {
                string _cachekey = "GetProductVW_" + productid.ToString();
                object _objcache = MemCache.GetCache(_cachekey);
                if (_objcache == null)
                {
                    _obj = ProductDA.Instance.GetProductVW(productid);
                    if (_obj != null && _obj.Unit > 0)
                    {
                        _obj.UnitName = DicUnitEnumBLL.Instance.GetDicUnitEnum(_obj.Unit).Name;
                    }
                    else
                    {
                        _obj.UnitName = "件";
                    }
                    MemCache.AddCache(_cachekey, _obj);
                }
                else
                {
                    _obj = (VWProductEntity)_objcache;
                }
            }

            return(_obj);
        }
Пример #10
0
        /// <summary>
        /// 产品编辑
        /// </summary>
        /// <returns></returns>
        public ActionResult ProductEdit()
        {
            //判断是否是修改
            int productid = QueryString.IntSafeQ("productid");
            int siteid    = QueryString.IntSafeQ("siteid");

            if (siteid == 0 && productid == 0)
            {
                return(Redirect(SuperMarketWebUrl.GetSysSelectSiteIdUrl()));
            }
            int             classid          = 0;
            int             brandid          = 0;
            VWProductEntity _vwproductentity = new VWProductEntity();

            if (productid > 0)
            {
                _vwproductentity                  = ProductBLL.Instance.GetProductVW(productid);
                _vwproductentity.ProductPics      = ProductStylePicsBLL.Instance.GetListPicsByProductId(productid); //获取样式图片列表
                _vwproductentity.ProductPropertys = ProductPropertyBLL.Instance.GetListByProductId(productid);      //获取样式属性列表
                ProductBLL.Instance.Assignment(ref _vwproductentity, productid);
                classid = _vwproductentity.ClassId;
                brandid = _vwproductentity.BrandId;
                siteid  = _vwproductentity.SiteId;
                ClassesFoundEntity _classentity = ClassesFoundBLL.Instance.GetClassesFound(classid, false);
                BrandEntity        _brandntity  = BrandBLL.Instance.GetBrand(brandid, false);
            }
            else
            {
                classid = QueryString.IntSafeQ("classid");
                brandid = QueryString.IntSafeQ("brandid");
            }


            ViewBag.SiteId  = siteid;
            ViewBag.Product = _vwproductentity;
            ViewBag.MemId   = memid;
            return(View());
        }
Пример #11
0
        public ActionResult Detail()
        {
            int             _productdetailid = QueryString.IntSafeQ("pd");
            VWProductEntity _vwentity        = new VWProductEntity();

            _vwentity = ProductBLL.Instance.GetProVWByDetailId(_productdetailid);
            IList <ProductStylePicsEntity> productpiclist = ProductStylePicsBLL.Instance.GetListPicsByProductId(_vwentity.ProductId);

            _vwentity.ProductPics = productpiclist;
            MemberLoginEntity member = CookieBLL.GetLoginCookie();

            if (member != null && member.MemId > 0)
            {
                ViewBag.MemId         = member.MemId;
                ViewBag.MemStatus     = member.Status;
                _vwentity.ActualPrice = Calculate.GetPrice(member.Status, member.IsStore, member.StoreType, member.MemGrade, _vwentity.TradePrice, _vwentity.Price, _vwentity.IsBP, _vwentity.DealerPrice);
            }
            VWProductNomalParamEntity paramentity = ProductExtBLL.Instance.GetProductNormalParamById(_vwentity.ProductId);

            ViewBag.VWProductEntity    = _vwentity;
            ViewBag.ProductParamEntity = paramentity;
            return(View());
        }
Пример #12
0
        public IList <VWProductEntity> GetSupProductsByClassId(int classid, int producttype = 1)
        {
            string    sql = @"SELECT top 5  pd.Id as ProductDetailId,b.Id AS [ProductId],b.SiteId,b.Name,b.Spec1,b.Spec2,b.PicURL as PicUrl,b.PicSuffix,pd.Price,pd.TradePrice,B.MarketPrice,
b.AdTitle,a.SalesNum
							FROM
							dbo.[ProductSimilarSup] a WITH(NOLOCK)	 INNER JOIN dbo.Product b  WITH(NOLOCK) 
							ON a.ProductId=b.Id  inner join ProductDetail pd WITH(NOLOCK)  on b.Id=pd.ProductId and pd.ProductType=@ProductType
							WHERE a.ClassId =@ClassId AND b.Status=1 ORDER BY a.Sort desc"                            ;
            DbCommand cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "@ClassId", DbType.Int32, classid);
            db.AddInParameter(cmd, "@ProductType", DbType.Int32, producttype);
            IList <VWProductEntity> list = new List <VWProductEntity>();

            using (IDataReader reader = db.ExecuteReader(cmd))
            {
                while (reader.Read())
                {
                    VWProductEntity entity = new VWProductEntity();
                    entity.ProductDetailId = StringUtils.GetDbInt(reader["ProductDetailId"]);
                    entity.ProductId       = StringUtils.GetDbInt(reader["ProductId"]);
                    entity.SiteId          = StringUtils.GetDbInt(reader["SiteId"]);
                    entity.Name            = StringUtils.GetDbString(reader["Name"]);
                    entity.Spec1           = StringUtils.GetDbString(reader["Spec1"]);
                    entity.Spec2           = StringUtils.GetDbString(reader["Spec2"]);
                    entity.PicUrl          = StringUtils.GetDbString(reader["PicUrl"]);
                    entity.PicSuffix       = StringUtils.GetDbString(reader["PicSuffix"]);
                    entity.Price           = StringUtils.GetDbDecimal(reader["Price"]);
                    entity.TradePrice      = StringUtils.GetDbDecimal(reader["TradePrice"]);
                    entity.MarketPrice     = StringUtils.GetDbDecimal(reader["MarketPrice"]);
                    entity.AdTitle         = StringUtils.GetDbString(reader["AdTitle"]);
                    entity.SaleNum         = StringUtils.GetDbInt(reader["SalesNum"]);
                    list.Add(entity);
                }
            }
            return(list);
        }
Пример #13
0
        public IList <VWProductEntity> GetHotProducts(int classid, int size, int producttype = 1)
        {
            string    sql = @"SELECT  top " + size + @"  a.ProductId,[AdTitle],[Title],[BrandId],pd.[Price],[MarketPrice],[PicUrl]
,a.[ClassId], [Cost],pd.[TradePrice], pd.[TransFee],
pd.[TransFeeType], a.Sort from dbo.[ProductSimilarHot] a WITH(NOLOCK)	
INNER JOIN dbo.[Product]  b WITH(NOLOCK)  ON a.ProductId=b.Id AND a.ClassId=@ClassId 
inner join dbo.[ProductDetail] pd WITH(NOLOCK) on b.Id=pd.ProductId and pd.ProductType=@ProductType
						 "                        ;
            DbCommand cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "@ClassId", DbType.Int32, classid);
            db.AddInParameter(cmd, "@ProductType", DbType.Int32, producttype);
            IList <VWProductEntity> list = new List <VWProductEntity>();

            using (IDataReader reader = db.ExecuteReader(cmd))
            {
                if (reader.Read())
                {
                    VWProductEntity entity = new VWProductEntity();
                    entity.ProductId    = StringUtils.GetDbInt(reader["ProductId"]);
                    entity.AdTitle      = StringUtils.GetDbString(reader["AdTitle"]);
                    entity.Title        = StringUtils.GetDbString(reader["Title"]);
                    entity.BrandId      = StringUtils.GetDbInt(reader["BrandId"]);
                    entity.Price        = StringUtils.GetDbDecimal(reader["Price"]);
                    entity.MarketPrice  = StringUtils.GetDbDecimal(reader["MarketPrice"]);
                    entity.PicUrl       = StringUtils.GetDbString(reader["PicUrl"]);
                    entity.ClassId      = StringUtils.GetDbInt(reader["ClassId"]);
                    entity.Cost         = StringUtils.GetDbDecimal(reader["Cost"]);
                    entity.TradePrice   = StringUtils.GetDbDecimal(reader["TradePrice"]);
                    entity.TransFee     = StringUtils.GetDbDecimal(reader["TransFee"]);
                    entity.TransFeeType = StringUtils.GetDbInt(reader["TransFeeType"]);
                    list.Add(entity);
                }
            }
            return(list);
        }
Пример #14
0
        /// <summary>
        /// 网站首页
        /// </summary>
        /// <returns></returns>
        public ActionResult ShopCart()
        {
            string pids  = QueryString.SafeQ("pids", 500);
            string nums  = QueryString.SafeQ("nums", 500);
            int    jishi = QueryString.IntSafeQ("js");

            if (jishi == 0)
            {
                jishi = (int)JiShiSongEnum.Normal;
            }
            VWShoppingCartInfo shoppingCart = new VWShoppingCartInfo();

            if (jishi == (int)JiShiSongEnum.JiShi)
            {
                shoppingCart = SessionUtil.GetXuQiuSession();
            }
            else
            {
                shoppingCart = SessionUtil.GetCartSession();
            }


            IList <MemShoppCarEntity> clist = new List <MemShoppCarEntity>();

            if (shoppingCart != null && shoppingCart.CartItems != null && shoppingCart.CartItems.Count > 0)
            {
                IList <ShoppCookie> shopcoolist = shoppingCart.CartItems.OrderByDescending(c => c.C).ThenByDescending(c => c.S).ToList();
                //shoppingCart.CartItemsL = new List<ShoppCarEntity>();
                foreach (ShoppCookie entity in shopcoolist)
                {
                    if (entity.ProDId <= 0)
                    {
                        if (jishi == (int)JiShiSongEnum.JiShi)
                        {
                            ShoppingXuQiuProcessor.RemoveXuQiuItem(shoppingCart, entity.ProDId);
                        }
                        else
                        {
                            ShoppingCartProcessor.RemoveCartItem(shoppingCart, entity.ProDId);
                        }
                    }
                    else
                    {
                        VWProductEntity   vwpentity     = ProductBLL.Instance.GetProVWByDetailId(entity.ProDId);
                        MemShoppCarEntity shopcarentity = new MemShoppCarEntity();
                        shopcarentity.PicUrl          = vwpentity.PicUrl;
                        shopcarentity.PicSuffix       = vwpentity.PicSuffix;
                        shopcarentity.Price           = Calculate.GetPrice(member.Status, member.IsStore, member.StoreType, member.MemGrade, vwpentity.TradePrice, vwpentity.Price, vwpentity.IsBP, vwpentity.DealerPrice);
                        shopcarentity.ProductName     = vwpentity.AdTitle;
                        shopcarentity.Spec1           = vwpentity.Spec1;
                        shopcarentity.Spec2           = vwpentity.Spec2;
                        shopcarentity.Spec3           = vwpentity.Spec3;
                        shopcarentity.TotalPrice      = shopcarentity.Price * entity.Num;
                        shopcarentity.Num             = entity.Num;
                        shopcarentity.ProductType     = vwpentity.ProductType;
                        shopcarentity.ProductId       = vwpentity.ProductId;
                        shopcarentity.StockNum        = vwpentity.StockNum;
                        shopcarentity.Check           = entity.C == 1;
                        shopcarentity.ProductDetailId = entity.ProDId;
                        clist.Add(shopcarentity);
                    }
                }
                shoppingCart.CartItemsL = clist;
            }
            if (!string.IsNullOrEmpty(pids))
            {
                string[]            pidattr = pids.Split('_');
                string[]            numattr = nums.Split('_');
                IList <ShoppCookie> list    = new List <ShoppCookie>();
                for (int i = 0; i < pidattr.Length; i++)
                {
                    VWProductEntity _productentity = ProductBLL.Instance.GetProVWByDetailId(StringUtils.GetDbInt(pidattr[i]));
                    if (_productentity.ProductDetailId > 0)
                    {
                        ShoppCookie cookentity = new ShoppCookie();
                        cookentity.C      = 1;
                        cookentity.Num    = StringUtils.GetDbInt(numattr[i]);
                        cookentity.ProDId = _productentity.ProductDetailId;
                        list.Add(cookentity);
                    }
                }
                if (jishi == (int)JiShiSongEnum.JiShi)
                {
                    shoppingCart = ShoppingXuQiuProcessor.BuyContinue(shoppingCart, list);
                }
                else
                {
                    shoppingCart = ShoppingCartProcessor.BuyContinue(shoppingCart, list);
                }

                clist = new List <MemShoppCarEntity>();
                IList <ShoppCookie> shopcoolist = shoppingCart.CartItems.OrderByDescending(c => c.C).ThenByDescending(c => c.S).ToList();

                foreach (ShoppCookie entity in shopcoolist)
                {
                    if (entity.ProDId <= 0)
                    {
                        if (jishi == (int)JiShiSongEnum.JiShi)
                        {
                            ShoppingXuQiuProcessor.RemoveXuQiuItem(shoppingCart, entity.ProDId);
                        }
                        else
                        {
                            ShoppingCartProcessor.RemoveCartItem(shoppingCart, entity.ProDId);
                        }
                    }
                    else
                    {
                        VWProductEntity   vwpentity     = ProductBLL.Instance.GetProVWByDetailId(entity.ProDId);
                        MemShoppCarEntity shopcarentity = new MemShoppCarEntity();
                        shopcarentity.PicUrl          = vwpentity.PicUrl;
                        shopcarentity.PicSuffix       = vwpentity.PicSuffix;
                        shopcarentity.Price           = Calculate.GetPrice(member.Status, member.IsStore, member.StoreType, member.MemGrade, vwpentity.TradePrice, vwpentity.Price, vwpentity.IsBP, vwpentity.DealerPrice);
                        shopcarentity.ProductName     = vwpentity.AdTitle;
                        shopcarentity.Spec1           = vwpentity.Spec1;
                        shopcarentity.Spec2           = vwpentity.Spec2;
                        shopcarentity.Spec3           = vwpentity.Spec3;
                        shopcarentity.TotalPrice      = shopcarentity.Price * entity.Num;
                        shopcarentity.Num             = entity.Num;
                        shopcarentity.ProductType     = vwpentity.ProductType;
                        shopcarentity.ProductId       = vwpentity.ProductId;
                        shopcarentity.StockNum        = vwpentity.StockNum;
                        shopcarentity.Check           = entity.C == 1;
                        shopcarentity.ProductDetailId = entity.ProDId;
                        clist.Add(shopcarentity);
                    }
                }
                shoppingCart.CartItemsL = clist;
            }
            ViewBag.ShoppingCart = shoppingCart;
            ViewBag.MemId        = memid;
            ViewBag.JiShiSong    = jishi;

            ViewBag.PageMenu = "3";
            return(View());
        }
Пример #15
0
 /// <summary>
 /// 给VWProduct其他字段赋值
 /// </summary>
 /// <returns></returns>
 public int Assignment(ref VWProductEntity entity, int id)
 {
     return(ProductDA.Instance.Assignment(ref entity, id));
 }
Пример #16
0
        public ActionResult Detail()
        {
            string title            = "易店心,";
            int    _productdetailid = QueryString.IntSafeQ("pd");
            int    _producttype     = (int)ProductType.Normal;

            if (_productdetailid == 0)
            {
                _productdetailid = StringUtils.GetDbInt(RouteData.Values["pd"]);
                if (_productdetailid == 0)
                {
                    return(Redirect("/"));
                }
            }
            VWProductEntity _vwentity = new VWProductEntity();

            _vwentity = ProductBLL.Instance.GetProVWByDetailId(_productdetailid);
            int _productid = _vwentity.ProductId;

            _producttype = _vwentity.ProductType;

            //if(_vwentity.ProductType== (int)ProductType.SpecialPrice)
            //{
            //    return RedirectToAction(  "SProductDetail", new { pd = _productdetailid });
            //}
            title        += _vwentity.AdTitle;
            ViewBag.Title = title;
            IList <ProductStylePicsEntity> productpiclist = null;

            ClassesFoundEntity _classentity = ClassesFoundBLL.Instance.GetClassesFound(_vwentity.ClassId, false);
            BrandEntity        _brandrntity = BrandBLL.Instance.GetBrand(_vwentity.BrandId, false);

            ViewBag.RavClassList  = ListRavStr(_classentity);
            ViewBag.Brand         = _brandrntity;
            productpiclist        = ProductStylePicsBLL.Instance.GetListPicsByProductId(_productid);
            _vwentity.ProductPics = productpiclist;

            IList <ProductPropertyEntity> productpropertylist = ProductPropertyBLL.Instance.GetListByProductId(_productid);

            _vwentity.ProductPropertys = productpropertylist;

            if (!string.IsNullOrEmpty(_vwentity.Spec1))
            {
                ViewBag.Spec1Name = _vwentity.Spec1;
                IList <VWProductEntity> plist = ProductBLL.Instance.GetListSpecsByStyleId(_vwentity.SiteId, _vwentity.ProductType, _vwentity.CGMemId);
                //ViewBag.SpecList = plist;
                var listfilter = (from c in plist
                                  select new { c.Spec1, c.Spec2, c.PicUrlLittle, c.ProductId, c.ProductDetailId });
                string liststr = JsonJC.ObjectToJson(listfilter);
                ViewBag.SpecListJson = liststr;
                IList <string> OBJSpec1 = (from c in plist
                                           where !string.IsNullOrEmpty(c.Spec1)
                                           select c.Spec1).Distinct().OrderBy(p => p).ToList();
                ViewBag.Spec1List = OBJSpec1;

                if (!string.IsNullOrEmpty(_vwentity.Spec2))
                {
                    ViewBag.Spec2Name = _vwentity.Spec2;
                    IList <string> OBJSpec2 = (from c in plist
                                               where !string.IsNullOrEmpty(c.Spec2)
                                               select c.Spec2).Distinct().OrderBy(p => p).ToList <string>();
                    ViewBag.Spec2List = OBJSpec2;
                }
            }

            MemberLoginEntity member = CookieBLL.GetLoginCookie();

            if (member != null && member.MemId > 0)
            {
                ViewBag.MemId         = member.MemId;
                ViewBag.MemStatus     = member.Status;
                ViewBag.Member        = member;
                _vwentity.ActualPrice = Calculate.GetPrice(member.Status, member.IsStore, member.StoreType, member.MemGrade, _vwentity.TradePrice, _vwentity.Price, _vwentity.IsBP, _vwentity.DealerPrice);
            }
            ViewBag.VWProductEntity = _vwentity;
            return(View());
        }
Пример #17
0
        public ActionResult Cart()
        {
            string             pids         = QueryString.SafeQ("pids", 500);
            string             nums         = QueryString.SafeQ("nums", 500);
            VWShoppingCartInfo shoppingCart = SessionUtil.GetCartSession();

            //待项目完善后此段判断可删除
            if (shoppingCart != null && shoppingCart.CartItems != null && shoppingCart.CartItems.Count > 0)
            {
                shoppingCart.CartItemsL = new List <MemShoppCarEntity>();

                foreach (ShoppCookie entity in shoppingCart.CartItems)
                {
                    if (entity.ProDId <= 0)
                    {
                        ShoppingCartProcessor.RemoveCartItem(shoppingCart, entity.ProDId);
                    }
                    else
                    {
                        VWProductEntity   vwpentity     = ProductBLL.Instance.GetProVWByDetailId(entity.ProDId);
                        MemShoppCarEntity shopcarentity = new MemShoppCarEntity();
                        shopcarentity.PicUrl          = vwpentity.PicUrl;
                        shopcarentity.PicSuffix       = vwpentity.PicSuffix;
                        shopcarentity.Price           = Calculate.GetPrice(member.Status, member.IsStore, member.StoreType, member.MemGrade, vwpentity.TradePrice, vwpentity.Price, vwpentity.IsBP, vwpentity.DealerPrice);
                        shopcarentity.ProductName     = vwpentity.AdTitle;
                        shopcarentity.Spec1           = vwpentity.Spec1;
                        shopcarentity.Spec2           = vwpentity.Spec2;
                        shopcarentity.Spec3           = vwpentity.Spec3;
                        shopcarentity.TotalPrice      = shopcarentity.Price * entity.Num;
                        shopcarentity.Num             = entity.Num;
                        shopcarentity.ProductType     = vwpentity.ProductType;
                        shopcarentity.ProductId       = vwpentity.ProductId;
                        shopcarentity.Check           = entity.C == 1;
                        shopcarentity.ProductDetailId = entity.ProDId;
                        shopcarentity.CGMemId         = vwpentity.CGMemId;
                        shopcarentity.CGMemNickName   = vwpentity.CGMemNickName;
                        shopcarentity.IsAhmTake       = vwpentity.IsAhmTake;
                        shoppingCart.CartItemsL.Add(shopcarentity);
                    }
                }
            }
            if (!string.IsNullOrEmpty(pids))
            {
                string[]                  pidattr = pids.Split('_');
                string[]                  numattr = nums.Split('_');
                IList <ShoppCookie>       list    = new List <ShoppCookie>();
                IList <MemShoppCarEntity> listL   = new List <MemShoppCarEntity>();
                for (int i = 0; i < pidattr.Length; i++)
                {
                    VWProductEntity _productentity = ProductBLL.Instance.GetProVWByDetailId(StringUtils.GetDbInt(pidattr[i]));
                    if (_productentity.ProductDetailId > 0)
                    {
                        ShoppCookie cookentity = new ShoppCookie();
                        cookentity.C      = 1;
                        cookentity.Num    = StringUtils.GetDbInt(numattr[i]);
                        cookentity.ProDId = _productentity.ProductDetailId;
                        list.Add(cookentity);
                    }
                }
                shoppingCart            = ShoppingCartProcessor.BuyContinue(shoppingCart, list);
                shoppingCart.CartItemsL = new List <MemShoppCarEntity>();

                foreach (ShoppCookie entity in shoppingCart.CartItems)
                {
                    if (entity.ProDId <= 0)
                    {
                        ShoppingCartProcessor.RemoveCartItem(shoppingCart, entity.ProDId);
                    }
                    else
                    {
                        VWProductEntity   vwpentity     = ProductBLL.Instance.GetProVWByDetailId(entity.ProDId);
                        MemShoppCarEntity shopcarentity = new MemShoppCarEntity();
                        shopcarentity.PicUrl          = vwpentity.PicUrl;
                        shopcarentity.PicSuffix       = vwpentity.PicSuffix;
                        shopcarentity.Price           = Calculate.GetPrice(member.Status, member.IsStore, member.StoreType, member.MemGrade, vwpentity.TradePrice, vwpentity.Price, vwpentity.IsBP, vwpentity.DealerPrice);
                        shopcarentity.ProductName     = vwpentity.AdTitle;
                        shopcarentity.Spec1           = vwpentity.Spec1;
                        shopcarentity.Spec2           = vwpentity.Spec2;
                        shopcarentity.Spec3           = vwpentity.Spec3;
                        shopcarentity.TotalPrice      = shopcarentity.Price * entity.Num;
                        shopcarentity.Num             = entity.Num;
                        shopcarentity.ProductType     = vwpentity.ProductType;
                        shopcarentity.ProductId       = vwpentity.ProductId;
                        shopcarentity.Check           = entity.C == 1;
                        shopcarentity.ProductDetailId = entity.ProDId;
                        shopcarentity.CGMemId         = vwpentity.CGMemId;
                        shopcarentity.CGMemNickName   = vwpentity.CGMemNickName;
                        shopcarentity.IsAhmTake       = vwpentity.IsAhmTake;
                        shoppingCart.CartItemsL.Add(shopcarentity);
                    }
                }
            }


            //int memid = 0; int issupplier = 0;
            //MemberLoginEntity member = CookieBLL.GetLoginCookie();
            //if (member != null && member.MemId > 0)
            //{
            //    memid = member.MemId ;
            //    issupplier = member.IsStore;
            //}
            ViewBag.ShoppingCart = shoppingCart;
            ViewBag.MemId        = memid;
            return(View());
        }
Пример #18
0
        public void XuQiuCartMethod()
        {
            Dictionary <int, IList <MemShoppCarEntity> > shopdic = new Dictionary <int, IList <MemShoppCarEntity> >();

            int                itemproductnum   = 0; //产品数量
            decimal            productamountall = 0; //产品总金额
            string             pids             = QueryString.SafeQ("pids", 500);
            string             nums             = QueryString.SafeQ("nums", 500);
            VWShoppingCartInfo shoppingCart     = SessionUtil.GetXuQiuSession();

            //待项目完善后此段判断可删除
            if (shoppingCart != null && shoppingCart.CartItems != null && shoppingCart.CartItems.Count > 0)
            {
                shoppingCart.CartItemsL = new List <MemShoppCarEntity>();

                foreach (ShoppCookie entity in shoppingCart.CartItems)
                {
                    if (entity.ProDId <= 0)
                    {
                        ShoppingXuQiuProcessor.RemoveXuQiuItem(shoppingCart, entity.ProDId);
                    }
                    else
                    {
                        VWProductEntity vwpentity = ProductBLL.Instance.GetProVWByDetailId(entity.ProDId);

                        MemShoppCarEntity shopcarentity = new MemShoppCarEntity();
                        shopcarentity.PicUrl          = vwpentity.PicUrl;
                        shopcarentity.PicSuffix       = vwpentity.PicSuffix;
                        shopcarentity.Price           = Calculate.GetPrice(member.Status, member.IsStore, member.StoreType, member.MemGrade, vwpentity.TradePrice, vwpentity.Price, vwpentity.IsBP, vwpentity.DealerPrice);
                        shopcarentity.ProductName     = vwpentity.AdTitle;
                        shopcarentity.Spec1           = vwpentity.Spec1;
                        shopcarentity.Spec2           = vwpentity.Spec2;
                        shopcarentity.Spec3           = vwpentity.Spec3;
                        shopcarentity.TotalPrice      = shopcarentity.Price * entity.Num;
                        shopcarentity.Num             = entity.Num;
                        shopcarentity.ProductType     = vwpentity.ProductType;
                        shopcarentity.ProductId       = vwpentity.ProductId;
                        shopcarentity.Check           = entity.C == 1;
                        shopcarentity.ProductDetailId = entity.ProDId;
                        shopcarentity.CGMemId         = vwpentity.CGMemId;
                        shopcarentity.CGMemNickName   = vwpentity.CGMemNickName;
                        shopcarentity.IsAhmTake       = vwpentity.IsAhmTake;
                        if (!shopdic.Keys.Contains(vwpentity.CGMemId))
                        {
                            shopdic[vwpentity.CGMemId] = new List <MemShoppCarEntity>();
                        }
                        shopdic[vwpentity.CGMemId].Add(shopcarentity);
                        itemproductnum    = itemproductnum + entity.Num;
                        productamountall += shopcarentity.TotalPrice;
                    }
                }
            }
            if (!string.IsNullOrEmpty(pids))
            {
                string[]                  pidattr = pids.Split('_');
                string[]                  numattr = nums.Split('_');
                IList <ShoppCookie>       list    = new List <ShoppCookie>();
                IList <MemShoppCarEntity> listL   = new List <MemShoppCarEntity>();
                for (int i = 0; i < pidattr.Length; i++)
                {
                    VWProductEntity _productentity = ProductBLL.Instance.GetProVWByDetailId(StringUtils.GetDbInt(pidattr[i]));
                    if (_productentity.ProductDetailId > 0)
                    {
                        ShoppCookie cookentity = new ShoppCookie();
                        cookentity.C      = 1;
                        cookentity.Num    = StringUtils.GetDbInt(numattr[i]);
                        cookentity.ProDId = _productentity.ProductDetailId;
                        list.Add(cookentity);
                    }
                }
                shoppingCart            = ShoppingXuQiuProcessor.BuyContinue(shoppingCart, list);
                shoppingCart.CartItemsL = new List <MemShoppCarEntity>();

                foreach (ShoppCookie entity in shoppingCart.CartItems)
                {
                    if (entity.ProDId <= 0)
                    {
                        ShoppingXuQiuProcessor.RemoveXuQiuItem(shoppingCart, entity.ProDId);
                    }
                    else
                    {
                        VWProductEntity   vwpentity     = ProductBLL.Instance.GetProVWByDetailId(entity.ProDId);
                        MemShoppCarEntity shopcarentity = new MemShoppCarEntity();
                        shopcarentity.PicUrl          = vwpentity.PicUrl;
                        shopcarentity.PicSuffix       = vwpentity.PicSuffix;
                        shopcarentity.Price           = Calculate.GetPrice(member.Status, member.IsStore, member.StoreType, member.MemGrade, vwpentity.TradePrice, vwpentity.Price, vwpentity.IsBP, vwpentity.DealerPrice);
                        shopcarentity.ProductName     = vwpentity.AdTitle;
                        shopcarentity.Spec1           = vwpentity.Spec1;
                        shopcarentity.Spec2           = vwpentity.Spec2;
                        shopcarentity.Spec3           = vwpentity.Spec3;
                        shopcarentity.TotalPrice      = shopcarentity.Price * entity.Num;
                        shopcarentity.Num             = entity.Num;
                        shopcarentity.ProductType     = vwpentity.ProductType;
                        shopcarentity.ProductId       = vwpentity.ProductId;
                        shopcarentity.Check           = entity.C == 1;
                        shopcarentity.ProductDetailId = entity.ProDId;
                        shopcarentity.CGMemId         = vwpentity.CGMemId;
                        shopcarentity.CGMemNickName   = vwpentity.CGMemNickName;
                        shopcarentity.IsAhmTake       = vwpentity.IsAhmTake;
                        if (!shopdic.Keys.Contains(vwpentity.CGMemId))
                        {
                            shopdic[vwpentity.CGMemId] = new List <MemShoppCarEntity>();
                        }
                        shopdic[vwpentity.CGMemId].Add(shopcarentity);
                        itemproductnum    = itemproductnum + entity.Num;
                        productamountall += shopcarentity.TotalPrice;
                    }
                }
            }
            ViewBag.ShoppingCartXuQiu = shopdic;
            ViewBag.ItemNum           = itemproductnum;
            ViewBag.AmountAll         = productamountall;
        }