Пример #1
0
		private void AddNivelDesignado(TreeNodeCollection TargetNodes, GISADataset.NivelRow nRow, GISADataset.NivelRow nUpperRow, GISADataset.TipoNivelRelacionadoRow tnrRow, IDbConnection connection)
		{
			GISATreeNode node = new GISATreeNode(Nivel.GetDesignacao(nRow));
			node.NivelRow = nRow;
			node.NivelUpperRow = nUpperRow;
			if (node.RelacaoHierarquicaRow != null)
			{
				string data = FormatYearsInterval(node.RelacaoHierarquicaRow);
				if (data.Length > 0)
					node.Text = string.Format("{0}   {1}", node.Text, data);
			}

			int iconIndex = 0;
			iconIndex = -1;
			if (tnrRow != null)
				iconIndex = System.Convert.ToInt32(tnrRow.GUIOrder);

			if (nRow.CatCode.Trim().Equals("CA"))
                node.ImageIndex = iconIndex == -1 ? SharedResourcesOld.CurrentSharedResources.NivelImageIncognitoControloAut() : SharedResourcesOld.CurrentSharedResources.NivelImageControloAut(iconIndex);
			else
                node.ImageIndex = iconIndex == -1 ? SharedResourcesOld.CurrentSharedResources.NivelImageIncognito() : SharedResourcesOld.CurrentSharedResources.NivelImageBase(iconIndex);

			node.SelectedImageIndex = node.ImageIndex;
			try
			{
				if (nUpperRow == null)
				{
                    if (DBAbstractDataLayer.DataAccessRules.NivelRule.Current.getDirectChildCount(nRow.ID.ToString(), "rh.IDTipoNivelRelacionado != 11", connection) > 0)
                            node.Nodes.Add("<A atualizar...>");
				}
				else
				{
					long a = DateTime.Now.Ticks;
					if (DBAbstractDataLayer.DataAccessRules.NivelRule.Current.EstimateChildCount(nUpperRow.ID.ToString(), true, connection).Contains(nRow.ID))
						node.Nodes.Add("<A atualizar...>");
					long b = DateTime.Now.Ticks;
					accum += (b - a);
				}
			}
			catch (Exception ex)
			{
				Trace.WriteLine(ex);
				throw;
			}
			AddToTreeview(TargetNodes, node, -1);
		}        
Пример #2
0
        protected override void GenerateInventarioEntry(Document doc, GISADataset.RelacaoHierarquicaRow rhRow, float CurrentIndentCm)
        {
            GISADataset.NivelRow n = rhRow.NivelRowByNivelRelacaoHierarquica;

            string entry = string.Format("{0}: {1} - {2}", rhRow.TipoNivelRelacionadoRow.Codigo, rhRow.NivelRowByNivelRelacaoHierarquica.Codigo, Nivel.GetDesignacao(n));

            Paragraph p = new Paragraph(entry, this.BodyFont);

            p.setIndentationLeft(CentimeterToPoint(CurrentIndentCm));
            doc.add(p);
            DoRemovedEntries(1);
            if (!rhRow.TipoNivelRelacionadoRow.TipoNivelRow.IsDocument)
            {
                GenerateInventarioEntryChildren(doc, rhRow, CurrentIndentCm);
            }
            else
            {
                GenerateInventarioEntryDetails(doc, rhRow, CurrentIndentCm);
            }
        }
