Beispiel #1
0
        public JsonResult AddLimitItem(string Title, string ProductName, long ProductId, decimal Price, string CategoryName,
                                       DateTime StartTime, DateTime EndTime, int MaxSaleCount, int Stock = 0)
        {
            Result result = new Result();

            try
            {
                var average = _iOrderService.GetRecentMonthAveragePrice(CurrentSellerManager.ShopId, ProductId);
                var pro     = _iProductService.GetProduct(ProductId);
                LimitTimeMarketInfo info = new LimitTimeMarketInfo
                {
                    AuditStatus      = LimitTimeMarketInfo.LimitTimeMarketAuditStatus.WaitForAuditing,
                    Title            = Title,
                    ProductId        = ProductId,
                    ProductName      = ProductName,
                    CancelReson      = "",
                    CategoryName     = CategoryName,
                    StartTime        = StartTime,
                    EndTime          = EndTime,
                    MaxSaleCount     = MaxSaleCount,
                    Price            = Price,
                    SaleCount        = 0,
                    ShopId           = CurrentSellerManager.ShopId,
                    ShopName         = _iShopService.GetShop(CurrentSellerManager.ShopId).ShopName,
                    Stock            = Stock,
                    AuditTime        = StartTime,
                    RecentMonthPrice = average,
                    ImagePath        = pro.ImagePath,
                    ProductAd        = pro.ShortDescription,
                    MinPrice         = pro.MinSalePrice
                };
                _iLimitTimeBuyService.AddLimitTimeItem(info);
                result.success = true;
                result.msg     = "添加限时购成功";
            }
            catch (HimallException ex)
            {
                result.msg = ex.Message;
            }
            catch (Exception ex)
            {
                Log.Error("添加限时购出错", ex);
                result.msg = "添加限时购出错!";
            }
            return(Json(result));
        }