本文整理汇总了C#中iTextSharp.text.List.First方法的典型用法代码示例。如果您正苦于以下问题:C# List.First方法的具体用法?C# List.First怎么用?C# List.First使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iTextSharp.text.List
的用法示例。
在下文中一共展示了List.First方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MergeFiles
public static void MergeFiles(string destinationFile, List<string> files, bool removeMergedFiles)
{
try
{
var f = 0;
var reader = new PdfReader(files.First());
var numberOfPages = reader.NumberOfPages;
var document = new Document(reader.GetPageSizeWithRotation(1));
var writer = PdfWriter.GetInstance(document, new FileStream(destinationFile, FileMode.Create));
document.Open();
var content = writer.DirectContent;
while (f < files.Count)
{
var i = 0;
while (i < numberOfPages)
{
i++;
document.SetPageSize(reader.GetPageSizeWithRotation(i));
document.NewPage();
var page = writer.GetImportedPage(reader, i);
var rotation = reader.GetPageRotation(i);
if (rotation == 90 || rotation == 270)
content.AddTemplate(page, 0, -1f, 1f, 0, 0, reader.GetPageSizeWithRotation(i).Height);
else
content.AddTemplate(page, 1f, 0, 0, 1f, 0, 0);
}
f++;
if (f < files.Count)
{
reader = new PdfReader(files[f]);
numberOfPages = reader.NumberOfPages;
}
}
document.Close();
if (removeMergedFiles)
{
DeleteMergedFiles(files);
}
}
catch (Exception e)
{
var strOb = e.Message;
}
}
示例2: GerarPdf
public void GerarPdf(List<Pagamento> listaPagamento)
{
var doc = new Document();
PdfWriter.GetInstance(doc, new FileStream(@"c:\temp\teste.pdf", FileMode.Create));
doc.Open();
var pagamento = listaPagamento.First();
var corpoEmail = CorpoEmail();
corpoEmail = corpoEmail.Replace("[mes]", pagamento.DataPagamento.ToString("Y"));
corpoEmail = corpoEmail.Replace("[canal]", pagamento.Contrato.Vendedor.Nome);
corpoEmail = corpoEmail.Replace("[body]", BodyTabelaComissao(listaPagamento));
corpoEmail = corpoEmail.Replace("[foot]", FooterTabelaComissao(listaPagamento));
var hw = new iTextSharp.text.html.simpleparser.HTMLWorker(doc);
hw.Parse(new StringReader(corpoEmail));
doc.Close();
//return corpoEmail;
}
示例3: FillForm
public static response_item_type[] FillForm(pdf_stamper_request request,string mapping_root_path,string template_root_path, string output_root_path, DataTable data, string fonts_root_path, bool force_unc) {
lock (_lock) {
try {
List<Item> items_with_path = new List<Item>();
mappings mapping = new mappings();
if (File.Exists(mapping_root_path))
mapping = File.ReadAllText(mapping_root_path).DeserializeXml2<mappings>();
FileInfo mapping_path = new FileInfo(mapping_root_path);
/*
string fox_helper_path = Path.Combine(mapping_path.DirectoryName, "Fox.txt");
if (!File.Exists(fox_helper_path)) {
StringBuilder b = new StringBuilder();
b.Append(@"
DIMENSION laArray[30,2]
laArray[1,1] = 'Obrazac1'
laArray[2,1] = 'Obrazac2'
laArray[3,1] = 'Obrazac3'
laArray[4,1] = 'Obrazac4'
laArray[5,1] = 'Obrazac5'
laArray[6,1] = 'Obrazac6'
laArray[7,1] = 'Obrazac7'
laArray[8,1] = 'Obrazac8'
laArray[9,1] = 'Obrazac9'
laArray[10,1] ='Obrazac10'
laArray[11,1] = 'Obrazac11'
laArray[12,1] = 'Obrazac12'
laArray[13,1] = 'Obrazac13'
laArray[14,1] = 'Obrazac14'
laArray[15,1] = 'Obrazac15'
laArray[16,1] = 'Obrazac16'
laArray[17,1] = 'Obrazac17'
laArray[18,1] = 'Obrazac18'
laArray[19,1] = 'Obrazac19'
laArray[20,1] ='Obrazac20'
laArray[21,1] = 'Obrazac21'
laArray[22,1] = 'Obrazac22'
laArray[23,1] = 'Obrazac23'
laArray[24,1] = 'Obrazac24'
laArray[25,1] = 'Obrazac25'
laArray[26,1] = 'Obrazac26'
laArray[27,1] = 'Obrazac27'
laArray[28,1] = 'Obrazac28'
laArray[29,1] = 'Obrazac29'
laArray[30,1] ='Obrazac30'
");
int current_index = -1;
foreach (var item in mapping.mapping_item) {
current_index = Int32.Parse(item.pdf_template.ToString().Replace("Obrazac", ""));
string source_document_path = item.file_path.Replace("@root", template_root_path);
FileInfo info = new FileInfo(source_document_path);
string value = string.Format("laArray[{0},2] = '{1}'", current_index, info.Name.Replace(info.Extension,String.Empty));
b.AppendLine(value);
}
File.WriteAllText(fox_helper_path,b.ToString());
}
*/
if (data.Rows.Count == 0) {
Logging.Singleton.WriteDebug("There is no data in the provided data table!");
foreach (var template in request.pdf_template_list) {
mapping_item_type selected = mapping.mapping_item.Where(p => p.pdf_template == template).First();
string source_document_path = selected.file_path.Replace("@root", template_root_path);
items_with_path.Add(new Item() { Path = source_document_path, PdfTemplate = template });
}
if (request.merge_output == true) {
string merged_document_path = Path.Combine(output_root_path, String.Format("{0}_{1}{2}", "merged", DateTime.Now.ToFileTimeUtc().ToString(), ".pdf"));
PdfMerge merge = new PdfMerge();
foreach (var item in items_with_path) {
merge.AddDocument(item.Path);
}
merge.EnablePagination = false;
merge.Merge(merged_document_path);
string result = Convert.ToBase64String(File.ReadAllBytes(merged_document_path));
return new response_item_type[] { new response_item_type() { pdf_template = template.MergedContent, data = force_unc? string.Empty : result, unc_path=merged_document_path } };
}
else {
List<response_item_type> items = new List<response_item_type>();
foreach (var item in items_with_path) {
var temp = new response_item_type() { pdf_template = item.PdfTemplate, data = force_unc ? string.Empty : Convert.ToBase64String(File.ReadAllBytes(item.Path)), unc_path = item.Path };
items.Add(temp);
}
return items.ToArray();
}
}
else {
DataRow row = data.Rows[0];
string id_pog = string.Empty;
if (data.Columns.Contains("id_pog"))
id_pog = row["id_pog"].ToString();
if (request.debug_mode) {
foreach (DataColumn column in data.Columns) {
Logging.Singleton.WriteDebugFormat("Data column [{0}] has a value [{1}]", column.ToString(), row[column].ToString());
}
//.........这里部分代码省略.........
示例4: MergePdfForms
/// <summary>
/// Merges pdf files from a byte list
/// </summary>
/// <param name="files">list of files to merge</param>
/// <returns>memory stream containing combined pdf</returns>
public static string MergePdfForms(List<string> file_names, string output) {
if (file_names.Count > 1) {
List<byte[]> files = new List<byte[]>();
foreach (string file_name in file_names) {
var file = File.ReadAllBytes(file_name);
files.Add(file);
}
string[] names;
PdfStamper stamper;
MemoryStream msTemp = null;
PdfReader pdfTemplate = null;
PdfReader pdfFile;
Document doc;
PdfWriter pCopy;
MemoryStream msOutput = new MemoryStream();
pdfFile = new PdfReader(files[0]);
doc = new Document();
pCopy = new PdfSmartCopy(doc, msOutput);
pCopy.PdfVersion = PdfWriter.VERSION_1_7;
doc.Open();
for (int k = 0; k < files.Count; k++) {
for (int i = 1; i < pdfFile.NumberOfPages + 1; i++) {
msTemp = new MemoryStream();
pdfTemplate = new PdfReader(files[k]);
stamper = new PdfStamper(pdfTemplate, msTemp);
names = new string[stamper.AcroFields.Fields.Keys.Count];
stamper.AcroFields.Fields.Keys.CopyTo(names, 0);
foreach (string name in names) {
stamper.AcroFields.RenameField(name, name + "_file" + k.ToString());
}
stamper.Close();
pdfFile = new PdfReader(msTemp.ToArray());
((PdfSmartCopy)pCopy).AddPage(pCopy.GetImportedPage(pdfFile, i));
pCopy.FreeReader(pdfFile);
}
}
FileStream f = new FileStream(output, FileMode.Create);
msOutput.WriteTo(f);
msOutput.Flush();
f.Flush();
pdfFile.Close();
pCopy.Close();
doc.Close();
msOutput.Close();
f.Close();
return output;
}
else if (file_names.Count == 1) {
File.Copy(file_names.First(), output);
return output;
}
return null;
}
示例5: drawTeamPairs
private void drawTeamPairs(Document doc, UserShows userShow)
{
var multiDogClasses = new List<MultiDogClasses>();
var multiDogEntries = new List<MultiDogEntry>();
Shows thisShow = new Shows(userShow.ShowID);
User currentUser = new User(userShow.Userid);
List<ShowClasses> classList = ShowClasses.GetAllClassesForShow(userShow.ShowID).Where(sc => sc.Part == 0).ToList();
multiDogClasses = TeamPairsManager.GetTeamPairClasses(userShow.ShowID);
multiDogEntries = TeamPairsManager.GetTeamPairs(userShow.ShowID, userShow.Userid, multiDogClasses);
doc.NewPage();
var container = new PdfPTable(new float[] { 200, 200 });
PdfPTable teamPairsTable = new PdfPTable(new float[] { 200, 200 });;
int lastClassId = 0;
int teamCnt = 0 ;
PdfPCell cell;
foreach (var entry in multiDogEntries)
{
if (lastClassId != entry.ClassId)
{
if (lastClassId != 0)
{
if (teamCnt % 2 > 0)
{
cell = new PdfPCell(new Phrase(new Chunk("", dogDetailsInClass)));
cell.BorderWidth = 0;
container.AddCell(cell);
}
teamCnt = 0;
}
lastClassId = entry.ClassId;
var classDetails = multiDogClasses.First(x => x.ClassId == entry.ClassId);
teamPairsTable = new PdfPTable(new float[] { 200, 200 });
cell = new PdfPCell(new Phrase(new Chunk(string.Format("Class No:{0} - {1}", classDetails.ClassNo, classDetails.ClassName), headerFont)));
cell.Colspan = 2;
cell.BorderWidth = 0;
cell.FixedHeight = 25f;
cell.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
teamPairsTable.AddCell(cell);
cell = new PdfPCell(teamPairsTable);
cell.Colspan = 2;
cell.BorderWidth = 0;
container.AddCell(cell);
}
teamPairsTable = new PdfPTable(new float[] { 200, 200 });
var teamPairsHeader = new PdfPTable(new float[] { 200, 200, 100 });
var p = new Paragraph();
p.Add(new Phrase(new Chunk("Captain", inClassFont)));
p.Add(new Phrase(Chunk.NEWLINE));
p.Add(new Phrase(new Chunk(entry.TeamDetails.Captain.Replace("'", "'"), fontBold)));
cell = new PdfPCell(p);
cell.BorderWidth = 0;
cell.FixedHeight = 30;
cell.BorderWidthBottom = 2;
teamPairsHeader.AddCell(cell);
p = new Paragraph();
p.Add(new Phrase(new Chunk("Team Name", inClassFont)));
p.Add(new Phrase(Chunk.NEWLINE));
p.Add(new Phrase(new Chunk(entry.TeamDetails.TeamName.Replace("'", "'"), fontBold)));
cell = new PdfPCell(p);
cell.BorderWidth = 0;
cell.BorderWidthBottom = 2;
cell.FixedHeight = 30;
teamPairsHeader.AddCell(cell);
p = new Paragraph();
p.Add(new Phrase(new Chunk(string.Format(" RO: {0}", entry.RO), inClassFontBold)));
cell = new PdfPCell(p);
cell.BorderWidth = 0;
cell.BorderWidthBottom = 2;
cell.BorderWidthLeft = 2;
cell.FixedHeight = 30;
teamPairsHeader.AddCell(cell);
cell = new PdfPCell(teamPairsHeader);
cell.Colspan = 2;
cell.BorderWidth = 0;
teamPairsTable.AddCell(cell);
cell = new PdfPCell(new Phrase(new Chunk("Members", dogDetailsInClass)));
cell.Colspan = 2;
cell.BorderWidth = 0;
cell.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
teamPairsTable.AddCell(cell);
int memcnt = 0;
foreach (var members in entry.Members)
{
if (memcnt == entry.DogCount)
{
cell = new PdfPCell();
cell.Colspan = 2;
cell.BorderWidth = 0;
cell.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
teamPairsTable.AddCell(cell);
//.........这里部分代码省略.........
示例6: AddDogDetails
private PdfPCell AddDogDetails(Dogs d, List<DogClasses> dcList, Color altColor, bool topBorder )
{
Paragraph p = new Paragraph();
Phrase ph = new Phrase();
ph.Add(new Chunk(d.KCName, normalFont));
ph.Add(Chunk.NEWLINE);
var doginfo = d.KCNumber;
if (!string.IsNullOrEmpty(d.DoB))
{
doginfo += ",";
doginfo += d.DoB;
}
ph.Add(new Chunk(doginfo, normalFont));
ph.Add(Chunk.NEWLINE);
doginfo = d.Breed;
if (doginfo.Length > 0) doginfo += ",";
doginfo += "Grade " + Dogs.GetDogGrade(d.Grade);
ph.Add(new Chunk(doginfo, normalFont));
ph.Add(Chunk.NEWLINE);
doginfo = "";
doginfo += Dogs.GetDogHeight(d.Height);
doginfo += ",";
doginfo += Dogs.GetDogSexType(d.Sex);
if (dcList.Any() && dcList.First().Lho == 1)
{
doginfo += ",LHO";
}
ph.Add(new Chunk(doginfo, normalFont));
ph.Add(Chunk.NEWLINE);
var cell = new PdfPCell(ph);
cell.BorderWidth = 0;
cell.BackgroundColor = altColor;
if (topBorder)
{
cell.BorderColorTop = Color.BLACK;
cell.BorderWidthTop = 1;
}
return cell;
}
示例7: ScoreBoardColumnHeaders
private void ScoreBoardColumnHeaders(ShowClasses showClass, PdfPTable callingListTbl, List<CallingListDto> callingList, float[] colWidths)
{
if (TeamPairsManager.isMultiDog(showClass.EntryType))
{
callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk("RO", headerHFont))) { BorderWidth = 0 });
callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk("Team Name", headerHFont)))
{
BorderWidth = 0,
Colspan = 2
});
}
else
{
if (showClass.Lho == 1 || showClass.Lho == 2)
{
if (callingList.Any())
{
var item = callingList.First();
var cnt = callingList.Count(x => x.Lho == item.Lho);
var title = $"{(item.Lho == 0 ? "Full Height " : "Lower Height")} ({cnt})";
callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk(title, headerHFont)))
{
BorderWidth = 0,
Colspan = colWidths.Length,
BackgroundColor = Color.LIGHT_GRAY,
HorizontalAlignment = Element.ALIGN_CENTER,
FixedHeight = 20,
BorderColorBottom = Color.BLACK,
BorderWidthBottom = 2
});
}
else
{
var title = $"Dont Know (9999)";
callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk(title, headerHFont)))
{
BorderWidth = 0,
Colspan = colWidths.Length,
BackgroundColor = Color.LIGHT_GRAY,
HorizontalAlignment = Element.ALIGN_CENTER,
FixedHeight = 20,
BorderColorBottom = Color.BLACK,
BorderWidthBottom = 2
});
}
}
callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk("RO", headerHFont))) { BorderWidth = 0 });
callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk("Ring No", headerHFont))) {BorderWidth = 0});
callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk("Handler", headerHFont))) { BorderWidth = 0 });
callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk("Dog Name", headerHFont))) { BorderWidth = 0 });
}
callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk("Clears", headerHFont))) { BorderWidth = 0 });
callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk("Faults", headerHFont))) { BorderWidth = 0 });
callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk("Time", headerHFont))) { BorderWidth = 0 });
}
示例8: BuildPDF
private void BuildPDF(Dictionary<string, ISPage> pageMap, string baseRoom, Dictionary<string, int> chapterPageMap, bool fakeRun)
{
if (fakeRun)
{
ISPageHtmlParser.BuildAllISPages(pageMap, baseRoom, filePath).Wait();
}
//now that we have all the pages, we'll have to clean them up and decide on pages
Dictionary<string, int> ISPageToPhysicalPageMap = new Dictionary<string, int>();
int currentPage = 1;
int currentChapter = 1;
Random r = new Random(123456);
List<string> pagesLeft = new List<string>(pageMap.Count);
foreach (string x in pageMap.Keys)
{
pagesLeft.Add(x);
}
using (MemoryStream memStream = new MemoryStream())
{
Document pdfDoc = new Document();
iTextSharp.text.pdf.PdfWriter writer = iTextSharp.text.pdf.PdfWriter.GetInstance(pdfDoc, memStream);
HeaderFooter evnt = new HeaderFooter();
if (fakeRun)
{
evnt.pageByTitle = chapterPageMap;
}
else
{
evnt.pageByTitle = new Dictionary<string, int>();
}
if (!fakeRun)
{
writer.PageEvent = evnt;
}
pdfDoc.Open();
pdfDoc.AddAuthor("test");
pdfDoc.AddTitle("testTitle");
while (pagesLeft.Any())
{
string pageToAdd = pagesLeft.First();
if (currentPage > 1)
{
pagesLeft.Skip(r.Next(pagesLeft.Count)).First();
}
pagesLeft.Remove(pageToAdd);
if (fakeRun)
{
chapterPageMap.Add(pageToAdd, writer.PageNumber + 1);
}
ISPageToPhysicalPageMap.Add(pageToAdd, currentPage);
var chapter = GetPDFPage(pageMap[pageToAdd], int.Parse(pageToAdd), chapterPageMap);
pdfDoc.Add(chapter);
int actualPageLength = fakeRun ? 1 : chapterPageMap[pageToAdd];
currentPage += actualPageLength;
currentChapter++;
}
pdfDoc.Close();
writer.Close();
if (!fakeRun)
{
File.WriteAllBytes(Path.Combine(filePath, fileName), memStream.GetBuffer());
}
}
}
示例9: generarRecibo
public static string generarRecibo(System.Drawing.Image qr, List<CatalogoDeudores.DetalleDeuda> detalles, unidad uni, titular tit, double descuento = 0)
{
calibri = BaseFont.CreateFont(IncludesPath + "calibri.ttf", BaseFont.CP1252, BaseFont.EMBEDDED);
calibri8N = new iTextSharp.text.Font(calibri, 8, iTextSharp.text.Font.NORMAL);
calibri8B = new iTextSharp.text.Font(calibri, 8, iTextSharp.text.Font.BOLD);
calibri9N = new iTextSharp.text.Font(calibri, 9, iTextSharp.text.Font.NORMAL);
calibri9B = new iTextSharp.text.Font(calibri, 9, iTextSharp.text.Font.BOLD);
calibri12N = new iTextSharp.text.Font(calibri, 10, iTextSharp.text.Font.NORMAL);
calibri12B = new iTextSharp.text.Font(calibri, 10, iTextSharp.text.Font.BOLD);
calibri11N = new iTextSharp.text.Font(calibri, 10, iTextSharp.text.Font.NORMAL);
calibri11B = new iTextSharp.text.Font(calibri, 10, iTextSharp.text.Font.BOLD);
Document doc = new Document(PageSize.A4, milimetroToPoint(12), milimetroToPoint(12), milimetroToPoint(7), 0f);
bool exists = System.IO.Directory.Exists(Ruta + "Recibos");
if (!exists)
System.IO.Directory.CreateDirectory(Ruta + "Recibos");
string nombre = detalles.First().Edificio + " " + detalles.First().Unidad + " " + DateTime.Now.ToShortDateString().Replace("/", "-");
var output = new FileStream(Ruta + @"Recibos\" + nombre + ".pdf", FileMode.Create);
var writer = PdfWriter.GetInstance(doc, output);
doc.Open();
addEncabezado(doc, qr);
addConceptos(doc, detalles, uni, tit, descuento);
doc.Add(new Paragraph(10, " "));
addFirmaSello(doc);
doc.Close();
return Ruta + @"Recibos\" + nombre + ".pdf";
}
示例10: generarInformeUnidadesEdificio
//.........这里部分代码省略.........
c.Border = 0;
p = new Paragraph(leading, sum, calibri8N);
p.Alignment = Element.ALIGN_CENTER;
c.AddElement(p);
t.AddCell(c);
c = new PdfPCell();
c.Border = 0;
p = new Paragraph(leading, bauleras, calibri8N);
p.Alignment = Element.ALIGN_CENTER;
c.AddElement(p);
t.AddCell(c);
}
c = new PdfPCell();
c.Border = 0;
p = new Paragraph(1, " ", calibri8B);
p.Alignment = Element.ALIGN_CENTER;
c.AddElement(p);
t.AddCell(c);
t.AddCell(c);
t.AddCell(c);
t.AddCell(c);
t.AddCell(c);
t.AddCell(c);
t.AddCell(c);
t.AddCell(c);
leading = 7;
c = new PdfPCell();
c.Border = 0;
c.BorderWidthTop = 0.1F;
p = new Paragraph(leading, "Totales", calibri8B);
p.Alignment = Element.ALIGN_CENTER;
c.AddElement(p);
t.AddCell(c);
c = new PdfPCell();
c.Border = 0;
c.BorderWidthTop = 0.1F;
p = new Paragraph(leading, " ", calibri8B);
p.Alignment = Element.ALIGN_LEFT;
c.AddElement(p);
t.AddCell(c);
c = new PdfPCell();
c.Border = 0;
c.BorderWidthTop = 0.1F;
p = new Paragraph(leading, gen.ToString("n2"), calibri8B);
p.Alignment = Element.ALIGN_CENTER;
c.AddElement(p);
t.AddCell(c);
c = new PdfPCell();
c.Border = 0;
c.BorderWidthTop = 0.1F;
p = new Paragraph(leading, dep.ToString("n2"), calibri8B);
p.Alignment = Element.ALIGN_CENTER;
c.AddElement(p);
t.AddCell(c);
c = new PdfPCell();
c.Border = 0;
c.BorderWidthTop = 0.1F;
p = new Paragraph(leading, loc.ToString("n2"), calibri8B);
p.Alignment = Element.ALIGN_CENTER;
c.AddElement(p);
t.AddCell(c);
c = new PdfPCell();
c.Border = 0;
c.BorderWidthTop = 0.1F;
p = new Paragraph(leading, coch.ToString("n2"), calibri8B);
p.Alignment = Element.ALIGN_CENTER;
c.AddElement(p);
t.AddCell(c);
c = new PdfPCell();
c.Border = 0;
c.BorderWidthTop = 0.1F;
p = new Paragraph(leading, su.ToString("n2"), calibri8B);
p.Alignment = Element.ALIGN_CENTER;
c.AddElement(p);
t.AddCell(c);
c = new PdfPCell();
c.Border = 0;
c.BorderWidthTop = 0.1F;
p = new Paragraph(leading, baul.ToString("n2"), calibri8B);
p.Alignment = Element.ALIGN_CENTER;
c.AddElement(p);
t.AddCell(c);
doc.Add(t);
doc.Close();
}
return Ruta + @"Listados unidades\\" + edificiosUnidadesCoef.First().Edificio + ".pdf";
}
示例11: emitirRecibo
public static string emitirRecibo(Bitmap qr, List<CatalogoDeudores.DetalleDeuda> detallesACobrar, Double descuento = 0)
{
unidad u = new unidad();
u.id_unidad = detallesACobrar.First().Unidad;
u.dir_edificio = detallesACobrar.First().Edificio;
u = CatalogoUnidades.getUnidad(u);
return ControladorInformes.generarRecibo(qr, detallesACobrar, u, u.titular, descuento);
}
示例12: getByeCount
private int getByeCount(int competitorCount)
{
/*3 = 1
4 = 0
5 = 3
6 = 2
7 = 1
8 = 0
9 = 7
10 = 6
11 = 5
12 = 4
13 = 3
14 = 2
15 = 1
16 = 0
17 = 15
18 = 14*/
if (competitorCount > 2)
{
List<int> power2 = new List<int>();
power2.Add(2);
power2.Add(4);
power2.Add(8);
power2.Add(16);
power2.Add(32);
power2.Add(64);
power2.Add(128);
return power2.First(m => m >= competitorCount) - competitorCount;
}
else
{
return 0;
}
}
示例13: FillTable
private void FillTable(PdfPTable pdfTable, List<StoreReport> allReports)
{
var mainHeaderCell = GetCustomizedCell("Aggregated Sales Report", 1, TABLE_COLUMNS, 15);
pdfTable.AddCell(mainHeaderCell);
mainHeaderCell.Padding = 0f;
var currentDate = allReports.First().Date;
SetHeadersContent(pdfTable, currentDate);
decimal currentSum = 0;
decimal grandTotalSum = 0;
var isDateChanged = false;
foreach (var monthReport in allReports)
{
if (isDateChanged)//monthReport.Date != currentDate)
{
SetHeadersContent(pdfTable, monthReport.Date);
isDateChanged = false;
}
foreach (var product in monthReport.Products)
{
AddProductInfo(product, pdfTable);
}
currentSum += monthReport.TotalSum;
grandTotalSum += monthReport.TotalSum;
if (!monthReport.Date.Equals(currentDate))// || monthReport.Equals(allReports.First()))
{
SetTotalSumRow(pdfTable, currentSum, monthReport);
currentDate = monthReport.Date;
currentSum = 0;
isDateChanged = true;
}
}
SetTotalSumRow(pdfTable, currentSum, allReports.Last());
SetGrandTotalSumRow(pdfTable, grandTotalSum);
}