Пример #3
0
        private string GetFRDBaseAsRTF(GISADataset.NivelRow NivelRow)
        {
            GISADataset.FRDBaseRow FRDBaseRow = null;

            GisaDataSetHelper.ManageDatasetConstraints(false);
            GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection());
            try
            {
                PesquisaRule.Current.LoadFRDBaseUFData(GisaDataSetHelper.GetInstance(), NivelRow.ID, ho.Connection);
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
                throw ex;
            }
            finally
            {
                ho.Dispose();
            }

            GisaDataSetHelper.ManageDatasetConstraints(true);

            StringBuilder Result = new StringBuilder();

            if (GisaDataSetHelper.GetInstance().FRDBase.Select("IDNivel=" + NivelRow.ID.ToString()).Length > 0)
            {
                FRDBaseRow = (GISADataset.FRDBaseRow)(GisaDataSetHelper.GetInstance().FRDBase.Select("IDNivel=" + NivelRow.ID.ToString())[0]);

                // --Identificação--
                Result.Append("\\fs36\\b{}Identificação\\b0{}\\fs24\\sb196\\sa48\\par{}\\sb0\\sa0{}");
                // Entidade Detentora
                if (FRDBaseRow.NivelRow.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica().Length == 1)
                {
                    Result.Append(GetConditionalText("\\i{}Entidade detentora: \\i0{}", FRDBaseRow.NivelRow.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica()[0].NivelRowByNivelRelacaoHierarquicaUpper.GetNivelDesignadoRows()[0].Designacao, "\\par{}"));
                }
                // Codigo de Referência
                Result.Append(GetConditionalText("\\i{}Número de recenseamento: \\i0{}", FRDBaseRow.NivelRow.Codigo, "\\par{}"));
                // Cota
                if (FRDBaseRow.GetSFRDUFCotaRows().Length == 1)
                {
                    if (!(FRDBaseRow.GetSFRDUFCotaRows()[0].IsCotaNull()))
                    {
                        Result.Append(GetConditionalText("\\i{}Cota: \\i0{}", FRDBaseRow.GetSFRDUFCotaRows()[0].Cota, "\\par{}"));
                    }
                    else
                    {
                        Result.Append(GetConditionalText("\\i{}Cota: \\i0{}", "", "\\par{}"));
                    }
                }
                // Título
                Result.Append("\\i{}" + TipoNivelRelacionado.GetTipoNivelRelacionadoDaPrimeiraRelacaoEncontrada(FRDBaseRow.NivelRow).Designacao + ": \\i0{}" + Nivel.GetDesignacao(FRDBaseRow.NivelRow) + "\\par{}");
                // Datas
                if (FRDBaseRow.GetSFRDDatasProducaoRows().Length == 1)
                {
                    Result.Append("\\i{}Datas: \\i0{}" + GUIHelper.GUIHelper.FormatDateInterval(FRDBaseRow.GetSFRDDatasProducaoRows()[0]) + "\\par{}");
                }
                // Tipo e dimensões
                if (FRDBaseRow.GetSFRDUFDescricaoFisicaRows().Length == 1)
                {
                    GISADataset.SFRDUFDescricaoFisicaRow sfrdufRow = null;
                    string tipoMedida = null;
                    sfrdufRow = FRDBaseRow.GetSFRDUFDescricaoFisicaRows()[0];
                    Result.Append("\\i{}Tipo: \\i0{}" + sfrdufRow.TipoAcondicionamentoRow.Designacao + "\\par{}");
                    if (sfrdufRow.TipoMedidaRow == null)
                    {
                        tipoMedida = string.Empty;
                    }
                    else
                    {
                        tipoMedida = sfrdufRow.TipoMedidaRow.Designacao;
                    }

                    Result.Append("\\i{}Dimensões: \\i0{}" + string.Format("{0} x {1} x {2} ({3})", GISA.Utils.GUIHelper.getStringifiedDecimal(sfrdufRow["MedidaLargura"]), GISA.Utils.GUIHelper.getStringifiedDecimal(sfrdufRow["MedidaAltura"]), GISA.Utils.GUIHelper.getStringifiedDecimal(sfrdufRow["MedidaProfundidade"]), tipoMedida) + "\\par{}");
                }

                // --ConteudoEstrutura--
                string ConteudoEstrutura = "";
                if (FRDBaseRow.GetSFRDConteudoEEstruturaRows().Length == 1)
                {
                    GISADataset.SFRDConteudoEEstruturaRow ceRow = (GISADataset.SFRDConteudoEEstruturaRow)FRDBaseRow.GetSFRDConteudoEEstruturaRows()[0];

                    if (ceRow.IsConteudoInformacionalNull())
                    {
                        ConteudoEstrutura = GetConditionalText("\\i{}Conteúdo informacional: \\i0{}\\par{}", "", "\\li128\\par\\li0{}");
                    }
                    else
                    {
                        ConteudoEstrutura = GetConditionalText("\\i{}Conteúdo informacional: \\i0{}\\par{}", ceRow.ConteudoInformacional, "\\li128\\par\\li0{}");
                    }
                }

                Result.Append(Section("\\fs36\\b{}Conteúdo e estrutura\\b0{}\\fs24\\sb196\\sa48\\par{}\\sb0\\sa0{}", GetConditionalText("\\i{}Tipologia informacional: \\i0{}\\par{}", GetTermosIndexados(FRDBaseRow, TipoNoticiaAut.TipologiaInformacional), ""), ConteudoEstrutura));

                // --Documentação associada--

                if (FRDBaseRow.GetSFRDDocumentacaoAssociadaRows().Length > 0)
                {
                    Result.Append(Section("\\fs36\\b{}Documentação associada\\b0{}\\fs24\\sb196\\sa48\\par{}\\sb0\\sa0{}", GetConditionalText("\\i{}Existência e localização de originais: \\i0{}\\par{}", FRDBaseRow.GetSFRDDocumentacaoAssociadaRows()[0].ExistenciaDeOriginais, "\\li128\\par\\li0{}") + GetConditionalText("\\i{}Existência e localização de cópias: \\i0{}\\par{}", FRDBaseRow.GetSFRDDocumentacaoAssociadaRows()[0].ExistenciaDeCopias, "\\li128\\par\\li0{}")));
                }

                // --Indexação--
                Result.Append(Section("\\fs36\\b{}Indexação\\b0{}\\fs24\\sb196\\sa48\\par{}\\sb0\\sa0{}", GetConditionalText("\\i{}Conteúdos: \\i0{}\\par{}", GetTermosIndexados(FRDBaseRow, TipoNoticiaAut.Ideografico, TipoNoticiaAut.Onomastico, TipoNoticiaAut.ToponimicoGeografico), "")));
            }
            return(Result.ToString());
        }
