当前位置: 首页>>代码示例>>C#>>正文


C# List.Sum方法代码示例

本文整理汇总了C#中iTextSharp.text.List.Sum方法的典型用法代码示例。如果您正苦于以下问题:C# List.Sum方法的具体用法?C# List.Sum怎么用?C# List.Sum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在iTextSharp.text.List的用法示例。


在下文中一共展示了List.Sum方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FooterTabelaComissao

 private static string FooterTabelaComissao(List<Pagamento> listaPagamento)
 {
     return string.Format("<tr><td>{0}</th><td>{1}</th><td>{2}</th><td>{3}</th></tr>"
         , "Total: "
         , listaPagamento.Sum(p => p.ValorPago)
         , listaPagamento.Sum(p => p.ValorPago - ((p.ValorPago*p.Contrato.Vendedor.Comissao)/100))
         , listaPagamento.Sum(p => ((p.ValorPago * p.Contrato.Vendedor.Comissao) / 100)));
 }
开发者ID:DaniloFerroni,项目名称:B2BTechnology,代码行数:8,代码来源:Arquivo.cs

示例2: loadTheKho

 public void loadTheKho()
 {
     _DMTheKho = TheKhoManager.getAllByDate(dtpNgayGhi.Value);
     gdvTheKho.DataSource = _DMTheKho;
     _tongLuongSach = _DMTheKho.Sum(tk => tk.SoLuong);
     lbTongLuongSach.Text = _tongLuongSach.ToString();
 }
开发者ID:diepmyduong,项目名称:QuanLyPhatHanhSach,代码行数:7,代码来源:frmThongKeTonKho.cs

示例3: loadSach

 public void loadSach()
 {
     _DMSach = SachManager.getAllAlive()
         .Where(p => p.tongSoLuongNhapTheoThang(_startMonth, _startYear, _endMonth, _endYear) > 0
         && p.tongTienNhapTheoThang(_startMonth, _startYear, _endMonth, _endYear) > 0).ToList() ;
     lbTongLuongNhap.Text = _DMSach.Sum(s => s.SoLuongNhapTheoThang).ToString();
     gdvLoNhap.DataSource = _DMSach;
 }
开发者ID:diepmyduong,项目名称:QuanLyPhatHanhSach,代码行数:8,代码来源:frmThongKeLoNhap.cs

示例4: GenerateReports

        public void GenerateReports(IEnumerable<AggregatedSalesReport> reports, string path)
        {
            Document doc = new Document(PageSize.A4, 10, 10, 42, 35);
            PdfWriter.GetInstance(doc, new FileStream(path, FileMode.Create));
            doc.Open();

            PdfPTable table = new PdfPTable(5);
            int[] columnWidths = new[] {25, 11, 13, 42, 9};
            table.SetWidths(columnWidths);

            DateTime? currentDate = null;
            decimal currentSum = 0;
            IList<decimal> dateSums = new List<decimal>();

            this.AddTableHeader(table);
            foreach (var report in reports)
            {
                if (currentDate == null || !report.Date.Date.Equals(currentDate.Value.Date))
                {
                    if (currentDate != null)
                    {
                        this.AddDataFooter(table, currentSum, currentDate.Value);
                        dateSums.Add(currentSum);
                        currentSum = 0;
                    }
                    this.AddDataHeader(table, report.Date);
                }
                this.AddDataRow(table, report);
                currentDate = report.Date;
                currentSum += report.Sum;
            }

            if (reports.Any())
            {
                this.AddDataFooter(table, currentSum, currentDate.Value);
                dateSums.Add(currentSum);
            }

            this.AddTableFooter(table, dateSums.Sum());
            doc.Add(table);
            doc.Close();
        }
开发者ID:DbApps-Teamwork,项目名称:Db-Applications-Teamwork,代码行数:42,代码来源:PdfReportsGenerator.cs

