示例#1
0
        public static Document UFToLuceneDocument(UnidadeFisica uf)
        {
            Field id                    = new Field("id", uf.Id, Field.Store.YES, Field.Index.NOT_ANALYZED);
            Field existe                = new Field("existe", "sim", Field.Store.NO, Field.Index.NOT_ANALYZED);
            Field numero                = new Field("numero", uf.Numero, Field.Store.NO, Field.Index.ANALYZED);
            Field designacao            = new Field("designacao", uf.Designacao, Field.Store.NO, Field.Index.ANALYZED);
            Field cota                  = new Field("cota", uf.Cota.ToLower(), Field.Store.NO, Field.Index.NOT_ANALYZED);
            Field conteudoInformacional = new Field("conteudoInformacional", uf.ConteudoInformacional, Field.Store.NO, Field.Index.ANALYZED);
            Field tipoUnidadeFisica     = new Field("tipoUnidadeFisica", uf.TipoUnidadeFisica, Field.Store.NO, Field.Index.ANALYZED);
            Field guiaIncorporacao      = new Field("guiaIncorporacao", uf.GuiaIncorporacao, Field.Store.NO, Field.Index.ANALYZED);
            Field codigoBarras          = new Field("codigoBarras", uf.CodigoBarras, Field.Store.NO, Field.Index.ANALYZED);
            Field eliminado             = new Field("eliminado", uf.Eliminado, Field.Store.NO, Field.Index.NOT_ANALYZED);
            Field fieldInicioProducao   = new Field("dataProducaoInicio", ToLuceneDate(uf.DataInicioProd, true), Field.Store.YES, Field.Index.NOT_ANALYZED);
            Field fieldFimProducao      = new Field("dataProducaoFim", ToLuceneDate(uf.DataFimProd, false), Field.Store.YES, Field.Index.NOT_ANALYZED);

            Document doc = new Document();

            doc.Add(id);
            doc.Add(existe);
            doc.Add(numero);
            doc.Add(designacao);
            doc.Add(cota);
            doc.Add(conteudoInformacional);
            doc.Add(tipoUnidadeFisica);
            doc.Add(guiaIncorporacao);
            doc.Add(codigoBarras);
            doc.Add(eliminado);
            doc.Add(fieldInicioProducao);
            doc.Add(fieldFimProducao);

            return(doc);
        }
        protected override Lucene.Net.Documents.Document GetDocument(long id)
        {
            var uf = new UnidadeFisica();

            uf.Id         = id.ToString();
            uf.Designacao = string.Format(P, id.ToString());
            return(Util.UFToLuceneDocument(uf));
        }
示例#3
0
        public void GetAllUnidadesFisicas()
        {
            IList <long> ids = GISAUtils.getAllUnidadesFisicasIds();

            foreach (long id in ids)
            {
                UnidadeFisica uf = new UnidadeFisica(id);
                Assert.IsNotNull(uf);
            }
        }
示例#4
0
        public void GetARandomUnidadeFisica()
        {
            IList <long> ids = GISAUtils.getAllUnidadesFisicasIds();

            if (ids.Count > 0)
            {
                Random random = new Random();
                int    pos    = random.Next(0, ids.Count - 1);

                UnidadeFisica uf = new UnidadeFisica(ids[pos]);
                Assert.IsNotNull(uf);
            }
        }
示例#5
0
 private List <string> BuildRow(UnidadeFisica uf)
 {
     return(new List <string> {
         uf.Codigo,
         uf.Titulo,
         GISA.Utils.GUIHelper.FormatDateInterval(
             GISA.Utils.GUIHelper.FormatDate(uf.InicioAno, uf.InicioMes, uf.InicioDia, uf.InicioAtribuida),
             GISA.Utils.GUIHelper.FormatDate(uf.FimAno, uf.FimMes, uf.FimDia, uf.FimAtribuida)),
         uf.Cota,
         uf.GuiaIncorporacao,
         uf.CodBarras
     });
 }
示例#6
0
        public void DateWellFormedString()
        {
            IList <long> ids = GISAUtils.getAllUnidadesFisicasIds();

            foreach (long id in ids)
            {
                UnidadeFisica uf = new UnidadeFisica(id);
                Console.WriteLine(uf.DataInicioProd);
                Console.WriteLine(uf.DataFimProd);
                Assert.AreEqual(8, uf.DataInicioProd.Length);
                Assert.AreEqual(8, uf.DataFimProd.Length);
            }
        }
