Exemplo n.º 1
0
        /// <summary>
        /// 向会员销售
        /// </summary>
        /// <returns>购买记录</returns>
        public SellRecord Sell(Tutor tutor, Member member)
        {
            // 1、新建一个购买记录
            SellRecord sellRecord = new SellRecord()
            {
                Product   = this,
                ProductId = this.Id,
                Price     = this.Price,
                Tutor     = tutor,
                TutorId   = tutor.Id,
                SellDate  = DateTime.Now
            };

            // 产生一张新卡
            MemberCard newMemberCard = CreateMemberCart();

            // 卡中写入会员及销售信息
            newMemberCard.SellRecord   = sellRecord;
            newMemberCard.PurchaseDate = DateTime.Now;
            newMemberCard.Member       = member;

            // 会员的卡集中增加此卡
            member.MemberCards.Add(newMemberCard);

            return(sellRecord);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 销售产品
        /// </summary>
        /// <param name="product">所销售产品</param>
        /// <returns>购买记录</returns>
        public SellRecord Sell(Tutor tutor)
        {
            SellRecord purchase = new SellRecord()
            {
                Product   = this,
                ProductId = this.Id,
                Price     = this.Price,
                Tutor     = tutor,
                TutorId   = tutor.Id,
                SellDate  = DateTime.Now
            };

            return(purchase);
        }