@@ -56,7 +56,7 @@ public async Task<byte[]> ExportRemoteUsersToExcelAsync(int siteId)
5656 var worksheet = package . Workbook . Worksheets . Add ( "Remote Users" ) ;
5757
5858 // Set headers
59- var headers = new [ ] { "First Name" , "Last Name" , "Email" , "College" , "License Class" , "License Number" , "Practitioner Id" } ;
59+ var headers = new [ ] { "First Name" , "Last Name" , "Email" , "College" , "License Class" , "Registration Id" , "CPS ID Number", "PharmaNet Id" , "CreatedDate " } ;
6060 for ( int i = 0 ; i < headers . Length ; i ++ )
6161 {
6262 worksheet . Cells [ 1 , i + 1 ] . Value = headers [ i ] ;
@@ -78,8 +78,10 @@ public async Task<byte[]> ExportRemoteUsersToExcelAsync(int siteId)
7878 worksheet . Cells [ i + 2 , 3 ] . Value = dto . Email ;
7979 worksheet . Cells [ i + 2 , 4 ] . Value = dto . College ;
8080 worksheet . Cells [ i + 2 , 5 ] . Value = dto . LicenseClass ;
81- worksheet . Cells [ i + 2 , 6 ] . Value = dto . LicenseNumber ;
82- worksheet . Cells [ i + 2 , 7 ] . Value = dto . PractitionerId ;
81+ worksheet . Cells [ i + 2 , 6 ] . Value = dto . RegistrationId ;
82+ worksheet . Cells [ i + 2 , 7 ] . Value = dto . CPSIDNumber ;
83+ worksheet . Cells [ i + 2 , 8 ] . Value = dto . PharmaNetId ;
84+ worksheet . Cells [ i + 2 , 9 ] . Value = dto . CreatedDate ;
8385 }
8486
8587 // Auto-fit columns
@@ -93,31 +95,62 @@ private async Task<IEnumerable<RemoteUserExportDto>> GetRemoteUsers(int siteId)
9395 {
9496 return await _context . RemoteUsers
9597 . Where ( ru => ru . SiteId == siteId )
98+ . OrderBy ( ru => ru . CreatedTimeStamp )
9699 . Select ( ru => new RemoteUserExportDto
97- {
98- FirstName = ru . FirstName ,
99- LastName = ru . LastName ,
100- Email = ru . Email ,
101- College = ru . RemoteUserCertification . College . Name ,
102- LicenseClass = ru . RemoteUserCertification . License . Name ,
103- LicenseNumber = ru . RemoteUserCertification . LicenseNumber ,
104- PractitionerId = ru . RemoteUserCertification . PractitionerId
105- } )
100+ (
101+ ru . FirstName ,
102+ ru . LastName ,
103+ ru . Email ,
104+ ru . RemoteUserCertification . College . Name ,
105+ ru . RemoteUserCertification . College . Code ,
106+ ru . RemoteUserCertification . License . Code ,
107+ ru . RemoteUserCertification . License . Name ,
108+ ru . RemoteUserCertification . LicenseNumber ,
109+ ru . RemoteUserCertification . PractitionerId ,
110+ ru . CreatedTimeStamp
111+ ) )
106112 . ToListAsync ( ) ;
107113 }
108114
115+
109116 /// <summary>
110117 /// DTO for exporting remote user data
111118 /// </summary>
112119 public class RemoteUserExportDto
113120 {
121+ public RemoteUserExportDto ( string firstName ,
122+ string lastName ,
123+ string email ,
124+ string college ,
125+ int collegeCode ,
126+ int licenseCode ,
127+ string licenseClass ,
128+ string licenseNumber ,
129+ string practitionerId ,
130+ DateTimeOffset ? createdDate )
131+ {
132+ FirstName = firstName ;
133+ LastName = lastName ;
134+ Email = email ;
135+ College = college ;
136+ LicenseClass = licenseClass ;
137+ CPSIDNumber = collegeCode == CollegeCode . CPSBC ? licenseNumber : "" ;
138+ RegistrationId = collegeCode == CollegeCode . CPSBC ? "" : licenseNumber ;
139+ PharmaNetId = collegeCode == CollegeCode . BCCNM || licenseCode == LicenseCode . NaturopathicFull ||
140+ licenseCode == LicenseCode . NaturopathicTemporay || licenseCode == LicenseCode . NaturopathicStudent
141+ ? practitionerId : "" ;
142+ CreatedDate = createdDate . HasValue ? createdDate . Value . ToString ( "yyyy-MM-dd HH:mm:ss" ) : "" ;
143+ }
144+
114145 public string FirstName { get ; set ; }
115146 public string LastName { get ; set ; }
116147 public string Email { get ; set ; }
117148 public string College { get ; set ; }
118149 public string LicenseClass { get ; set ; }
119- public string LicenseNumber { get ; set ; }
120- public string PractitionerId { get ; set ; }
150+ public string RegistrationId { get ; set ; }
151+ public string PharmaNetId { get ; set ; }
152+ public string CPSIDNumber { get ; set ; }
153+ public string CreatedDate { get ; set ; }
121154 }
122155 }
123156}
0 commit comments