protected void PrintType( CheckinLabel labelOrig, LabelType labelType ) { if ( tvLocations.CheckedNodes.Length > 0 ) { System.Collections.Generic.List<string> success = new System.Collections.Generic.List<string>(); System.Collections.Generic.List<string> fails = new System.Collections.Generic.List<string>(); foreach ( TreeViewNode node in tvLocations.CheckedNodes ) { if ( node.Depth == 1 ) { Location location = new Location( int.Parse( node.ID ) ); try { CheckinLabel label = labelOrig.ShallowCopy(); if ( LabelType.All == labelType ) { label.PrintAllLabels( location.Printer.PrinterName ); } else if ( LabelType.Attendance == labelType ) { label.PrintAttendanceLabel( location.Printer.PrinterName ); } else if ( LabelType.ClaimCard == labelType ) { label.PrintClaimCard( location.Printer.PrinterName ); } else if ( LabelType.Nametag == labelType ) { label.PrintNametag( location.Printer.PrinterName ); } else if ( LabelType.Test == labelType ) { label.FullName = location.LocationName; label.PrintAttendanceLabel( location.Printer.PrinterName ); } success.Add( string.Format( "<li>{0} ({1})</li>", location.LocationName, location.Printer.PrinterName ) ); } catch ( System.Exception ex ) { fails.Add( string.Format( "{0} ({1})<BR>{2}", location.LocationName, location.Printer.PrinterName, ex.Message ) + "<BR>StackTrace: " + ex.StackTrace ); } } } if ( success.Count > 0 ) { lblSuccessMessage.Text = labelType.ToString() + " successfully printed in room (printer):<br /><ul>" + string.Join( "", success.ToArray() ) + "</ul><hr>"; lblSuccessMessage.Visible = true; } if ( fails.Count > 0 ) { lblErrorMessage.Text = string.Join( "<hr>Failure to print in room (printer):<br>", fails.ToArray() ); lblErrorMessage.Visible = true; } } }