コード例 #1
0
        public async Task <GetCruisesForEditOutput> GetCruisesForEdit(EntityDto input)
        {
            _unitOfWorkManager.Current.DisableFilter(AbpDataFilters.MayHaveTenant);
            GetCruisesForEditOutput output = new GetCruisesForEditOutput();

            try
            {
                Cruise cruises = await _cruisesRepository.FirstOrDefaultAsync(input.Id);

                output = new GetCruisesForEditOutput {
                    Cruises = ObjectMapper.Map <CreateOrEditCruisesDto>(cruises)
                };

                if (output.Cruises.CruiseShipsId != null)
                {
                    CruiseShip _lookupCruiseShips = await _lookup_cruiseShipsRepository.FirstOrDefaultAsync((int)output.Cruises.CruiseShipsId);

                    output.CruiseShipsCruiseShipName = _lookupCruiseShips.CruiseShipName.ToString();
                }
                if (output.Cruises.CruiseServicesId != null)
                {
                    CruiseService _lookupCruiseServices = await _lookup_cruiseServicesRepository.FirstOrDefaultAsync((int)output.Cruises.CruiseServicesId);

                    output.CruiseServicesServiceName = _lookupCruiseServices.ServiceName.ToString();
                }

                if (output.Cruises.CruiseItinerariesId != null)
                {
                    CruiseItinerary _lookupCruiseItinerary = await _lookup_CruiseItineraryRepository.FirstOrDefaultAsync((int)output.Cruises.CruiseItinerariesId);

                    output.CruiseItinerariesItineraryName = _lookupCruiseItinerary.ItineraryName.ToString();
                }

                if (output.Cruises.CruiseThemesId != null)
                {
                    CruiseTheme _lookupCruiseThemes = await _lookup_cruiseThemesRepository.FirstOrDefaultAsync((int)output.Cruises.CruiseThemesId);

                    var _masterAmenities = await _lookup_cruiseMasterAmenitiesRepository.FirstOrDefaultAsync((int)_lookupCruiseThemes.CruiseThemeName);

                    output.CruiseThemesCruiseThemeName = _masterAmenities.DisplayName.ToString();
                }



                return(output);
            }
            catch (Exception ex)
            {
                return(output);
            }
        }
コード例 #2
0
        public async Task <GetCruisesForViewDto> GetCruisesForView(int id)
        {
            _unitOfWorkManager.Current.DisableFilter(AbpDataFilters.MayHaveTenant);
            Cruise cruises = await _cruisesRepository.GetAsync(id);

            GetCruisesForViewDto output = new GetCruisesForViewDto {
                Cruises = ObjectMapper.Map <CruisesDto>(cruises)
            };

            if (output.Cruises.CruiseShipsId != null)
            {
                CruiseShip _lookupCruiseShips = await _lookup_cruiseShipsRepository.FirstOrDefaultAsync((int)output.Cruises.CruiseShipsId);

                output.CruiseShipsCruiseShipName = _lookupCruiseShips.CruiseShipName.ToString();
            }

            if (output.Cruises.CruiseThemesId != null)
            {
                CruiseTheme _lookupCruiseThemes = await _lookup_cruiseThemesRepository.FirstOrDefaultAsync((int)output.Cruises.CruiseThemesId);

                var _masterAmenities = await _lookup_cruiseMasterAmenitiesRepository.FirstOrDefaultAsync((int)_lookupCruiseThemes.CruiseThemeName);

                output.CruiseThemesCruiseThemeName = _masterAmenities.DisplayName.ToString();
            }

            if (output.Cruises.CruiseServicesId != null)
            {
                CruiseService _lookupCruiseServices = await _lookup_cruiseServicesRepository.FirstOrDefaultAsync((int)output.Cruises.CruiseServicesId);

                output.CruiseServicesServiceName = _lookupCruiseServices.ServiceName.ToString();
            }

            if (output.Cruises.CruiseItinerariesId != null)
            {
                CruiseItinerary _lookupCruiseItinerary = await _lookup_CruiseItineraryRepository.FirstOrDefaultAsync((int)output.Cruises.CruiseItinerariesId);

                output.CruiseItinerariesItineraryName = _lookupCruiseItinerary.ItineraryName.ToString();
            }

            return(output);
        }