Пример #4
0
		public ArrayList AddNivel(TreeView trvw, GISADataset.NivelRow nRow, GISADataset.NivelRow nUpperRow, IDbConnection connection)
		{
			ArrayList result = new ArrayList();
			GISATreeNode node = null;
			// Para as EDs (em relação às quais não existem níveis superiores)
			if (nUpperRow == null)
			{
				node = FindTreeNodeByNivelRow(trvw.Nodes, nRow);
				if (node == null)
				{
					node = new GISATreeNode(Nivel.GetDesignacao(nRow));
					//Node.Tag = rhRow
					node.NivelRow = nRow;
					node.NivelUpperRow = null;

					GISADataset.TipoNivelRelacionadoRow tnrRow = null;
					int iconIndex = 0;
					tnrRow = TipoNivelRelacionado.GetTipoNivelRelacionadoFromRelacaoHierarquica(node.NivelRow, node.NivelUpperRow);
					iconIndex = -1;

					if (tnrRow != null)
					{
						iconIndex = System.Convert.ToInt32(tnrRow.GUIOrder);
					}
					if (nRow.CatCode.Trim().Equals("CA"))
					{
						if (iconIndex == -1)
						{
							node.ImageIndex = SharedResourcesOld.CurrentSharedResources.NivelImageIncognitoControloAut();
						}
						else
						{
							node.ImageIndex = SharedResourcesOld.CurrentSharedResources.NivelImageControloAut(iconIndex);
						}
					}
					else
					{
						if (iconIndex == -1)
						{
							node.ImageIndex = SharedResourcesOld.CurrentSharedResources.NivelImageIncognito();
						}
						else
						{
							node.ImageIndex = SharedResourcesOld.CurrentSharedResources.NivelImageBase(iconIndex);
						}
					}
					node.SelectedImageIndex = node.ImageIndex;
					trvw.Nodes.Add(node);
				}
				result.Add(node);
			}
			else
			{
				ArrayList ParentNodes = new ArrayList();
				GISADataset.RelacaoHierarquicaRow[] TempParentRelations = Nivel.GetParentRelations(nRow, nUpperRow, connection);

				//Obter os nós pai com base nas rows pai
				if (TempParentRelations.Length == 0)
				{
					ArrayList nodes = null;
					nodes = AddNivel(trvw, nUpperRow, null, connection);
					ParentNodes.AddRange(nodes);
				}
				foreach (GISADataset.RelacaoHierarquicaRow parentRhRow in TempParentRelations)
				{
					ArrayList nodes = null;
					nodes = AddNivel(trvw, parentRhRow.NivelRowByNivelRelacaoHierarquica, parentRhRow.NivelRowByNivelRelacaoHierarquicaUpper, connection);
					ParentNodes.AddRange(nodes);
				}

				// Neste ponto ParentNodes contém todos os nós a que um nó de nRow deverá ser adicionado
				foreach (TreeNode parentNode in ParentNodes)
				{
					node = FindTreeNodeByNivelRow(parentNode.Nodes, nRow);
					if (node == null)
					{
						node = new GISATreeNode(Nivel.GetDesignacao(nRow));
						//node.Tag = rhRow
						node.NivelRow = nRow;
						node.NivelUpperRow = nUpperRow;
						string data = FormatYearsInterval(node.RelacaoHierarquicaRow);
						if (data.Length > 0)
						{
							node.Text = string.Format("{0}   {1}", node.Text, data);
						}
						if (nRow.CatCode.Trim().Equals("CA"))
						{
							node.ImageIndex = SharedResourcesOld.CurrentSharedResources.NivelImageControloAut(System.Convert.ToInt32(TipoNivelRelacionado.GetTipoNivelRelacionadoFromRelacaoHierarquica(node.RelacaoHierarquicaRow).GUIOrder));
						}
						else
						{
							node.ImageIndex = SharedResourcesOld.CurrentSharedResources.NivelImageBase(System.Convert.ToInt32(TipoNivelRelacionado.GetTipoNivelRelacionadoFromRelacaoHierarquica(node.RelacaoHierarquicaRow).GUIOrder));
						}
						node.SelectedImageIndex = node.ImageIndex;
						parentNode.Nodes.Add(node);
					}
					result.Add(node);
				}
			}
			return result;
		}
