Exemplo n.º 1
0
        private ControloAutoridade CreateCAIfNonExistent(long ID)
        {
            ControloAutoridade ca;

            ca = GetExistentCA(ID);
            if (ca == null)
            {
                ca    = new ControloAutoridade();
                ca.ID = ID;
                caIDs.Add(ID);
                cas.Add(ID, ca);
                DoAddedEntries(1);
            }
            return(ca);
        }
Exemplo n.º 2
0
        private void AddOtherControloAutoridade(Document doc, ControloAutoridade ca)
        {
            if (IDTipoNoticiaAut != ca.IDTipoNoticiaAut)
            {
                IDTipoNoticiaAut = ca.IDTipoNoticiaAut;
                Paragraph p = new Paragraph(CentimeterToPoint(0.5F), ca.Codigo + "   " + GISA.Utils.GUIHelper.CapitalizeFirstLetter(ca.TipoNoticiaAut), this.BodyFont);
                p.SpacingBefore = 10f;
                p.SpacingAfter  = 5f;
                doc.Add(p);
            }

            IDTipoNoticiaAut = ca.IDTipoNoticiaAut;
            Paragraph p2 = new Paragraph(CentimeterToPoint(0.5F), ca.Codigo + "   " + GISA.Utils.GUIHelper.CapitalizeFirstLetter(ca.Designacao), this.ContentFont);

            doc.Add(p2);
        }