示例#7
0
        private void AddUF(UnidadeFisica uf, iTextSharp.text.Table tbl)
        {
            var font = uf.Eliminada ? this.ContentStrikeThroughFont : this.ContentFont;

            AddNewCell(tbl, uf.Codigo, font);
            AddNewCell(tbl, uf.Titulo, font);
            AddNewCell(tbl, GISA.Utils.GUIHelper.FormatDateInterval(
                           GISA.Utils.GUIHelper.FormatDate(uf.InicioAno, uf.InicioMes, uf.InicioDia, uf.InicioAtribuida),
                           GISA.Utils.GUIHelper.FormatDate(uf.FimAno, uf.FimMes, uf.FimDia, uf.FimAtribuida)),
                       font);
            AddNewCell(tbl, uf.Cota, font);
            AddNewCell(tbl, uf.GuiaIncorporacao, font);
            AddNewCell(tbl, uf.CodBarras, font);
        }
示例#8
0
        protected override void LoadContents(IDbConnection connection, ref IDataReader reader)
        {
            try
            {
                reader = DBAbstractDataLayer.DataAccessRules.RelatorioRule.Current.ReportResPesquisaResumidoUnidadesFisicas(connection);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                throw;
            }

            UnidadeFisica uf = new UnidadeFisica();
            long          ufID;

            ufs = new List <UnidadeFisica>();
            Dictionary <long, string> codCompletos = new Dictionary <long, string>();

            ufID = 0;
            while (reader.Read())
            {
                uf                  = new UnidadeFisica();
                ufID                = System.Convert.ToInt64(reader.GetValue(0));
                uf.ID               = ufID.ToString();
                uf.Codigo           = reader.GetValue(1).ToString();
                uf.Titulo           = reader.GetValue(2).ToString();
                uf.InicioAno        = reader.GetValue(3).ToString();
                uf.InicioMes        = reader.GetValue(4).ToString();
                uf.InicioDia        = reader.GetValue(5).ToString();
                uf.InicioAtribuida  = reader.GetValue(6) == DBNull.Value ? false : System.Convert.ToBoolean(reader.GetValue(6));
                uf.FimAno           = reader.GetValue(7).ToString();
                uf.FimMes           = reader.GetValue(8).ToString();
                uf.FimDia           = reader.GetValue(9).ToString();
                uf.FimAtribuida     = reader.GetValue(10) == DBNull.Value ? false : System.Convert.ToBoolean(reader.GetValue(10));
                uf.Cota             = reader.GetValue(11).ToString();
                uf.GuiaIncorporacao = reader.GetValue(12) == DBNull.Value ? "" : reader.GetValue(12).ToString();
                uf.Eliminada        = reader.GetValue(13) == DBNull.Value ? false : System.Convert.ToBoolean(reader.GetValue(13));
                uf.CodBarras        = reader.GetValue(14) == DBNull.Value ? "" : reader.GetValue(14).ToString();

                ufs.Add(uf);
                DoAddedEntries(1);
            }
        }
        protected override void LoadContents(IDbConnection connection, ref IDataReader reader) 
		{ 
			try 
			{
				reader = DBAbstractDataLayer.DataAccessRules.RelatorioRule.Current.ReportResPesquisaResumidoUnidadesFisicas(connection);				
			}
			catch (Exception e)
			{
				Debug.WriteLine(e);
				throw;
			}

            UnidadeFisica uf = new UnidadeFisica();
			long ufID;
            ufs = new List<UnidadeFisica>();
            Dictionary<long, string> codCompletos = new Dictionary<long,string>();

            ufID = 0;
			while (reader.Read())
			{
                uf = new UnidadeFisica();
				ufID = System.Convert.ToInt64(reader.GetValue(0));
				uf.ID = ufID.ToString();
                uf.Codigo = reader.GetValue(1).ToString();
                uf.Titulo = reader.GetValue(2).ToString();
				uf.InicioAno = reader.GetValue(3).ToString();
				uf.InicioMes = reader.GetValue(4).ToString();
				uf.InicioDia = reader.GetValue(5).ToString();
                uf.InicioAtribuida = reader.GetValue(6) == DBNull.Value ? false : System.Convert.ToBoolean(reader.GetValue(6));
				uf.FimAno = reader.GetValue(7).ToString();
				uf.FimMes = reader.GetValue(8).ToString();
				uf.FimDia = reader.GetValue(9).ToString();
                uf.FimAtribuida = reader.GetValue(10) == DBNull.Value ? false : System.Convert.ToBoolean(reader.GetValue(10));
                uf.Cota = reader.GetValue(11).ToString();
                uf.GuiaIncorporacao = reader.GetValue(12) == DBNull.Value ? "" : reader.GetValue(12).ToString();
                uf.Eliminada = reader.GetValue(13) == DBNull.Value ? false : System.Convert.ToBoolean(reader.GetValue(13));
                uf.CodBarras = reader.GetValue(14) == DBNull.Value ? "" : reader.GetValue(14).ToString();

				ufs.Add(uf);
                DoAddedEntries(1);
			}
		}
