public NormalResult UpdateCommodity(OneDollarBuyingCommodityEntity commodity)
        {
            if (commodity == null)
            {
                Debug.Assert(false, "commodity 为空");
                return(new NormalResult("参数错误"));
            }

            SqlStructureBuild sqlBuild = new SqlStructureBuild();

            sqlBuild.Table = "OneDollarBuyingCommodity";
            sqlBuild.Type  = SqlExpressionType.Update;
            sqlBuild.AddParameter("Id", commodity.Id, true);
            sqlBuild.AddParameter("Name", commodity.Name);
            sqlBuild.AddParameter("Price", commodity.Price);
            sqlBuild.AddParameter("ForSale", commodity.ForSale);
            sqlBuild.AddParameter("InfiniteStock", commodity.InfiniteStock);
            sqlBuild.AddParameter("ImageUrl", commodity.ImageUrl);
            sqlBuild.AddParameter("Introduction", commodity.Introduction);
            _dataBase.ExcuteSqlExpression(sqlBuild.GetSqlExpression());

            PutOnSale(commodity.Id);

            return(new NormalResult());
        }
        public ActionResult UpdateCommodity()
        {
            OneDollarBuyingCommodityEntity commodity = RequestArgs <OneDollarBuyingCommodityEntity>();

            if (commodity == null)
            {
                return(RespondResult(false, "参数无效。"));
            }

            NormalResult result = _oneDollarBuyingManager.UpdateCommodity(commodity);

            #region 操作日志

            _operatedLogManager.Create(new OperatedLogEntity()
            {
                Domain      = DomainContext.Domain.Id,
                AppId       = DomainContext.AppId,
                User        = UserContext.User.Id,
                IP          = Request.UserHostAddress,
                Module      = EnumModule.Campaign,
                Description = "更新1元抢购商品"
            });

            #endregion

            return(RespondResult(result.Success, result.Message));
        }
        public ActionResult GetCommodity()
        {
            string strId = Request.QueryString["id"];
            Guid   id    = Guid.Empty;

            if (String.IsNullOrEmpty(strId) || Guid.TryParse(strId, out id) == false)
            {
                return(RespondResult(false, "参数无效。"));
            }

            OneDollarBuyingCommodityEntity commodity = _oneDollarBuyingManager.GetCommodity(id);

            return(RespondDataResult(commodity));
        }
        public OneDollarBuyingCommodityEntity GetCommodity(Guid id)
        {
            OneDollarBuyingCommodityEntity pointCommodity = new OneDollarBuyingCommodityEntity();

            pointCommodity.Id = id;

            if (_dataBase.Fill <OneDollarBuyingCommodityEntity>(pointCommodity))
            {
                return(pointCommodity);
            }
            else
            {
                return(null);
            }
        }
        public NormalResult CreateCommodity(OneDollarBuyingCommodityEntity commodity)
        {
            if (commodity == null)
            {
                Debug.Assert(false, "commodity 为空");
                return(new NormalResult("参数错误"));
            }

            commodity.CreateTime = DateTime.Now;
            commodity.Sort       = _domainManager.GetSort(commodity.Domain, "OneDollarBuyingCommodity");
            _dataBase.Insert(commodity);

            PutOnSale(commodity.Id);

            return(new NormalResult());
        }
        public OneDollarBuyingDealInfo GetDealInfo(Guid saleId)
        {
            OneDollarBuyingDealInfo dealInfo = new OneDollarBuyingDealInfo();

            dealInfo.SaleId = saleId;

            if (_dataBase.Fill <OneDollarBuyingDealInfo>(dealInfo))
            {
                OneDollarBuyingCommodityEntity commodity = GetCommodity(dealInfo.CommodityId);
                dealInfo.CommodityName = commodity.Name;

                if (dealInfo.LuckyMemberId.HasValue)
                {
                    dealInfo.LuckyMember = _memberManager.GetMember(dealInfo.LuckyMemberId.Value);
                }
                return(dealInfo);
            }
            else
            {
                return(null);
            }
        }