/// <summary>
        /// 购买套餐
        /// </summary>
        /// <param name="memberId">会员id</param>
        /// <param name="employeeId">员工id</param>
        /// <param name="packageId">套餐id</param>
        /// <param name="packagePrice">套餐价格</param>
        /// <param name="packageHour">套餐课时</param>
        /// <param name="packageDuration">套餐有效时限</param>
        /// <returns></returns>
        public bool BuyPackage(int memberId, int employeeId, int packageId, double packagePrice, int packageHour, int packageDuration)
        {
            var member     = repository.GetById(memberId);
            var package    = packageRepository.GetById(packageId);
            var transactor = employeeRepository.GetById(employeeId);
            //新增会员套餐
            var memberPackage = new MemberPackage
            {
                PackageId     = package.Id,
                PackageName   = package.Name,
                ActivityId    = package.ActivityId,
                ActivityName  = package.ActivityName,
                MemberId      = member.Id,
                MemberName    = member.Name,
                StudioId      = member.StudioId,
                StudioName    = member.StudioName,
                Price         = packagePrice,
                Hour          = packageHour,
                Duration      = packageDuration,
                RemainingHour = packageHour,
                StartTime     = DateTime.Now,
                EndTime       = DateTime.Now.AddDays(packageDuration)
            };

            memberPackageRepository.Add(memberPackage);

            //新增套餐账单
            var packageBill = new PackageBill
            {
                StudioId        = member.StudioId,
                StudioName      = member.StudioName,
                MemberId        = member.Id,
                MemberName      = member.Name,
                TransactorId    = transactor.Id,
                TransactorName  = transactor.Name,
                MemberPackageId = memberPackage.Id,
                PackageName     = package.Name,
                ActivityId      = package.ActivityId,
                ActivityName    = package.ActivityName,
                Price           = memberPackage.Price,
                Hour            = memberPackage.Hour,
                Time            = DateTime.Now
            };

            packageBillRepository.Add(packageBill);

            return(true);
        }
예제 #2
0
파일: Bill.cs 프로젝트: jasatwal/skybill
        public Bill(Statement statement,
                    PackageBill package,
                    CallChargesBill callCharges,
                    SkyStoreBill skyStore,
                    Money total)
        {
            Check.Argument.IsNotNull(statement, nameof(statement));
            Check.Argument.IsNotNull(package, nameof(package));

            this.statement = statement;
            this.package = package;
            this.callCharges = callCharges;
            this.skyStore = skyStore;

            costings = new BillCostings(
                package.Costings.Total
                    .Add(callCharges?.Costings.Total ?? Money.Zero)
                    .Add(skyStore?.Costings.Total ?? Money.Zero),
                total);
        }
예제 #3
0
파일: Bill.cs 프로젝트: jasatwal/skybill
        public Bill(Statement statement,
                    PackageBill package,
                    CallChargesBill callCharges,
                    SkyStoreBill skyStore,
                    Money total)
        {
            Check.Argument.IsNotNull(statement, nameof(statement));
            Check.Argument.IsNotNull(package, nameof(package));

            this.statement   = statement;
            this.package     = package;
            this.callCharges = callCharges;
            this.skyStore    = skyStore;

            costings = new BillCostings(
                package.Costings.Total
                .Add(callCharges?.Costings.Total ?? Money.Zero)
                .Add(skyStore?.Costings.Total ?? Money.Zero),
                total);
        }
예제 #4
0
        /// <summary>
        /// 获取套餐账单详情
        /// </summary>
        /// <param name="packageBillId"></param>
        /// <returns></returns>
        public JsonResult GetPackageBillDetail(int packageBillId)
        {
            PackageBill packageBill = domainModel.GetPackageBillDetail(packageBillId);

            return(Json(packageBill));
        }