示例#10
0
        public static List <UnidadeFisica> getAllUnidadesFisicas()
        {
            var      ret     = new List <UnidadeFisica>();
            ISession session = null;
            var      doc     = default(UnidadeFisica);

            try
            {
                session = GISAUtils.SessionFactory.OpenSession();
                var ufs = session.CreateSQLQuery(getAllUnidadesFisicasQuery);
                ufs.SetTimeout(1000);

                foreach (var ufa in ufs.List())
                {
                    var uf = ufa as object[];
                    doc                       = new UnidadeFisica();
                    doc.Id                    = uf[0].ToString();
                    doc.Numero                = uf[1].ToString();
                    doc.Designacao            = uf[2].ToString();
                    doc.CodigoBarras          = uf[3].ToString();
                    doc.GuiaIncorporacao      = uf[4].ToString();
                    doc.Eliminado             = uf[5].ToString().Equals("1") ? "Sim" : "Não";
                    doc.Cota                  = uf[6].ToString();
                    doc.DataInicioProd        = GISAUtils.DataInicioProdFormatada(uf[7].ToString(), uf[8].ToString(), uf[9].ToString());
                    doc.DataFimProd           = GISAUtils.DataInicioProdFormatada(uf[10].ToString(), uf[11].ToString(), uf[12].ToString());
                    doc.ConteudoInformacional = uf[13].ToString();
                    doc.TipoUnidadeFisica     = uf[14].ToString();
                    ret.Add(doc);
                }
                ufs = null;
                session.Close();
            }
            catch (Exception) { throw; }
            finally
            {
                if (session != null)
                {
                    session.Close();
                }
            }
            return(ret);
        }
示例#11
0
		protected override void LoadContents(IDbConnection connection, ref IDataReader reader) {
            reader = DBAbstractDataLayer.DataAccessRules.RelatorioRule.Current.ReportUnidadesFisicas(this.mIDTrustee, this.mFields, connection);            

			UnidadeFisica uf = null;
			// ler as unidades físicas a apresentar na lista
			while (reader.Read()) {
				uf = new UnidadeFisica();
				uf.ID = System.Convert.ToInt64(reader.GetValue(0));
				uf.IDEntidadeDetentora = System.Convert.ToInt64(reader.GetValue(1));
				uf.CodigoCompleto = reader.GetString(2);
				uf.Designacao = reader.GetString(3);

                int i = 4;
                foreach (ReportParameterRelPesqUF rp in this.mFields)
                {
                    if (rp.RetType == ReportParameter.ReturnType.TextOnly)
                    {
                        if (rp.Campo == ReportParameterRelPesqUF.CamposRelPesqUF.DatasProducao)
                        {
                            // dois campos não são strings (são booleans)
                            ArrayList info = new ArrayList();
                            info.Add(rp.Campo);
                            ArrayList valores = new ArrayList();
                            foreach (string coluna in rp.DBField)
                            {
                                valores.Add(reader.GetValue(i));
                                i++;
                            }
                            info.Add(valores);
                            uf.InfoAdicional.Add(info);
                        }
                        else
                        {
                            // todos os campos são strings
                            ArrayList info = new ArrayList();
                            info.Add(rp.Campo);
                            List<string> valores = new List<string>();
                            foreach (string coluna in rp.DBField)
                            {
                                valores.Add(reader.GetValue(i).ToString());
                                i++;
                            }
                            info.Add(valores);
                            uf.InfoAdicional.Add(info);
                        }
                    }
                }

				unidadesFisicas.Add(uf);
                ufs.Add(uf.ID, uf);

                DoAddedEntries(1);
			}
            reader.NextResult();

            List<ReportParameterRelPesqUF.CamposRelPesqUF> fields = Fields(this.mFields);
            if (fields.Contains(ReportParameterRelPesqUF.CamposRelPesqUF.UnidadesInformacionaisAssociadas))
            {
                while (reader.Read())
                {
                    uf = GetExistentUF(System.Convert.ToInt64(reader.GetValue(0)));
                    if (uf != null)
                    {
                        uf.UnidadesInformacionais.Add(new ArrayList() { reader.GetValue(1), reader.GetValue(2) });
                    }
                }
                reader.NextResult();
            }
		}
示例#12
0
 public void GetANegativeIdUnidadeFisica()
 {
     UnidadeFisica uf = new UnidadeFisica(-1);
 }