示例5: Invoice

        public HttpResponseMessage Invoice(string date, string number, string total, string emails, string clientNumber, string matter, string description)
        {
            byte[] pdf = null;
            using (var ms = new MemoryStream())
            {
                using (var doc = new Document())
                {
                    doc.SetMargins(60, 60, 40, 40);
                    PdfWriter.GetInstance(doc, ms);
                    doc.Open();

                    #region Header
                    var table = new PdfPTable(4) { WidthPercentage = 100 };
                    var colSizes = new List<float> { 120f, 130f, 140f };
                    colSizes.Add(doc.PageSize.Width - colSizes.Sum());
                    table.SetWidths(colSizes.ToArray());
                    table.AddCell(new PdfPCell
                    {
                        Image = Image.GetInstance(HttpContext.Current.Request.MapPath("~\\App_Data\\Logo.jpg")),
                        BorderColorRight = BaseColor.WHITE,
                        Rowspan = 3
                    });

                    table.AddCell(new PdfPCell(CreatePhrase("950 E. State Hwy 114\nSuite 160\nSouthlake, TX 76092"))
                    {
                        HorizontalAlignment = Element.ALIGN_CENTER,
                        VerticalAlignment = Element.ALIGN_MIDDLE,
                        Rowspan = 3
                    });

                    table.AddCell(CreateCell("Invoice Date", Element.ALIGN_RIGHT));
                    table.AddCell(CreateCell(date, Element.ALIGN_CENTER));
                    table.AddCell(CreateCell("Invoice Number", Element.ALIGN_RIGHT));
                    table.AddCell(CreateCell(number, Element.ALIGN_CENTER));
                    table.AddCell(CreateCell("Invoice Total", Element.ALIGN_RIGHT));
                    table.AddCell(CreateCell(total, Element.ALIGN_CENTER));
                    doc.Add(table);
                    #endregion

                    #region Emails
                    doc.Add(CreatePhrase(" "));
                    table = new PdfPTable(1) { WidthPercentage = 100 };
                    table.AddCell(CreateCell($"Invoice for {emails}", Element.ALIGN_CENTER));
                    doc.Add(table);
                    #endregion

                    #region Matters
                    doc.Add(CreatePhrase(" "));
                    table = new PdfPTable(4) { WidthPercentage = 100 };
                    colSizes = new List<float> { 120f, 130f, 80f };
                    colSizes.Insert(2, doc.PageSize.Width - colSizes.Sum());
                    table.SetWidths(colSizes.ToArray());

                    var columns = new List<string> { "Client", "Matter", "Description", "Amount" };                    
                    columns.ForEach(c =>
                    {
                        var cell = new PdfPCell
                        {
                            Phrase = CreatePhrase(c, headerFont),
                            HorizontalAlignment = Element.ALIGN_CENTER                                                    
                        };
                        table.AddCell(cell);
                    });

                    columns = new List<string> { clientNumber, matter, description, total };
                    columns.ForEach(c =>
                    {
                        table.AddCell(CreateCell(c, Element.ALIGN_CENTER));
                    });
                    doc.Add(table);
                    #endregion

                    #region Footer
                    doc.Add(CreatePhrase("\nIf you have any questions, please contact us at [email protected]\n"));
                    doc.Add(CreatePhrase("\nThank you for using SyncIDS.com!"));
                    #endregion
                }
                pdf = ms.ToArray();
            }  

            var response = new HttpResponseMessage(HttpStatusCode.OK);
            response.Content = new ByteArrayContent(pdf);
            response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/pdf");
            return response;
        }
开发者ID:syncids,项目名称:utils-api,代码行数:85,代码来源:PdfController.cs

示例6: LoadTT

        private void LoadTT()
        {
            _DSDaiLy = DaiLyManager.getAllAlive()
                                    .Where(dl => dl.tinhTongTienThanhToanTheoThang(_startMonth,_startYear,_endMonth, _endYear) > 0).ToList();
            gdvDaiLy.DataSource = _DSDaiLy;
            lbTongThu.Text = _DSDaiLy.Sum(s => s.TongTienThanhToanTheoThang) + "";
            int tongthu = int.Parse(lbTongThu.Text.ToString());

            _DSNXB = NhaXuatBanManager.getAllAlive()
                .Where(dl => dl.tinhTongTienThanhToanTheoThang(_startMonth, _startYear, _endMonth, _endYear) > 0).ToList();
            gdvNXB.DataSource = _DSNXB;
            lbTongChi.Text = _DSNXB.Sum(s => s.TongTienThanhToanTheoThang) + "";
            int tongchi = int.Parse(lbTongChi.Text.ToString());
            lbLoiNhuan.Text= tongthu - tongchi + "";
        }
开发者ID:diepmyduong,项目名称:QuanLyPhatHanhSach,代码行数:15,代码来源:frmThongKeDoanhThu.cs

示例7: LoadTT

 private void LoadTT()
 {
     _Sach = SachManager.getAll()
                             .Where(s => s.tongSoLuongBanTheoThang(_startMonth,_startYear,_endMonth,_endYear) > 0 &&
                                 s.tongTienBanTheoThang(_startMonth,_startYear,_endMonth,_endYear) > 0).ToList();
     gdvDMSach.DataSource = _Sach;
     lbSachBanDuoc.Text = _Sach.Sum(s => s.TongSoLuongBanTheoThang) + "";
     lbTongTien.Text = _Sach.Sum(s => s.TongTienBanTheoThang) + "";
 }
