Пример #1
0
        private Workbook ConstructWorkbook()
        {
            Workbook  workBook  = new Workbook();
            Worksheet workSheet = AddWorkSheet(ref workBook);

            workSheet = AddColumnHeadings(workSheet);
            for (int i = 0; i < this.NominatedRequestPersons.Count; i++)
            {
                RequestPerson rp = this.NominatedRequestPersons[i];
                workSheet.Cells[i + 1, 0].PutValue(rp.Person.Name);
                int j = 0;
                for (j = 0; j < this.ScreeningEntities.Count; j++)
                {
                    ScreeningEntity se = this.ScreeningEntities[j];
                    ScreeningRequestPersonEntity srpe = rp.GetMostRecentScreeningRequestPersonEntity(se.ScreeningEntityName);
                    if (srpe != null)
                    {
                        workSheet.Cells[i + 1, j + 1].PutValue(srpe.ScreeningResult.ToString());
                        workSheet.Cells[i + 1, j + 1].SetStyle(GetCellStyleForResult(srpe.ScreeningResult.ToString()));
                    }
                }
                //dsrsg
                ScreeningRequestPersonRecommendation srpr = rp.GetScreeningRequestPersonRecommendation();
                if (srpr != null)
                {
                    workSheet.Cells[i + 1, j + 1].PutValue(srpr.ScreeningResult.ToString());
                    workSheet.Cells[i + 1, j + 1].SetStyle(GetCellStyleForResult(srpr.ScreeningResult.ToString()));
                }
                //the user's commentary and reason; dsrsg commentary if no screening entity
                if (!string.IsNullOrEmpty(this.UserScreeningEntityName))
                {
                    ScreeningRequestPersonEntity srpe = rp.GetMostRecentScreeningRequestPersonEntity(this.UserScreeningEntityName);
                    if (srpe != null)
                    {
                        workSheet.Cells[i + 1, j + 2].PutValue(srpe.Reason);
                        workSheet.Cells[i + 1, j + 3].PutValue(srpe.Commentary);
                    }
                }
                else
                if (srpr != null)
                {
                    workSheet.Cells[i + 1, j + 3].PutValue(srpr.Commentary);
                }
            }
            workSheet.AutoFitColumns();
            return(workBook);
        }
        /// <summary>
        /// Sets a row in the person attached
        /// </summary>
        /// <param name="row">The row that has already been added to the persons attached table</param>
        /// <param name="person">The person whose details should be added to the row</param>
        /// <returns>Pdf row object</returns>
        private Row SetPersonAttachedRow(ScreeningEntity screeningEntity, Row row, RequestPerson requestPerson)
        {
            string   personName;
            Text     text;
            Cell     cell;
            TextInfo textInfo = new TextInfo();

            row.VerticalAlignment = VerticalAlignmentType.Top;
            row.IsBroken          = false;

            //text customization for labels in request details
            textInfo.FontSize           = 12;
            textInfo.IsTrueTypeFontBold = false;
            textInfo.Alignment          = AlignmentType.Center;

            //Name Column
            personName = requestPerson.Person.Name;
            cell       = row.Cells.Add(personName.Trim(), textInfo);

            //Military ID Column
            cell = row.Cells.Add(requestPerson.Person.MilitaryIDNumber, textInfo);

            //Color
            ScreeningRequestPersonEntity srpe = requestPerson.GetMostRecentScreeningRequestPersonEntity(screeningEntity.ScreeningEntityName);
            string color = string.Empty;

            if (srpe != null)
            {
                color = srpe.ScreeningResult.ToString();
            }
            cell = row.Cells.Add();
            text = new Text(color);
            if (!string.IsNullOrEmpty(color))
            {
                //Green
                if (color.Equals(ScreeningResult.GREEN, StringComparison.OrdinalIgnoreCase))
                {
                    text.TextInfo.BackgroundColor = new Color("Green");
                    text.TextInfo.Color           = new Color("White");
                }
                //Yellow
                else if (color.Equals(ScreeningResult.YELLOW, StringComparison.OrdinalIgnoreCase))
                {
                    text.TextInfo.BackgroundColor = new Color("Yellow");
                    text.TextInfo.Color           = new Color("Black");
                }
                //Red
                else if (color.Equals(ScreeningResult.RED, StringComparison.OrdinalIgnoreCase))
                {
                    text.TextInfo.BackgroundColor = new Color("Red");
                    text.TextInfo.Color           = new Color("White");
                }
            }
            text.TextInfo.Alignment   = AlignmentType.Center;
            text.TextInfo.LineSpacing = 6;
            cell.Paragraphs.Add(text);

            //Reason
            cell = row.Cells.Add(srpe != null ? srpe.Reason : string.Empty, textInfo);

            //Commentary
            cell = row.Cells.Add(srpe != null ? srpe.Commentary : string.Empty, textInfo);

            return(row);
        }