Exemplo n.º 3
0
        private void AddEntidadeProdutora(Document doc, ControloAutoridade ca)
        {
            Paragraph p = new Paragraph(CentimeterToPoint(0.5F), ca.Codigo + "   " + GISA.Utils.GUIHelper.CapitalizeFirstLetter(ca.Designacao), this.BodyFont);

            p.SpacingBefore = 10f;
            p.SpacingAfter  = 5f;
            doc.Add(p);

            Table casTable = new Table(2, 1);

            casTable.BorderColor            = iTextSharp.text.Color.WHITE;
            casTable.DefaultCellBorderColor = iTextSharp.text.Color.WHITE;
            casTable.Width     = 100;
            casTable.Widths    = new float[] { 28, 72 };
            casTable.Alignment = Element.ALIGN_CENTER;

            System.Text.StringBuilder agregados;
            ArrayList info;

            // percorrer a lista de campos selecionados pelo utilizador respeitando a ordem que aparecem na interface
            foreach (ReportParameterRelEPs param in this.mFields)
            {
                ReportParameterRelEPs.CamposRelEPs campo = param.Campo;
                if (param.RetType == ReportParameter.ReturnType.TextOnly)
                {
                    info = ca.InfoAdicional[campo];
                    List <string> campos = new List <string>();
                    switch (campo)
                    {
                    case ReportParameterRelEPs.CamposRelEPs.DatasExistencia:
                        ArrayList camposDP = new ArrayList();
                        camposDP = (ArrayList)info[1];
                        List <string> paragraphs = new List <string>();
                        if (camposDP[0].ToString().Length > 0 || camposDP[1].ToString().Length > 0 || camposDP[2].ToString().Length > 0 ||
                            camposDP[4].ToString().Length > 0 || camposDP[5].ToString().Length > 0 || camposDP[6].ToString().Length > 0)
                        {
                            string datasProducao = GISA.Utils.GUIHelper.FormatDateInterval(
                                GISA.Utils.GUIHelper.FormatDate(camposDP[0].ToString(), camposDP[1].ToString(), camposDP[2].ToString(), System.Convert.ToBoolean(camposDP[3])),
                                GISA.Utils.GUIHelper.FormatDate(camposDP[4].ToString(), camposDP[5].ToString(), camposDP[6].ToString(), System.Convert.ToBoolean(camposDP[7])));

                            AddNewCell(casTable, GetParameterName(param) + ":", this.HeaderFont);
                            paragraphs.Add(datasProducao);
                            paragraphs.Add(camposDP[8].ToString());
                            AddNewCell(casTable, paragraphs, this.ContentFont);
                        }
                        break;

                    case ReportParameterRelEPs.CamposRelEPs.LinguaAlfabeto:
                        campos = (List <string>)info[1];
                        if (campos[0].Length > 0 || campos[1].Length > 0)
                        {
                            AddNewCell(casTable, GetParameterName(param) + ":", this.HeaderFont);
                            AddNewCell(casTable, string.Format("{0} / {1} ", campos[0], campos[1]), this.ContentFont);
                        }
                        break;

                    default:
                        campos = (List <string>)info[1];
                        if (campos[0].Length > 0)
                        {
                            AddNewCell(casTable, GetParameterName(param) + ":", this.HeaderFont);
                            AddNewCell(casTable, campos[0], this.ContentFont);
                        }
                        break;
                    }
                }
                else
                {
                    agregados = new System.Text.StringBuilder();
                    switch (campo)
                    {
                    case ReportParameterRelEPs.CamposRelEPs.FormaParalela:
                        if (ca.FormasParalelas.Count > 0)
                        {
                            AddNewCell(casTable, GetParameterName(param) + ":", this.HeaderFont);
                            List <string> paragraphs = new List <string>();
                            foreach (string forma in ca.FormasParalelas)
                            {
                                paragraphs.Add("• " + forma);
                            }

                            AddNewCell(casTable, paragraphs, this.ContentFont);
                        }
                        break;

                    case ReportParameterRelEPs.CamposRelEPs.FormaNormalizada:
                        if (ca.FormasNormalizadas.Count > 0)
                        {
                            AddNewCell(casTable, GetParameterName(param) + ":", this.HeaderFont);
                            List <string> paragraphs = new List <string>();
                            foreach (string forma in ca.FormasNormalizadas)
                            {
                                paragraphs.Add("• " + forma);
                            }

                            AddNewCell(casTable, paragraphs, this.ContentFont);
                        }
                        break;

                    case ReportParameterRelEPs.CamposRelEPs.OutrasFormas:
                        if (ca.OutrasFormas.Count > 0)
                        {
                            AddNewCell(casTable, GetParameterName(param) + ":", this.HeaderFont);
                            List <string> paragraphs = new List <string>();
                            foreach (string forma in ca.OutrasFormas)
                            {
                                paragraphs.Add("• " + forma);
                            }

                            AddNewCell(casTable, paragraphs, this.ContentFont);
                        }
                        break;

                    case ReportParameterRelEPs.CamposRelEPs.Relacoes:
                        if (ca.Relacoes.Count > 0)
                        {
                            AddNewCell(casTable, GetParameterName(param) + ":", this.HeaderFont);
                            List <string> paragraphs = new List <string>();
                            foreach (Relacao rel in ca.Relacoes)
                            {
                                paragraphs.Add("• " + rel.FormaAutorizadaRelacionada);
                                if (rel.IdentificadorUnico.Length > 0)
                                {
                                    paragraphs.Add("Identificador único: " + rel.IdentificadorUnico);
                                }
                                paragraphs.Add("Categoria: " + rel.Categoria);
                                if (rel.InicioAno.Length > 0 || rel.InicioMes.Length > 0 || rel.InicioDia.Length > 0 || rel.FimAno.Length > 0 || rel.FimMes.Length > 0 || rel.FimDia.Length > 0)
                                {
                                    paragraphs.Add("Data de relação: " + GISA.Utils.GUIHelper.FormatDateInterval(
                                                       GISA.Utils.GUIHelper.FormatDate(rel.InicioAno, rel.InicioMes, rel.InicioDia),
                                                       GISA.Utils.GUIHelper.FormatDate(rel.FimAno, rel.FimMes, rel.FimDia)));
                                }
                                if (rel.Descricao.Length > 0)
                                {
                                    paragraphs.Add("Descrição: " + rel.Descricao);
                                }
                            }
                            AddNewCell(casTable, paragraphs, this.ContentFont);
                        }
                        break;
                    }
                }
            }

            casTable.Offset = 0f;
            AddTable(doc, casTable);
        }