private async Task <KioskDto> CreateKioskAsync(CountryDto countryDto, GroupDto groupDto) { _log.Debug("Begin ProcessKioskAsync Create"); var defaultValue = await _collectDeviceService.CollectDeviceInfoAsync(); _log.Debug("defaultValue: " + defaultValue); var kiosk = await _apiService.CreateKioskAsync(new KioskDto { MachineId = KioskConfigurationHepler.GetValueFromSecurity(MACHINE_ID), Name = SettingsConfigurationCommon.MACHINE_NAME, GroupId = groupDto.Id, CountryId = countryDto.Id, IpAddress = UnitHelper.GetLocalIPAddress(), Address = GeoLocaltion.GetCountryName(), DefaultValue = defaultValue, Status = KioskStatus.online, Long = GeoLocaltion.GetLongitude(), Lat = GeoLocaltion.GetLatitude() }); _log.Debug("UnitHelper.GetMacAddress() " + UnitHelper.GetMacAddress()); await _apiService.UpdateKioskSecurityByKeyAsync(KioskConfigurationHepler.GetValueFromSecurity(LICENSE_KEY), new KioskSecurityDto { MacAddress = UnitHelper.GetMacAddress(), IsActive = true }); return(kiosk); }
private async Task <KioskDto> ProcessKioskAsync() { try { _log.Debug("Begin ProcessKioskAsync"); var kiosk = await _apiService.FindKioskByMachineIdAsync(KioskConfigurationHepler.GetValueFromSecurity(MACHINE_ID)); if (kiosk == null) { CountryDto countryDto = await _apiService.FindCountryByNameAsync(GeoLocaltion.GetCountryName()); GroupDto groupDto = await _apiService.FindGroupByNameAsync("Unknow"); return(await CreateKioskAsync(countryDto, groupDto)); } else { return(await UpdateKioskAsync(kiosk, kiosk.GroupId, kiosk.CountryId)); } } catch (Exception ex) { _log.Error(ex); throw new Exception("Please check log with error from SignalRClientProvider ==> ProcessKioskAsync: " + ex.Message, ex); } }