开发者ID:diepmyduong,项目名称:QuanLyPhatHanhSach,代码行数:9,代码来源:frmThongKeSachBan.cs

示例8: PopulatePdfFile

        private static PdfPTable PopulatePdfFile(List<DateSalesReports> dataGroups)
        {
            PdfPTable table = new PdfPTable(DocumentColumnsCount);
            table.TotalWidth = TotalFileWidth;
            table.LockedWidth = true;

            AddContentMainHeader(table);

            foreach (var dataGroup in dataGroups)
            {
                AddSecondaryHeaderCells(table, dataGroup.Key);
                AddContentCells(table, dataGroup);
            }

            var grandTotal = dataGroups.Sum(dg => dg.TotalSumOfSales).ToString("F");
            AddFooterRow(table, "Grand Total: ", grandTotal);

            return table;
        }
开发者ID:Team-Perivian-Lily,项目名称:Supermarket-System,代码行数:19,代码来源:PdfUtility.cs

示例9: LoadGrid

        void LoadGrid(int pTableId)
        {
            vBasket = Basket.GetBasketList(pTableId);
            if (vBasket.Count == 0)
            {
                dgvProducts.DataSource = null;
                return;
            }
            gChelner = vBasket[0].Chelner;
            dgvProducts.DataSource = vBasket;
            gTable = tables.First(z => z.Id == pTableId);// Table.GetTableById(pTableId);

            total = vBasket.Sum(t => t.Total);
            lblTotal.Text = total.ToString("N2");
        }
开发者ID:gacaromar,项目名称:Restaurant,代码行数:15,代码来源:ucSaleSlip.cs

示例10: LoadBasket

        private void LoadBasket()
        {
            vBasket = Basket.GetBasketList(gTable.Id);
            dgvProducts.DataSource = vBasket;

            total = vBasket.Sum(t => t.Total);
            lblTotal.Text = total.ToString("N2");
        }
开发者ID:gacaromar,项目名称:Restaurant,代码行数:8,代码来源:ucSaleSlip.cs

示例11: LoadTT

 private void LoadTT()
 {
     if (_CurrentNXB != null)
     {
         _DSHDNXB = _CurrentNXB.getHoaDonTheoThang(_startMonth, _startYear, _endMonth, _endYear).ToList();
         gdvHoaDon.DataSource = _DSHDNXB;
         lbTongTienChi.Text = _DSHDNXB.Sum(p => p.TongTien) + "";
     }
 }
开发者ID:diepmyduong,项目名称:QuanLyPhatHanhSach,代码行数:9,代码来源:frmThongKeNguonChi.cs

示例12: LoadTT

 private void LoadTT()
 {
     if (_CurrentDaiLy != null)
     {
         _HDDaiLy = _CurrentDaiLy.getHoaDonTheoThang(_startMonth, _startYear, _endMonth, _endYear).ToList();
         gdvHoaDon.DataSource = _HDDaiLy;
         lbTongTienThu.Text = _HDDaiLy.Sum(p => p.TongTien) + "";
     }
 }
开发者ID:diepmyduong,项目名称:QuanLyPhatHanhSach,代码行数:9,代码来源:frmThongKeNguonThu.cs

示例13: loadTT

 private void loadTT()
 {
     if (x == 1)
     {
         _DMSachNXB = SachManager.getAll()
             .Where(s => s.tongSoLuongNXBNoTheoThang(_startMonth, _startYear, _endMonth, _endYear) > 0 &&
             s.tongTienNXBNoTheoThang(_startMonth, _startYear, _endMonth, _endYear) > 0).ToList();
         gdvDMSach.DataSource = _DMSachNXB;
         lbSoLuongNo.Text = _DMSachNXB.Sum(s => s.TongSoLuongNXBNoTheoThang) + "";
         lbTongTien.Text = _DMSachNXB.Sum(s => s.TongTienNXBNoTheoThang) + "";
     }
     if (x == 2)
     {
         _DMSachDLy = SachManager.getAll()
             .Where(s => s.tongSoLuongDaiLyNoTheoThang(_startMonth, _startYear, _endMonth, _endYear) > 0 && s.tongTienDaiLyNoTheoThang(_startMonth, _startYear, _endMonth, _endYear) > 0).ToList();
         gdvDMSach.DataSource = _DMSachDLy;
         lbSoLuongNo.Text = _DMSachDLy.Sum(s => s.TongSoLuongDaiLyNoTheoThang) + "";
         lbTongTien.Text = _DMSachDLy.Sum(s => s.TongTienDaiLyNoTheoTang) + "";
     }
 }