Пример #5
0
        public override void ModelToView()
        {
            IsPopulated = false;
            string QueryFilter = string.Format("IDFRDBase={0}", CurrentUFFRDBase.ID);

            GISADataset.SFRDUFCotaRow[] cotaRows = null;
            cotaRows = (GISADataset.SFRDUFCotaRow[])(GisaDataSetHelper.GetInstance().SFRDUFCota.Select(QueryFilter));

            if (cotaRows.Length == 0)
            {
                CurrentUFSFRDCota = GisaDataSetHelper.GetInstance().SFRDUFCota.AddSFRDUFCotaRow(CurrentUFFRDBase, "", new byte[] { }, 0);
            }
            else
            {
                CurrentUFSFRDCota = cotaRows[0];
            }

            GISADataset.SFRDConteudoEEstruturaRow[] conteudoRows = null;
            conteudoRows = (GISADataset.SFRDConteudoEEstruturaRow[])(GisaDataSetHelper.GetInstance().SFRDConteudoEEstrutura.Select(QueryFilter));
            if (conteudoRows.Length == 0)
            {
                CurrentUFSFRDConteudoEEstrutura = GisaDataSetHelper.GetInstance().SFRDConteudoEEstrutura.AddSFRDConteudoEEstruturaRow(CurrentUFFRDBase, "", "", new byte[] { }, 0);
            }
            else
            {
                CurrentUFSFRDConteudoEEstrutura = conteudoRows[0];
            }

            GISADataset.SFRDDatasProducaoRow[] datasProducaoRows = null;
            datasProducaoRows = (GISADataset.SFRDDatasProducaoRow[])(GisaDataSetHelper.GetInstance().SFRDDatasProducao.Select(QueryFilter));
            if (datasProducaoRows.Length == 0)
            {
                CurrentUFSFRDDatasProducao                 = GisaDataSetHelper.GetInstance().SFRDDatasProducao.NewSFRDDatasProducaoRow();
                CurrentUFSFRDDatasProducao.FRDBaseRow      = CurrentUFFRDBase;
                CurrentUFSFRDDatasProducao.InicioAtribuida = false;
                CurrentUFSFRDDatasProducao.FimAtribuida    = false;
                GisaDataSetHelper.GetInstance().SFRDDatasProducao.AddSFRDDatasProducaoRow(CurrentUFSFRDDatasProducao);
            }
            else
            {
                CurrentUFSFRDDatasProducao = datasProducaoRows[0];
            }

            GISADataset.SFRDUFDescricaoFisicaRow[] descricaoFisicaRows = null;
            descricaoFisicaRows = (GISADataset.SFRDUFDescricaoFisicaRow[])(GisaDataSetHelper.GetInstance().SFRDUFDescricaoFisica.Select(QueryFilter));
            if (descricaoFisicaRows.Length == 0)
            {
                CurrentUFSFRDDescricaoFisica                         = GisaDataSetHelper.GetInstance().SFRDUFDescricaoFisica.NewSFRDUFDescricaoFisicaRow();
                CurrentUFSFRDDescricaoFisica.FRDBaseRow              = CurrentUFFRDBase;
                CurrentUFSFRDDescricaoFisica.IDTipoMedida            = 1;
                CurrentUFSFRDDescricaoFisica.TipoAcondicionamentoRow = (GISADataset.TipoAcondicionamentoRow)(GisaDataSetHelper.GetInstance().TipoAcondicionamento.Select(string.Format("ID={0:d}", TipoAcondicionamento.Pasta))[0]);
                GisaDataSetHelper.GetInstance().SFRDUFDescricaoFisica.AddSFRDUFDescricaoFisicaRow(CurrentUFSFRDDescricaoFisica);
            }
            else
            {
                CurrentUFSFRDDescricaoFisica = descricaoFisicaRows[0];
            }

            GISADataset.NivelUnidadeFisicaRow[] nivelUFRows = null;
            nivelUFRows = (GISADataset.NivelUnidadeFisicaRow[])(GisaDataSetHelper.GetInstance().NivelUnidadeFisica.Select(string.Format("ID={0}", CurrentUFFRDBase.NivelRow.ID)));
            if (nivelUFRows.Length == 0)
            {
                GISADataset.NivelUnidadeFisicaRow newNivelUFRow = null;
                newNivelUFRow = GisaDataSetHelper.GetInstance().NivelUnidadeFisica.NewNivelUnidadeFisicaRow();
                newNivelUFRow.NivelDesignadoRow = CurrentUFFRDBase.NivelRow.GetNivelDesignadoRows()[0];
                GisaDataSetHelper.GetInstance().NivelUnidadeFisica.AddNivelUnidadeFisicaRow(newNivelUFRow);

                CurrentNivelUnidadeFisica = newNivelUFRow;
            }
            else
            {
                CurrentNivelUnidadeFisica = (GISADataset.NivelUnidadeFisicaRow)(nivelUFRows[0]);
            }

            GUIHelper.GUIHelper.populateDataInicio(dtProducaoInicio, CurrentUFSFRDDatasProducao);
            GUIHelper.GUIHelper.populateDataFim(dtProducaoFim, CurrentUFSFRDDatasProducao);

            DimensoesSuporte1.populateDimensoes(CurrentUFSFRDDescricaoFisica);

            cbTipo.DisplayMember = "Designacao";
            cbTipo.Items.Clear();
            cbTipo.Items.AddRange(GisaDataSetHelper.GetInstance().TipoAcondicionamento.Select());
            cbTipo.SelectedItem = CurrentUFSFRDDescricaoFisica.TipoAcondicionamentoRow;

            chkAtribuidaInicio.Checked = CurrentUFSFRDDatasProducao.InicioAtribuida;
            chkAtribuidaFim.Checked    = CurrentUFSFRDDatasProducao.FimAtribuida;

            if (CurrentNivelUnidadeFisica.IsCodigoBarrasNull())
            {
                txtCodigoBarras.Text = "";
            }
            else
            {
                txtCodigoBarras.Text = CurrentNivelUnidadeFisica.CodigoBarras.ToString();
            }

            if (CurrentNivelUnidadeFisica.IsGuiaIncorporacaoNull())
            {
                txtGuia.Text = "";
            }
            else
            {
                txtGuia.Text = CurrentNivelUnidadeFisica.GuiaIncorporacao;
            }

            if (CurrentUFSFRDCota.IsCotaNull())
            {
                txtCota.Text = "";
            }
            else
            {
                txtCota.Text = CurrentUFSFRDCota.Cota;
            }

            this.txtCota.TextChanged += new System.EventHandler(this.txtCota_TextChanged);

            if (!(CurrentUFSFRDConteudoEEstrutura.IsConteudoInformacionalNull()))
            {
                txtConteudoInformacional.Text = CurrentUFSFRDConteudoEEstrutura.ConteudoInformacional;
            }
            else
            {
                txtConteudoInformacional.Text = "";
            }

            GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection());
            try
            {
                txtCodigoDeReferencia.Text = DBAbstractDataLayer.DataAccessRules.NivelRule.Current.GetCodigoOfNivel(CurrentUFFRDBase.NivelRow.ID, ho.Connection)[0].ToString();
            }
            finally
            {
                ho.Dispose();
            }
            txtTitulo.Text = Nivel.GetDesignacao(CurrentUFFRDBase.NivelRow);

            // Tipo entrega
            cbTipoEntrega.Items.Add(string.Empty);
            cbTipoEntrega.Items.AddRange(GisaDataSetHelper.GetInstance().TipoEntrega.Rows.Cast <GISADataset.TipoEntregaRow>().ToArray());
            cbTipoEntrega.DisplayMember = "Designacao";

            if (CurrentNivelUnidadeFisica.IsIDTipoEntregaNull())
            {
                cbTipoEntrega.SelectedIndex = 0;
            }
            else
            {
                cbTipoEntrega.SelectedItem = CurrentNivelUnidadeFisica.TipoEntregaRow;
            }

            // Local consulta
            controlLocalConsulta1.rebindToData();
            if (CurrentNivelUnidadeFisica.IsIDLocalConsultaNull())
            {
                controlLocalConsulta1.cbLocalConsulta.SelectedIndex = 0;
            }
            else
            {
                controlLocalConsulta1.cbLocalConsulta.SelectedValue = CurrentNivelUnidadeFisica.IDLocalConsulta;
            }

            IsPopulated = true;
        }
