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


C# List.Any方法代码示例

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


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

示例1: AutoResizeTableColumns

        /// <summary>
        /// Tries to auto resize the specified table columns.
        /// </summary>
        /// <param name="table">pdf table</param>
        public static void AutoResizeTableColumns(this PdfGrid table)
        {
            if (table == null) return;
            var currentRowWidthsList = new List<float>();
            var previousRowWidthsList = new List<float>();

            foreach (var row in table.Rows)
            {
                currentRowWidthsList.Clear();
                currentRowWidthsList.AddRange(row.GetCells().Select(cell => cell.GetCellWidth()));

                if (!previousRowWidthsList.Any())
                {
                    previousRowWidthsList = new List<float>(currentRowWidthsList);
                }
                else
                {
                    for (int i = 0; i < previousRowWidthsList.Count; i++)
                    {
                        if (previousRowWidthsList[i] < currentRowWidthsList[i])
                            previousRowWidthsList[i] = currentRowWidthsList[i];
                    }
                }
            }

            if (previousRowWidthsList.Any())
                table.SetTotalWidth(previousRowWidthsList.ToArray());
        }
开发者ID:VahidN,项目名称:PdfReport,代码行数:32,代码来源:ElementsWidth.cs

示例2: Tablero

        // GET: Tablero
        public ActionResult Tablero(string lvl, int? areaId)
        {
            ApplicationUser usuario = (ApplicationUser)db.Users.FirstOrDefault(item => item.UserName == User.Identity.Name);
            int periodId = (int)Session["SelectedPeriod"];
            Periodo period = db.Periodos.Find(periodId);
            int nivel;
            Area area;

            if (lvl == null)
            {
                nivel = usuario.UsuarioArea.Nivel.ID;
            }
            else
            {
                nivel = int.Parse(lvl);
            }
            // Area
            if (areaId == null)
            {
                if (usuario.TienePermiso(1)) // Administrador
                {
                    area = db.Areas.First();
                }
                else
                {
                    area = usuario.UsuarioArea;
                }
                areaId = area.ID;
            }
            else
            {
                area = db.Areas.FirstOrDefault(item => item.ID == areaId);
            }
            ViewBag.CurrentArea = area;
            // Areas
            if (usuario.TieneNivel(1) || usuario.TienePermiso(1))
            {
                ViewBag.Areas = db.Areas.Where(item => item.Nivel.ID == nivel).ToList();
            }
            else if (usuario.TieneNivel(2))
            {
                if (nivel == 2)
                {
                    ViewBag.Areas = db.Areas.Where(item => item.ID == usuario.UsuarioArea.ID).ToList();
                }
                else if (nivel == 3)
                {
                    List<Area> Areas = new List<Area>();
                    List<int> areasId = new List<int>();

                    Areas = db.Areas.Where(item => item.Nivel.ID == nivel && item.AreaPadre.ID == usuario.UsuarioArea.ID).ToList();
                    areasId = (from a in Areas
                               select a.ID).ToList();
                    Areas.AddRange(db.Areas.Where(item => item.Nivel.ID == nivel && areasId.Any(p => item.AreaPadre.ID == p)).ToList());
                    areasId = (from a in Areas
                               select a.ID).ToList();
                    Areas.AddRange(db.Areas.Where(item => item.Nivel.ID == nivel && areasId.Any(p => item.AreaPadre.ID == p)).ToList());
                    ViewBag.Areas = Areas.Distinct().OrderBy(item => item.ID);
                }
            }
            else if (usuario.TienePermiso(6))
            {
                List<Area> Areas = new List<Area>();

                Areas.Add(usuario.UsuarioArea);
                Areas.AddRange(usuario.UsuarioArea.AreasHijas.ToList());
                ViewBag.Areas = Areas.OrderBy(item => item.AreaPadre.ID);
            }
            lvl = nivel.ToString();
            ViewBag.usuario = usuario;
            ViewBag.Nivel = lvl;
            ViewBag.PeriodoSeleccionado = period;

               /* int _nivel = 3;

            if (usuario.TieneNivel(1))
            {
                _nivel = 1;
            }

            if (usuario.TieneNivel(2))
            {
                _nivel = 2;
            }

            if (usuario.TieneNivel(3))
            {
                _nivel = 3;
            }*/

            List<NivelOrganizacional> Niveles = new List<NivelOrganizacional>();

            NivelOrganizacional Nivel_01 = db.NivelesOrganizacionales.Find(1);
            Niveles.Add(Nivel_01);
            NivelOrganizacional Nivel_02 = db.NivelesOrganizacionales.Find(2);
            Niveles.Add(Nivel_02);
            NivelOrganizacional Nivel_03 = db.NivelesOrganizacionales.Find(3);
            Niveles.Add(Nivel_03);
            ViewBag.Niveles = Niveles;
//.........这里部分代码省略.........
开发者ID:ligues,项目名称:isar_dev,代码行数:101,代码来源:ReportesController.cs

示例3: Proyectos

        // GET: Proyectos
        public ActionResult Proyectos(int? areaId, int? tipoId)
        {
            ApplicationUser usuario = (ApplicationUser)db.Users.FirstOrDefault(item => item.UserName == User.Identity.Name);
            int periodId = (int)Session["SelectedPeriod"];
            Periodo period = db.Periodos.Find(periodId);
            Area area;
            TipoProyecto tipo;

            if (areaId == null)
            {
                if (usuario.TienePermiso(26) && usuario.TieneNivel(2))
                {
                    area = db.Areas.Where(item => item.Nivel.ID == 3 && item.AreaPadre.ID == usuario.UsuarioArea.ID).First();
                }
                if (usuario.TienePermiso(1) || (usuario.TienePermiso(26) && (usuario.TieneNivel(1)))) // Administrador y Presidente
                {
                    area = db.Areas.Where(item => item.Nivel.ID == 3).First();
                }
                else if (usuario.TieneNivel(3) && usuario.TienePermiso(6))
                {
                    area = usuario.UsuarioArea;
                }
                else
                {
                    area = usuario.UsuarioArea;
                }
                areaId = area.ID;
            }
            else
            {
                area = db.Areas.Where(item => item.Nivel.ID == 3).FirstOrDefault(item => item.ID == areaId);
            }
            if (tipoId == null)
            {
                tipo = db.TipoProyecto.FirstOrDefault();
                tipoId = tipo.ID;
            }
            else
            {
                tipo = db.TipoProyecto.Find(tipoId);
            }
            ViewBag.CurrentTipo = tipo;
            ViewBag.CurrentArea = area;
            if (usuario.TienePermiso(26) && usuario.TieneNivel(2))
            {
                List<Area> Areas = new List<Area>();
                List<int> areasId = new List<int>();

                Areas = db.Areas.Where(item => item.Nivel.ID == 3 && item.AreaPadre.ID == usuario.UsuarioArea.ID).ToList();
                areasId = (from a in Areas
                           select a.ID).ToList();
                Areas.AddRange(db.Areas.Where(item => item.Nivel.ID == 3 && areasId.Any(p => item.AreaPadre.ID == p)).ToList());
                areasId = (from a in Areas
                           select a.ID).ToList();
                Areas.AddRange(db.Areas.Where(item => item.Nivel.ID == 3 && areasId.Any(p => item.AreaPadre.ID == p)).ToList());
                ViewBag.Areas = Areas.Distinct().OrderBy(item => item.ID);
            }
            if (usuario.TienePermiso(1) || (usuario.TienePermiso(26) && (usuario.TieneNivel(1)))) // Administrador y Presidente
            {
                ViewBag.Areas = db.Areas.Where(item => item.Nivel.ID == 3).ToList();
            }
            if (usuario.TienePermiso(6) && usuario.TieneNivel(3))
            {
                List<Area> Areas = new List<Area>();

                Areas.Add(usuario.UsuarioArea);
                Areas.AddRange(usuario.UsuarioArea.AreasHijas.ToList());
                ViewBag.Areas = Areas.OrderBy(item => item.AreaPadre.ID);
            }
            ViewBag.Tipos = db.TipoProyecto.ToList();
            ViewBag.usuario = usuario;
            ViewBag.PeriodoSeleccionado = period;
            return View(db.Proyectos.Where(item => item.Tipo.ID == tipoId && item.Area.ID == areaId && item.Periodos.Any(p => p.ID == periodId)).ToList());
        }
开发者ID:ligues,项目名称:isar_dev,代码行数:75,代码来源:ReportesController.cs

示例4: 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;
        }