コード例 #3
0
        private async Task Update(CreateOrEditCruisesDto input)
        {
            Cruise cruises = await _cruisesRepository.FirstOrDefaultAsync((int)input.Id);

            cruises.CheckIn = DateTime.ParseExact(input.CheckIn, "MM/dd/yyyy HH:mm",
                                                  CultureInfo.InvariantCulture);
            cruises.Checkout = DateTime.ParseExact(input.Checkout, "MM/dd/yyyy HH:mm",
                                                   CultureInfo.InvariantCulture);

            cruises.CruiseDuration  = input.CruiseDuration;
            cruises.CruiseStartPort = input.CruiseStartPort;
            cruises.CruiseEndPort   = input.CruiseEndPort;

            cruises.CruiseIsEnabled     = input.CruiseIsEnabled;
            cruises.CruiseIsEnabledB2B  = input.CruiseIsEnabledB2B;
            cruises.CruiseItinerariesId = input.CruiseItinerariesId;
            cruises.CruiseServicesId    = input.CruiseServicesId;
            cruises.CruiseShipsId       = input.CruiseShipsId;
            cruises.CruiseThemesId      = input.CruiseThemesId;
            cruises.CruiseYear          = input.CruiseYear;

            cruises.Cruise_Airport = input.Cruise_Airport;
            cruises.DepositType    = input.DepositType;
            cruises.DisableForApi  = input.DisableForApi;
            cruises.FreeInternet   = input.FreeInternet;

            cruises.StandardDeposit  = input.StandardDeposit;
            cruises.VirtualCruise    = input.VirtualCruise;
            cruises.BookingEmail     = input.BookingEmail;
            cruises.TransferIncluded = input.TransferIncluded;
            cruises.CruiseOperatorId = input.CruiseOperatorId;
            if (AbpSession.TenantId != null)
            {
                cruises.TenantId = AbpSession.TenantId;
            }

            await _cruisesRepository.UpdateAsync(cruises);

            //ObjectMapper.Map(input, cruises);
        }
コード例 #4
0
        private async Task Create(CreateOrEditCruisesDto input)
        {
            Cruise cruises = new Cruise
            {
                CheckIn = DateTime.ParseExact(input.CheckIn, "MM/dd/yyyy HH:mm",
                                              CultureInfo.InvariantCulture),
                Checkout = DateTime.ParseExact(input.Checkout, "MM/dd/yyyy HH:mm",
                                               CultureInfo.InvariantCulture),
                CruiseDuration      = input.CruiseDuration,
                CruiseStartPort     = input.CruiseStartPort,
                CruiseEndPort       = input.CruiseEndPort,
                CruiseIsEnabled     = input.CruiseIsEnabled,
                CruiseIsEnabledB2B  = input.CruiseIsEnabledB2B,
                CruiseItinerariesId = input.CruiseItinerariesId,
                CruiseServicesId    = input.CruiseServicesId,
                CruiseShipsId       = input.CruiseShipsId,
                CruiseThemesId      = input.CruiseThemesId,
                CruiseYear          = input.CruiseYear,
                Cruise_Airport      = input.Cruise_Airport,
                DepositType         = input.DepositType,
                DisableForApi       = input.DisableForApi,
                FreeInternet        = input.FreeInternet,
                BookingEmail        = input.BookingEmail,
                TransferIncluded    = input.TransferIncluded,
                CruiseOperatorId    = input.CruiseOperatorId,
                StandardDeposit     = input.StandardDeposit,
                VirtualCruise       = input.VirtualCruise
            };

            if (AbpSession.TenantId != null)
            {
                cruises.TenantId = AbpSession.TenantId;
            }

            await _cruisesRepository.InsertAsync(cruises);
        }