Example #1
0
        private static CarEntity TranslateCarEntity(CarInfo carInfo)
        {
            CarEntity carEntity = new CarEntity();

            if (carInfo != null)
            {
                carEntity.CarID           = carInfo.CarID;
                carEntity.CarName         = carInfo.CarName ?? "";
                carEntity.ModelCode       = carInfo.ModelCode ?? "";
                carEntity.CarModel        = carInfo.CarModel ?? "";
                carEntity.AttachmentIDs   = carInfo.AttachmentIDs ?? "";
                carEntity.ContractCode    = carInfo.ContractCode ?? "";
                carEntity.AppearanceSize  = carInfo.AppearanceSize ?? "";
                carEntity.PlateSize       = carInfo.PlateSize ?? "";
                carEntity.Capacity        = carInfo.Capacity ?? "";
                carEntity.Slope           = carInfo.Slope ?? "";
                carEntity.MaxWeight       = carInfo.MaxWeight ?? "";
                carEntity.Wheelbase       = carInfo.Wheelbase ?? "";
                carEntity.BatteryCapacity = carInfo.BatteryCapacity ?? "";
                carEntity.Quality         = carInfo.Quality ?? "";
                carEntity.Braking         = carInfo.Braking ?? "";
                carEntity.MaxSpeed        = carInfo.MaxSpeed ?? "";
                carEntity.SiteNum         = carInfo.SiteNum ?? "";
                carEntity.BatteryType     = carInfo.BatteryType ?? "";
                carEntity.SafeConfigure   = carInfo.SafeConfigure ?? "";
                carEntity.OuterConfigure  = carInfo.OuterConfigure ?? "";
                carEntity.Renewal         = carInfo.Renewal ?? "";
                carEntity.SupplierID      = carInfo.SupplierID;
                carEntity.Status          = carInfo.Status;
                carEntity.CarLicNumber    = carInfo.CarLicNumber;
                carEntity.ModifyDate      = carInfo.ModifyDate;
                carEntity.Operator        = carInfo.Operator;
                carEntity.SalePrice       = carInfo.SalePrice;
                carEntity.LeasePrice      = carInfo.LeasePrice;
                carEntity.BrandID         = carInfo.BrandID;


                List <AttachmentEntity> attachments = new List <AttachmentEntity>();
                if (!string.IsNullOrEmpty(carEntity.AttachmentIDs))
                {
                    attachments = BaseDataService.GetAttachmentInfoByKyes(carEntity.AttachmentIDs);
                }
                carEntity.AttachmentsInfo = attachments;

                StoreEntity store = StoreService.GetStoreById(carEntity.SupplierID) ?? new StoreEntity();
                carEntity.Store = store;

                BrandEntity brand = BrandService.GetBrandById(carEntity.BrandID) ?? new BrandEntity();
                carEntity.CarBrand = brand;
            }

            return(carEntity);
        }
Example #2
0
        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);
        }