示例#13
0
        public static List<UnidadeFisica> getAllUnidadesFisicas()
        {
            var ret = new List<UnidadeFisica>();
            ISession session = null;
            var doc = default(UnidadeFisica);
            try
            {

                session = GISAUtils.SessionFactory.OpenSession();
                var ufs = session.CreateSQLQuery(getAllUnidadesFisicasQuery);
                ufs.SetTimeout(1000);

                foreach (var ufa in ufs.List())
                {
                    var uf = ufa as object[];
                    doc = new UnidadeFisica();
                    doc.Id = uf[0].ToString();
                    doc.Numero = uf[1].ToString();
                    doc.Designacao = uf[2].ToString();
                    doc.CodigoBarras = uf[3].ToString();
                    doc.GuiaIncorporacao = uf[4].ToString();
                    doc.Eliminado = uf[5].ToString().Equals("1") ? "Sim" : "Não";
                    doc.Cota = uf[6].ToString();
                    doc.DataInicioProd = GISAUtils.DataInicioProdFormatada(uf[7].ToString(), uf[8].ToString(), uf[9].ToString());
                    doc.DataFimProd = GISAUtils.DataInicioProdFormatada(uf[10].ToString(), uf[11].ToString(), uf[12].ToString());
                    doc.ConteudoInformacional = uf[13].ToString();
                    doc.TipoUnidadeFisica = uf[14].ToString();
                    ret.Add(doc);
                }
                ufs = null;
                session.Close();
            }
            catch (Exception) { throw; }
            finally
            {
                if (session != null) session.Close();
            }
            return ret;
        }