Пример #6
0
        private void GenerateInventarioEntryDetails(Document doc, GISADataset.RelacaoHierarquicaRow rhRow, float CurrentIndentCm)
        {
            string    entry = string.Empty;
            Paragraph p;

            GISADataset.NivelRow n = rhRow.NivelRowByNivelRelacaoHierarquica;
            foreach (GISADataset.FRDBaseRow frd in rhRow.NivelRowByNivelRelacaoHierarquica.GetFRDBaseRows())
            {
                if (frd.IDTipoFRDBase == (long)TipoFRDBase.FRDOIPublicacao)
                {
                    entry = Nivel.GetCodigoOfNivel(n);
                    p     = new Paragraph(CentimeterToPoint(0.5F), entry, this.BodyFont);
                    p.setIndentationLeft(CentimeterToPoint(0));
                    doc.add(p);
                    entry = string.Format("{0}: {1}", rhRow.TipoNivelRelacionadoRow.Codigo, Nivel.GetDesignacao(n));
                    p     = new Paragraph(CentimeterToPoint(0.5F), entry, this.BodyFont);
                    p.setIndentationLeft(CentimeterToPoint(0.5F));
                    doc.add(p);
                    if (frd.GetSFRDDatasProducaoRows().Length > 0)
                    {
                        entry = "";
                        if (!frd.GetSFRDDatasProducaoRows()[0].IsInicioTextoNull() && frd.GetSFRDDatasProducaoRows()[0].InicioTexto.Length > 0)
                        {
                            entry += frd.GetSFRDDatasProducaoRows()[0].InicioTexto + ", ";
                        }
                        entry += GetInicioData(frd.GetSFRDDatasProducaoRows()[0]) + " - " + GetFimData(frd.GetSFRDDatasProducaoRows()[0]);
                        p      = new Paragraph(CentimeterToPoint(0.5F), entry, this.BodyFont);
                        p.setIndentationLeft(CentimeterToPoint(1F));
                        doc.add(p);
                    }
                    entry = "**Dimensão e suporte**";
                    if (entry.Length > 0)
                    {
                        p = new Paragraph(entry, this.BodyFont);
                        p.setIndentationLeft(CentimeterToPoint(1F));
                        doc.add(p);
                    }
                    entry = GetControloAutFormaAut(frd, new TipoNoticiaAut[] { TipoNoticiaAut.EntidadeProdutora });
                    //For Each idx As GISADataset.IndexFRDCARow In frd.GetIndexFRDCARows()
                    //    If idx.ControloAutRow.IDTipoNoticiaAut = TipoNoticiaAut.EntidadeProdutora Then
                    //        For Each cad As GISADataset.ControloAutDicionarioRow In idx.ControloAutRow.GetControloAutDicionarioRows
                    //            If cad.IDTipoControloAutForma = TipoControloAutForma.FormaAutorizada Then
                    //                If entry.Length > 0 Then entry += " / "
                    //                entry += cad.DicionarioRow.Termo
                    //            End If
                    //        Next
                    //    End If
                    //Next
                    if (entry.Length > 0)
                    {
                        p = new Paragraph(entry, this.BodyFont);
                        p.setIndentationLeft(CentimeterToPoint(1));
                        doc.add(p);
                    }
                    if (frd.GetSFRDContextoRows().Length == 1)
                    {
                        entry = frd.GetSFRDContextoRows()[0].HistoriaAdministrativa;
                        if (entry.Length > 0)
                        {
                            p = new Paragraph(entry, this.BodyFont);
                            p.setIndentationLeft(CentimeterToPoint(1));
                            doc.add(p);
                        }
                        entry = frd.GetSFRDContextoRows()[0].HistoriaCustodial;
                        if (entry.Length > 0)
                        {
                            p = new Paragraph(entry, this.BodyFont);
                            p.setIndentationLeft(CentimeterToPoint(1));
                            doc.add(p);
                        }
                        entry = frd.GetSFRDContextoRows()[0].FonteImediataDeAquisicao;
                        if (entry.Length > 0)
                        {
                            p = new Paragraph(entry, this.BodyFont);
                            p.setIndentationLeft(CentimeterToPoint(1));
                            doc.add(p);
                        }
                    }
                    entry = GetControloAutFormaAut(frd, new TipoNoticiaAut[] { TipoNoticiaAut.TipologiaInformacional });
                    //For Each idx As GISADataset.IndexFRDCARow In frd.GetIndexFRDCARows()
                    //    If idx.ControloAutRow.IDTipoNoticiaAut = TipoNoticiaAut.TipologiaInformacional Then
                    //        For Each cad As GISADataset.ControloAutDicionarioRow In idx.ControloAutRow.GetControloAutDicionarioRows
                    //            If cad.IDTipoControloAutForma = TipoControloAutForma.FormaAutorizada Then
                    //                If entry.Length > 0 Then entry += " / "
                    //                entry += cad.DicionarioRow.Termo
                    //            End If
                    //        Next
                    //    End If
                    //Next
                    if (entry.Length > 0)
                    {
                        p = new Paragraph(entry, this.BodyFont);
                        p.setIndentationLeft(CentimeterToPoint(1));
                        doc.add(p);
                    }
                    if (frd.GetSFRDConteudoEEstruturaRows().Length == 1)
                    {
                        entry = frd.GetSFRDConteudoEEstruturaRows()[0].ConteudoInformacional;
                        if (entry.Length > 0)
                        {
                            p = new Paragraph(entry, this.BodyFont);
                            p.setIndentationLeft(CentimeterToPoint(1));
                            doc.add(p);
                        }
                    }
                    if (frd.GetSFRDCondicaoDeAcessoRows().Length == 1)
                    {
                        entry = frd.GetSFRDCondicaoDeAcessoRows()[0].CondicaoDeReproducao;
                        if (entry.Length > 0)
                        {
                            p = new Paragraph(entry, this.BodyFont);
                            p.setIndentationLeft(CentimeterToPoint(1));
                            doc.add(p);
                        }
                    }
                    entry = GetControloAutFormaAut(frd, new TipoNoticiaAut[] { TipoNoticiaAut.Ideografico, TipoNoticiaAut.Onomastico, TipoNoticiaAut.ToponimicoGeografico });
                    //For Each idx As GISADataset.IndexFRDCARow In frd.GetIndexFRDCARows()
                    //    If idx.ControloAutRow.IDTipoNoticiaAut = TipoNoticiaAut.Ideografico Or idx.ControloAutRow.IDTipoNoticiaAut = TipoNoticiaAut.Onomastico Or idx.ControloAutRow.IDTipoNoticiaAut = TipoNoticiaAut.ToponimicoGeografico Then
                    //        For Each cad As GISADataset.ControloAutDicionarioRow In idx.ControloAutRow.GetControloAutDicionarioRows
                    //            If cad.IDTipoControloAutForma = TipoControloAutForma.FormaAutorizada Then
                    //                If entry.Length > 0 Then entry += " / "
                    //                entry += cad.DicionarioRow.Termo
                    //            End If
                    //        Next
                    //    End If
                    //Next
                    if (entry.Length > 0)
                    {
                        p = new Paragraph(entry, this.BodyFont);
                        p.setIndentationLeft(CentimeterToPoint(1));
                        doc.add(p);
                    }
                }
            }
        }
