/// <summary> /// 把东西分配给会员,并且要记录历史记录 /// </summary> /// <param name="number"></param> /// <param name="member"></param> /// <param name="daoFactory"></param> public virtual void AssignToMember(decimal number, Member member, IBadmintonDaoFactory daoFactory) { if (Balance < number) { throw new ArgumentOutOfRangeException("number", "请求派发的数量大于存量."); } IConsumablesHistoryDao historyDao = daoFactory.ConsumablesHistoryDao(); IPhysicalConsumables memberChecker = CreatePhysicalConsumables(number, member); //派发给会员,然后创建这个消耗品的历史记录 var assignHisotry = new ConsumablesHistory(memberChecker, number); historyDao.SaveOrUpdate(assignHisotry); //自身减少一部分数量 var selfHistory = new ConsumablesHistory(this, -number); historyDao.SaveOrUpdate(selfHistory); //自身数量减少 Balance = -number; daoFactory.ConsumablesDao().SaveOrUpdate(this); }
public YardController(IBadmintonDaoFactory daoFactory) { _daoFactory = daoFactory; }
public GymnasiumController(IBadmintonDaoFactory daoFactory) { _daoFactory = daoFactory; }
/// <summary> /// /// </summary> /// <param name="number"></param> /// <param name="member"></param> /// <param name="daoFactory"></param> public virtual void AssignTo(decimal number, Member member, IBadmintonDaoFactory daoFactory) { this.Balance = this.Balance - number; }
public BrandController(IBadmintonDaoFactory daoFactory) { _daoFactory = daoFactory; }
public MeasurementUnitController(IBadmintonDaoFactory daoFactory) { _daoFactory = daoFactory; }
public ModelController(IBadmintonDaoFactory daoFactory) { _daoFactory = daoFactory; }
/// <summary> /// 进货 /// </summary> /// <param name="amount">进货金额</param> /// <param name="numberOrGoods">进货数量</param> /// <param name="daoFactory">dao</param> /// <remarks> /// 1) 把入货数历史记录计算好,并且存入db /// 2)处理余额。 /// 3)计算好单价 /// </remarks> public virtual void Purchase(decimal amount, decimal numberOrGoods, IBadmintonDaoFactory daoFactory) { UnitPrice = CalculateUnitPrice(amount, numberOrGoods); throw new NotImplementedException(); }