示例#14
0
        protected override void LoadContents(IDbConnection connection, ref IDataReader reader)
        {
            if (mAutoEliminacaoRow == null)
            {
                throw new ArgumentNullException("Auto de eliminação não especificado");
            }

            reader = DBAbstractDataLayer.DataAccessRules.RelatorioRule.Current.ReportAutoEliminacao(this.mIDTrustee, mAutoEliminacaoRow.ID, connection);

            Serie         sr;
            UnidadeFisica uf;
            Documento     docm;

            long ID = -1;

            // carregamento de séries
            while (reader.Read())
            {
                ID = System.Convert.ToInt64(reader.GetValue((int)AutoEliminacaoSeriesColumns.ID));
                sr = new Serie(ID);
                series.Add(ID, sr);
                sr.Designacao   = reader.GetString((int)AutoEliminacaoSeriesColumns.Designacao);
                sr.DataProducao = GISA.Utils.GUIHelper.FormatDateInterval(
                    GISA.Utils.GUIHelper.FormatDate(
                        GisaDataSetHelper.GetDBNullableText(ref reader, (int)AutoEliminacaoSeriesColumns.ProducaoInicioAno),
                        GisaDataSetHelper.GetDBNullableText(ref reader, (int)AutoEliminacaoSeriesColumns.ProducaoInicioMes),
                        GisaDataSetHelper.GetDBNullableText(ref reader, (int)AutoEliminacaoSeriesColumns.ProducaoInicioDia)),
                    GISA.Utils.GUIHelper.FormatDate(
                        GisaDataSetHelper.GetDBNullableText(ref reader, (int)AutoEliminacaoSeriesColumns.ProducaoFimAno),
                        GisaDataSetHelper.GetDBNullableText(ref reader, (int)AutoEliminacaoSeriesColumns.ProducaoFimMes),
                        GisaDataSetHelper.GetDBNullableText(ref reader, (int)AutoEliminacaoSeriesColumns.ProducaoFimDia)));
                sr.Preservar = GisaDataSetHelper.GetDBNullableBoolean(ref reader, (int)AutoEliminacaoSeriesColumns.Preservar);
                DoAddedEntries(1);
            }

            reader.NextResult();

            // carregamento de unidades físicas
            while (reader.Read())
            {
                ID = System.Convert.ToInt64(reader.GetValue((int)AutoEliminacaoUnidadesFisicasColumns.ID));
                uf = new UnidadeFisica(ID);
                unidadesFisicas.Add(ID, uf);
                uf.Designacao           = reader.GetValue((int)AutoEliminacaoUnidadesFisicasColumns.Designacao).ToString();
                uf.Cota                 = GisaDataSetHelper.GetDBNullableText(ref reader, (int)AutoEliminacaoUnidadesFisicasColumns.Cota);
                uf.TipoAcondicionamento = GisaDataSetHelper.GetDBNullableText(ref reader, (int)AutoEliminacaoUnidadesFisicasColumns.TipoAcondicionamento);
                string medidaLargura = GisaDataSetHelper.GetDBNullableText(ref reader, (int)AutoEliminacaoUnidadesFisicasColumns.MedidaLargura);
                if (medidaLargura.Length != 0)
                {
                    uf.MedidaLargura = System.Convert.ToDecimal(medidaLargura);
                }
                uf.DataProducao = GISA.Utils.GUIHelper.FormatDateInterval(
                    GISA.Utils.GUIHelper.FormatDate(
                        GisaDataSetHelper.GetDBNullableText(ref reader, (int)AutoEliminacaoUnidadesFisicasColumns.ProducaoInicioAno),
                        GisaDataSetHelper.GetDBNullableText(ref reader, (int)AutoEliminacaoUnidadesFisicasColumns.ProducaoInicioMes),
                        GisaDataSetHelper.GetDBNullableText(ref reader, (int)AutoEliminacaoUnidadesFisicasColumns.ProducaoInicioDia)),
                    GISA.Utils.GUIHelper.FormatDate(
                        GisaDataSetHelper.GetDBNullableText(ref reader, (int)AutoEliminacaoUnidadesFisicasColumns.ProducaoFimAno),
                        GisaDataSetHelper.GetDBNullableText(ref reader, (int)AutoEliminacaoUnidadesFisicasColumns.ProducaoFimMes),
                        GisaDataSetHelper.GetDBNullableText(ref reader, (int)AutoEliminacaoUnidadesFisicasColumns.ProducaoFimDia)));
                DoAddedEntries(1);
            }
            reader.NextResult();

            // carregamento de documentos
            while (reader.Read())
            {
                ID   = System.Convert.ToInt64(reader.GetValue((int)AutoEliminacaoDocumentosColumns.ID));
                docm = new Documento(ID);
                documentos.Add(ID, docm);
                if (!object.ReferenceEquals(reader.GetValue((int)AutoEliminacaoDocumentosColumns.IDSerie), DBNull.Value))
                {
                    sr = (Serie)series[System.Convert.ToInt64(reader.GetValue((int)AutoEliminacaoDocumentosColumns.IDSerie))];
                    if (sr.Documentos == null)
                    {
                        sr.Documentos = new ArrayList();
                    }
                    sr.Documentos.Add(docm);
                    docm.Serie = sr;
                }
                docm.Designacao   = reader.GetString((int)AutoEliminacaoDocumentosColumns.Designacao);
                docm.DataProducao = GISA.Utils.GUIHelper.FormatDateInterval(
                    GISA.Utils.GUIHelper.FormatDate(
                        GisaDataSetHelper.GetDBNullableText(ref reader, (int)AutoEliminacaoDocumentosColumns.ProducaoInicioAno),
                        GisaDataSetHelper.GetDBNullableText(ref reader, (int)AutoEliminacaoDocumentosColumns.ProducaoInicioMes),
                        GisaDataSetHelper.GetDBNullableText(ref reader, (int)AutoEliminacaoDocumentosColumns.ProducaoInicioDia)),
                    GISA.Utils.GUIHelper.FormatDate(
                        GisaDataSetHelper.GetDBNullableText(ref reader, (int)AutoEliminacaoDocumentosColumns.ProducaoFimAno),
                        GisaDataSetHelper.GetDBNullableText(ref reader, (int)AutoEliminacaoDocumentosColumns.ProducaoFimMes),
                        GisaDataSetHelper.GetDBNullableText(ref reader, (int)AutoEliminacaoDocumentosColumns.ProducaoFimDia)));

                docm.Preservar = System.Convert.ToBoolean(reader.GetValue((int)AutoEliminacaoDocumentosColumns.Preservar));
                DoAddedEntries(1);
            }
            reader.NextResult();

            // carregamento de entidades produtoras
            string DesignacaoEP = null;

            while (reader.Read())
            {
                ID           = System.Convert.ToInt64(reader.GetValue(0));
                DesignacaoEP = reader.GetString(1);
                sr           = (Serie)series[ID];
                docm         = (Documento)documentos[ID];
                if (sr != null)
                {
                    if (sr.EntidadesProdutoras == null)
                    {
                        sr.EntidadesProdutoras = new ArrayList();
                    }
                    sr.EntidadesProdutoras.Add(DesignacaoEP);
                }
                else if (docm != null)
                {
                    if (docm.EntidadesProdutoras == null)
                    {
                        docm.EntidadesProdutoras = new ArrayList();
                    }
                    docm.EntidadesProdutoras.Add(DesignacaoEP);
                }
                DoAddedEntries(1);
            }
            reader.NextResult();

            // carregamento das associações entre unidades fisicas e unidades de descrição
            long IDDocumental = -1;

            while (reader.Read())
            {
                ID = System.Convert.ToInt64(reader.GetValue(0));
                string IDDoc = GisaDataSetHelper.GetDBNullableText(ref reader, 2);
                if (IDDoc.Length != 0)
                {
                    IDDocumental = System.Convert.ToInt64(IDDoc);
                }
                uf   = (UnidadeFisica)unidadesFisicas[ID];
                sr   = (Serie)series[IDDocumental];
                docm = (Documento)documentos[IDDocumental];
                if (sr != null)
                {
                    if (uf.Series == null)
                    {
                        uf.Series = new ArrayList();
                    }
                    uf.Series.Add(sr);
                    if (sr.UnidadesFisicas == null)
                    {
                        sr.UnidadesFisicas = new ArrayList();
                    }
                    sr.UnidadesFisicas.Add(uf);
                }
                else if (docm != null)
                {
                    if (uf.Documentos == null)
                    {
                        uf.Documentos = new ArrayList();
                    }
                    uf.Documentos.Add(docm);
                    if (docm.UnidadesFisicas == null)
                    {
                        docm.UnidadesFisicas = new ArrayList();
                    }
                    docm.UnidadesFisicas.Add(uf);

                    if (docm.Serie == null) //documento solto
                    {
                        if (docm.UnidadesFisicas == null)
                        {
                            docm.UnidadesFisicas = new ArrayList();
                        }

                        if (!docm.UnidadesFisicas.Contains(uf))
                        {
                            docm.UnidadesFisicas.Add(uf); // informação inferida de que se a unidade fisica pertence ao documento então também pertencerá certamente à série, mesmo que isso não tenha sido descrito
                        }
                    }
                    else //documento que constitui uma série
                    {
                        if (docm.Serie.UnidadesFisicas == null)
                        {
                            docm.Serie.UnidadesFisicas = new ArrayList();
                        }

                        if (!docm.Serie.UnidadesFisicas.Contains(uf))
                        {
                            docm.Serie.UnidadesFisicas.Add(uf); // informação inferida de que se a unidade fisica pertence ao documento então também pertencerá certamente à série, mesmo que isso não tenha sido descrito
                        }
                    }
                }
                DoAddedEntries(1);
            }
        }
 private List<string> BuildRow(UnidadeFisica uf)
 {
     return new List<string>{ 
         uf.Codigo,
         uf.Titulo,
         GISA.Utils.GUIHelper.FormatDateInterval(
             GISA.Utils.GUIHelper.FormatDate(uf.InicioAno, uf.InicioMes, uf.InicioDia, uf.InicioAtribuida),
             GISA.Utils.GUIHelper.FormatDate(uf.FimAno, uf.FimMes, uf.FimDia, uf.FimAtribuida)),
         uf.Cota,
         uf.GuiaIncorporacao,
         uf.CodBarras};
 }
