Ejemplo n.º 1
0
        /// <summary>
        /// 根据用户id获取购物车商品
        /// </summary>
        /// <param name="userid">用户id</param>
        /// <param name="languageId">语言id</param>
        /// <returns>购物车商品模型</returns>
        public ResultModel GetShoppingCartByUserId(string userid, int languageId)
        {
            StringBuilder sb     = new StringBuilder();
            ResultModel   result = new ResultModel {
                IsValid = false
            };
            string sql = @"Select p.FareTemplateID,p.Volume,sp.PurchasePrice,sc.ShoppingCartId As 'CartsId',m.IsProvideInvoices,sp.Stock AS 'StockQuantity',p.PostagePrice,p.SupplierId,
                            p.ProductID AS 'GoodsId',p.FreeShipping,p.Weight,p.RebateDays,p.RebateRatio,sc.Quantity As 'Count',pp.PicUrl As 'Pic',pl.ProductName AS 'GoodsName',
                            Case When (pr.StarDate<=GETDATE() and pr.EndDate>=GETDATE() and pr.SalesRuleId=2 and pr.Discount>0) Then sp.HKPrice*pr.Discount Else sp.HKPrice End As 'GoodsUnits',
                            sp.MarketPrice,p.MerchantID AS 'ComId',m.ShopName AS 'ComName',p.Status,p.MerchantID,(SELECT  reverse(stuff(reverse((
                                                              SELECT DISTINCT BBB.AttributeName+',' FROM dbo.SKU_AttributeValues AAA  JOIN dbo.SKU_Attributes BBB ON AAA.AttributeId=BBB.AttributeId
                                                              WHERE CHARINDEX(convert(varchar,AAA.ValueId)+'_',sp.SKUStr)>0
                                                                    OR CHARINDEX('_'+convert(varchar,AAA.ValueId),sp.SKUStr)>0
                                                                    OR sp.SKUStr=convert(varchar,AAA.ValueId) FOR XML PATH(''))),1,1,''))) As 'AttributeName',
                            sp.SkuName As 'ValueStr',sp.SKU_ProducId As 'SkuNumber',sc.IsCheck As 'IsChecked',sc.CartDate
                            From ShoppingCart sc  LEFT JOIN Product p on sc.ProductID = p.ProductId  
                            LEFT JOIN ProductPic pp on p.ProductID = pp.ProductId  LEFT JOIN Product_Lang pl ON p.ProductID = pl.ProductId 
                            LEFT JOIN YH_MerchantInfo m ON p.MerchantID=m.MerchantID LEFT JOIN SKU_Product sp on sc.SKU_ProducId = sp.SKU_ProducId 
                            LEFT JOIN ProductRule pr ON sc.ProductID = pr.ProductId Where pp.Flag = 1 And pl.LanguageID ={0} And sc.UserID ={1};";

            sb.AppendFormat(sql, languageId, userid);
            var            data    = _database.RunSqlQuery(x => x.ToResultSets(sb.ToString()));
            List <dynamic> sources = data[0];

            result.Data = sources.ToEntity <GoodsInfoModel>();
            foreach (var prodcut in result.Data)
            {
                //prodcut.Pic = GetConfig.FullPath() + prodcut.Pic;
                prodcut.Pic = HtmlExtensions.GetImagesUrl(prodcut.Pic, 72, 72);
                prodcut.AddToShoppingCartTime = DateTimeExtensions.DateTimeToString(prodcut.CartDate);
            }
            result.IsValid = true;
            return(result);
        }
Ejemplo n.º 2
0
 public string getDatePublishEndRepresentation()
 {
     return(DateTimeExtensions.DateTimeToString(datePublishEnd));
 }
 public string getEndDateRepresentation()
 {
     return(DateTimeExtensions.DateTimeToString(endDate));
 }
Ejemplo n.º 4
0
 public string getDatePublished()
 {
     return(DateTimeExtensions.DateTimeToString(datePublished));
 }
 public string getStartDateRepresentation()
 {
     return(DateTimeExtensions.DateTimeToString(startDate));
 }