Exemplo n.º 1
0
        private string GetBandReport(IBand band)
        {
            StringBuilder bandInfo = new StringBuilder();

            bandInfo.Append(band.Name + ": ");
            if (band.Members.Any())
            {
                bandInfo.Append(string.Join(", ", band.Members));
            }

            bandInfo.AppendLine();
            if (band.Songs.Any())
            {
                var songs = band.Songs
                            .Select(s => s.Title)
                            .OrderBy(s => s);
                bandInfo.Append(string.Join("; ", songs));
            }
            else
            {
                bandInfo.Append("no songs");
            }

            return(bandInfo.ToString());
        }
            /// <summary>
            /// Creates an report object with the passed data.
            /// </summary>
            /// <returns>Returns a Report object.</returns>
            public Report Report()
            {
                SetupStyles();
                SetupReportInfo("Document Exporter");

                IBand reportHeader     = section.AddBand();
                IText reportHeaderText = reportHeader.AddText();

                reportHeaderText.Height     = new FixedHeight(30);
                reportHeaderText.Style.Font = headerFont;

                if (this.exportAllPages)
                {
                    reportHeaderText.AddContent("Congratulations! You have exported all pages from the report successfully!");
                }
                else
                {
                    reportHeaderText.AddContent(string.Format("Congratulations! You have exported page {0} successfully!", this.currentPageNumber));
                }

                ITable table = section.AddTable();

                table.Borders        = bordersStyle;
                table.Margins.Top    = 5;
                table.Margins.Bottom = 5;
                table.Width          = new RelativeWidth(100);
                table.Margins.Left   = 30;

                // Header
                ITableHeader header = table.Header;

                header.Height = new FixedHeight(24);
                header.Repeat = true;

                this.AddHeaderCell(header, "Order ID");
                this.AddHeaderCell(header, "Contact Name");
                this.AddHeaderCell(header, "Shipping Address");
                this.AddHeaderCell(header, "Order Date");

                //Here we add all the rows of the table
                this.AddTableRows(table);

                return(report);
            }
        private string GetBandReport(IBand band)
        {
            StringBuilder bandInfo = new StringBuilder();
            bandInfo.Append(band.Name + ": ");
            if (band.Members.Any())
            {
                bandInfo.Append(string.Join(", ", band.Members));
            }

            bandInfo.AppendLine();
            if (band.Songs.Any())
            {
                var songs = band.Songs
                  .Select(s => s.Title)
                  .OrderBy(s => s);
                bandInfo.Append(string.Join("; ", songs));
            }
            else
            {
                bandInfo.Append("no songs");
            }

            return bandInfo.ToString();
        }
Exemplo n.º 4
0
 public BandResource(IBand band)
 {
     _band = band;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Sets the wanted seach.
 /// </summary>
 /// <param name="band">The band.</param>
 public void SetWantedSeach(IBand band)
 {
     _band = band;
 }
Exemplo n.º 6
0
        public virtual void AddNewSection()
        {
            // Add new section to the document
            ISection newSection = this.document.AddSection();

            var footer = newSection.AddFooter();
            footer.Height = 20;
            var text = footer.AddText(20, 0);
            text.Style.Font = this.pdfFonts[PdfFont.DefaultSmallerReg];
            text.AddContent("Erzeugungsdatum: " + DateTime.Now.ToShortDateString());

            // Set page size and paddings
            newSection.PageSize = PageSizes.A4;
            newSection.PagePaddings.Left = 20;
            newSection.PagePaddings.Right = 20;
            newSection.PagePaddings.Top = 10;
            newSection.PagePaddings.Bottom = 20;

            //Add page numbering
            PageNumbering pageNumber = newSection.PageNumbering;
            pageNumber.Style = new  Style(this.pdfFonts[PdfFont.DefaultSmallReg], Brushes.Black);
            pageNumber.Template = "Seite [Page #]";
            // von [LastPageInSection]"
            pageNumber.SkipFirst = false;
            pageNumber.Continue = false;
            pageNumber.Alignment.Horizontal = Alignment.Right;
            pageNumber.Alignment.Vertical = Alignment.Bottom;
            pageNumber.OffsetY = -12;
            pageNumber.OffsetX = 0;

            // Add a new band to the newly created section
            this.currentBand = newSection.AddBand();
        }
Exemplo n.º 7
0
        // IDisposable
        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposedValue)
            {
                if (disposing)
                {
                    this.currentBand = null;
                    this.document = null;
                }

                // TODO: free your own state (unmanaged objects).
                // TODO: set large fields to null.
            }
            this.disposedValue = true;
        }
        protected string GetBandReport(IBand band)
        {
            var output = new StringBuilder();
            output.Append(band.Name + ": ");
            if (band.Members.Any())
            {
                output.Append( string.Join(", ", band.Members));
            }
            if (band.Songs.Any())
            {
                output.Append(Environment.NewLine + string.Join("; ", band.Songs.OrderBy(x => x.Title)));
            }
            else
            {
                output.Append(Environment.NewLine + "no songs");
            }

            return output.ToString();
        }
Exemplo n.º 9
0
 private void InsertMemberToBand(IBand band, string memberName)
 {
     band.Members.Add(memberName);
     this.Printer.PrintLine("The member {0} has been added to the band {1}.",memberName,band.Name);
 }
Exemplo n.º 10
0
 private void InsertBand(IBand band)
 {
     this.performers.Add(band);
     this.Printer.PrintLine("Band {0} added successfully", band.Name);
 }
Exemplo n.º 11
0
 private static void WriteBand(IBand band)
 {
     Console.WriteLine(band.Name + ", " + band.Genre + ", " + band.NumberOfMembers);
 }