示例#16
0
		private void AddUnidadeFisica(Document doc, UnidadeFisica uf) {
			Paragraph p = new Paragraph(CentimeterToPoint(0.5F), uf.CodigoCompleto + "   " + GISA.Utils.GUIHelper.CapitalizeFirstLetter(uf.Designacao), this.BodyFont);
			p.SpacingBefore = 10f;
			p.SpacingAfter = 5f;
			doc.Add(p);

			Table ufsTable = new Table(2, 5);
            ufsTable.BorderColor = iTextSharp.text.Color.WHITE;
			ufsTable.DefaultCellBorderColor = iTextSharp.text.Color.WHITE;
			ufsTable.Width = 100;
			ufsTable.Widths = new float[] {28, 72};
			ufsTable.Alignment = Element.ALIGN_CENTER;
            foreach (ArrayList info in uf.InfoAdicional)
            {                
                List<string> campos = new List<string>();
                ReportParameterRelPesqUF.CamposRelPesqUF param = (ReportParameterRelPesqUF.CamposRelPesqUF)info[0];
                //campos = (List<string>)info[1];
                switch (param)
                {
                    case ReportParameterRelPesqUF.CamposRelPesqUF.CotaCodigoBarras:
                        campos = (List<string>)info[1];
                        if (campos[0].Length > 0 || campos[1].Length > 0)
                        {
                            AddNewCell(ufsTable, GetParameterName(param) + ":", this.HeaderFont);
                            AddNewCell(ufsTable, string.Format("{0} — {1}", campos[0], campos[1]), this.ContentFont);
                        }
                        break;
                    case ReportParameterRelPesqUF.CamposRelPesqUF.DatasProducao:
                        ArrayList camposDP = new ArrayList();
                        camposDP = (ArrayList)info[1];
                        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(ufsTable, GetParameterName(param) + ":", this.HeaderFont);
                            AddNewCell(ufsTable, datasProducao, this.ContentFont);
                        }
                        break;
                    case ReportParameterRelPesqUF.CamposRelPesqUF.TipoDimensoes:
                        campos = (List<string>)info[1];
                        if (campos[0].Length > 0 || campos[1].Length > 0 || campos[2].Length > 0 || campos[3].Length > 0)
                        {
                            AddNewCell(ufsTable, GetParameterName(param) + ":", this.HeaderFont);
                            AddNewCell(ufsTable, string.Format("{0} com {1} x {2} x {3} m", campos[0], campos[1], campos[2], campos[3]), this.ContentFont);
                        }
                        break;
                    case ReportParameterRelPesqUF.CamposRelPesqUF.UltimaAlteracao:
                        campos = (List<string>)info[1];
                        if (campos[0].Length > 0)
                        {
                            AddNewCell(ufsTable, GetParameterName(param) + ":", this.HeaderFont);
                            AddNewCell(ufsTable, System.Convert.ToDateTime(campos[0]).ToString("yyyy-MM-dd"), this.ContentFont);
                        }
                        else
                        {
                            AddNewCell(ufsTable, GetParameterName(param) + ":", this.HeaderFont);
                            AddNewCell(ufsTable, string.Empty, this.ContentFont);
                        }
                        break;
                    case ReportParameterRelPesqUF.CamposRelPesqUF.Eliminada:
                        campos = (List<string>)info[1];
                        if (campos[0].Length > 0)
                        {
                            AddNewCell(ufsTable, GetParameterName(param) + ":", this.HeaderFont);
                            if (campos[0].ToLower().Equals("true"))
                                AddNewCell(ufsTable, campos[1], this.ContentFont);
                            else
                                AddNewCell(ufsTable, "Não", this.ContentFont);
                        }
                        break;                    
                    default:
                        campos = (List<string>)info[1];
                        if (campos[0].Length > 0)
                        {
                            AddNewCell(ufsTable, GetParameterName(param) + ":", this.HeaderFont);
                            AddNewCell(ufsTable, campos[0], this.ContentFont);
                        }
                        break;
                }
            }

            if (uf.UnidadesInformacionais.Count > 0)
            {
                System.Text.StringBuilder agregados = new System.Text.StringBuilder();
                AddNewCell(ufsTable, "Unidades Informacionais:", this.HeaderFont);
                List<string> paragraphs = new List<string>();
                foreach (ArrayList ua in uf.UnidadesInformacionais)
                    paragraphs.Add(string.Format("{1}: {0}", ua[0], ua[1]));

                AddNewCell(ufsTable, paragraphs, this.ContentFont);
            }
			ufsTable.Offset = 0f;

            AddTable(doc, ufsTable);            
		}
