Add pmsdetailsconverter.ps1
This commit is contained in:
parent
5dcf578f63
commit
53a698bbca
41
pmsdetailsconverter.ps1
Normal file
41
pmsdetailsconverter.ps1
Normal file
@ -0,0 +1,41 @@
|
||||
# Save this as "SaveHotelConfig.ps1"
|
||||
|
||||
# Prompt the user for the hotel data input
|
||||
$hotelData = Read-Host -Prompt "Please paste the hotel configuration data"
|
||||
|
||||
# Split the input into lines and create a hashtable to store key-value pairs
|
||||
$hotelConfig = @{}
|
||||
|
||||
# Process each line of the input data
|
||||
$hotelData -split "`n" | ForEach-Object {
|
||||
# Split each line by colon and trim whitespace
|
||||
$line = $_.Trim()
|
||||
if ($line -match "^(.*?):(.*)$") {
|
||||
$key = $matches[1].Trim()
|
||||
$value = $matches[2].Trim()
|
||||
|
||||
# Map the parsed keys to corresponding field names in JSON
|
||||
switch ($key) {
|
||||
"System" { $hotelConfig["System"] = $value }
|
||||
"Site ID" { $hotelConfig["SiteID"] = $value }
|
||||
"User Name" { $hotelConfig["UserName"] = $value }
|
||||
"Password" { $hotelConfig["Password"] = $value }
|
||||
"Site URL" { $hotelConfig["SiteURL"] = $value }
|
||||
"Time zone" { $hotelConfig["TimeZone"] = $value }
|
||||
"Chain Code" { $hotelConfig["ChainCode"] = $value }
|
||||
"Hotel Code" { $hotelConfig["HotelCode"] = $value }
|
||||
"Domain" { $hotelConfig["Domain"] = $value }
|
||||
"Origin EntityID" { $hotelConfig["OriginEntityID"] = $value }
|
||||
"Origin SystemType" { $hotelConfig["OriginSystemType"] = $value }
|
||||
"Destination EntityID" { $hotelConfig["DestinationEntityID"] = $value }
|
||||
"Destination SystemType" { $hotelConfig["DestinationSystemType"] = $value }
|
||||
"Site Username" { $hotelConfig["SiteUsername"] = $value }
|
||||
"Site Password" { $hotelConfig["SitePassword"] = $value }
|
||||
"Cloud PMS" { $hotelConfig["CloudPMS"] = $value }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Save the hotel configuration to a JSON file
|
||||
$hotelConfig | ConvertTo-Json | Set-Content -Path "HotelConfig.json" -Encoding UTF8
|
||||
Write-Output "Hotel configuration saved to HotelConfig.json"
|
Loading…
x
Reference in New Issue
Block a user