/** * method to order the list by manufacturer */ private void radManufacturer_Click(object sender, EventArgs e) { List <Bottles> lstBottle = new List <Bottles>(); lstBottle = Bottles.OrderByManufacturer(); // method to reload the data, specifying the data to use LoadData(lstBottle); }
private Document GeneratePDF(string use) { List <Bottles> listBottle = new List <Bottles>(); //check which order by is selected, select the correct list depending on that if (radColor.Checked) { listBottle = Bottles.OrderByColor(); } else if (radCountry.Checked) { listBottle = Bottles.OrderByCountry(); } else if (radManufacturer.Checked) { listBottle = Bottles.OrderByManufacturer(); } else if (radVariety.Checked) { listBottle = Bottles.OrderByVarietal(); } else if (txtResearch.Text != "") { listBottle = Bottles.ResearchByKeyword(txtResearch.Text); } //if no ordering, select all bottles as they are in DB else { listBottle = Bottles.ShowAllBottles(); } string jour = DateTime.Today.Day.ToString() + "." + DateTime.Today.Month.ToString() + "." + DateTime.Today.Year.ToString(); // Must have write permissions to the path folder PdfWriter writer; if (use == "def") { writer = new PdfWriter("C:\\ListeBouteilles_" + jour + ".pdf"); } else { writer = new PdfWriter("C:\\temp\\list" + jour + ".pdf"); } //it is necessary to specify, because the class PdfDocument exist in both iText and Spire iText.Kernel.Pdf.PdfDocument pdf = new iText.Kernel.Pdf.PdfDocument(writer); Document document = new Document(pdf); Paragraph header = new Paragraph("Liste de bouteilles stockées") .SetTextAlignment(TextAlignment.CENTER) .SetFontSize(14); document.Add(header); Table table = CreateTable(listBottle); document.Add(table); document.Close(); return(document); }
public void OrderByCountry_alphabetical_OK() { List <Bottles> resExpected = lstCountry; List <Bottles> resCalculated; resCalculated = Bottles.OrderByManufacturer(); Assert.AreEqual(resExpected, resCalculated); }