Пример #7
0
        private void EditNivel()
        {
            var nRow   = this.nivelNavigator1.SelectedNivel;
            var frdRow = nRow.GetFRDBaseRows().Single();
            var rhRow  = nRow.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica().First();
            var tnrRow = TipoNivelRelacionado.GetTipoNivelRelacionadoFromRelacaoHierarquica(rhRow);

            var frm = new FormNivelDocumentalFedora();

            frm.IDTipoNivelRelacionado = tnrRow.ID;

            string WindowTitle = string.Format("Editar {0}", tnrRow.Designacao);


            frm.Text               = WindowTitle;
            frm.txtCodigo.Text     = nRow.Codigo;
            frm.txtDesignacao.Text = Nivel.GetDesignacao(nRow);
            frm.FRDBaseRow         = nRow.GetFRDBaseRows().Single();
            frm.LoadData();

            var idxFRDCARow = frdRow.GetIndexFRDCARows().SingleOrDefault(r => r["Selector"] != DBNull.Value && r.Selector == -1);

            // show form and receive user feedback
            if (frm.ShowDialog() == DialogResult.OK)
            {
                Trace.WriteLine("A editar nível...");
                GISADataset.NivelDesignadoRow ndRow = null;
                nRow.Codigo = frm.txtCodigo.Text;


                // Um Nivel documental deve ter obrigatoriamente um NivelDesignado.
                Debug.Assert(nRow.GetNivelDesignadoRows().Length > 0);
                ndRow            = nRow.GetNivelDesignadoRows()[0];
                ndRow.Designacao = frm.txtDesignacao.Text;

                var tipologiaSelected = ((FormNivelDocumentalFedora)frm).Tipologia;

                if (tipologiaSelected == null && idxFRDCARow != null)
                {
                    idxFRDCARow.Delete();
                }
                else if (tipologiaSelected != null && idxFRDCARow == null)
                {
                    idxFRDCARow = GisaDataSetHelper.GetInstance().IndexFRDCA.AddIndexFRDCARow(frdRow, ((FormNivelDocumentalFedora)frm).Tipologia.ControloAutRow, -1, new byte[] { }, 0);
                }
                else if (tipologiaSelected != null && idxFRDCARow != null && idxFRDCARow.IDControloAut != tipologiaSelected.IDControloAut)
                {
                    idxFRDCARow.Delete();
                    idxFRDCARow = GisaDataSetHelper.GetInstance().IndexFRDCA.AddIndexFRDCARow(frdRow, ((FormNivelDocumentalFedora)frm).Tipologia.ControloAutRow, -1, new byte[] { }, 0);
                }

                string termoToCompare = frm.Tipologia == null ? null : ((FormNivelDocumentalFedora)frm).Tipologia.DicionarioRow.Termo;
                if (objetoDigital != null && objetoDigital.tipologia != termoToCompare)
                {
                    objetoDigital.tipologia = tipologiaSelected != null ? tipologiaSelected.DicionarioRow.Termo : "";
                    objetoDigital.state     = State.modified;
                }

                // registar a edição do item selecionado
                CurrentContext.RaiseRegisterModificationEvent(nRow.GetFRDBaseRows()[0]);

                PersistencyHelper.EnsureUniqueCodigoNivelPreConcArguments pcArgs = new PersistencyHelper.EnsureUniqueCodigoNivelPreConcArguments();
                pcArgs.nRowID  = nRow.ID;
                pcArgs.ndRowID = ndRow.ID;
                // Se se tratar de uma entidade detentora não passar os Ids de uma relação
                // hierárquica para um nível superior pois não existe nenhum.
                if (nRow.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica().Length > 0)
                {
                    pcArgs.rhRowID      = nRow.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica()[0].ID;
                    pcArgs.rhRowIDUpper = nRow.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica()[0].IDUpper;
                }
                pcArgs.testOnlyWithinNivel = true;

                // actualizar objecto digital caso exista
                var preTransactionAction = new PreTransactionAction();
                var args = new PersistencyHelper.FedoraIngestPreTransactionArguments();
                preTransactionAction.args = args;

                preTransactionAction.preTransactionDelegate = delegate(PersistencyHelper.PreTransactionArguments preTransactionArgs)
                {
                    string msg = null;
                    if (objetoDigital != null)
                    {
                        preTransactionArgs.cancelAction = !SessionHelper.AppConfiguration.GetCurrentAppconfiguration().FedoraHelperSingleton.Ingest(objetoDigital, out msg);
                    }
                    preTransactionArgs.message = msg;
                };

                PersistencyHelper.SaveResult successfulSave = PersistencyHelper.save(DelegatesHelper.ensureUniqueCodigo, pcArgs, preTransactionAction);
                if (!pcArgs.successful)
                {
                    MessageBox.Show(pcArgs.message, "Edição da unidade de descrição", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (successfulSave == PersistencyHelper.SaveResult.successful)
                {
                    GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection());
                    try
                    {
                        List <string> IDNiveis = new List <string>();
                        IDNiveis.Add(nRow.ID.ToString());
                        GISA.Search.Updater.updateNivelDocumental(IDNiveis);
                    }
                    catch (Exception ex)
                    {
                        Trace.WriteLine(ex.ToString());
                        throw;
                    }
                    finally
                    {
                        ho.Dispose();
                    }
                }

                PersistencyHelper.cleanDeletedData();

                // Actualizar a interface com os novos valores. Se editarmos a
                // raiz (estrutural) da vista documental é necessário actualizar
                // automaticamente também a vista estrutural.

                if (!(nRow.RowState == DataRowState.Detached))
                {
                    if (this.nivelNavigator1.PanelToggleState == NivelNavigator.ToggleState.Estrutural)
                    {
                        this.nivelNavigator1.UpdateSelectedNodeName(Nivel.GetDesignacao(nRow));
                    }
                    else
                    {
                        this.nivelNavigator1.UpdateSelectedListItemName(Nivel.GetDesignacao(nRow));
                    }
                }

                // Forçar a gravação do documento
                CurrentContext.SetNivelEstrututalDocumental(null);
                CurrentContext.SetNivelEstrututalDocumental(nRow);
            }
        }
Пример #8
0
		protected override string GetDependenciesReport(DataRow[] rows)
		{
			string report = null;
			foreach (DataRow dependentRow in rows)
			{
				if (report == null)
				{
					report = "";
				}
				report += "  " + TipoNivelRelacionado.GetTipoNivelRelacionadoDaPrimeiraRelacaoEncontrada(((GISADataset.SFRDUFDescricaoFisicaRow)dependentRow).FRDBaseRow.NivelRow).Designacao + ": " + Nivel.GetDesignacao(((GISADataset.SFRDUFDescricaoFisicaRow)dependentRow).FRDBaseRow.NivelRow) + Environment.NewLine;
			}
			if (report != null)
			{
				report = "Remover este material fará com que todas as suas referências passem a \"" + ((GISADataset.TipoSuporteRow)(GisaDataSetHelper.GetInstance().TipoSuporte.Select("ID = 1")[0])).Designacao + "\"" + Environment.NewLine + "Foram encontrados os seguintes níveis associados a " + "este material:" + Environment.NewLine + Environment.NewLine + report;
			}
			return report;
		}