This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sonuc = from ogr | |
in ListOgrenci | |
where ogr.SINIFNUMARASI == 2 | |
select ogr; | |
foreach (var item in sonuc) | |
{ | |
//sonuc değişkenimize sınıf numarası 2 olan öğrencilerin objeleri doluyor | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sonuc = from ogr | |
in ListOgrenci | |
orderby ogr.YASI descending | |
select ogr.ADSOYAD; | |
foreach (string item in sonuc) | |
{ | |
//sonuc değişkenimize dolan isimleri artık her dönüş sırasında item değişkeninen ulasabiliriz. | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void SavePdf(string fileName) | |
{ | |
PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(true); | |
pdfRenderer.Document = document; | |
pdfRenderer.RenderDocument(); | |
pdfRenderer.Save(fileName); | |
//Son olarak SaveDialog'tan gelen klasör yoluna özelliklerini ve verilierini belirttiğim pdf dokümanımı render edip kaydediyorum. | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void FillDataToContent(DataTable dataTable) | |
{ | |
int topPadding = 7, bottomPading = 7; | |
Row newRow = null; | |
for (int i = 0; i < dataTable.Rows.Count; i++) | |
{ | |
newRow = table.AddRow(); | |
newRow.TopPadding = topPadding; | |
newRow.BottomPadding = bottomPading; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void CreateSection(string filePath, DataTable dataTable) | |
{ | |
// Pdf belgemizin yönünü belirliyoruz (dikey, yatay) | |
document.DefaultPageSetup.Orientation = Orientation.Portrait; | |
Section section = document.AddSection(); | |
Image image = section.AddImage(Path.Combine(Environment.CurrentDirectory, "ekmob_logo.jpg")); | |
image.Top = ShapePosition.Top; | |
image.Left = ShapePosition.Right; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void CreatePDFReportFile(string fileName) | |
{ | |
document = new Document(); | |
//Global de oluşturduğum document değişkenimi türetiyorum. | |
DataTable dataContent = GetInvoiceContent(); | |
CreateSection(fileName, dataContent); | |
FillDataToContent(dataContent); | |
SavePdf(fileName); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static DataTable GetInvoiceContent() | |
{ | |
// Faturamız için datatable üretiyoruz ve sahte veriyle dolduruyoruz. | |
DataTable dt = new DataTable(); | |
dt.Columns.Add("Ürün Kodu"); | |
dt.Columns.Add("Ürün Adı"); | |
dt.Columns.Add("Birim"); | |
dt.Columns.Add("Miktar"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static Document document = null; | |
//Pdf belgemizi oluşturmakta kullanacağımız nesnelerimizi atayabileceğimiz bir "MigraDoc.DocumentObjectModel.Document" değişkenini global'de tanımlıyorum. | |
static Table table = null; | |
//Sıkça kullanacağımız "MigraDoc.DocumentObjectModel.Table" nesnemizide global değişken olarak tanımlıyorum. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ANKET | |
{ | |
public String AketBasligi { get; set; } | |
public String AnketAciklamasi { get; set; } | |
public MigraDoc.DocumentObjectModel.Orientation SayfaYonu { get; set; } | |
public String UstBilgi { get; set; } | |
public String AltBilgi { get; set; } | |
public Boolean SayfaSayisiGoster { get; set; } | |
public List<SORULAR> sorular { get; set; } | |
public Boolean SoruSayisiniYaz { get; set; } |
NewerOlder