예제 #1
0
        private static ReservationsEntity TranslateReservationsEntity(ReservationsInfo info)
        {
            ReservationsEntity reservationsEntity = new ReservationsEntity();

            if (info != null)
            {
                reservationsEntity.ID           = info.ID;
                reservationsEntity.CustomerID   = info.CustomerID;
                reservationsEntity.CustomerName = info.CustomerName;
                reservationsEntity.RType        = info.RType;
                reservationsEntity.PayType      = info.PayType;
                reservationsEntity.CarID        = info.CarID;
                reservationsEntity.LeaseTime    = info.LeaseTime;
                reservationsEntity.Price        = info.Price;
                reservationsEntity.Remark       = info.Remark;
                reservationsEntity.RDate        = info.RDate;
                reservationsEntity.Status       = info.Status;

                CustomerEntity customer = null;//CustomerService.GetCustomerByID(info.CustomerID);
                reservationsEntity.Customer = customer;

                if (info.RType == "SJ" || info.RType == "ZL")//汽车预约
                {
                    CarEntity car = CarService.GetCarEntityById(info.CarID);
                    reservationsEntity.Car = car;
                }
                else if (info.RType == "DZ")//充电桩预约
                {
                    ChargingPileEntity chargingPile = ChargeService.GetChargingPileEntityById(info.CarID);
                    reservationsEntity.ChargingPile = chargingPile;
                }

                BaseDataEntity pay = BaseDataService.GetBaseDataByPCode("P00").FirstOrDefault(t => t.TypeCode == info.PayType) ?? new BaseDataEntity();
                reservationsEntity.PayTypeInfo = pay;//支付信息
            }

            return(reservationsEntity);
        }