public async Task <IResponse <ShiftResponse> > GetShifts(DateTime visitDate) { try { var partnerId = _settings.GetConfigSetting <string>(SettingKeys.Integration.KidZania.PartnerId); var password = _settings.GetConfigSetting <string>(SettingKeys.Integration.KidZania.Password); var cityId = _settings.GetConfigSetting <string>(SettingKeys.Integration.KidZania.CityId); var parkId = _settings.GetConfigSetting <string>(SettingKeys.Integration.KidZania.ParkId); TicketBookSoapClient ticketBookSoapClient = new TicketBookSoapClient(TicketBookSoapClient.EndpointConfiguration.TicketBookSoap); Shift_Out[] shiftOut = await ticketBookSoapClient.FnSchedule_ShiftAsync(Convert.ToInt64(cityId), Convert.ToInt64(parkId), visitDate, partnerId, password).ConfigureAwait(false); Vd_Park_Out[] parkOut = await ticketBookSoapClient.FnSchedule_VisitDate_ParkAsync(Convert.ToInt64(parkId), visitDate, partnerId, password).ConfigureAwait(false); return(GetResponse(true, new ShiftResponse { ShiftOut = AutoMapper.Mapper.Map <List <ShiftOut> >(shiftOut), ParkOut = AutoMapper.Mapper.Map <List <ParkOut> >(parkOut) })); } catch (Exception ex) { _logger.Log(LogCategory.Error, new Exception("Failed to get shifts", ex)); return(GetResponse(false, null)); } }
public async Task <IResponse <VisitorTypeResponse> > GetVisitorTypes(DateTime visitDate, long ShiftId) { try { var partnerId = _settings.GetConfigSetting <string>(SettingKeys.Integration.KidZania.PartnerId); var password = _settings.GetConfigSetting <string>(SettingKeys.Integration.KidZania.Password); var cityId = _settings.GetConfigSetting <string>(SettingKeys.Integration.KidZania.CityId); var parkId = _settings.GetConfigSetting <string>(SettingKeys.Integration.KidZania.ParkId); TicketBookSoapClient ticketBookSoapClient = new TicketBookSoapClient(TicketBookSoapClient.EndpointConfiguration.TicketBookSoap); Vd_Park_Out[] parkOuts = await ticketBookSoapClient.FnSchedule_VisitDate_ParkAsync(Convert.ToInt64(parkId), visitDate, partnerId, password).ConfigureAwait(false); List <VisitorTypes> VisitorTypes = new List <VisitorTypes>(); if (ShiftId != 0) { IEnumerable <Vd_Park_Out> parkOutsByShiftId = parkOuts.Where(p => p.ShiftId == ShiftId); if (parkOutsByShiftId != null) { parkOuts = parkOuts.Where(p => p.ShiftId == ShiftId).ToArray(); } VisitorTypes = parkOuts[0].VisitorTypes.ToList(); } return(GetResponse(true, new VisitorTypeResponse { VisitorTypes = AutoMapper.Mapper.Map <List <FIL.Contracts.Models.Integrations.Kidzania.VisitorType> >(VisitorTypes) })); } catch (Exception ex) { _logger.Log(LogCategory.Error, new Exception("Failed to get shifts", ex)); return(GetResponse(false, null)); } }