示例#17
0
        private void AddUnidadeFisica(Document doc, UnidadeFisica uf)
        {
            Paragraph p = new Paragraph(CentimeterToPoint(0.5F), uf.CodigoCompleto + "   " + GISA.Utils.GUIHelper.CapitalizeFirstLetter(uf.Designacao), this.BodyFont);

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

            Table ufsTable = new Table(2, 5);

            ufsTable.BorderColor            = iTextSharp.text.Color.WHITE;
            ufsTable.DefaultCellBorderColor = iTextSharp.text.Color.WHITE;
            ufsTable.Width     = 100;
            ufsTable.Widths    = new float[] { 28, 72 };
            ufsTable.Alignment = Element.ALIGN_CENTER;
            foreach (ArrayList info in uf.InfoAdicional)
            {
                List <string> campos = new List <string>();
                ReportParameterRelPesqUF.CamposRelPesqUF param = (ReportParameterRelPesqUF.CamposRelPesqUF)info[0];
                //campos = (List<string>)info[1];
                switch (param)
                {
                case ReportParameterRelPesqUF.CamposRelPesqUF.CotaCodigoBarras:
                    campos = (List <string>)info[1];
                    if (campos[0].Length > 0 || campos[1].Length > 0)
                    {
                        AddNewCell(ufsTable, GetParameterName(param) + ":", this.HeaderFont);
                        AddNewCell(ufsTable, string.Format("{0} — {1}", campos[0], campos[1]), this.ContentFont);
                    }
                    break;

                case ReportParameterRelPesqUF.CamposRelPesqUF.DatasProducao:
                    ArrayList camposDP = new ArrayList();
                    camposDP = (ArrayList)info[1];
                    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(ufsTable, GetParameterName(param) + ":", this.HeaderFont);
                        AddNewCell(ufsTable, datasProducao, this.ContentFont);
                    }
                    break;

                case ReportParameterRelPesqUF.CamposRelPesqUF.TipoDimensoes:
                    campos = (List <string>)info[1];
                    if (campos[0].Length > 0 || campos[1].Length > 0 || campos[2].Length > 0 || campos[3].Length > 0)
                    {
                        AddNewCell(ufsTable, GetParameterName(param) + ":", this.HeaderFont);
                        AddNewCell(ufsTable, string.Format("{0} com {1} x {2} x {3} m", campos[0], campos[1], campos[2], campos[3]), this.ContentFont);
                    }
                    break;

                case ReportParameterRelPesqUF.CamposRelPesqUF.UltimaAlteracao:
                    campos = (List <string>)info[1];
                    if (campos[0].Length > 0)
                    {
                        AddNewCell(ufsTable, GetParameterName(param) + ":", this.HeaderFont);
                        AddNewCell(ufsTable, System.Convert.ToDateTime(campos[0]).ToString("yyyy-MM-dd"), this.ContentFont);
                    }
                    else
                    {
                        AddNewCell(ufsTable, GetParameterName(param) + ":", this.HeaderFont);
                        AddNewCell(ufsTable, string.Empty, this.ContentFont);
                    }
                    break;

                case ReportParameterRelPesqUF.CamposRelPesqUF.Eliminada:
                    campos = (List <string>)info[1];
                    if (campos[0].Length > 0)
                    {
                        AddNewCell(ufsTable, GetParameterName(param) + ":", this.HeaderFont);
                        if (campos[0].ToLower().Equals("true"))
                        {
                            AddNewCell(ufsTable, campos[1], this.ContentFont);
                        }
                        else
                        {
                            AddNewCell(ufsTable, "Não", this.ContentFont);
                        }
                    }
                    break;

                default:
                    campos = (List <string>)info[1];
                    if (campos[0].Length > 0)
                    {
                        AddNewCell(ufsTable, GetParameterName(param) + ":", this.HeaderFont);
                        AddNewCell(ufsTable, campos[0], this.ContentFont);
                    }
                    break;
                }
            }

            if (uf.UnidadesInformacionais.Count > 0)
            {
                System.Text.StringBuilder agregados = new System.Text.StringBuilder();
                AddNewCell(ufsTable, "Unidades Informacionais:", this.HeaderFont);
                List <string> paragraphs = new List <string>();
                foreach (ArrayList ua in uf.UnidadesInformacionais)
                {
                    paragraphs.Add(string.Format("{1}: {0}", ua[0], ua[1]));
                }

                AddNewCell(ufsTable, paragraphs, this.ContentFont);
            }
            ufsTable.Offset = 0f;

            AddTable(doc, ufsTable);
        }
