예제 #1
0
        private void ReportBody()
        {
            Fonksiyon f = new Fonksiyon();

            #region Table header

            BaseFont Vn_Helvetica = BaseFont.CreateFont(@"C:\Windows\Fonts\arial.ttf", "Identity-H", BaseFont.EMBEDDED);
            Font     _fontStyle   = new Font(Vn_Helvetica, 11, Font.NORMAL);

            _pdfCell = new PdfPCell(new Phrase("Sıra No", _fontStyle));
            _pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            _pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            _pdfCell.BackgroundColor     = BaseColor.LIGHT_GRAY;
            _pdfCell.Padding             = 7;
            _pdfTable.AddCell(_pdfCell);

            _pdfCell = new PdfPCell(new Phrase("Öğrenci No", _fontStyle));
            _pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            _pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            _pdfCell.BackgroundColor     = BaseColor.LIGHT_GRAY;
            _pdfCell.Padding             = 7;
            _pdfTable.AddCell(_pdfCell);

            _pdfCell = new PdfPCell(new Phrase("Adı", _fontStyle));
            _pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            _pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            _pdfCell.BackgroundColor     = BaseColor.LIGHT_GRAY;
            _pdfCell.Padding             = 7;
            _pdfTable.AddCell(_pdfCell);

            _pdfCell = new PdfPCell(new Phrase("Soyadı", _fontStyle));
            _pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
            _pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
            _pdfCell.BackgroundColor     = BaseColor.LIGHT_GRAY;
            _pdfCell.Padding             = 7;
            _pdfTable.AddCell(_pdfCell);
            _pdfTable.CompleteRow();
            #endregion

            #region Table Body
            int sirano = 1;
            foreach (YoklamaViewModel item in _yoklamaListe)
            {
                string dersSaati   = f.DersSaatiGetir(Convert.ToInt32(item.DersGrupID)).DersGrupAdi;
                string dersAdi     = f.DersGetir(Convert.ToInt32(item.DersID)).DersAdi;
                string ogretmenAdi = f.OgretmenGetir(Convert.ToInt32(item.OgretmenID)).AdSoyad;

                _pdfCell                     = new PdfPCell(new Phrase(dersSaati + " - " + dersAdi + " [ " + ogretmenAdi + " ]", _fontStyle));
                _pdfCell.Colspan             = _totalcolumn;
                _pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                _pdfCell.VerticalAlignment   = Element.ALIGN_LEFT;
                _pdfCell.BackgroundColor     = BaseColor.LIGHT_GRAY;
                _pdfCell.Padding             = 7;
                _pdfTable.AddCell(_pdfCell);
                _pdfTable.CompleteRow();
                sirano = 1;
                if (item.OgrenciIDListe == null)
                {
                    _pdfCell                     = new PdfPCell(new Phrase("Sınıfta Gelmeyen Yoktur.", _fontStyle));
                    _pdfCell.Colspan             = _totalcolumn;
                    _pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                    _pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                    _pdfCell.BackgroundColor     = BaseColor.WHITE;
                    _pdfCell.Padding             = 5;
                    _pdfTable.AddCell(_pdfCell);
                }
                else
                {
                    foreach (var ogrenci in item.OgrenciIDListe)
                    {
                        _pdfCell = new PdfPCell(new Phrase(sirano++.ToString(), _fontStyle));
                        _pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                        _pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                        _pdfCell.BackgroundColor     = BaseColor.WHITE;
                        _pdfCell.Padding             = 5;
                        _pdfTable.AddCell(_pdfCell);

                        _pdfCell = new PdfPCell(new Phrase(f.OgrenciGetir(Convert.ToInt32(ogrenci)).OgrenciNo.ToString(), _fontStyle));
                        _pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                        _pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                        _pdfCell.BackgroundColor     = BaseColor.WHITE;
                        _pdfCell.Padding             = 5;
                        _pdfTable.AddCell(_pdfCell);

                        _pdfCell = new PdfPCell(new Phrase(f.OgrenciGetir(Convert.ToInt32(ogrenci)).Adi.ToString(), _fontStyle));
                        _pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                        _pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                        _pdfCell.BackgroundColor     = BaseColor.WHITE;
                        _pdfCell.Padding             = 5;
                        _pdfTable.AddCell(_pdfCell);

                        _pdfCell = new PdfPCell(new Phrase(f.OgrenciGetir(Convert.ToInt32(ogrenci)).Soyadi.ToString(), _fontStyle));
                        _pdfCell.HorizontalAlignment = Element.ALIGN_CENTER;
                        _pdfCell.VerticalAlignment   = Element.ALIGN_MIDDLE;
                        _pdfCell.BackgroundColor     = BaseColor.WHITE;
                        _pdfCell.Padding             = 5;
                        _pdfTable.AddCell(_pdfCell);
                        _pdfTable.CompleteRow();
                    }
                }
            }
            #endregion
        }