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


C# List.IndexOf方法代码示例

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


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

示例1: printRingForUser


//.........这里部分代码省略.........
                                chunk.SetBackground(new Color(System.Drawing.ColorTranslator.FromHtml(dogRow["DogColour"].ToString())));

                                var dogPara = new Paragraph();
                                dogPara.Add(new Phrase(chunk));

                                if (TeamPairsManager.isMultiDog( EntryType ))
                                {
                                    pairsTeams.Add(new TeamPairsTrioDto
                                    {
                                        ClassId = ClassID,
                                        ClassNo = ClassNo,
                                        DogId = DogID,
                                        DogName = dogName,
                                        RO = -1
                                    });
                                }
                                dogPara.Add(new Phrase(new Chunk(String.Format(" [{1}] {0}", Fpp.Core.Utils.TitleCaseString(dogName), dogRow["RO"]), dogDetailsInClass)));
                                dogPara.Add(new Phrase(new Chunk(String.Format("{0}", (dogLho == 0 ? "" : " (LHO)")), font8)));
                                dogPara.Add(Chunk.NEWLINE);

                                int AltHandler = Convert.ToInt32(dogRow["AltHandler"]);
                                String HandlerName = "";
                                if (AltHandler > 0)
                                {
                                    User u = new User(AltHandler);
                                    HandlerName = u.Name;
                                    dogPara.Add(new Phrase(new Chunk(String.Format("Handler:{0}", Fpp.Core.Utils.TitleCaseString(HandlerName)), dogInClass)));
                                }
                                allDogsInClass.Add(dogPara);
                                countDogs++;
                            }
                            else
                            {
                                if (defaultUsers != null && defaultUsers.IndexOf(DefaultHandler) == -1)
                                {
                                    defaultUsers.Add(DefaultHandler);
                                }
                            }
                        }
                        if (countDogs == 0)
                        {
                            cell = new PdfPCell(new Phrase(new Chunk(ringRow["ClsNo"].ToString(), dogNotInClass)));
                            cell.BorderWidth = 0;
                            cell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
                            classDetailsTable.AddCell(cell);

                            var namePara = new Paragraph();
                            namePara.Add(new Phrase(new Chunk(clsName, dogNotInClass)));
                            namePara.Add(new Phrase(new Chunk(lhoInd, lhoFontBold)));
                            p.Add(namePara);
                            cell = new PdfPCell(p);
                            cell.BorderWidth = 0;
                            cell.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
                            cell.NoWrap = false;
                            classDetailsTable.AddCell(cell);

                            cell = new PdfPCell(new Phrase(new Chunk(dogsInClassDisplay, dogNotInClass)));
                            cell.BorderWidth = 0;
                            cell.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
                            classDetailsTable.AddCell(cell);
                        }
                        else
                        {

                            cell = new PdfPCell(p);
                            cell.BorderWidth = 0;
开发者ID:woofwoof88,项目名称:first-place-processing,代码行数:67,代码来源:RunningPlans.cs

示例2: ConflictLogic

        /// <summary>
        /// Adds conflicts to the database depending upon the current state of the election.
        /// </summary>
        /// <param name="session">A valid session.</param>
        protected virtual void ConflictLogic(ISession session)
        {
            List<ElectionConflict> conflicts = ElectionConflict.FindElectionConflicts(session, ID);
            foreach (ElectionConflict conflict in conflicts)
                NHibernateHelper.Delete(session, conflict);

            ITransaction transaction = session.BeginTransaction();
            // Get the current committee
            Committee committee = Committee.FindCommittee(session, PertinentCommittee);

            // Get the users who won the election.
            Dictionary<string, int> winners = GetResults(session);
            List<User> winningUsers = new List<User>();
            foreach (string email in winners.Keys)
            {
                winningUsers.Add(User.FindUser(session, email));
            }

            // Get the users on the committee.
            List<User> members = User.FindUsers(session, committee.Name);

            // List all of the departments currently present on the committee.
            // and use a parallel list to store the ID of the other department
            // member so we can add it to the conflict later.
            List<DepartmentType> departments = new List<DepartmentType>();
            List<int> secID = new List<int>();
            foreach (User i in members)
            {
                departments.Add(i.Department);
                secID.Add(i.ID);
            }

            // For each user who won, add a new conflict if their department
            // is already present on the list. Adding, departments as we go.
            // Also raise conflicts if the winning users hold officer positions,
            // or if they already serve on a committee.
            foreach (User i in winningUsers)
            {
                // check if they have a prior committment
                if (i.OfficerPosition != OfficerPositionType.None ||
                    i.CurrentCommittee != User.NoCommittee)
                {
                    ElectionConflict conflict = new ElectionConflict();
                    conflict.Election = ID;
                    conflict.FirstUser = i.ID;
                    conflict.SecUser = ElectionConflict.SecondUserNotApplicable;
                    conflict.Type = ConflictType.ElectedToMultipleCommittees;
                    session.SaveOrUpdate(conflict);
                }

                // check for department-based conflicts
                if(departments.Contains(i.Department))
                {
                    ElectionConflict conflict = new ElectionConflict();
                    conflict.Election = ID;
                    conflict.FirstUser = i.ID;
                    conflict.SecUser = secID[departments.IndexOf(i.Department)];
                    conflict.Type = ConflictType.TooManyDeptMembers;
                    session.SaveOrUpdate(conflict);
                }
            }
            session.Flush();
            NHibernateHelper.Finished(transaction);
        }
开发者ID:bashtech,项目名称:ivote-teama,代码行数:68,代码来源:CommitteeElection.cs

示例3: WriteFields

        /// <summary>
        /// 输出到PDF
        /// </summary>
        /// <param name="list"></param>
        /// <param name="sysFont"></param>
        /// <param name="multiRow"></param>
        /// <param name="export">算高度的情况最后输出时使用</param>
        /// <returns></returns>
        public Table WriteFields(List<List<PdfDesc>> list, System.Drawing.Font sysFont, int multiRow, bool export)
        {
            #region Variable Definition
            Cell cell = null;
            int maxColumnCount = -1;
            int maxRowCount = -1;
            LineSeparator lineSeparator = null;
            int tempCount = 0;
            int previousFieldCells = 0;
            Table tb = null;
            #endregion

            //try
            //{
                Font pdfFont = this.GetPdfFont(sysFont);

                //Hashtable allStartIndex = new Hashtable();

                Dictionary<int, int> allStartIndex = new Dictionary<int, int>();

                if (export)
                {
                    foreach (List<PdfDesc> row in list)
                    {
                        if (!allStartIndex.ContainsKey(row[0].FieldNum))
                        {
                            allStartIndex.Add(row[0].FieldNum, list.IndexOf(row));
                        }
                    }
                }
                else
                {
                    allStartIndex.Add(0, 0);
                }

                List<int> startIndex = new List<int>();

                foreach (int index in allStartIndex.Values)
                {
                    startIndex.Add(index);
                }

                for (int l = 0; l < startIndex.Count; l++)
                {
                    //計算最大Column和最大Row

                    maxColumnCount = 0;

                    if (startIndex.Count == 1)
                    {
                        maxRowCount = list.Count;
                    }
                    else if (l != startIndex.Count - 1)
                    {
                        maxRowCount = startIndex[l + 1] - startIndex[l];
                    }
                    else
                    {
                        maxRowCount = list.Count - startIndex[l];
                    }

                    for (int s = startIndex[l]; s < list.Count; s++)
                    //foreach (List<PdfDesc> row in list)
                    {
                        if (startIndex.Count != 1)
                        {
                            if (l != startIndex.Count - 1 && s == startIndex[l + 1])
                            {
                                break;
                            }
                        }

                        List<PdfDesc> row = list[s];

                        foreach (PdfDesc pdfDesc in row)
                        {
                            tempCount += pdfDesc.Cells;
                        }

                        if (tempCount > maxColumnCount)
                        {
                            maxColumnCount = tempCount;
                        }

                        tempCount = 0;
                    }

                    tb = new Table(maxColumnCount, maxRowCount);

                    #region 計算欄位寬度
                    if (multiRow == 1)
                    {
//.........这里部分代码省略.........
开发者ID:san90279,项目名称:UK_OAS,代码行数:101,代码来源:PdfController.cs

示例4: WriteItem


//.........这里部分代码省略.........

                            cell = new Cell(new Chunk(value, pdfFont));
                        }
                        else
                        {
                            #region Image Item
                            image = Image.GetInstance((System.Drawing.Image)((ReportItem)list[i]).Value, System.Drawing.Imaging.ImageFormat.Jpeg);

                            image.Alignment = this.GetPdfImageHAlign(((ReportItem)list[i]).ContentAlignment);

                            if (list.Count > 1)
                            {
                                imageWidth = (this.pdfDoc.PageSize.Width - this.pdfDoc.LeftMargin - this.pdfDoc.RightMargin) / (float)list.Count;
                                //imageWidth -= (float)16;
                                //image.ScaleAbsoluteWidth(imageWidth);
                            }
                            Chunk chuck = new Chunk(image, 0, 0, true);
                            cell = new Cell(chuck);
                            #endregion
                        }

                        cell.UseAscender = true; //此屬性設置為True的時候VerticalAlignment才會起作用
                        cell.VerticalAlignment = Cell.ALIGN_MIDDLE;

                        cell.HorizontalAlignment = this.GetPdfHAlign(((ReportItem)list[i]).ContentAlignment);

                        if (((ReportItem)list[i]).Cells == 0)
                        {
                            if (tb.Columns - cellCount != 0)
                            {
                                cell.Colspan = tb.Columns - cellCount;
                            }
                        }
                        else
                        {
                            cell.Colspan = ((ReportItem)list[i]).Cells;
                        }
                        cell.Border = Rectangle.NO_BORDER;

                        if (((ReportItem)list[i]).Position == ReportItem.PositionAlign.Right && ((ReportItem)list[i]).Cells != 0)
                        {
                            if (maxColumnCount - cellCount - ((ReportItem)list[i]).Cells != 0)
                            {
                                Cell tempCell = new Cell();
                                tempCell.Colspan = maxColumnCount - cellCount - ((ReportItem)list[i]).Cells;
                                tempCell.Border = Rectangle.NO_BORDER;
                                tb.AddCell(tempCell);

                                cellCount = maxColumnCount - ((ReportItem)list[i]).Cells;
                            }
                        }

                        if (i == 0 && ((ReportItem)list[i]).Position != ReportItem.PositionAlign.Right)
                        {
                            tb.AddCell(cell, lists.IndexOf(list), i);
                        }
                        else
                        {
                            tb.AddCell(cell, lists.IndexOf(list), cellCount);
                        }

                        cellCount += ((ReportItem)list[i]).Cells;
                    }
                }

                if (ExportByHeight)
                {
                    if (HeaderTable == null && object.ReferenceEquals(sysFont, report.HeaderFont))
                    {
                        HeaderTable = tb;

                        if (HeaderHeight == 0.0)
                        {
                            HeaderHeight = height;
                        }

                    }
                    else if (FooterTable == null && object.ReferenceEquals(sysFont, report.FooterFont))
                    {
                        FooterTable = tb;

                        if (FooterHeight == 0.0)
                        {
                            FooterHeight = height;
                        }
                    }
                }
                else
                {
                    this.pdfDoc.Add(tb);
                }
            //}
            //catch (Exception ex)
            //{
            //    log.WriteExceptionInfo(ex);
            //    throw ex;
            //}

            return tb;
        }