开发者ID:woofwoof88,项目名称:first-place-processing,代码行数:41,代码来源:pdfMasterList.ashx.cs

示例5: 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 });
 }
开发者ID:woofwoof88,项目名称:first-place-processing,代码行数:55,代码来源:DocumentManager.cs

示例6: 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());
                }
            }
        }
开发者ID:aaams,项目名称:infinite-story-download,代码行数:76,代码来源:PdfWriter.cs

示例7: CreateBookMark

 private Dictionary<string,object> CreateBookMark(KeyValuePair<string,BookMark> bookMark)
 {
     var bm = new Dictionary<string, object>();
     bm["Action"] = "GoTo";
     bm["Title"] = bookMark.Key;
     bm["Page"] = string.Format("{0} XYZ 0 0 0", bookMark.Value.Page);
     if(bookMark.Value.Children != null)
     {
         List<Dictionary<string, object>> kids = new List<Dictionary<string, object>>();
         foreach(var kvp in bookMark.Value.Children)
         {
             kids.Add(CreateBookMark(kvp));
         }
         if (kids.Any())
         {
             bm["children"] = kids;
         }
     }
     return bm;
 }
开发者ID:kamalm87,项目名称:WebScaleFileManage,代码行数:20,代码来源:Parser.cs

示例8: demographicfield

 public String demographicfield(int fieldID,int pollID,String [] items)
 {
     var result = "";
     var poll = pollRepository.GetPollByID(pollID);
     List<string> values = new List<string>();
     IList<ParticipantFieldValue> valued = participantRepository.GetParticipantFieldByID(fieldID).fieldValues.Where(valu => (!valu.value.Equals(""))).ToList();
     if (poll.isGroup) valued = valued.Where(v => v.groupd != null).ToList();
     else valued = valued.Where(v => v.participant != null).ToList();
     values = (from v in valued select v.value).Distinct().ToList();
     bool num = true;
     int number;
     if (values.Any(v => (!int.TryParse(v, out number)))) num = false;
     if (num == false)
     {
         values.Sort((x, y) => string.Compare(x, y));
         foreach (String value in values)
         {
             if (items != null && items.Contains(value))
                 result = result + "<label><input type=\"checkbox\" name=\"items\" checked=\"yes\" value=\"" + value + "\"/>" + value + "</label><br />";
             else result = result + "<label><input type=\"checkbox\" name=\"items\" value=\"" + value + "\"/>" + value + "</label><br />";
         }
     }
     else
     {
         List<int> intvalues = values.ConvertAll<int>(delegate(String i) { return int.Parse(i); });
         intvalues.Sort();
         foreach (int value in intvalues)
         {
             if (items != null && items.Contains(value.ToString()))
                 result = result + "<label><input type=\"checkbox\" name=\"items\" checked=\"yes\" value=\"" + value + "\"/>" + value + "</label><br />";
             else result = result + "<label><input type=\"checkbox\" name=\"items\" value=\"" + value + "\"/>" + value + "</label><br />";
         }
     }
     return result;
 }
开发者ID:thebinarysearchtree,项目名称:dbPoll,代码行数:35,代码来源:PollController.cs


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