示例#1
0
        /// <summary>
        ///     添加飞机租赁订单行
        /// </summary>
        /// <param name="price">单价</param>
        /// <param name="amount">数量</param>
        /// <param name="discount">折扣</param>
        /// <param name="delivery">预计交付日期</param>
        /// <returns>飞机租赁订单行</returns>
        public AircraftLeaseOrderLine AddNewAircraftLeaseOrderLine(decimal price, int amount, decimal discount,
            DateTime delivery)
        {
            var aircraftLeaseOrderLine = new AircraftLeaseOrderLine
            {
                OrderId = Id,
                UnitPrice = price,
                Amount = amount,
                Discount = discount,
                EstimateDeliveryDate = delivery
            };

            aircraftLeaseOrderLine.GenerateNewIdentity();
            OrderLines.Add(aircraftLeaseOrderLine);

            return aircraftLeaseOrderLine;
        }
示例#2
0
        /// <summary>
        ///     更新订单行
        /// </summary>
        /// <param name="line">订单行DTO</param>
        /// <param name="orderLine">订单行</param>
        private void UpdateOrderLine(AircraftLeaseOrderLineDTO line, AircraftLeaseOrderLine orderLine)
        {
            // 获取飞机物料机型
            var material =
                _materialRepository.GetFiltered(m => m.Id == line.AircraftMaterialId)
                    .OfType<AircraftMaterial>()
                    .FirstOrDefault();
            if (material == null)
            {
                throw new ArgumentException("未能获取飞机物料!");
            }
            var aircraftTypeId = material.AircraftTypeId;

            // 更新订单行
            orderLine.UpdateOrderLine(line.UnitPrice, line.Amount, line.Discount, line.EstimateDeliveryDate);
            orderLine.SetAircraftMaterial(line.AircraftMaterialId);

            // 更新合同飞机
            var contractAircraft = _contractAircraftRepository.Get(orderLine.ContractAircraftId);
            contractAircraft.SetAircraftType(aircraftTypeId);
            contractAircraft.SetRankNumber(line.RankNumber);
            contractAircraft.SetCSCNumber(line.CSCNumber);
            contractAircraft.SetSerialNumber(line.SerialNumber);
            contractAircraft.SetPlanAircraft(line.PlanAircraftID);
        }