开发者ID:san90279,项目名称:UK_OAS,代码行数:101,代码来源:PdfController.cs

示例5: printRingForUser


//.........这里部分代码省略.........
                    ringCnt++;
                    ringDetails = new PdfPTable(1);
                    rings.AddCell(new PdfPCell( ringDetails));

                    List<Judge> judgeList = Judge.getJudgesForRingList(RingID);

                    cell = new PdfPCell(new Phrase(new Chunk("Ring No " + ringRow["RingNo"].ToString(), judgeFont)));
                    cell.BorderWidth = 0;
                    cell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                    ringDetails.AddCell(cell);

                    foreach (Judge judge in judgeList)
                    {
                        cell = new PdfPCell(new Phrase(new Chunk(judge.Name, judgeFont)));
                        cell.BorderWidth = 0;
                        cell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                        ringDetails.AddCell(cell);
                    }
                    currentRingID = RingID;
                    classDetailsTable = new PdfPTable(new float[] { 50, 225, 100 });
                    classDetailsTable.DefaultCell.BorderWidth = 0;
                    ringDetails.AddCell(classDetailsTable);
                }
                html += "<tr>";
                DataSet dogsList = d.GetDogsInClass(userShow.Userid, ClassID);
                int DogsInClass = d.dogsInClassCount(ClassID);

                String clsName = String.Format("{0} {1} {2} {3}",
                                ShowClasses.expandCatagory(ringRow),
                                ShowClasses.expandHeight(ringRow),
                                ringRow["LongName"],
                                ringRow["name"]);
                String grades = ShowClasses.shortenGrades(ringRow);
                int ix = clsName.IndexOf("Grd");
                if (ix == -1) ix = clsName.IndexOf("Cmb");
                if (ix > -1)
                {
                    clsName = clsName.Substring(0, ix + 3) + " " + grades + " " + clsName.Substring(ix + 4);
                }
                else
                {
                    ix = clsName.IndexOf(" ");
                    clsName = clsName.Substring(0, ix) + " " + grades + " " + clsName.Substring(ix + 1);
                }

                if (dogsList.Tables[0].Rows.Count > 0)
                {
                    Phrase[] tmpCells = new Phrase[3];
                    tmpCells[0] = new Phrase(new Chunk(ringRow["ClsNo"].ToString(), dogInClass));
                    tmpCells[1] = new Phrase(new Chunk(clsName, dogInClass));
                    tmpCells[2] = new Phrase(new Chunk(String.Format("({0})", DogsInClass), dogInClass));

                    int countDogs = 0;
                    int DefaultHandler;
                    Paragraph p = new Paragraph();
                    foreach (DataRow dogRow in dogsList.Tables[0].Rows)
                    {
                        int DogID = Convert.ToInt32(dogRow["DogID"]);
                        DefaultHandler = Convert.ToInt32(dogRow["DefaultHandler"]);
                        if (DefaultHandler == 0) DefaultHandler = -1;
                        if ((DefaultHandler == -1 && currentUser.UserID == UserID) ||
                            (DefaultHandler == UserID)
                            )
                        {
                            if (countDogs == 0)
                            {
开发者ID:woofwoof88,项目名称:first-place-processing,代码行数:67,代码来源:pdfRunningPlan.ashx.cs


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