Esempio n. 1
0
        public VWProductNomalParamEntity GetParamById(int pid)
        {
            string    sql = @"SELECT a.[Id] AS ProductId,a.Name,a.ClassId,a.BrandId,a.Code,a.Unit ,[DetailDescrip] 
							FROM
							dbo.[Product] a WITH(NOLOCK)  left JOIN  dbo.ProductExt b  WITH(NOLOCK)  ON a.id=b.ProductId 
							WHERE a.Id= @ProductId"                            ;
            DbCommand cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "@ProductId", DbType.Int32, pid);
            VWProductNomalParamEntity entity = new VWProductNomalParamEntity();

            using (IDataReader reader = db.ExecuteReader(cmd))
            {
                if (reader.Read())
                {
                    entity.ProductId     = StringUtils.GetDbInt(reader["ProductId"]);
                    entity.ProductName   = StringUtils.GetDbString(reader["Name"]);
                    entity.ClassId       = StringUtils.GetDbInt(reader["ClassId"]);
                    entity.BrandId       = StringUtils.GetDbInt(reader["BrandId"]);
                    entity.FacCode       = StringUtils.GetDbString(reader["Code"]);
                    entity.UnitId        = StringUtils.GetDbInt(reader["Unit"]);
                    entity.DetailDescrip = StringUtils.GetDbString(reader["DetailDescrip"]);
                }
            }
            return(entity);
        }
        //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);
        }
Esempio n. 3
0
        public VWProductNomalParamEntity GetProductNormalParamById(int pid)
        {
            VWProductNomalParamEntity entity = new VWProductNomalParamEntity();
            string _cachekey = "GetProductNormalParamById" + pid;// SysCacheKey.ProductExtListKey;
            object obj       = MemCache.GetCache(_cachekey);

            if (obj == null)
            {
                entity = ProductExtDA.Instance.GetParamById(pid);
                if (entity != null && entity.ProductId > 0)
                {
                    if (entity.ClassId > 0)
                    {
                        entity.ClassName = ClassesFoundBLL.Instance.GetClassesFound(entity.ClassId).Name;
                    }
                    if (entity.BrandId > 0)
                    {
                        BrandEntity brand = BrandBLL.Instance.GetBrand(entity.BrandId);
                        if (brand != null && brand.Id > 0)
                        {
                            entity.BrandName = brand.Name;
                            if (string.IsNullOrEmpty(entity.Factory))
                            {
                                entity.Factory = brand.Manufacturer;
                            }
                        }
                    }
                    if (entity.UnitId > 0)
                    {
                        DicUnitEnumEntity unit = DicUnitEnumBLL.Instance.GetDicUnitEnum(entity.UnitId);
                        if (unit != null && unit.Id > 0)
                        {
                            entity.UnitName = unit.Name;
                        }
                        else
                        {
                            entity.UnitName = "件";
                        }
                    }
                    MemCache.AddCache(_cachekey, entity);
                }
            }
            else
            {
                entity = (VWProductNomalParamEntity)obj;
            }
            return(entity);
        }
Esempio n. 4
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());
        }