开发者ID:diepmyduong,项目名称:QuanLyPhatHanhSach,代码行数:20,代码来源:frmThongKeCongNo.cs

示例14: printCongNoDaiLy

        public byte[] printCongNoDaiLy(List<Sach> DMSach, DateTime startDate, DateTime endDate)
        {
            try
            {
                var filePath = Path.Combine(FolderPath, FileName);
                PdfWriter writer = PdfWriter.GetInstance(_doc, new FileStream(filePath, FileMode.Create));
                //Create table here for write database data

                var soLuongNo = (decimal)DMSach.Sum(s => s.TongSoLuongDaiLyNoTheoThang);
                var tongTienNo = (decimal)DMSach.Sum(s => s.TongTienDaiLyNoTheoTang);
                var HeaderTable = new PdfPTable(2);
                HeaderTable.HorizontalAlignment = 0;
                HeaderTable.SpacingBefore = 20;
                HeaderTable.SpacingAfter = 10;
                HeaderTable.SetWidths(new int[] { 2, 6 });

                HeaderTable.AddCell(createNoBorderCell("Ngày in", 2, 1, 1));
                HeaderTable.AddCell(createNoBorderCell(": " + DataDisplayHelper.dislayShortDate(DateTime.Now), 0, 1, 1));

                //Thông tin thống kê
                var InfoTable = new PdfPTable(4);
                InfoTable.HorizontalAlignment = 0;
                InfoTable.SpacingAfter = 10;
                InfoTable.DefaultCell.Border = 0;
                InfoTable.TotalWidth = 15;
                InfoTable.SetWidths(new int[] { 2, 2, 2, 2 });
                InfoTable.WidthPercentage = 100;
                InfoTable.DefaultCell.Border = Rectangle.BOX;
                InfoTable.AddCell(createHeaderCell("Xem từ tháng", 1, 1, 1));
                InfoTable.AddCell(createCell(DataDisplayHelper.dislayMonth(startDate), 1, 1, 1));
                InfoTable.AddCell(createHeaderCell("Đến tháng", 1, 1, 1));
                InfoTable.AddCell(createCell(DataDisplayHelper.dislayMonth(endDate), 1, 1, 1));
                InfoTable.AddCell(createHeaderCell("Số lượng nợ", 1, 1, 1));
                InfoTable.AddCell(createCell(DataDisplayHelper.displayNumber(soLuongNo), 0, 3, 1));
                InfoTable.AddCell(createHeaderCell("Tổng tiền", 1, 1, 1));
                InfoTable.AddCell(createCell(DataDisplayHelper.displayMoney(tongTienNo), 0, 3, 1));

                //Thống kê nguồn thu
                var DetailTable = new PdfPTable(8);
                DetailTable.HorizontalAlignment = 1;
                DetailTable.SpacingAfter = 10;
                DetailTable.WidthPercentage = 100;
                DetailTable.SetWidths(new int[] { 1, 6, 4, 3, 1, 3, 2, 3 });
                DetailTable.AddCell(createTableTitleCell("Danh mục sách Đại lý nợ", 0, 8, 1));
                DetailTable.AddCell(createNoBorderCell(" ", 1, 8, 1));
                foreach (var s in DMSach)
                {
                    DetailTable.AddCell(createBottomBorderCell(s.MaSoSach.ToString(), 1, 1, 1, BaseColor.LIGHT_GRAY));
                    DetailTable.AddCell(createBottomBorderCell(s.TenSach, 1, 1, 1, BaseColor.LIGHT_GRAY));
                    DetailTable.AddCell(createBottomBorderCell(" ", 1, 3, 1, BaseColor.LIGHT_GRAY));
                    DetailTable.AddCell(createBottomBorderCell("Tổng cộng", 1, 1, 1, BaseColor.LIGHT_GRAY));
                    DetailTable.AddCell(createBottomBorderCell(DataDisplayHelper.displayNumber((decimal)s.TongSoLuongDaiLyNoTheoThang), 1, 1, 1, BaseColor.LIGHT_GRAY));
                    DetailTable.AddCell(createBottomBorderCell(DataDisplayHelper.displayMoney((decimal)s.TongTienDaiLyNoTheoTang), 1, 1, 1, BaseColor.LIGHT_GRAY));
                    var CongNo = s.getCongNoDaiLyTheoThang(startDate.Month, startDate.Year, endDate.Month, endDate.Year);
                    foreach (var p in CongNo)
                    {
                        DetailTable.AddCell(createNoBorderCell(" ", 1, 2, 1));
                        //DetailTable.AddCell(createNoBorderCell("Phiếu xuất số " + p.Maso, 1, 1, 1));
                        DetailTable.AddCell(createNoBorderCell("Tháng " + DataDisplayHelper.dislayMonth(p.Thang), 1, 2, 1));
                        DetailTable.AddCell(createNoBorderCell(" ", 1, 1, 1));
                        DetailTable.AddCell(createNoBorderCell(DataDisplayHelper.displayMoney(p.DonGia), 1, 1, 1));
                        DetailTable.AddCell(createNoBorderCell(p.SoLuong.ToString(), 1, 1, 1));
                        DetailTable.AddCell(createNoBorderCell(DataDisplayHelper.displayMoney(p.ThanhTien), 1, 1, 1));
                    }
                }

                _doc.Open();
                _doc.Add(_tilte);
                _doc.Add(HeaderTable);
                _doc.Add(InfoTable);
                _doc.Add(DetailTable);
                _doc.Close();

                return File.ReadAllBytes(filePath);
            }
            catch (Exception)
            {
                return null;
            }
            finally
            {
                _doc.Close();
            }
        }
