From b2ddb7558cb73b3b7c15e1805ae387849bf10bb8 Mon Sep 17 00:00:00 2001 From: ychung-mot Date: Fri, 25 Oct 2024 10:17:55 -0700 Subject: [PATCH] chore: code refactoring --- server/StrDss.Common/Constants.cs | 397 +++++++++++------- server/StrDss.Service/RentalListingService.cs | 256 +++++++---- 2 files changed, 409 insertions(+), 244 deletions(-) diff --git a/server/StrDss.Common/Constants.cs b/server/StrDss.Common/Constants.cs index 54905928..c39c9c41 100644 --- a/server/StrDss.Common/Constants.cs +++ b/server/StrDss.Common/Constants.cs @@ -119,170 +119,255 @@ public static class PlatformFields public const string PlatformType = "PlatformType"; } + public static class CsvCols + { + public const string MostRecentPlatformReportMonth = "Most Recent Platform Report Month"; + public const string Status = "Status"; + public const string JurisdictionAssignedTo = "Jurisdiction assigned to"; + public const string EconomicRegionName = "economic_region_name"; + public const string PrRequirement = "pr_requirement"; + public const string BlRequirement = "BL_requirement"; + public const string PlatformCode = "Platform Code"; + public const string ListingId = "Listing ID"; + public const string UrlAddress = "URL Address"; + public const string PlatformListingAddress = "Platform listing address"; + public const string GeocoderBestMatchAddressComplete = "Geocoder Best match address (current month) - complete address"; + public const string GeocoderBestMatchAddressCity = "Geocoder Best match address (current month) -city only"; + public const string LocalGovernmentBusinessLicenceNumber = "Local Government Business Licence Number"; + public const string EntireUnit = "Entire Unit"; + public const string NumberOfBedroomsAvailableForStr = "Number of Bedrooms available for STR"; + public const string CurrentMonth = "Current Month"; + public const string NumberOfNightsBookedCurrentMonth = "Number of nights booked (Current month)"; + public const string NumberOfNightsBookedPreviousMonth1 = "Number of nights booked (Current month - 1)"; + public const string NumberOfNightsBookedPreviousMonth2 = "Number of nights booked (Current month - 2)"; + public const string NumberOfNightsBookedPreviousMonth3 = "Number of nights booked (Current month - 3)"; + public const string NumberOfNightsBookedPreviousMonth4 = "Number of nights booked (Current month - 4)"; + public const string NumberOfNightsBookedPreviousMonth5 = "Number of nights booked (Current month - 5)"; + public const string NumberOfNightsBookedPreviousMonth6 = "Number of nights booked (Current month - 6)"; + public const string NumberOfNightsBookedPreviousMonth7 = "Number of nights booked (Current month - 7)"; + public const string NumberOfNightsBookedPreviousMonth8 = "Number of nights booked (Current month - 8)"; + public const string NumberOfNightsBookedPreviousMonth9 = "Number of nights booked (Current month - 9)"; + public const string NumberOfNightsBookedPreviousMonth10 = "Number of nights booked (Current month - 10)"; + public const string NumberOfNightsBookedPreviousMonth11 = "Number of nights booked (Current month - 11)"; + public const string NumberOfSeparateReservationsCurrentMonth = "Number of separate reservations (Current month)"; + public const string NumberOfSeparateReservationsPreviousMonth1 = "Number of separate reservations (Current month - 1)"; + public const string NumberOfSeparateReservationsPreviousMonth2 = "Number of separate reservations (Current month - 2)"; + public const string NumberOfSeparateReservationsPreviousMonth3 = "Number of separate reservations (Current month - 3)"; + public const string NumberOfSeparateReservationsPreviousMonth4 = "Number of separate reservations (Current month - 4)"; + public const string NumberOfSeparateReservationsPreviousMonth5 = "Number of separate reservations (Current month - 5)"; + public const string NumberOfSeparateReservationsPreviousMonth6 = "Number of separate reservations (Current month - 6)"; + public const string NumberOfSeparateReservationsPreviousMonth7 = "Number of separate reservations (Current month - 7)"; + public const string NumberOfSeparateReservationsPreviousMonth8 = "Number of separate reservations (Current month - 8)"; + public const string NumberOfSeparateReservationsPreviousMonth9 = "Number of separate reservations (Current month - 9)"; + public const string NumberOfSeparateReservationsPreviousMonth10 = "Number of separate reservations (Current month - 10)"; + public const string NumberOfSeparateReservationsPreviousMonth11 = "Number of separate reservations (Current month - 11)"; + public const string PropertyHostName = "Property Host name"; + public const string PropertyHostEmailAddress = "Property Host email address"; + public const string PropertyHostPhoneNumber = "Property Host phone number"; + public const string PropertyHostFaxNumber = "Property Host fax number"; + public const string PropertyHostMailingAddress = "Property Host Mailing Address"; + public const string SupplierHost1Name = "Supplier Host 1 name"; + public const string SupplierHost1EmailAddress = "Supplier Host 1 email address"; + public const string SupplierHost1PhoneNumber = "Supplier Host 1 phone number"; + public const string SupplierHost1FaxNumber = "Supplier Host 1 fax number"; + public const string SupplierHost1MailingAddress = "Supplier Host 1 Mailing Address"; + public const string HostIdOfSupplierHost1 = "Host ID of Supplier Host 1"; + public const string SupplierHost2Name = "Supplier Host 2 name"; + public const string SupplierHost2EmailAddress = "Supplier Host 2 email address"; + public const string SupplierHost2PhoneNumber = "Supplier Host 2 phone number"; + public const string SupplierHost2FaxNumber = "Supplier Host 2 fax number"; + public const string SupplierHost2MailingAddress = "Supplier Host 2 Mailing Address"; + public const string HostIdOfSupplierHost2 = "Host ID of Supplier Host 2"; + public const string SupplierHost3Name = "Supplier Host 3 name"; + public const string SupplierHost3EmailAddress = "Supplier Host 3 email address"; + public const string SupplierHost3PhoneNumber = "Supplier Host 3 phone number"; + public const string SupplierHost3FaxNumber = "Supplier Host 3 fax number"; + public const string SupplierHost3MailingAddress = "Supplier Host 3 Mailing Address"; + public const string HostIdOfSupplierHost3 = "Host ID of Supplier Host 3"; + public const string SupplierHost4Name = "Supplier Host 4 name"; + public const string SupplierHost4EmailAddress = "Supplier Host 4 email address"; + public const string SupplierHost4PhoneNumber = "Supplier Host 4 phone number"; + public const string SupplierHost4FaxNumber = "Supplier Host 4 fax number"; + public const string SupplierHost4MailingAddress = "Supplier Host 4 Mailing Address"; + public const string HostIdOfSupplierHost4 = "Host ID of Supplier Host 4"; + public const string SupplierHost5Name = "Supplier Host 5 name"; + public const string SupplierHost5EmailAddress = "Supplier Host 5 email address"; + public const string SupplierHost5PhoneNumber = "Supplier Host 5 phone number"; + public const string SupplierHost5FaxNumber = "Supplier Host 5 fax number"; + public const string SupplierHost5MailingAddress = "Supplier Host 5 Mailing Address"; + public const string HostIdOfSupplierHost5 = "Host ID of Supplier Host 5"; + public const string LastActionTaken = "Last Action Taken"; + public const string DateOfLastActionTaken = "Date of Last Action Taken"; + public const string PreviousActionTaken1 = "Previous Action Taken 1"; + public const string DateOfPreviousActionTaken1 = "Date of Previous Action Taken 1"; + public const string PreviousActionTaken2 = "Previous Action Taken 2"; + public const string DateOfPreviousActionTaken2 = "Date of Previous Action Taken 2"; + } + public static class RentalListingExport { public static readonly string[] Headers = new string[] { - "Most Recent Platform Report Month", - "Status", - "Jurisdiction assigned to", - "economic_region_name", - "pr_requirement", - "BL_requirement", - "Platform Code", - "Listing ID", - "URL Address", - "Platform listing address", - "Geocoder Best match address (current month) - complete address", - "Geocoder Best match address (current month) -city only", - "Local Government Business Licence Number", - "Entire Unit", - "Number of Bedrooms available for STR", - "Current Month", - "Number of nights booked (Current month)", - "Number of nights booked (Current month - 1)", - "Number of nights booked (Current month - 2)", - "Number of nights booked (Current month - 3)", - "Number of nights booked (Current month - 4)", - "Number of nights booked (Current month - 5)", - "Number of nights booked (Current month - 6)", - "Number of nights booked (Current month - 7)", - "Number of nights booked (Current month - 8)", - "Number of nights booked (Current month - 9)", - "Number of nights booked (Current month - 10)", - "Number of nights booked (Current month - 11)", - "Number of separate reservations (Current month)", - "Number of separate reservations (Current month - 1)", - "Number of separate reservations (Current month - 2)", - "Number of separate reservations (Current month - 3)", - "Number of separate reservations (Current month - 4)", - "Number of separate reservations (Current month - 5)", - "Number of separate reservations (Current month - 6)", - "Number of separate reservations (Current month - 7)", - "Number of separate reservations (Current month - 8)", - "Number of separate reservations (Current month - 9)", - "Number of separate reservations (Current month - 10)", - "Number of separate reservations (Current month - 11)", - "Property Host name", - "Property Host email address", - "Property Host phone number", - "Property Host fax number", - "Property Host Mailing Address", - "Supplier Host 1 name", - "Supplier Host 1 email address", - "Supplier Host 1 phone number", - "Supplier Host 1 fax number", - "Supplier Host 1 Mailing Address", - "Host ID of Supplier Host 1", - "Supplier Host 2 name", - "Supplier Host 2 email address", - "Supplier Host 2 phone number", - "Supplier Host 2 fax number", - "Supplier Host 2 Mailing Address", - "Host ID of Supplier Host 2", - "Supplier Host 3 name", - "Supplier Host 3 email address", - "Supplier Host 3 phone number", - "Supplier Host 3 fax number", - "Supplier Host 3 Mailing Address", - "Host ID of Supplier Host 3", - "Supplier Host 4 name", - "Supplier Host 4 email address", - "Supplier Host 4 phone number", - "Supplier Host 4 fax number", - "Supplier Host 4 Mailing Address", - "Host ID of Supplier Host 4", - "Supplier Host 5 name", - "Supplier Host 5 email address", - "Supplier Host 5 phone number", - "Supplier Host 5 fax number", - "Supplier Host 5 Mailing Address", - "Host ID of Supplier Host 5", - "Last Action Taken", - "Date of Last Action Taken", - "Previous Action Taken 1", - "Date of Previous Action Taken 1", - "Previous Action Taken 2", - "Date of Previous Action Taken 2" + CsvCols.MostRecentPlatformReportMonth, + CsvCols.Status, + CsvCols.JurisdictionAssignedTo, + CsvCols.EconomicRegionName, + CsvCols.PrRequirement, + CsvCols.BlRequirement, + CsvCols.PlatformCode, + CsvCols.ListingId, + CsvCols.UrlAddress, + CsvCols.PlatformListingAddress, + CsvCols.GeocoderBestMatchAddressComplete, + CsvCols.GeocoderBestMatchAddressCity, + CsvCols.LocalGovernmentBusinessLicenceNumber, + CsvCols.EntireUnit, + CsvCols.NumberOfBedroomsAvailableForStr, + CsvCols.CurrentMonth, + CsvCols.NumberOfNightsBookedCurrentMonth, + CsvCols.NumberOfNightsBookedPreviousMonth1, + CsvCols.NumberOfNightsBookedPreviousMonth2, + CsvCols.NumberOfNightsBookedPreviousMonth3, + CsvCols.NumberOfNightsBookedPreviousMonth4, + CsvCols.NumberOfNightsBookedPreviousMonth5, + CsvCols.NumberOfNightsBookedPreviousMonth6, + CsvCols.NumberOfNightsBookedPreviousMonth7, + CsvCols.NumberOfNightsBookedPreviousMonth8, + CsvCols.NumberOfNightsBookedPreviousMonth9, + CsvCols.NumberOfNightsBookedPreviousMonth10, + CsvCols.NumberOfNightsBookedPreviousMonth11, + CsvCols.NumberOfSeparateReservationsCurrentMonth, + CsvCols.NumberOfSeparateReservationsPreviousMonth1, + CsvCols.NumberOfSeparateReservationsPreviousMonth2, + CsvCols.NumberOfSeparateReservationsPreviousMonth3, + CsvCols.NumberOfSeparateReservationsPreviousMonth4, + CsvCols.NumberOfSeparateReservationsPreviousMonth5, + CsvCols.NumberOfSeparateReservationsPreviousMonth6, + CsvCols.NumberOfSeparateReservationsPreviousMonth7, + CsvCols.NumberOfSeparateReservationsPreviousMonth8, + CsvCols.NumberOfSeparateReservationsPreviousMonth9, + CsvCols.NumberOfSeparateReservationsPreviousMonth10, + CsvCols.NumberOfSeparateReservationsPreviousMonth11, + CsvCols.PropertyHostName, + CsvCols.PropertyHostEmailAddress, + CsvCols.PropertyHostPhoneNumber, + CsvCols.PropertyHostFaxNumber, + CsvCols.PropertyHostMailingAddress, + CsvCols.SupplierHost1Name, + CsvCols.SupplierHost1EmailAddress, + CsvCols.SupplierHost1PhoneNumber, + CsvCols.SupplierHost1FaxNumber, + CsvCols.SupplierHost1MailingAddress, + CsvCols.HostIdOfSupplierHost1, + CsvCols.SupplierHost2Name, + CsvCols.SupplierHost2EmailAddress, + CsvCols.SupplierHost2PhoneNumber, + CsvCols.SupplierHost2FaxNumber, + CsvCols.SupplierHost2MailingAddress, + CsvCols.HostIdOfSupplierHost2, + CsvCols.SupplierHost3Name, + CsvCols.SupplierHost3EmailAddress, + CsvCols.SupplierHost3PhoneNumber, + CsvCols.SupplierHost3FaxNumber, + CsvCols.SupplierHost3MailingAddress, + CsvCols.HostIdOfSupplierHost3, + CsvCols.SupplierHost4Name, + CsvCols.SupplierHost4EmailAddress, + CsvCols.SupplierHost4PhoneNumber, + CsvCols.SupplierHost4FaxNumber, + CsvCols.SupplierHost4MailingAddress, + CsvCols.HostIdOfSupplierHost4, + CsvCols.SupplierHost5Name, + CsvCols.SupplierHost5EmailAddress, + CsvCols.SupplierHost5PhoneNumber, + CsvCols.SupplierHost5FaxNumber, + CsvCols.SupplierHost5MailingAddress, + CsvCols.HostIdOfSupplierHost5, + CsvCols.LastActionTaken, + CsvCols.DateOfLastActionTaken, + CsvCols.PreviousActionTaken1, + CsvCols.DateOfPreviousActionTaken1, + CsvCols.PreviousActionTaken2, + CsvCols.DateOfPreviousActionTaken2, }; public static readonly string[] FinHeaders = new string[] { - "Most Recent Platform Report Month", - "Status", - "Jurisdiction assigned to", - "economic_region_name", - "pr_requirement", - "BL_requirement", - "Platform Code", - "Listing ID", - "URL Address", - "Platform listing address", - "Geocoder Best match address (current month) - complete address", - "Geocoder Best match address (current month) -city only", - "Local Government Business Licence Number", - "Entire Unit", - "Number of Bedrooms available for STR", - "Current Month", - "Number of nights booked (Current month)", - "Number of nights booked (Current month - 1)", - "Number of nights booked (Current month - 2)", - "Number of nights booked (Current month - 3)", - "Number of nights booked (Current month - 4)", - "Number of nights booked (Current month - 5)", - "Number of nights booked (Current month - 6)", - "Number of nights booked (Current month - 7)", - "Number of nights booked (Current month - 8)", - "Number of nights booked (Current month - 9)", - "Number of nights booked (Current month - 10)", - "Number of nights booked (Current month - 11)", - "Number of separate reservations (Current month)", - "Number of separate reservations (Current month - 1)", - "Number of separate reservations (Current month - 2)", - "Number of separate reservations (Current month - 3)", - "Number of separate reservations (Current month - 4)", - "Number of separate reservations (Current month - 5)", - "Number of separate reservations (Current month - 6)", - "Number of separate reservations (Current month - 7)", - "Number of separate reservations (Current month - 8)", - "Number of separate reservations (Current month - 9)", - "Number of separate reservations (Current month - 10)", - "Number of separate reservations (Current month - 11)", - "Property Host name", - "Property Host email address", - "Property Host phone number", - "Property Host fax number", - "Property Host Mailing Address", - "Supplier Host 1 name", - "Supplier Host 1 email address", - "Supplier Host 1 phone number", - "Supplier Host 1 fax number", - "Supplier Host 1 Mailing Address", - "Host ID of Supplier Host 1", - "Supplier Host 2 name", - "Supplier Host 2 email address", - "Supplier Host 2 phone number", - "Supplier Host 2 fax number", - "Supplier Host 2 Mailing Address", - "Host ID of Supplier Host 2", - "Supplier Host 3 name", - "Supplier Host 3 email address", - "Supplier Host 3 phone number", - "Supplier Host 3 fax number", - "Supplier Host 3 Mailing Address", - "Host ID of Supplier Host 3", - "Supplier Host 4 name", - "Supplier Host 4 email address", - "Supplier Host 4 phone number", - "Supplier Host 4 fax number", - "Supplier Host 4 Mailing Address", - "Host ID of Supplier Host 4", - "Supplier Host 5 name", - "Supplier Host 5 email address", - "Supplier Host 5 phone number", - "Supplier Host 5 fax number", - "Supplier Host 5 Mailing Address", - "Host ID of Supplier Host 5" + CsvCols.MostRecentPlatformReportMonth, + CsvCols.Status, + CsvCols.JurisdictionAssignedTo, + CsvCols.EconomicRegionName, + CsvCols.PrRequirement, + CsvCols.BlRequirement, + CsvCols.PlatformCode, + CsvCols.ListingId, + CsvCols.UrlAddress, + CsvCols.PlatformListingAddress, + CsvCols.GeocoderBestMatchAddressComplete, + CsvCols.GeocoderBestMatchAddressCity, + CsvCols.LocalGovernmentBusinessLicenceNumber, + CsvCols.EntireUnit, + CsvCols.NumberOfBedroomsAvailableForStr, + CsvCols.CurrentMonth, + CsvCols.NumberOfNightsBookedCurrentMonth, + CsvCols.NumberOfNightsBookedPreviousMonth1, + CsvCols.NumberOfNightsBookedPreviousMonth2, + CsvCols.NumberOfNightsBookedPreviousMonth3, + CsvCols.NumberOfNightsBookedPreviousMonth4, + CsvCols.NumberOfNightsBookedPreviousMonth5, + CsvCols.NumberOfNightsBookedPreviousMonth6, + CsvCols.NumberOfNightsBookedPreviousMonth7, + CsvCols.NumberOfNightsBookedPreviousMonth8, + CsvCols.NumberOfNightsBookedPreviousMonth9, + CsvCols.NumberOfNightsBookedPreviousMonth10, + CsvCols.NumberOfNightsBookedPreviousMonth11, + CsvCols.NumberOfSeparateReservationsCurrentMonth, + CsvCols.NumberOfSeparateReservationsPreviousMonth1, + CsvCols.NumberOfSeparateReservationsPreviousMonth2, + CsvCols.NumberOfSeparateReservationsPreviousMonth3, + CsvCols.NumberOfSeparateReservationsPreviousMonth4, + CsvCols.NumberOfSeparateReservationsPreviousMonth5, + CsvCols.NumberOfSeparateReservationsPreviousMonth6, + CsvCols.NumberOfSeparateReservationsPreviousMonth7, + CsvCols.NumberOfSeparateReservationsPreviousMonth8, + CsvCols.NumberOfSeparateReservationsPreviousMonth9, + CsvCols.NumberOfSeparateReservationsPreviousMonth10, + CsvCols.NumberOfSeparateReservationsPreviousMonth11, + CsvCols.PropertyHostName, + CsvCols.PropertyHostEmailAddress, + CsvCols.PropertyHostPhoneNumber, + CsvCols.PropertyHostFaxNumber, + CsvCols.PropertyHostMailingAddress, + CsvCols.SupplierHost1Name, + CsvCols.SupplierHost1EmailAddress, + CsvCols.SupplierHost1PhoneNumber, + CsvCols.SupplierHost1FaxNumber, + CsvCols.SupplierHost1MailingAddress, + CsvCols.HostIdOfSupplierHost1, + CsvCols.SupplierHost2Name, + CsvCols.SupplierHost2EmailAddress, + CsvCols.SupplierHost2PhoneNumber, + CsvCols.SupplierHost2FaxNumber, + CsvCols.SupplierHost2MailingAddress, + CsvCols.HostIdOfSupplierHost2, + CsvCols.SupplierHost3Name, + CsvCols.SupplierHost3EmailAddress, + CsvCols.SupplierHost3PhoneNumber, + CsvCols.SupplierHost3FaxNumber, + CsvCols.SupplierHost3MailingAddress, + CsvCols.HostIdOfSupplierHost3, + CsvCols.SupplierHost4Name, + CsvCols.SupplierHost4EmailAddress, + CsvCols.SupplierHost4PhoneNumber, + CsvCols.SupplierHost4FaxNumber, + CsvCols.SupplierHost4MailingAddress, + CsvCols.HostIdOfSupplierHost4, + CsvCols.SupplierHost5Name, + CsvCols.SupplierHost5EmailAddress, + CsvCols.SupplierHost5PhoneNumber, + CsvCols.SupplierHost5FaxNumber, + CsvCols.SupplierHost5MailingAddress, + CsvCols.HostIdOfSupplierHost5, }; public static string GetHeadersAsCsv() diff --git a/server/StrDss.Service/RentalListingService.cs b/server/StrDss.Service/RentalListingService.cs index 40107be0..bdbd0ff7 100644 --- a/server/StrDss.Service/RentalListingService.cs +++ b/server/StrDss.Service/RentalListingService.cs @@ -181,8 +181,8 @@ public async Task CreateRentalListingExportFiles() lgExport = InitializeExport(headers); } - var line = ToCsvString(listing); - var finLine = ToCsvString(listing, true); + var line = ToCsvString(listing, RentalListingExport.Headers); + var finLine = ToCsvString(listing, RentalListingExport.FinHeaders); lgExport.Add(line); allExport.Add(line); @@ -254,95 +254,175 @@ private async Task CreateFinalExports(List allExport, List finEx await ProcessExportForLocalGovernment(lgExport, lgId, lg); } - private static string ToCsvString(RentalListingExportDto listing, bool isFin = false) + private static string ToCsvString(RentalListingExportDto listing, string[] headers) { var builder = new StringBuilder(); - builder.Append(FormatCsvField(listing.LatestReportPeriodYm)).Append(','); // Most Recent Platform Report Month - builder.Append(FormatCsvField(listing.ListingStatusTypeNm)).Append(','); // Status - builder.Append(FormatCsvField(listing.ManagingOrganizationNm)).Append(','); // Jurisdiction assigned to - builder.Append(FormatCsvField(listing.EconomicRegionDsc)).Append(','); // economic_region_name - builder.Append(FormatCsvField(listing.IsPrincipalResidenceRequired)).Append(','); // pr_requirement - builder.Append(FormatCsvField(listing.IsBusinessLicenceRequired)).Append(','); // BL_requirement - builder.Append(FormatCsvField(listing.OfferingOrganizationCd)).Append(','); // Platform Code - builder.Append(FormatCsvField(listing.PlatformListingNo)).Append(','); // Listing ID - builder.Append(FormatCsvField(listing.PlatformListingUrl)).Append(','); // URL Address - builder.Append(FormatCsvField(listing.OriginalAddressTxt)).Append(','); // Platform listing address - builder.Append(FormatCsvField(listing.MatchAddressTxt)).Append(','); // Geocoder Best match address (current month) - complete address - builder.Append(FormatCsvField(listing.AddressSort2LocalityNm)).Append(','); // Geocoder Best match address (current month) -city only - builder.Append(FormatCsvField(listing.BusinessLicenceNo)).Append(','); // Local Government Business Licence Number - builder.Append(FormatCsvField(listing.IsEntireUnit)).Append(','); // Accommodation Type - builder.Append(FormatCsvField(listing.AvailableBedroomsQty)).Append(','); // Number of Bedrooms available for STR - builder.Append(FormatCsvField(listing.CurrentMonth)).Append(','); // Current Month - builder.Append(FormatCsvField(listing.NightsBookedQty00)).Append(','); // Number of nights booked (Current month) - builder.Append(FormatCsvField(listing.NightsBookedQty01)).Append(','); // Number of nights booked (Current month - 1) - builder.Append(FormatCsvField(listing.NightsBookedQty02)).Append(','); // Number of nights booked (Current month - 2) - builder.Append(FormatCsvField(listing.NightsBookedQty03)).Append(','); // Number of nights booked (Current month - 3) - builder.Append(FormatCsvField(listing.NightsBookedQty04)).Append(','); // Number of nights booked (Current month - 4) - builder.Append(FormatCsvField(listing.NightsBookedQty05)).Append(','); // Number of nights booked (Current month - 5) - builder.Append(FormatCsvField(listing.NightsBookedQty06)).Append(','); // Number of nights booked (Current month - 6) - builder.Append(FormatCsvField(listing.NightsBookedQty07)).Append(','); // Number of nights booked (Current month - 7) - builder.Append(FormatCsvField(listing.NightsBookedQty08)).Append(','); // Number of nights booked (Current month - 8) - builder.Append(FormatCsvField(listing.NightsBookedQty09)).Append(','); // Number of nights booked (Current month - 9) - builder.Append(FormatCsvField(listing.NightsBookedQty10)).Append(','); // Number of nights booked (Current month - 10) - builder.Append(FormatCsvField(listing.NightsBookedQty11)).Append(','); // Number of nights booked (Current month - 11) - builder.Append(FormatCsvField(listing.SeparateReservationsQty00)).Append(','); // Number of separate reservations (Current month) - builder.Append(FormatCsvField(listing.SeparateReservationsQty01)).Append(','); // Number of separate reservations (Current month - 1) - builder.Append(FormatCsvField(listing.SeparateReservationsQty02)).Append(','); // Number of separate reservations (Current month - 2) - builder.Append(FormatCsvField(listing.SeparateReservationsQty03)).Append(','); // Number of separate reservations (Current month - 3) - builder.Append(FormatCsvField(listing.SeparateReservationsQty04)).Append(','); // Number of separate reservations (Current month - 4) - builder.Append(FormatCsvField(listing.SeparateReservationsQty05)).Append(','); // Number of separate reservations (Current month - 5) - builder.Append(FormatCsvField(listing.SeparateReservationsQty06)).Append(','); // Number of separate reservations (Current month - 6) - builder.Append(FormatCsvField(listing.SeparateReservationsQty07)).Append(','); // Number of separate reservations (Current month - 7) - builder.Append(FormatCsvField(listing.SeparateReservationsQty08)).Append(','); // Number of separate reservations (Current month - 8) - builder.Append(FormatCsvField(listing.SeparateReservationsQty09)).Append(','); // Number of separate reservations (Current month - 9) - builder.Append(FormatCsvField(listing.SeparateReservationsQty10)).Append(','); // Number of separate reservations (Current month - 10) - builder.Append(FormatCsvField(listing.SeparateReservationsQty11)).Append(','); // Number of separate reservations (Current month - 11) - builder.Append(FormatCsvField(listing.PropertyHostName)).Append(','); // Property Host name - builder.Append(FormatCsvField(listing.PropertyHostEmail)).Append(','); // Property Host email address - builder.Append(FormatCsvField(listing.PropertyHostPhoneNumber)).Append(','); // Property Host phone number - builder.Append(FormatCsvField(listing.PropertyHostFaxNumber)).Append(','); // Property Host fax number - builder.Append(FormatCsvField(listing.PropertyHostMailingAddress)).Append(','); // Property Host Mailing Address - builder.Append(FormatCsvField(listing.SupplierHost1Name)).Append(','); // Supplier Host 1 name - builder.Append(FormatCsvField(listing.SupplierHost1Email)).Append(','); // Supplier Host 1 email address - builder.Append(FormatCsvField(listing.SupplierHost1PhoneNumber)).Append(','); // Supplier Host 1 phone number - builder.Append(FormatCsvField(listing.SupplierHost1FaxNumber)).Append(','); // Supplier Host 1 fax number - builder.Append(FormatCsvField(listing.SupplierHost1MailingAddress)).Append(','); // Supplier Host 1 Mailing Address - builder.Append(FormatCsvField(listing.SupplierHost1Id)).Append(','); // Host ID of Supplier Host 1 - builder.Append(FormatCsvField(listing.SupplierHost2Name)).Append(','); // Supplier Host 2 name - builder.Append(FormatCsvField(listing.SupplierHost2Email)).Append(','); // Supplier Host 2 email address - builder.Append(FormatCsvField(listing.SupplierHost2PhoneNumber)).Append(','); // Supplier Host 2 phone number - builder.Append(FormatCsvField(listing.SupplierHost2FaxNumber)).Append(','); // Supplier Host 2 fax number - builder.Append(FormatCsvField(listing.SupplierHost2MailingAddress)).Append(','); // Supplier Host 2 Mailing Address - builder.Append(FormatCsvField(listing.SupplierHost2Id)).Append(','); // Host ID of Supplier Host 2 - builder.Append(FormatCsvField(listing.SupplierHost3Name)).Append(','); // Supplier Host 3 name - builder.Append(FormatCsvField(listing.SupplierHost3Email)).Append(','); // Supplier Host 3 email address - builder.Append(FormatCsvField(listing.SupplierHost3PhoneNumber)).Append(','); // Supplier Host 3 phone number - builder.Append(FormatCsvField(listing.SupplierHost3FaxNumber)).Append(','); // Supplier Host 3 fax number - builder.Append(FormatCsvField(listing.SupplierHost3MailingAddress)).Append(','); // Supplier Host 3 Mailing Address - builder.Append(FormatCsvField(listing.SupplierHost3Id)).Append(','); // Host ID of Supplier Host 3 - builder.Append(FormatCsvField(listing.SupplierHost4Name)).Append(','); // Supplier Host 4 name - builder.Append(FormatCsvField(listing.SupplierHost4Email)).Append(','); // Supplier Host 4 email address - builder.Append(FormatCsvField(listing.SupplierHost4PhoneNumber)).Append(','); // Supplier Host 4 phone number - builder.Append(FormatCsvField(listing.SupplierHost4FaxNumber)).Append(','); // Supplier Host 4 fax number - builder.Append(FormatCsvField(listing.SupplierHost4MailingAddress)).Append(','); // Supplier Host 4 Mailing Address - builder.Append(FormatCsvField(listing.SupplierHost4Id)).Append(','); // Host ID of Supplier Host 4 - builder.Append(FormatCsvField(listing.SupplierHost5Name)).Append(','); // Supplier Host 5 name - builder.Append(FormatCsvField(listing.SupplierHost5Email)).Append(','); // Supplier Host 5 email address - builder.Append(FormatCsvField(listing.SupplierHost5PhoneNumber)).Append(','); // Supplier Host 5 phone number - builder.Append(FormatCsvField(listing.SupplierHost5FaxNumber)).Append(','); // Supplier Host 5 fax number - builder.Append(FormatCsvField(listing.SupplierHost5MailingAddress)).Append(','); // Supplier Host 5 Mailing Address - builder.Append(FormatCsvField(listing.SupplierHost5Id)).Append(','); // Host ID of Supplier Host 5 - - if (!isFin) - { - builder.Append(FormatCsvField(listing.LastActionNm)).Append(','); // Last Action Taken - builder.Append(FormatCsvField(listing.LastActionDtm)).Append(','); // Date of Last Action Taken - builder.Append(FormatCsvField(listing.LastActionNm1)).Append(','); // Last Action Taken 1 - builder.Append(FormatCsvField(listing.LastActionDtm1)).Append(','); // Date of Last Action Taken 1 - builder.Append(FormatCsvField(listing.LastActionNm2)).Append(','); // Previous Action Taken 2 - builder.Append(FormatCsvField(listing.LastActionDtm2)); // Date of Previous Action Taken 2 - } + if (headers.Contains(CsvCols.MostRecentPlatformReportMonth)) + builder.Append(FormatCsvField(listing.LatestReportPeriodYm)).Append(','); + if (headers.Contains(CsvCols.Status)) + builder.Append(FormatCsvField(listing.ListingStatusTypeNm)).Append(','); + if (headers.Contains(CsvCols.JurisdictionAssignedTo)) + builder.Append(FormatCsvField(listing.ManagingOrganizationNm)).Append(','); + if (headers.Contains(CsvCols.EconomicRegionName)) + builder.Append(FormatCsvField(listing.EconomicRegionDsc)).Append(','); + if (headers.Contains(CsvCols.PrRequirement)) + builder.Append(FormatCsvField(listing.IsPrincipalResidenceRequired)).Append(','); + if (headers.Contains(CsvCols.BlRequirement)) + builder.Append(FormatCsvField(listing.IsBusinessLicenceRequired)).Append(','); + if (headers.Contains(CsvCols.PlatformCode)) + builder.Append(FormatCsvField(listing.OfferingOrganizationCd)).Append(','); + if (headers.Contains(CsvCols.ListingId)) + builder.Append(FormatCsvField(listing.PlatformListingNo)).Append(','); + if (headers.Contains(CsvCols.UrlAddress)) + builder.Append(FormatCsvField(listing.PlatformListingUrl)).Append(','); + if (headers.Contains(CsvCols.PlatformListingAddress)) + builder.Append(FormatCsvField(listing.OriginalAddressTxt)).Append(','); + if (headers.Contains(CsvCols.GeocoderBestMatchAddressComplete)) + builder.Append(FormatCsvField(listing.MatchAddressTxt)).Append(','); + if (headers.Contains(CsvCols.GeocoderBestMatchAddressCity)) + builder.Append(FormatCsvField(listing.AddressSort2LocalityNm)).Append(','); + if (headers.Contains(CsvCols.LocalGovernmentBusinessLicenceNumber)) + builder.Append(FormatCsvField(listing.BusinessLicenceNo)).Append(','); + if (headers.Contains(CsvCols.EntireUnit)) + builder.Append(FormatCsvField(listing.IsEntireUnit)).Append(','); + if (headers.Contains(CsvCols.NumberOfBedroomsAvailableForStr)) + builder.Append(FormatCsvField(listing.AvailableBedroomsQty)).Append(','); + if (headers.Contains(CsvCols.CurrentMonth)) + builder.Append(FormatCsvField(listing.CurrentMonth)).Append(','); + if (headers.Contains(CsvCols.NumberOfNightsBookedCurrentMonth)) + builder.Append(FormatCsvField(listing.NightsBookedQty00)).Append(','); + if (headers.Contains(CsvCols.NumberOfNightsBookedPreviousMonth1)) + builder.Append(FormatCsvField(listing.NightsBookedQty01)).Append(','); + if (headers.Contains(CsvCols.NumberOfNightsBookedPreviousMonth2)) + builder.Append(FormatCsvField(listing.NightsBookedQty02)).Append(','); + if (headers.Contains(CsvCols.NumberOfNightsBookedPreviousMonth3)) + builder.Append(FormatCsvField(listing.NightsBookedQty03)).Append(','); + if (headers.Contains(CsvCols.NumberOfNightsBookedPreviousMonth4)) + builder.Append(FormatCsvField(listing.NightsBookedQty04)).Append(','); + if (headers.Contains(CsvCols.NumberOfNightsBookedPreviousMonth5)) + builder.Append(FormatCsvField(listing.NightsBookedQty05)).Append(','); + if (headers.Contains(CsvCols.NumberOfNightsBookedPreviousMonth6)) + builder.Append(FormatCsvField(listing.NightsBookedQty06)).Append(','); + if (headers.Contains(CsvCols.NumberOfNightsBookedPreviousMonth7)) + builder.Append(FormatCsvField(listing.NightsBookedQty07)).Append(','); + if (headers.Contains(CsvCols.NumberOfNightsBookedPreviousMonth8)) + builder.Append(FormatCsvField(listing.NightsBookedQty08)).Append(','); + if (headers.Contains(CsvCols.NumberOfNightsBookedPreviousMonth9)) + builder.Append(FormatCsvField(listing.NightsBookedQty09)).Append(','); + if (headers.Contains(CsvCols.NumberOfNightsBookedPreviousMonth10)) + builder.Append(FormatCsvField(listing.NightsBookedQty10)).Append(','); + if (headers.Contains(CsvCols.NumberOfNightsBookedPreviousMonth11)) + builder.Append(FormatCsvField(listing.NightsBookedQty11)).Append(','); + if (headers.Contains(CsvCols.NumberOfSeparateReservationsCurrentMonth)) + builder.Append(FormatCsvField(listing.SeparateReservationsQty00)).Append(','); + if (headers.Contains(CsvCols.NumberOfSeparateReservationsPreviousMonth1)) + builder.Append(FormatCsvField(listing.SeparateReservationsQty01)).Append(','); + if (headers.Contains(CsvCols.NumberOfSeparateReservationsPreviousMonth2)) + builder.Append(FormatCsvField(listing.SeparateReservationsQty02)).Append(','); + if (headers.Contains(CsvCols.NumberOfSeparateReservationsPreviousMonth3)) + builder.Append(FormatCsvField(listing.SeparateReservationsQty03)).Append(','); + if (headers.Contains(CsvCols.NumberOfSeparateReservationsPreviousMonth4)) + builder.Append(FormatCsvField(listing.SeparateReservationsQty04)).Append(','); + if (headers.Contains(CsvCols.NumberOfSeparateReservationsPreviousMonth5)) + builder.Append(FormatCsvField(listing.SeparateReservationsQty05)).Append(','); + if (headers.Contains(CsvCols.NumberOfSeparateReservationsPreviousMonth6)) + builder.Append(FormatCsvField(listing.SeparateReservationsQty06)).Append(','); + if (headers.Contains(CsvCols.NumberOfSeparateReservationsPreviousMonth7)) + builder.Append(FormatCsvField(listing.SeparateReservationsQty07)).Append(','); + if (headers.Contains(CsvCols.NumberOfSeparateReservationsPreviousMonth8)) + builder.Append(FormatCsvField(listing.SeparateReservationsQty08)).Append(','); + if (headers.Contains(CsvCols.NumberOfSeparateReservationsPreviousMonth9)) + builder.Append(FormatCsvField(listing.SeparateReservationsQty09)).Append(','); + if (headers.Contains(CsvCols.NumberOfSeparateReservationsPreviousMonth10)) + builder.Append(FormatCsvField(listing.SeparateReservationsQty10)).Append(','); + if (headers.Contains(CsvCols.NumberOfSeparateReservationsPreviousMonth11)) + builder.Append(FormatCsvField(listing.SeparateReservationsQty11)).Append(','); + if (headers.Contains(CsvCols.PropertyHostName)) + builder.Append(FormatCsvField(listing.PropertyHostName)).Append(','); + if (headers.Contains(CsvCols.PropertyHostEmailAddress)) + builder.Append(FormatCsvField(listing.PropertyHostEmail)).Append(','); + if (headers.Contains(CsvCols.PropertyHostPhoneNumber)) + builder.Append(FormatCsvField(listing.PropertyHostPhoneNumber)).Append(','); + if (headers.Contains(CsvCols.PropertyHostFaxNumber)) + builder.Append(FormatCsvField(listing.PropertyHostFaxNumber)).Append(','); + if (headers.Contains(CsvCols.PropertyHostMailingAddress)) + builder.Append(FormatCsvField(listing.PropertyHostMailingAddress)).Append(','); + if (headers.Contains(CsvCols.SupplierHost1Name)) + builder.Append(FormatCsvField(listing.SupplierHost1Name)).Append(','); + if (headers.Contains(CsvCols.SupplierHost1EmailAddress)) + builder.Append(FormatCsvField(listing.SupplierHost1Email)).Append(','); + if (headers.Contains(CsvCols.SupplierHost1PhoneNumber)) + builder.Append(FormatCsvField(listing.SupplierHost1PhoneNumber)).Append(','); + if (headers.Contains(CsvCols.SupplierHost1FaxNumber)) + builder.Append(FormatCsvField(listing.SupplierHost1FaxNumber)).Append(','); + if (headers.Contains(CsvCols.SupplierHost1MailingAddress)) + builder.Append(FormatCsvField(listing.SupplierHost1MailingAddress)).Append(','); + if (headers.Contains(CsvCols.HostIdOfSupplierHost1)) + builder.Append(FormatCsvField(listing.SupplierHost1Id)).Append(','); + if (headers.Contains(CsvCols.SupplierHost2Name)) + builder.Append(FormatCsvField(listing.SupplierHost2Name)).Append(','); + if (headers.Contains(CsvCols.SupplierHost2EmailAddress)) + builder.Append(FormatCsvField(listing.SupplierHost2Email)).Append(','); + if (headers.Contains(CsvCols.SupplierHost2PhoneNumber)) + builder.Append(FormatCsvField(listing.SupplierHost2PhoneNumber)).Append(','); + if (headers.Contains(CsvCols.SupplierHost2FaxNumber)) + builder.Append(FormatCsvField(listing.SupplierHost2FaxNumber)).Append(','); + if (headers.Contains(CsvCols.SupplierHost2MailingAddress)) + builder.Append(FormatCsvField(listing.SupplierHost2MailingAddress)).Append(','); + if (headers.Contains(CsvCols.HostIdOfSupplierHost2)) + builder.Append(FormatCsvField(listing.SupplierHost2Id)).Append(','); + if (headers.Contains(CsvCols.SupplierHost3Name)) + builder.Append(FormatCsvField(listing.SupplierHost3Name)).Append(','); + if (headers.Contains(CsvCols.SupplierHost3EmailAddress)) + builder.Append(FormatCsvField(listing.SupplierHost3Email)).Append(','); + if (headers.Contains(CsvCols.SupplierHost3PhoneNumber)) + builder.Append(FormatCsvField(listing.SupplierHost3PhoneNumber)).Append(','); + if (headers.Contains(CsvCols.SupplierHost3FaxNumber)) + builder.Append(FormatCsvField(listing.SupplierHost3FaxNumber)).Append(','); + if (headers.Contains(CsvCols.SupplierHost3MailingAddress)) + builder.Append(FormatCsvField(listing.SupplierHost3MailingAddress)).Append(','); + if (headers.Contains(CsvCols.HostIdOfSupplierHost3)) + builder.Append(FormatCsvField(listing.SupplierHost3Id)).Append(','); + if (headers.Contains(CsvCols.SupplierHost4Name)) + builder.Append(FormatCsvField(listing.SupplierHost4Name)).Append(','); + if (headers.Contains(CsvCols.SupplierHost4EmailAddress)) + builder.Append(FormatCsvField(listing.SupplierHost4Email)).Append(','); + if (headers.Contains(CsvCols.SupplierHost4PhoneNumber)) + builder.Append(FormatCsvField(listing.SupplierHost4PhoneNumber)).Append(','); + if (headers.Contains(CsvCols.SupplierHost4FaxNumber)) + builder.Append(FormatCsvField(listing.SupplierHost4FaxNumber)).Append(','); + if (headers.Contains(CsvCols.SupplierHost4MailingAddress)) + builder.Append(FormatCsvField(listing.SupplierHost4MailingAddress)).Append(','); + if (headers.Contains(CsvCols.HostIdOfSupplierHost4)) + builder.Append(FormatCsvField(listing.SupplierHost4Id)).Append(','); + if (headers.Contains(CsvCols.SupplierHost5Name)) + builder.Append(FormatCsvField(listing.SupplierHost5Name)).Append(','); + if (headers.Contains(CsvCols.SupplierHost5EmailAddress)) + builder.Append(FormatCsvField(listing.SupplierHost5Email)).Append(','); + if (headers.Contains(CsvCols.SupplierHost5PhoneNumber)) + builder.Append(FormatCsvField(listing.SupplierHost5PhoneNumber)).Append(','); + if (headers.Contains(CsvCols.SupplierHost5FaxNumber)) + builder.Append(FormatCsvField(listing.SupplierHost5FaxNumber)).Append(','); + if (headers.Contains(CsvCols.SupplierHost5MailingAddress)) + builder.Append(FormatCsvField(listing.SupplierHost5MailingAddress)).Append(','); + if (headers.Contains(CsvCols.HostIdOfSupplierHost5)) + builder.Append(FormatCsvField(listing.SupplierHost5Id)).Append(','); + if (headers.Contains(CsvCols.LastActionTaken)) + builder.Append(FormatCsvField(listing.LastActionNm)).Append(','); + if (headers.Contains(CsvCols.DateOfLastActionTaken)) + builder.Append(FormatCsvField(listing.LastActionDtm)).Append(','); + if (headers.Contains(CsvCols.PreviousActionTaken1)) + builder.Append(FormatCsvField(listing.LastActionNm1)).Append(','); + if (headers.Contains(CsvCols.DateOfPreviousActionTaken1)) + builder.Append(FormatCsvField(listing.LastActionDtm1)).Append(','); + if (headers.Contains(CsvCols.PreviousActionTaken2)) + builder.Append(FormatCsvField(listing.LastActionNm2)).Append(','); + if (headers.Contains(CsvCols.DateOfPreviousActionTaken2)) + builder.Append(FormatCsvField(listing.LastActionDtm2)).Append(','); + + if (builder.Length > 0) + builder.Length--; return builder.ToString(); }