@@ -64,10 +64,12 @@ static void Main(string[] args)
64
64
switch ( options . Command )
65
65
{
66
66
case Command . CLAR_UPLOAD :
67
- case Command . CLAR_DOWNLOAD :
67
+ case Command . CLAR_DOWNLOAD :
68
68
break ;
69
69
case Command . DRIVE_UPLOAD :
70
70
case Command . DRIVE_TRASH :
71
+ case Command . PHOTO_DOWNLOAD :
72
+ case Command . DOCUMENT_UPLOAD :
71
73
soapUrl = SoapUrlBuild ( options . Command ) ;
72
74
break ;
73
75
}
@@ -79,18 +81,32 @@ static void Main(string[] args)
79
81
80
82
files = Directory . GetFiles ( options . Path , searchPattern , new EnumerationOptions { MatchCasing = MatchCasing . CaseInsensitive } ) ;
81
83
82
- // Special file handling
84
+ // Special file handling and console update
83
85
switch ( options . Command )
84
- {
86
+ {
87
+ case Command . CLAR_UPLOAD :
88
+ Console . WriteLine ( "\n \n Deploying the CLAR and awaiting the result...\n \n " ) ;
89
+ break ;
85
90
case Command . CLAR_DOWNLOAD :
91
+ Console . WriteLine ( "\n \n Downloading the CLAR and awaiting the result...\n \n " ) ;
86
92
files = new string [ ] { Path . Combine ( options . Path , options . Parameters + "." + DateTime . Now . ToString ( "s" ) . Replace ( ":" , "." ) + ".clar" ) } ;
87
93
break ;
94
+ case Command . DRIVE_UPLOAD :
95
+ Console . WriteLine ( "\n \n Uploading files...\n \n " ) ;
96
+ break ;
88
97
case Command . DRIVE_TRASH :
98
+ Console . WriteLine ( "\n \n Trashing files...\n \n " ) ;
89
99
if ( files . Length > 0 )
90
100
{
91
101
files = File . ReadAllLines ( files [ 0 ] ) ;
92
102
}
93
103
break ;
104
+ case Command . PHOTO_DOWNLOAD :
105
+ Console . WriteLine ( "\n \n Downloading photos...\n \n " ) ;
106
+ break ;
107
+ case Command . DOCUMENT_UPLOAD :
108
+ Console . WriteLine ( "\n \n Uploading documents...\n \n " ) ;
109
+ break ;
94
110
default :
95
111
break ;
96
112
}
@@ -103,11 +119,9 @@ static void Main(string[] args)
103
119
{
104
120
case Command . CLAR_UPLOAD :
105
121
bytes = File . ReadAllBytes ( file ) ;
106
- Console . WriteLine ( "\n \n Deploying the CLAR and awaiting the result...\n \n " ) ;
107
122
result = Encoding . Default . GetString ( WDWebService . CallRest ( options . Tenant , options . Username + "@" + options . Tenant , options . Password , restUrl , WebRequestMethods . Http . Put , bytes ) ) ;
108
123
break ;
109
- case Command . CLAR_DOWNLOAD :
110
- Console . WriteLine ( "\n \n Downloading the CLAR and awaiting the result...\n \n " ) ;
124
+ case Command . CLAR_DOWNLOAD :
111
125
bytes = WDWebService . CallRest ( options . Tenant , options . Username + "@" + options . Tenant , options . Password , restUrl + "?fmt=clar" , WebRequestMethods . Http . Get , null ) ;
112
126
File . WriteAllBytes ( file , bytes ) ;
113
127
result = Encoding . Default . GetString ( WDWebService . CallRest ( options . Tenant , options . Username + "@" + options . Tenant , options . Password , restUrl , WebRequestMethods . Http . Get , null ) ) ;
@@ -117,13 +131,20 @@ static void Main(string[] args)
117
131
xnm . AddNamespace ( "default" , "urn:com.workday/esb/cloud/10.0" ) ;
118
132
result = "Last Uploaded to Workday: " + DateTime . Parse ( xDoc . XPathSelectElement ( "//default:deployed-since" , xnm ) . Value ) . ToLocalTime ( ) . ToString ( "s" ) ;
119
133
break ;
120
- case Command . DRIVE_UPLOAD :
134
+ case Command . DRIVE_UPLOAD :
121
135
bytes = File . ReadAllBytes ( file ) ;
122
136
result = DriveUpload ( file , bytes , soapUrl , options . Username ) ;
123
137
break ;
124
- case Command . DRIVE_TRASH :
138
+ case Command . DRIVE_TRASH :
125
139
result = DriveTrash ( file , soapUrl , options . Username ) ;
126
140
break ;
141
+ case Command . PHOTO_DOWNLOAD :
142
+ result = Photos . Download ( options , file , soapUrl ) ;
143
+ break ;
144
+ case Command . DOCUMENT_UPLOAD :
145
+ bytes = File . ReadAllBytes ( file ) ;
146
+ result = Documents . Upload ( file , bytes , soapUrl , processedDir , options ) ;
147
+ break ;
127
148
}
128
149
129
150
if ( result . ToLower ( ) . IndexOf ( "<html" ) >= 0 )
@@ -260,8 +281,17 @@ static bool InitOptions(string[] args)
260
281
break ;
261
282
case Command . DRIVE_UPLOAD :
262
283
case Command . DRIVE_TRASH :
284
+
263
285
searchPattern = options . Parameters ;
264
286
break ;
287
+ case Command . PHOTO_DOWNLOAD :
288
+ searchPattern = options . Parameters ;
289
+ break ;
290
+ case Command . DOCUMENT_UPLOAD :
291
+ searchPattern = "*.*" ;
292
+ break ;
293
+ default :
294
+ break ;
265
295
}
266
296
}
267
297
@@ -319,7 +349,9 @@ static void CommandOption()
319
349
case Command . CLAR_UPLOAD :
320
350
case Command . CLAR_DOWNLOAD :
321
351
case Command . DRIVE_UPLOAD :
322
- case Command . DRIVE_TRASH :
352
+ case Command . DRIVE_TRASH :
353
+ case Command . PHOTO_DOWNLOAD :
354
+ case Command . DOCUMENT_UPLOAD :
323
355
break ;
324
356
default :
325
357
throw new Exception ( "Invalid command. Please use --help for a list of valid commands." ) ;
@@ -345,6 +377,14 @@ static void PathOption()
345
377
case Command . DRIVE_TRASH :
346
378
options . Path = appDir ;
347
379
break ;
380
+ case Command . PHOTO_DOWNLOAD :
381
+ options . Path = appDir ;
382
+ break ;
383
+ case Command . DOCUMENT_UPLOAD :
384
+ options . Path = inboundDir ;
385
+ break ;
386
+ default :
387
+ break ;
348
388
}
349
389
}
350
390
Console . WriteLine ( "Processing: " + options . Path + "\n " ) ;
@@ -376,6 +416,15 @@ static void ParameterOption()
376
416
options . Parameters = "*trash*" ;
377
417
searchPattern = options . Parameters ;
378
418
break ;
419
+ case Command . PHOTO_DOWNLOAD :
420
+ Console . WriteLine ( "Enter the id file name:\n " ) ;
421
+ options . Parameters = Console . ReadLine ( ) . Trim ( ) ;
422
+ Console . WriteLine ( "" ) ;
423
+ searchPattern = options . Parameters ;
424
+ break ;
425
+ case Command . DOCUMENT_UPLOAD :
426
+ searchPattern = "*.*" ;
427
+ break ;
379
428
}
380
429
}
381
430
@@ -492,6 +541,12 @@ static string SoapUrlBuild(string command)
492
541
case Command . DRIVE_TRASH :
493
542
soapUrl += "/{tenant}/Drive/{version}" ;
494
543
break ;
544
+ case Command . PHOTO_DOWNLOAD :
545
+ soapUrl += "/{tenant}/Human_Resources/{version}" ;
546
+ break ;
547
+ case Command . DOCUMENT_UPLOAD :
548
+ soapUrl += "/{tenant}/Staffing/{version}" ;
549
+ break ;
495
550
}
496
551
497
552
return soapUrl ;
0 commit comments