开发者ID:diepmyduong,项目名称:QuanLyPhatHanhSach,代码行数:84,代码来源:PrintHelper.cs

示例15: printTonKho

        public byte[] printTonKho(List<TheKho> DMTheKho, DateTime date)
        {
            try
            {
                var filePath = Path.Combine(FolderPath, FileName);
                PdfWriter writer = PdfWriter.GetInstance(_doc, new FileStream(filePath, FileMode.Create));
                //Create table here for write database data

                var HeaderTable = new PdfPTable(2);
                HeaderTable.HorizontalAlignment = 0;
                HeaderTable.SpacingBefore = 20;
                HeaderTable.SpacingAfter = 10;
                HeaderTable.SetWidths(new int[] { 2, 6});

                HeaderTable.AddCell(createNoBorderCell("Ngày xem",0,1,1));
                HeaderTable.AddCell(createNoBorderCell(": "+DataDisplayHelper.dislayShortDate(date),2,1,1));
                HeaderTable.AddCell(createNoBorderCell("Ngày in", 0, 1, 1));
                HeaderTable.AddCell(createNoBorderCell(": " + DataDisplayHelper.dislayShortDate(DateTime.Now), 2, 1, 1));

                var DetailTable = new PdfPTable(5);
                DetailTable.HorizontalAlignment = 1;
                DetailTable.SpacingAfter = 10;
                DetailTable.DefaultCell.Border = 0;
                DetailTable.SetWidths(new int[] { 3, 4, 4, 2, 4 });
                DetailTable.WidthPercentage = 100;
                DetailTable.DefaultCell.Border = Rectangle.BOX;
                DetailTable.AddCell(createHeaderCell(TheKhoManager.Properties.MaSoSach, 1, 1, 1));
                DetailTable.AddCell(createHeaderCell(SachManager.Properties.TenSach, 1, 1, 1));
                DetailTable.AddCell(createHeaderCell(SachManager.Properties.TenTacGia, 1, 1, 1));
                DetailTable.AddCell(createHeaderCell(TheKhoManager.Properties.SoLuong, 1, 1, 1));
                DetailTable.AddCell(createHeaderCell(TheKhoManager.Properties.NgayGhi, 1, 1, 1));

                foreach (var s in DMTheKho)
                {
                    DetailTable.AddCell(createCell(s.MaSoSach.ToString(), 1, 1, 1));
                    DetailTable.AddCell(createCell(s.Sach.TenSach, 0, 1, 1));
                    DetailTable.AddCell(createCell(s.Sach.TenTacGia, 0, 1, 1));
                    DetailTable.AddCell(createCell(s.SoLuong.ToString(), 0, 1, 1));
                    DetailTable.AddCell(createCell(DataDisplayHelper.dislayShortDate(s.NgayGhi), 1, 1, 1));
                }
                DetailTable.AddCell(createHeaderCell("Tổng cộng", 2, 3, 1));
                DetailTable.AddCell(createCell(DMTheKho.Sum(tk => tk.SoLuong).ToString(), 0, 2, 1));

                _doc.Open();
                _doc.Add(_tilte);
                _doc.Add(HeaderTable);
                _doc.Add(DetailTable);
                _doc.Close();

                return File.ReadAllBytes(filePath);
            }
            catch (Exception)
            {
                return null;
            }
            finally
            {
                _doc.Close();
            }
        }
开发者ID:diepmyduong,项目名称:QuanLyPhatHanhSach,代码行数:60,代码来源:PrintHelper.cs


注:本文中的iTextSharp.text.List.Sum方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。