/// <summary> /// 修改空间超出补价定价 /// </summary> /// <param name="packSpaceId">空间Id</param> /// <param name="spacePricingType">套餐空间定价类型</param> /// <param name="criterionSquare">标准面积</param> /// <param name="spaceRatio">空间占比</param> /// <param name="unitPrice">超出面积单价</param> public void SetSpaceExceedPrice(Guid packSpaceId, DecorationPackSpacePricingType spacePricingType, float criterionSquare, decimal spaceRatio, decimal unitPrice) { DecorationPackSpace space = this.GetPackSpace(packSpaceId); space.SetPrice(spacePricingType, criterionSquare, spaceRatio, unitPrice); this.IsWhole = false; }
/// <summary> /// 获取套餐模板空间 /// </summary> /// <param name="packSpaceId">套餐模板空间Id</param> /// <returns>套餐模板空间</returns> public DecorationPackSpace GetPackSpace(Guid packSpaceId) { DecorationPackSpace currentPackSpace = this.Spaces.SingleOrDefault(x => x.Id == packSpaceId); #region # 验证 if (currentPackSpace == null) { throw new ArgumentOutOfRangeException("packSpaceId", string.Format("Id为\"{0}\"的套餐模板空间不存在!", packSpaceId)); } #endregion return(currentPackSpace); }
/// <summary> /// 删除套餐模板空间 /// </summary> /// <param name="space">套餐模板空间</param> public void RemoveSpace(DecorationPackSpace space) { this.Spaces.Remove(space); //设置总面积 //this.Square = this.Spaces.Any() ? this.Spaces.Sum(x => x.Square) : 0; //空间类型处理 if (this.Spaces.All(x => x.SpaceType != space.SpaceType)) { this.SpaceTypes.Remove(space.SpaceType.GetEnumMember()); this.SpaceTypesStr = this.SpaceTypes.ToJson(); } //挂起领域事件 EventMediator.Suspend(new PackSpaceDeletedEvent(this.Id, space.Id)); }
/// <summary> /// 添加套餐模板空间 /// </summary> /// <param name="space">套餐模板空间</param> public void AddSpace(DecorationPackSpace space) { this.Spaces.Add(space); //设置总面积 //this.Square = this.Spaces.Sum(x => x.Square); //空间类型处理 string spaceType = space.SpaceType.GetEnumMember(); HashSet <string> spaceTypes = new HashSet <string>(); foreach (string type in this.SpaceTypes) { spaceTypes.Add(type); } spaceTypes.Add(spaceType); this.SpaceTypesStr = spaceTypes.ToJson(); }