private static OrderEntity TranslateOrderEntity(OrderInfo info) { OrderEntity orderEntity = new OrderEntity(); if (info != null) { orderEntity.OrderInnerID = info.OrderInnerID; orderEntity.OrderID = info.OrderID; orderEntity.PreID = info.PreID; orderEntity.CustomerID = info.CustomerID; orderEntity.CustomerName = info.CustomerName; orderEntity.Mobile = info.Mobile; orderEntity.EID = info.EID; orderEntity.UseType = info.UseType; orderEntity.PayType = info.PayType; orderEntity.SupplierID = info.SupplierID; orderEntity.SupplierCode = info.SupplierCode; orderEntity.LeaseTime = info.LeaseTime; orderEntity.Price = info.Price; orderEntity.Amount = info.Amount; orderEntity.Remark = info.Remark; orderEntity.AttachmentIDs = info.AttachmentIDs; orderEntity.Status = info.Status; orderEntity.ModifyDate = info.ModifyDate; orderEntity.Operator = info.Operator; CustomerEntity customer = CustomerService.GetCustomerByID(info.CustomerID); orderEntity.Customer = customer; if ((info.UseType ?? "").ToLower() == "car")//汽车预约 { CarEntity car = CarService.GetCarEntityById(info.EID); orderEntity.Car = car; } else if ((info.UseType ?? "").ToLower() == "chargepile")//充电桩预约 { ChargingPileEntity chargingPile = ChargeService.GetChargingPileEntityById(info.EID); orderEntity.ChargePile = chargingPile; } BaseDataEntity pay = BaseDataService.GetBaseDataByPCode("P00").FirstOrDefault(t => t.TypeCode == info.PayType) ?? new BaseDataEntity(); orderEntity.PayTypeInfo = pay;//支付信息 StoreEntity store = StoreService.GetStoreById(info.SupplierID); orderEntity.Store = store; BaseDataEntity use = BaseDataService.GetBaseDataByPCode("U00").FirstOrDefault(t => t.TypeCode == info.UseType) ?? new BaseDataEntity(); orderEntity.UseTypeDesc = use;//使用方式信息 } return(orderEntity); }
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); }