示例#18
0
        protected override void LoadContents(IDbConnection connection, ref IDataReader reader)
        {
            reader = DBAbstractDataLayer.DataAccessRules.RelatorioRule.Current.ReportUnidadesFisicas(this.mIDTrustee, this.mFields, connection);

            UnidadeFisica uf = null;

            // ler as unidades físicas a apresentar na lista
            while (reader.Read())
            {
                uf    = new UnidadeFisica();
                uf.ID = System.Convert.ToInt64(reader.GetValue(0));
                uf.IDEntidadeDetentora = System.Convert.ToInt64(reader.GetValue(1));
                uf.CodigoCompleto      = reader.GetString(2);
                uf.Designacao          = reader.GetString(3);

                int i = 4;
                foreach (ReportParameterRelPesqUF rp in this.mFields)
                {
                    if (rp.RetType == ReportParameter.ReturnType.TextOnly)
                    {
                        if (rp.Campo == ReportParameterRelPesqUF.CamposRelPesqUF.DatasProducao)
                        {
                            // dois campos não são strings (são booleans)
                            ArrayList info = new ArrayList();
                            info.Add(rp.Campo);
                            ArrayList valores = new ArrayList();
                            foreach (string coluna in rp.DBField)
                            {
                                valores.Add(reader.GetValue(i));
                                i++;
                            }
                            info.Add(valores);
                            uf.InfoAdicional.Add(info);
                        }
                        else
                        {
                            // todos os campos são strings
                            ArrayList info = new ArrayList();
                            info.Add(rp.Campo);
                            List <string> valores = new List <string>();
                            foreach (string coluna in rp.DBField)
                            {
                                valores.Add(reader.GetValue(i).ToString());
                                i++;
                            }
                            info.Add(valores);
                            uf.InfoAdicional.Add(info);
                        }
                    }
                }

                unidadesFisicas.Add(uf);
                ufs.Add(uf.ID, uf);

                DoAddedEntries(1);
            }
            reader.NextResult();

            List <ReportParameterRelPesqUF.CamposRelPesqUF> fields = Fields(this.mFields);

            if (fields.Contains(ReportParameterRelPesqUF.CamposRelPesqUF.UnidadesInformacionaisAssociadas))
            {
                while (reader.Read())
                {
                    uf = GetExistentUF(System.Convert.ToInt64(reader.GetValue(0)));
                    if (uf != null)
                    {
                        uf.UnidadesInformacionais.Add(new ArrayList()
                        {
                            reader.GetValue(1), reader.GetValue(2)
                        });
                    }
                }
                reader.NextResult();
            }
        }
        private void AddUF(UnidadeFisica uf, iTextSharp.text.Table tbl)
        {
            var font = uf.Eliminada ? this.ContentStrikeThroughFont : this.ContentFont;

            AddNewCell(tbl, uf.Codigo, font);
            AddNewCell(tbl, uf.Titulo, font);
            AddNewCell(tbl, GISA.Utils.GUIHelper.FormatDateInterval(
                GISA.Utils.GUIHelper.FormatDate(uf.InicioAno, uf.InicioMes, uf.InicioDia, uf.InicioAtribuida),
                GISA.Utils.GUIHelper.FormatDate(uf.FimAno, uf.FimMes, uf.FimDia, uf.FimAtribuida)),
                font);
            AddNewCell(tbl, uf.Cota, font);
            AddNewCell(tbl, uf.GuiaIncorporacao, font);
            AddNewCell(tbl, uf.CodBarras, font);
        }