Ewl » Canonical The canonical version of EWL Read More
Clone URL:  
Pushed to 2 repositories · View In Graph Contained in tip and canonical

Updated FormItemStatics for next changeset.

Changeset 13f37cf98382

Parent 0a1b9aa03956

by Profile picture of William GrossWilliam Gross

Changes to one file · Browse files at 13f37cf98382 Showing diff from parent 0a1b9aa03956 Diff from another changeset...

 
17
18
19
 
20
21
22
23
24
 
468
469
470
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
471
472
473
 
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
 
17
18
19
20
21
 
22
23
24
 
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
 
519
520
521
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
522
523
524
@@ -17,8 +17,8 @@
  writeCheckboxFormItemGetters( writer, field );   writeBoolFormItemGetters( writer, field );   writer.WriteLine( "#pragma warning restore CS0618" ); // remove when EwfCheckBox and BlockCheckBox are gone + writeListFormItemGetters( writer, field );   writeDateFormItemGetters( writer, field ); - writeEnumerableFormItemGetters( writer, field );   writeGuidFormItemGetters( writer, field );     writeGenericGetter( writer, field ); @@ -468,6 +468,23 @@
  .FormatWith( dv ) );   }   + private static void writeListFormItemGetters( TextWriter writer, ModificationField field ) { + if( field.EnumerableElementTypeName.Any() ) + writeFormItemGetter( + writer, + field, + "CheckboxList", + new CSharpParameter( "CheckboxListSetup<{0}>".FormatWith( field.EnumerableElementTypeName ), "checkboxListSetup" ).ToCollection(), + false, + Enumerable.Empty<CSharpParameter>(), + field.TypeName, + Enumerable.Empty<CSharpParameter>(), + true, + dv => + "{0}.ToCheckboxList( checkboxListSetup, value: value, additionalValidationMethod: additionalValidationMethod ).ToFormItem( setup: formItemSetup, label: label )" + .FormatWith( dv ) ); + } +   private static void writeDateFormItemGetters( TextWriter writer, ModificationField field ) {   if( field.TypeIs( typeof( DateTime ) ) )   writeFormItemGetter( @@ -502,30 +519,6 @@
  .FormatWith( dv ) );   }   - private static void writeEnumerableFormItemGetters( TextWriter writer, ModificationField field ) { - if( !field.EnumerableElementTypeName.Any() ) - return; - writeFormItemGetters( - writer, - field, - "EwfCheckBoxList<" + field.EnumerableElementTypeName + ">", - "CheckBoxList", - field.TypeName, - "null", - new CSharpParameter( "IEnumerable<SelectListItem<" + field.EnumerableElementTypeName + ">>", "items" ).ToCollection(), - new CSharpParameter[ 0 ], - new[] - { - new CSharpParameter( "string", "caption", "\"\"" ), new CSharpParameter( "bool", "includeSelectAndDeselectAllButtons", "false" ), - new CSharpParameter( "byte", "numberOfColumns", "1" ), new CSharpParameter( "FormAction", "action", "null" ) - }, - new CSharpParameter[ 0 ], - "new EwfCheckBoxList<" + field.EnumerableElementTypeName + ">( items, v ?? new " + field.EnumerableElementTypeName + - "[ 0 ], caption: caption, includeSelectAndDeselectAllButtons: includeSelectAndDeselectAllButtons, numberOfColumns: numberOfColumns, action: action )", - "control.GetSelectedItemIdsInPostBack( postBackValues )", - "" ); - } -   private static void writeGuidFormItemGetters( TextWriter writer, ModificationField field ) {   if( !field.TypeIs( typeof( Guid ) ) )   return;