public void BuscarTest() { bool paso = false; Seguros seguro; seguro = SegurosBLL.Buscar(2); if (seguro != null) { paso = true; } Assert.AreEqual(paso, true); }
private void ReportBody() { fontStyle = FontFactory.GetFont("Calibri", 9f, 1); var _fontStyle = FontFactory.GetFont("Calibri", 9f, 0); #region Table Header pdfCell = new PdfPCell(new Phrase("ID", fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.LightGray; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase("Nombres", fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.LightGray; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase("Apellidos", fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.LightGray; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase("Dirección", fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.LightGray; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase("Teléfono", fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.LightGray; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase("Género", fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.LightGray; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase("Edad", fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.LightGray; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase("Fecha de Registro", fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.LightGray; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase("Seguro Médico", fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.LightGray; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase("Balance", fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.LightGray; pdfTable.AddCell(pdfCell); pdfTable.CompleteRow(); #endregion #region Table Body int num = 0; foreach (var item in listaPacientes) { num++; pdfCell = new PdfPCell(new Phrase(item.PacienteId.ToString(), _fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.White; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase(item.Nombres, _fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.White; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase(item.Apellidos, _fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.White; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase(item.Direccion, _fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.White; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase(item.Telefono, _fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.White; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase(item.Genero, _fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.White; pdfTable.AddCell(pdfCell); var edad = ((DateTime.Now - item.FechaNacimiento).TotalDays) / 365; pdfCell = new PdfPCell(new Phrase(edad.ToString("N1"), _fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.White; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase(item.FechaRegistro.ToString("dd/MM/yyyy"), _fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.White; pdfTable.AddCell(pdfCell); var SeguroMedico = SegurosBLL.Buscar(item.SeguroId).Nombre; pdfCell = new PdfPCell(new Phrase(SeguroMedico, _fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.White; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase(item.Balance.ToString("N2"), _fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_RIGHT; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.White; pdfTable.AddCell(pdfCell); pdfTable.CompleteRow(); } pdfCell = new PdfPCell(new Phrase(num++.ToString(), fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.White; pdfCell.Border = 0; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase(" ", fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.White; pdfCell.Border = 0; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase(" ", fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.White; pdfCell.Border = 0; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase(" ", fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.White; pdfCell.Border = 0; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase(" ", fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.White; pdfCell.Border = 0; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase(" ", fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.White; pdfCell.Border = 0; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase(" ", fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.White; pdfCell.Border = 0; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase(" ", fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.White; pdfCell.Border = 0; pdfTable.AddCell(pdfCell); pdfCell = new PdfPCell(new Phrase(" ", fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.White; pdfCell.Border = 0; pdfTable.AddCell(pdfCell); decimal total; total = listaPacientes.Sum(c => c.Balance); pdfCell = new PdfPCell(new Phrase(total.ToString("N2"), fontStyle)); pdfCell.HorizontalAlignment = Element.ALIGN_RIGHT; pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; pdfCell.BackgroundColor = BaseColor.White; pdfCell.Border = 0; pdfTable.AddCell(pdfCell); pdfTable.CompleteRow(); #endregion }