Ejemplo n.º 1
3
 private void AddOrRemoveODRelations(ObjDigComposto odComp, ObjDigSimples odSimples, GISADataset.ObjetoDigitalRow odRow)
 {
     var frdRow = currentNivel.GetFRDBaseRows().Single();
     if (odComp.state == State.added)
     {
         var imgODRow = odRow.GetSFRDImagemObjetoDigitalRows().SingleOrDefault(r => r.IDFRDBase == frdRow.ID);
         if (imgODRow != null) // esta row é nula no caso dos ODs Simples associados a subdocumentos
         {
             imgODRow.SFRDImagemRowParent.Delete();
             imgODRow.Delete();
         }
         GisaDataSetHelper.GetInstance().ObjetoDigitalRelacaoHierarquica.AddObjetoDigitalRelacaoHierarquicaRow(odRow, currentObjetoDigitalRowComp, new byte[] { }, 0);
     }
     else if (odComp.state == State.deleted)
     {
         if (odRow.GetSFRDImagemObjetoDigitalRows().Count() == 0) // se se tratar de um od simples sem estar relacionado com um subdocumento cria-se relacao com a UI selecionada
             FedoraHelper.RelateODtoUI(odSimples, odRow, currentNivel.GetFRDBaseRows().Single());
     }
 }
Ejemplo n.º 2
2
        private void CreateDatabaseObjDigSimples(ObjDigComposto odComp, GISADataset.ObjetoDigitalRow odRowComp, ObjDigSimples odSimples)
        {
            Debug.Assert(odComp != null);
            Debug.Assert(odSimples != null);
            Debug.Assert(odRowComp != null && odRowComp.RowState != DataRowState.Deleted);

            var orderNr = odComp.objSimples.IndexOf(odSimples);
            var odRow = GisaDataSetHelper.GetInstance().ObjetoDigital.AddObjetoDigitalRow(odSimples.pid, odSimples.titulo, odSimples.publicado, (orderNr + 1), new byte[] { }, 0);


            GisaDataSetHelper.GetInstance().ObjetoDigitalRelacaoHierarquica.AddObjetoDigitalRelacaoHierarquicaRow(odRow, odRowComp, new byte[] { }, 0);
            //PermissoesHelper.AddNewObjDigGrantPermissions(odRow, currentNivel);

            newObjects.Add(odRow, odSimples);
        }
Ejemplo n.º 3
0
        public static void ConfigureMenu(GISADataset CurrentDataSet, GISADataset.TipoNivelRelacionadoRow CurrentRow, ref ToolBarButton Button, EventHandler CurrentHandler, bool DocumentView)
        {
            ImageList ImgList = GetImageList();

            Menu.MenuItemCollection CurrentMenu = Button.DropDownMenu.MenuItems;

            foreach (GISADataset.TipoNivelRelacionadoRow subtnrRow in GetSubTipoNivelRelacionado(CurrentDataSet, CurrentRow))
            {
                // An option to create a certain type of nivel is shown if:
                // we are in the Strutcture view and we are providing options to create new structure items
                // *OR*
                // we are in Documents view and we are providing options to create new document items
                if ((!DocumentView && !(subtnrRow.TipoNivelRow.IsDocument ^ CurrentRow.TipoNivelRow.IsDocument)) || (DocumentView & CurrentRow.TipoNivelRow.IsDocument))
                {
                    // Adicionar opção de criação apenas para os tipos de nivelRelacionado que não sejam níveis orgânicos
                    if (!(GisaDataSetHelper.GetInstance().GlobalConfig[0].NiveisOrganicos && subtnrRow.IDTipoNivel == TipoNivel.ESTRUTURAL && CurrentRow.IDTipoNivel == TipoNivel.ESTRUTURAL))
                    {
                        AddMenuOption(CurrentMenu, CurrentRow, subtnrRow, CurrentHandler, ImgList);
                    }
                }
                else if (DocumentView)
                {
                    //Dim pxmi As PXMenuItem = New TipoNivelMenuItem("Criar" + subtnRow.Designacao, subtnRow, ImgList)
                    //Dim mi As MenuItem = DirectCast(pxmi, MenuItem)
                    if (subtnrRow.TipoNivelRow.IsDocument)
                    {
                        //If Not CurrentHandler Is Nothing Then AddHandler mi.Click, CurrentHandler
                        AddMenuOption(CurrentMenu, CurrentRow, subtnrRow, CurrentHandler, ImgList);
                    }
                }
            }
        }
Ejemplo n.º 4
0
		public void TearDown()
		{
			ds = null;
			r1 = null;
			r2 = null;
			r3 = null;
		}
Ejemplo n.º 5
0
			public void Run(GISADataset CurrentDataSet, GISADataset.NivelRow CurrentNivel, INivelChainVisitor CurrentVisitor)
			{
				Queue PendingNivel = new Queue();
				Stack ContextNivel = new Stack();

				PendingNivel.Enqueue(CurrentNivel);

				CurrentVisitor.InitVisit();

				while (PendingNivel.Count > 0)
				{
					GISADataset.NivelRow CursorNivel = (GISADataset.NivelRow)(PendingNivel.Dequeue());
					if (CursorNivel == null)
					{
						ContextNivel.Pop();
					}
					else
					{
						ContextNivel.Push(CursorNivel);

						GISADataset.NivelRow[] ContextNivelEx = null;
						ContextNivelEx = new GISADataset.NivelRow[ContextNivel.Count];
						ContextNivel.CopyTo(ContextNivelEx, 0);
						CurrentVisitor.Visit(CurrentDataSet, ContextNivelEx);

						foreach (GISADataset.RelacaoHierarquicaRow rhRow in GetNextNivelRows(CurrentDataSet, CursorNivel))
						{
							PendingNivel.Enqueue(rhRow.NivelRowByNivelRelacaoHierarquica);
						}
						PendingNivel.Enqueue(null);
					}
				}

				CurrentVisitor.DoneVisit();
			}
Ejemplo n.º 6
0
		private void GenerateInventarioEntryDetails(Document doc, GISADataset.RelacaoHierarquicaRow rhRow, float CurrentIndentCm) {
			
			string entry = "";
			
			Paragraph p;
			GisaDataSetHelper.GetFRDBaseDataAdapter(string.Format("WHERE IDNivel={0}", rhRow.ID), null, null).Fill(dataSet.FRDBase);
			GisaDataSetHelper.GetSFRDDatasProducaoDataAdapter(string.Format("INNER JOIN FRDBase ON SFRDDatasProducao.IDFRDBase=FRDBase.ID WHERE IDNivel={0}", rhRow.ID), null, null).Fill(dataSet.SFRDDatasProducao);
			GisaDataSetHelper.GetSFRDUFCotaDataAdapter(string.Format("INNER JOIN FRDBase ON SFRDUFCota.IDFRDBase=FRDBase.ID WHERE IDNivel={0}", rhRow.ID), null, null).Fill(dataSet.SFRDUFCota);
			//PersistencyHelper.cleanDeletedRows()
			foreach (GISADataset.FRDBaseRow frd in rhRow.NivelRowByNivelRelacaoHierarquica.GetFRDBaseRows()) {
				if (frd.IDTipoFRDBase == (long)TipoFRDBase.FRDOIPublicacao) {
					if (frd.GetSFRDDatasProducaoRows().Length > 0) { {
						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(entry, this.BodyFont);
						p.setIndentationLeft(CentimeterToPoint(CurrentIndentCm + 0.5f));
						doc.add(p);
					}
					}
					entry = frd.GetSFRDUFCotaRows()[0].Cota;
					p = new Paragraph(entry, this.BodyFont);
					p.setIndentationLeft(CentimeterToPoint(CurrentIndentCm + 0.5f));
					doc.add(p);
					entry = Nivel.GetCodigoOfNivel(rhRow.NivelRowByNivelRelacaoHierarquica);
					p = new Paragraph(entry, this.BodyFont);
					p.setIndentationLeft(CentimeterToPoint(CurrentIndentCm + 0.5f));
					doc.add(p);
				}
			}
		}
Ejemplo n.º 7
0
		public void SetUp()
		{
			ds = new GISADataset();
			ds.Merge(GisaDataSetHelper.GetInstance());

			r1 = ds.Nivel.NewNivelRow();
			r1.IDTipoNivel = 1;
			r1.Codigo = "Teste";

			r2 = ds.Nivel.NewNivelRow();
			r2.IDTipoNivel = 2;
			r2.Codigo = "Teste";

			r3 = ds.RelacaoHierarquica.NewRelacaoHierarquicaRow();
			r3.ID = r2.ID;
			r3.IDUpper = r1.ID;

			ds.Nivel.Rows.Add(r1);
			ds.Nivel.Rows.Add(r2);
			ds.RelacaoHierarquica.Rows.Add(r3);

			GISADataset.NivelDesignadoRow r4 = ds.NivelDesignado.NewNivelDesignadoRow();
			r4.ID = r1.ID;
			r4.Designacao = "Designacao";
			ds.NivelDesignado.AddNivelDesignadoRow(r4);
		}
Ejemplo n.º 8
0
 internal protected override DataRow NewRow(GISADataset.ControloAutRow caRow)
 {
     var newRow = GisaDataSetHelper.GetInstance().SFRDAutor.NewSFRDAutorRow();
     newRow.IDFRDBase = FRDBaseRow.ID;
     newRow.IDControloAut = caRow.ID;
     GisaDataSetHelper.GetInstance().SFRDAutor.AddSFRDAutorRow(newRow);
     return newRow;
 }
Ejemplo n.º 9
0
        public static GISADataset.RelacaoHierarquicaRow[] GetChildren(GISADataset CurrentDataSet, GISADataset.NivelRow CurrentNivel)
		{

			//TODO: chamar método que faz os fill: fillChildren(CurrentDataSet, CurrentNivel.ID, conn, tran)

			GISADataset.RelacaoHierarquicaRow[] Children = CurrentNivel.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquicaUpper();
			return Children;
		}
Ejemplo n.º 10
0
 public ControloAutDragDrop(ListView ListView, TipoNoticiaAut[] TipoNoticiaAutAllowed, GISADataset.ControloAutRow ControloAutRow, Control parent)
     : base(ListView, typeof(GISADataset.ControloAutRow), typeof(GISADataset.ControloAutRow[]))
 {
     this.TipoNoticiaAutAllowed = TipoNoticiaAutAllowed;
     this.FRDBaseRow = null;
     this.ControloAutRow = ControloAutRow;
     this.parent = parent;
 }
Ejemplo n.º 11
0
 public static string GenerateNewCodigoString(GISADataset.NivelRow nivelEDRow, int ano)
 {
     DataRow[] DataRows = GisaDataSetHelper.GetInstance().NivelUnidadeFisicaCodigo.Select("ID=" + nivelEDRow.ID.ToString() + " AND Ano=" + System.DateTime.Now.Year.ToString());
     if (DataRows.Length == 0)
         return "UF" + DateTime.Now.Year.ToString() + "-" + 1.ToString();
     else
         return "UF" + DateTime.Now.Year.ToString() + "-" + (((GISADataset.NivelUnidadeFisicaCodigoRow)(DataRows[0])).Contador + 1).ToString();
 }
Ejemplo n.º 12
0
        internal protected virtual DataRow NewRow(GISADataset.ControloAutRow caRow)
        {
            var newRow = GisaDataSetHelper.GetInstance().IndexFRDCA.NewIndexFRDCARow();
		    newRow.FRDBaseRow = FRDBaseRow;
            newRow.ControloAutRow = caRow;
            newRow["Selector"] = DBNull.Value;
            GisaDataSetHelper.GetInstance().IndexFRDCA.AddIndexFRDCARow(newRow);
            return newRow;
        }
Ejemplo n.º 13
0
        public static void LoadStaticDataTables(GISADataset CurrentDataSet)
        {
            DataBaseLayer dbLayer = GetDBLayer();

            DataBaseLayer.ConnectionHolder ch = dbLayer.HoldConnection();
            try
            {
                // Normas de países, línguas, caligrafia...
                GetIso15924DataAdapter(null, null, null).Fill(CurrentDataSet.Iso15924);
                GetIso3166DataAdapter(null, null, null).Fill(CurrentDataSet.Iso3166);
                GetIso639DataAdapter(null, null, null).Fill(CurrentDataSet.Iso639);

                // Configuracoes
                GetGlobalConfigDataAdapter(null, null, null).Fill(CurrentDataSet.GlobalConfig);

                // Conjunto de Privilégios da Aplicação
                // Identificam acesso a Módulos da aplicação ou funcionalidades dentro destes, não a dados.
                GetTipoFunctionGroupDataAdapter(null, null, null).Fill(CurrentDataSet.TipoFunctionGroup);
                GetTipoFunctionDataAdapter(null, null, null).Fill(CurrentDataSet.TipoFunction);
                GetTipoOperationDataAdapter(null, null, null).Fill(CurrentDataSet.TipoOperation);
                GetFunctionOperationDataAdapter(null, null, null).Fill(CurrentDataSet.FunctionOperation);

                // Tipos de producto existentes e funcionalidades proprias de cada um
                GetTipoServerDataAdapter(null, null, null).Fill(CurrentDataSet.TipoServer);
                GetTipoClientDataAdapter(null, null, null).Fill(CurrentDataSet.TipoClient);
                GetProductFunctionDataAdapter(null, null, null).Fill(CurrentDataSet.ProductFunction);

                //Enumerados utilizados em foreign keys
                GetTipoControloAutFormaDataAdapter(null, null, null).Fill(CurrentDataSet.TipoControloAutForma);
                GetTipoControloAutRelDataAdapter(null, null, null).Fill(CurrentDataSet.TipoControloAutRel);
                GetTipoDensidadeDataAdapter(null, null, null).Fill(CurrentDataSet.TipoDensidade);
                GetTipoEntidadeProdutoraDataAdapter(null, null, null).Fill(CurrentDataSet.TipoEntidadeProdutora);
                GetTipoEstadoDeConservacaoDataAdapter(null, null, null).Fill(CurrentDataSet.TipoEstadoDeConservacao);
                GetTipoFormaSuporteAcondDataAdapter(null, null, null).Fill(CurrentDataSet.TipoFormaSuporteAcond);
                GetTipoFRDBaseDataAdapter(null, null, null).Fill(CurrentDataSet.TipoFRDBase);
                GetTipoMaterialDeSuporteDataAdapter(null, null, null).Fill(CurrentDataSet.TipoMaterialDeSuporte);
                GetTipoMedidaDataAdapter(null, null, null).Fill(CurrentDataSet.TipoMedida);
                GetTipoNivelDataAdapter(null, null, null).Fill(CurrentDataSet.TipoNivel);
                GetTipoNivelRelacionadoDataAdapter(null, null, null).Fill(CurrentDataSet.TipoNivelRelacionado);
                GetRelacaoTipoNivelRelacionadoDataAdapter(null, null, null).Fill(CurrentDataSet.RelacaoTipoNivelRelacionado);
                GetTipoNoticiaAutDataAdapter(null, null, null).Fill(CurrentDataSet.TipoNoticiaAut);
                GetTipoNoticiaATipoControloAFormaDataAdapter(null, null, null).Fill(CurrentDataSet.TipoNoticiaATipoControloAForma);
                GetTipoOrdenacaoDataAdapter(null, null, null).Fill(CurrentDataSet.TipoOrdenacao);
                GetTipoPertinenciaDataAdapter(null, null, null).Fill(CurrentDataSet.TipoPertinencia);
                GetTipoQuantidadeDataAdapter(null, null, null).Fill(CurrentDataSet.TipoQuantidade);
                GetTipoSubDensidadeDataAdapter(null, null, null).Fill(CurrentDataSet.TipoSubDensidade);
                GetTipoTecnicasDeRegistoDataAdapter(null, null, null).Fill(CurrentDataSet.TipoTecnicasDeRegisto);
                GetTipoTradicaoDocumentalDataAdapter(null, null, null).Fill(CurrentDataSet.TipoTradicaoDocumental);

                // Autos de eliminação
                GetAutoEliminacaoDataAdapter(null, null, null).Fill(CurrentDataSet.AutoEliminacao);
            }
            finally
            {
                DataBaseLayer.DisposeConnection(ch);
            }
        }
Ejemplo n.º 14
0
		// Devolve a forma autorizada do CA passado
		public static GISADataset.ControloAutDicionarioRow getFormaAutorizada(GISADataset.ControloAutRow caRow)
		{
			foreach (GISADataset.ControloAutDicionarioRow cadRow in caRow.GetControloAutDicionarioRows())
			{
				if (cadRow.IDTipoControloAutForma == (long)TipoControloAutForma.FormaAutorizada)
					return cadRow;
			}
			return null;
		}
Ejemplo n.º 15
0
		protected override void GenerateInventarioEntry(Document doc, GISADataset.RelacaoHierarquicaRow rhRow, float CurrentIndentCm) {
			DoRemovedEntries(1);
			if (rhRow.TipoNivelRelacionadoRow.IDTipoNivel == TipoNivelRelacionado.D) {
				GenerateInventarioEntryDetails(doc, rhRow, CurrentIndentCm);
			}
			else {
				GenerateInventarioEntryChildren(doc, rhRow, CurrentIndentCm);
			}
		}
        public DomainValueListBoxController(GISADataset.FRDBaseRow FRDBaseRow, DataTable DomainValues, DataTable SelectionTable, string SelectionColumn, ListBox ListBox, bool ExclusiveSelection)
            : base()

		{
			this.DomainValues = DomainValues;
			this.Selection = new DataView(SelectionTable, "IDFRDBase=" + FRDBaseRow.ID.ToString(), "", DataViewRowState.CurrentRows);
			this.SelectionColumn = SelectionColumn;
			this.ListBox = ListBox;
			this.ExclusiveSelection = ExclusiveSelection;

			((CheckedListBox)ListBox).ItemCheck +=  ListBox_Itemcheck;
		}
        protected override void UpdateTrustees(GISADataset.TrusteeRow tRow)
        {
            GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection());
            try
            {
                TrusteeRule.Current.LoadTrusteesUsr(GisaDataSetHelper.GetInstance(), ho.Connection);
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
                throw;
            }
            finally
            {
                ho.Dispose();
            }

            lstVwTrustees.Items.Clear();
            ListViewItem item = null;
            ListViewItem selItem = null;
            foreach (var t in GisaDataSetHelper.GetInstance().Trustee.Cast<GISADataset.TrusteeRow>().ToList())
            {
#if TESTING
               
                item = lstVwTrustees.Items.Add("");
                if (t == tRow)
                {
                    selItem = item;
                }
                UpdateListViewItem(item, t);
                if (t.BuiltInTrustee)
                {
                    item.ForeColor = System.Drawing.Color.Gray;
                }
#else
				if (! t.BuiltInTrustee && t.IsVisibleObject)
				{
					item = lstVwTrustees.Items.Add("");
					if (t == tRow)
					{
						selItem = item;
					}
					UpdateListViewItem(item, t);
				}
#endif
            }
            lstVwTrustees.Sort();
            if (selItem != null)
            {
                lstVwTrustees.EnsureVisible(selItem.Index);
                lstVwTrustees.selectItem(selItem);
            }
        }
Ejemplo n.º 18
0
		public static GISADataset GetInstance()
		{
			if (mDataSet == null)
			{
				mDataSet = new GISADataset();

	#if DEBUG
				mDataSet.EnforceConstraints = false;
	#else
				mDataSet.EnforceConstraints = false;
	#endif

				//' This ensures that autonumber fields do not clash with database information
				foreach (DataTable t in mDataSet.Tables)
				{
					foreach (DataColumn c in t.Columns)
					{
						if (c.AutoIncrement)
						{
							c.AutoIncrementSeed = -1;
							c.AutoIncrementStep = -1;
						}
					}
				}

				// Carregar ficheiros xml embebidos no Gisa.Model contendo o meta model
				Assembly metaModelAssembly = Assembly.GetAssembly(typeof(MetaModelHelper));
				MetaModelHelper.MetaModel = new System.Xml.XmlDocument();
				MetaModelHelper.MetaModel.Load(metaModelAssembly.GetManifestResourceStream(metaModelAssembly.GetName().Name + ".MetaModel.GISADataset.xml"));
                MetaModelHelper.DataTypesDictionary = new System.Xml.XmlDocument();
                MetaModelHelper.DataTypesDictionary.Load(metaModelAssembly.GetManifestResourceStream(metaModelAssembly.GetName().Name + ".MetaModel.DataTypesDictionary.xml"));
                DBAbstractDataLayer.DataAccessRules.DALRule.MetaModel = new MetaModelHelper();

				IDbConnection conn = GisaDataSetHelper.GetConnection();
				try
				{
					conn.Open();
					GisaDataSetHelperRule.Current.LoadStaticDataTables(mDataSet, conn);
				} catch (System.SystemException ex)
				{
					// tratar as excepções de acesso à base de dados mantendo o dataset a null
					mDataSet = null;
					Trace.WriteLine(ex);
				}
				finally
				{
					conn.Close();
				}
			}
			return mDataSet;
		}
Ejemplo n.º 19
0
        public override void ModelToView()
        {
            IsPopulated = false;
            string      QueryFilter = "IDFRDBase=" + CurrentFRDBase.ID.ToString();
            GISADataset tempWith1   = GisaDataSetHelper.GetInstance();

            PopulateTipologias();
            PopulateSubTipologias();
            PopulateDiplomas();
            PopulateModelos();

            UpdateButtonState();
            IsPopulated = true;
        }
Ejemplo n.º 20
0
		public FormPickControloAut(GISADataset.ControloAutRow ContextControloAut) : base()
		{

			//This call is required by the Windows Form Designer.
			InitializeComponent();

			//Add any initialization after the InitializeComponent() Call
            caList.BeforeNewListSelection += caList_BeforeNewListSelection;
            caList.DoubleClick += caList_DoubleClick;
            btnAdicionar.Click += btnAdicionar_Click;

			mContextControloAut = ContextControloAut;
            caList.FilterVisible = true;
		}
Ejemplo n.º 21
0
		public override void GeneratePdf() {
			dataSet = new GISADataset();
			foreach (DataTable t in dataSet.Tables) {
				t.RowChanged += new DataRowChangeEventHandler(this.DataRowChanged);
			}
			GisaDataSetHelper.LoadStaticDataTables(dataSet);
			
			Document doc;
			doc = new Document(PageSize.A4, CentimeterToPoint(2.5F), CentimeterToPoint(2.5F), CentimeterToPoint(2.5F), CentimeterToPoint(2.5F));
			com.lowagie.text.pdf.PdfWriter.getInstance(doc, new java.io.FileOutputStream(mFileName, false));
			Generate(doc, mRelacaoHierarquicaRows);
			doc.close();
			dataSet = null;
		}
Ejemplo n.º 22
0
        public static void RegisterRecordModificationCA(GISADataset.ControloAutRow CurrentControloAut, bool existsModifiedDataFromRels, GISADataset.TrusteeUserRow tuOperator, GISADataset.TrusteeUserRow tuAuthor, DateTime data)
        {
            // só é registada uma nova entrada no controlo de descrição se alguma informação relativa à FRD 
            // tiver sido modificada; é também possível que já tenha sido registado uma nova entrada no controlo mas
            // nesse caso não se adiciona outra
            if (CurrentControloAut == null || CurrentControloAut.RowState == DataRowState.Detached ||
                GisaDataSetHelper.GetInstance().ControloAutDataDeDescricao.Select("IDControloAut=" + CurrentControloAut.ID.ToString(), "", DataViewRowState.Added).Length > 0)

                return;

            if (existsModifiedDataFromRels || Concorrencia.WasRecordModified(CurrentControloAut))
            {
                var cadddRow = CreateControlAutDataDeDescricaoRow(CurrentControloAut, tuOperator, tuAuthor, data);
                GisaDataSetHelper.GetInstance().ControloAutDataDeDescricao.AddControloAutDataDeDescricaoRow(cadddRow);
            }
        }
Ejemplo n.º 23
0
		public FormControloAutRel(GISADataset.ControloAutRow ContextCA, Control parent) : base()
		{

			//This call is required by the Windows Form Designer.
			InitializeComponent();

            //Add any initialization after the InitializeComponent() callcaList.BeforeNewListSelection += caList_BeforeNewListSelection;
            btnAccept.Click += btnAccept_Click;
			mContextControloAut = ContextCA;

			this.relacaoCA.ContextNivelRow = ((GISADataset.NivelControloAutRow)(GisaDataSetHelper.GetInstance().NivelControloAut.Select(string.Format("IDControloAut={0}", ContextCA.ID))[0])).NivelRow;            
            caList.BeforeNewListSelection += caList_BeforeNewListSelection;
            this.caList.FilterVisible = true;

            this.parent = parent;
		}
Ejemplo n.º 24
0
        public override void GeneratePdf()
        {
            dataSet = new GISADataset();
            foreach (DataTable t in dataSet.Tables)
            {
                t.RowChanged += new DataRowChangeEventHandler(this.DataRowChanged);
            }
            GisaDataSetHelper.LoadStaticDataTables(dataSet);

            Document doc;

            doc = new Document(PageSize.A4, CentimeterToPoint(2.5F), CentimeterToPoint(2.5F), CentimeterToPoint(2.5F), CentimeterToPoint(2.5F));
            com.lowagie.text.pdf.PdfWriter.getInstance(doc, new java.io.FileOutputStream(mFileName, false));
            Generate(doc, mRelacaoHierarquicaRows);
            doc.close();
            dataSet = null;
        }
Ejemplo n.º 25
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);
			}
		}
Ejemplo n.º 26
0
        // returns the updated NivelUnidadeFisicaCodigoRow considering a new Codigo
        public static GISADataset.NivelUnidadeFisicaCodigoRow GetNewCodigoRow(GISADataset.NivelRow nivelRow, int ano)
        {
            GISADataset.NivelRow ParentEDRow = nivelRow.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica()[0].NivelRowByNivelRelacaoHierarquicaUpper;
            DataRow[] DataRows = GisaDataSetHelper.GetInstance().NivelUnidadeFisicaCodigo.Select("ID=" + ParentEDRow.ID.ToString() + " AND Ano=" + System.DateTime.Now.Year.ToString());
            GISADataset.NivelUnidadeFisicaCodigoRow codigoRow = null;
            if (DataRows.Length == 0)
            {
                codigoRow = GisaDataSetHelper.GetInstance().NivelUnidadeFisicaCodigo.AddNivelUnidadeFisicaCodigoRow(ParentEDRow, System.DateTime.Now.Year, 1M, new byte[] { }, 0);
            }
            else
            {
                codigoRow = (GISADataset.NivelUnidadeFisicaCodigoRow)(DataRows[0]);
                codigoRow.Contador = codigoRow.Contador + 1;
            }

            return codigoRow;
        }
Ejemplo n.º 27
0
		protected void Generate(Document doc, GISADataset.RelacaoHierarquicaRow[] rhRows) {
			string queryN = "";
			string queryRH = "";

			foreach (GISADataset.RelacaoHierarquicaRow r in rhRows) {
				if (queryN.Length > 0)
					queryN += ", ";
				queryN += string.Format("{0}", r.NivelRowByNivelRelacaoHierarquica.ID);
				if (queryRH.Length > 0)
					queryRH += " OR ";
				queryRH += string.Format("(ID={0} AND IDUpper={1})", r.ID, r.IDUpper);
			}

			GisaDataSetHelper.GetNivelDataAdapter(string.Format("WHERE ID IN ({0})", queryN), null, null).Fill(dataSet.Nivel);
			GisaDataSetHelper.GetRelacaoHierarquicaDataAdapter(string.Format("WHERE {0}", queryRH), null, null).Fill(dataSet.RelacaoHierarquica);
			//PersistencyHelper.cleanDeletedRows()
			rhRows = (GISADataset.RelacaoHierarquicaRow[])dataSet.RelacaoHierarquica.Select("");
			
			java.awt.Color hfcolor = new java.awt.Color(128, 128, 128);
			
			Font hffont = new Font(Font.HELVETICA, 6, Font.ITALIC, hfcolor);
			
			HeaderFooter header = new HeaderFooter(new Phrase("Gestão Integrada de Sistemas de Arquivo", hffont), false);
			header.setAlignment(ElementConst.ALIGN_CENTER);
			header.setBorder(2);
			// iTextSharp.text.Rectangle.BOTTOM
			header.setBorderColor(hfcolor);
			doc.setHeader(header);
			
			HeaderFooter footer = new HeaderFooter(new Phrase("Câmara Municipal do Porto - Departamento de Arquivos - ", hffont), true);
			footer.setAlignment(ElementConst.ALIGN_CENTER);
			footer.setBorder(1);
			// iTextSharp.text.Rectangle.TOP
			footer.setBorderColor(hfcolor);
			doc.setFooter(footer);
			// Headers and footers apply to next page...
			doc.open();
			GenerateTitle(doc);
			
			float CurrentIndentCm = 0;
			DoAddedEntries(rhRows.Length);
			Array.Sort(rhRows, new NivelSorter());
			foreach (GISADataset.RelacaoHierarquicaRow rhRow in rhRows) {
				GenerateInventarioEntry(doc, rhRow, CurrentIndentCm);
			}
		}
Ejemplo n.º 28
0
        public static void ConfigureMenu(GISADataset CurrentDataSet, GISADataset.TipoNivelRelacionadoRow CurrentRow, ref ToolBarButton Button, EventHandler CurrentHandler)
        {
            ImageList ImgList = GetImageList();

            Menu.MenuItemCollection             CurrentMenu = Button.DropDownMenu.MenuItems;
            GISADataset.TipoNivelRelacionadoRow subtnrRow;

            if (CurrentRow.ID == TipoNivelRelacionado.D)
            {
                subtnrRow = CurrentDataSet.TipoNivelRelacionado.Cast <GISADataset.TipoNivelRelacionadoRow>().Single(r => r.ID == TipoNivelRelacionado.SD);
            }
            else
            {
                subtnrRow = CurrentDataSet.TipoNivelRelacionado.Cast <GISADataset.TipoNivelRelacionadoRow>().Single(r => r.ID == TipoNivelRelacionado.D);
            }

            AddMenuOption(CurrentMenu, CurrentRow, subtnrRow, CurrentHandler, ImgList);
        }
Ejemplo n.º 29
0
        public static void ForceRefresh(GISADataset.RelacaoHierarquicaRowChangeEvent e, MasterPanel mp, frmMain topLevelControl)
        {
            try
            {
                if (!(e.Action == DataRowAction.Add || (e.Action == DataRowAction.Change) || e.Action == DataRowAction.Delete))
                    return;

                // verificar se a row foi realmente editada
                if (e.Action == DataRowAction.Change && !Concorrencia.isModifiedRow(e.Row))
                    return;

                // descartar modificações intermédias de rows (por exemplo, a atribuição de um ID uma nivelRow quando gravada para a BD)
                if (e.Row.NivelRowByNivelRelacaoHierarquica == null || e.Row.NivelRowByNivelRelacaoHierarquicaUpper == null)
                    return;

                // garantir que a alteração occoreu entre duas entidades produtoras
                if (!(e.Row.NivelRowByNivelRelacaoHierarquica.IDTipoNivel == TipoNivel.ESTRUTURAL && (e.Row.NivelRowByNivelRelacaoHierarquicaUpper.IDTipoNivel == TipoNivel.LOGICO || e.Row.NivelRowByNivelRelacaoHierarquicaUpper.IDTipoNivel == TipoNivel.ESTRUTURAL)))
                    return;

                if (!topLevelControl.IsFirstMasterPanelInStack(mp) && topLevelControl.MasterPanelCount == 1)
                {
                    if (mp is INivelNavigatorProvider)
                    {
                        mp.lblFuncao.Text = "Estrutura orgânica";
                        var nav = mp as INivelNavigatorProvider;
                        nav.NivelNavigator.PanelToggleState = NivelNavigator.ToggleState.Estrutural;
                        nav.NivelNavigator.CollapseAllNodes();
                        nav.NivelNavigator.ToggleView(false);
                    }
                    else if (mp is IControloNivelListProvider)
                    {
                        var cnl = mp as IControloNivelListProvider;
                        cnl.ControloNivelList.CollapseAllNodes();
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.Assert(false, ex.ToString());
                Trace.WriteLine(ex);
                throw ex;
            }
        }
Ejemplo n.º 30
0
		protected void GenerateInventarioEntryChildren(Document doc, GISADataset.RelacaoHierarquicaRow rhRow, float CurrentIndentCm) {
			
			GISADataset.RelacaoHierarquicaRow[] childRhRows;
			try { {
				dataSet.EnforceConstraints = false;
				GisaDataSetHelper.GetNivelDataAdapter(string.Format("WHERE ID IN (SELECT ID FROM RelacaoHierarquica WHERE IDUpper={0})", rhRow.ID), null, null).Fill(dataSet.Nivel);
				GisaDataSetHelper.GetRelacaoHierarquicaDataAdapter(string.Format("WHERE IDUpper={0}", rhRow.ID), null, null).Fill(dataSet.RelacaoHierarquica);
				//PersistencyHelper.cleanDeletedRows()
				childRhRows = Nivel.GetChildren(dataSet, rhRow.NivelRowByNivelRelacaoHierarquica);
				if (childRhRows.Length == 0)
					return;// might not be correct. Was : Exit Sub
				DoAddedEntries(childRhRows.Length);
				GisaDataSetHelper.GetNivelDesignadoDataAdapter(string.Format("WHERE ID IN (SELECT ID FROM RelacaoHierarquica WHERE IDUpper={0})", rhRow.ID), null, null).Fill(dataSet.NivelDesignado);
				GisaDataSetHelper.GetControloAutDataAdapter(string.Format("WHERE ID IN (SELECT NivelControloAut.IDControloAut FROM RelacaoHierarquica inner join NivelControloAut ON RelacaoHierarquica.ID=NivelControloAut.ID WHERE IDUpper={0})", rhRow.ID), null, null).Fill(dataSet.ControloAut);
				GisaDataSetHelper.GetNivelControloAutDataAdapter(string.Format("WHERE ID IN (SELECT ID FROM RelacaoHierarquica WHERE IDUpper={0})", rhRow.ID), null, null).Fill(dataSet.NivelControloAut);
				GisaDataSetHelper.GetDicionarioDataAdapter(string.Format("WHERE ID IN (SELECT IDDicionario FROM ControloAutDicionario INNER JOIN NivelControloAut ON ControloAutDicionario.IDControloAut=NivelControloAut.IDControloAut INNER JOIN RelacaoHierarquica ON NivelControloAut.ID=RelacaoHierarquica.ID WHERE IDUpper={0})", rhRow.ID), null, null).Fill(dataSet.Dicionario);
				GisaDataSetHelper.GetControloAutDicionarioDataAdapter(string.Format("WHERE IDControloAut IN (SELECT IDControloAut FROM NivelControloAut INNER JOIN RelacaoHierarquica ON NivelControloAut.ID=RelacaoHierarquica.ID WHERE IDUpper={0})", rhRow.ID), null, null).Fill(dataSet.ControloAutDicionario);
					
				string query = string.Format("WHERE FRDBase.IDTipoFRDBase=3 AND FRDBase.IDNivel IN (SELECT ID FROM RelacaoHierarquica WHERE IDUpper={0})", rhRow.ID);
				GisaDataSetHelper.GetFRDBaseDataAdapter(query, null, null).Fill(dataSet.FRDBase);
				GisaDataSetHelper.GetSFRDDatasProducaoDataAdapter(string.Format("INNER JOIN FRDBase ON SFRDDatasProducao.IDFRDBase=FRDBase.ID {0}", query), null, null).Fill(dataSet.SFRDDatasProducao);
				GisaDataSetHelper.GetSFRDUFCotaDataAdapter(string.Format("INNER JOIN FRDBase ON SFRDUFCota.IDFRDBase=FRDBase.ID {0}", query), null, null).Fill(dataSet.SFRDUFCota);
				GisaDataSetHelper.GetSFRDConteudoEEstruturaDataAdapter(string.Format("INNER JOIN FRDBase ON SFRDConteudoEEstrutura.IDFRDBase=FRDBase.ID {0}", query), null, null).Fill(dataSet.SFRDConteudoEEstrutura);
				GisaDataSetHelper.GetSFRDCondicaoDeAcessoDataAdapter(string.Format("INNER JOIN FRDBase ON SFRDCondicaoDeAcesso.IDFRDBase=FRDBase.ID {0}", query), null, null).Fill(dataSet.SFRDCondicaoDeAcesso);
				GisaDataSetHelper.GetSFRDContextoDataAdapter(string.Format("INNER JOIN FRDBase ON SFRDContexto.IDFRDBase=FRDBase.ID {0}", query), null, null).Fill(dataSet.SFRDContexto);
				GisaDataSetHelper.GetControloAutDataAdapter(string.Format("INNER JOIN IndexFRDCA ON ControloAut.ID=IndexFRDCA.IDControloAut INNER JOIN FRDBase ON IDFRDBase=FRDBase.ID {0}", query), null, null).Fill(dataSet.ControloAut);
				GisaDataSetHelper.GetIndexFRDCADataAdapter(string.Format("INNER JOIN FRDBase ON IDFRDBase=FRDBase.ID {0}", query), null, null).Fill(dataSet.IndexFRDCA);
				GisaDataSetHelper.GetDicionarioDataAdapter(string.Format("WHERE ID IN (SELECT IDDicionario FROM ControloAutDicionario INNER JOIN IndexFRDCA ON ControloAutDicionario.IDControloAut=IndexFRDCA.IDControloAut INNER JOIN FRDBase ON IndexFRDCA.IDFRDBase=FRDBase.ID {0})", query), null, null).Fill(dataSet.Dicionario);
				GisaDataSetHelper.GetControloAutDicionarioDataAdapter(string.Format("WHERE IDControloAut IN (SELECT IDControloAut FROM IndexFRDCA INNER JOIN FRDBase ON IndexFRDCA.IDFRDBase=FRDBase.ID {0})", query), null, null).Fill(dataSet.ControloAutDicionario);
			}
			} 
			finally { {
				//PersistencyHelper.cleanDeletedRows()

				dataSet.EnforceConstraints = true;
			}
			}
			Array.Sort(childRhRows, new NivelSorter());
			foreach (GISADataset.RelacaoHierarquicaRow childn in childRhRows) {
				GenerateInventarioEntry(doc, childn, CurrentIndentCm + 0.5f);
			}
		}
Ejemplo n.º 31
0
		// Assume-se que anteriormente à criação do GisaPrincipal terá já de 
		// existir carregada a licença da aplicação
		public GisaPrincipal(GISADataset.TrusteeUserRow tuRow) : base(new GenericIdentity(tuRow.TrusteeRow.Name), new string[]{})
		{
			IDbConnection conn = GisaDataSetHelper.GetConnection();
			try
			{
				conn.Open();
				// Carregar os grupos a que este utilizador pertence
				TrusteeRule.Current.LoadGroups(GisaDataSetHelper.GetInstance(), tuRow.ID, conn);

				// Estabelecer qual é o utilizador actual. Ao faze-lo são automaticamente calculadas as suas permissões
				TrusteeUserOperator = tuRow;
				if (! TrusteeUserOperator.IsIDTrusteeUserDefaultAuthorityNull())
				{
					TrusteeUserAuthor = TrusteeUserOperator.TrusteeUserRowParent;
				}
			}
			finally
			{
				conn.Close();
			}
		}
Ejemplo n.º 32
0
 public static GISADataset.FRDBaseDataDeDescricaoRow CreateFRDBaseDataDeDescricaoRow(GISADataset.FRDBaseRow CurrentFRDBase, GISADataset.TrusteeUserRow tuOperator, GISADataset.TrusteeUserRow tuAuthor, DateTime data, long IDTipoNivelRelacionado, bool isImportacao)
 {
     GISADataset.FRDBaseDataDeDescricaoRow dddRow = null;
     dddRow = GisaDataSetHelper.GetInstance().FRDBaseDataDeDescricao.NewFRDBaseDataDeDescricaoRow();
     if (CurrentFRDBase.ID <= 0)
         throw new Exception(string.Format("Identificador negativo ({0}) no registo de frds!!", CurrentFRDBase.ID));
     dddRow.IDFRDBase = CurrentFRDBase.ID;
     dddRow.TrusteeUserRowByTrusteeUserFRDBaseDataDeDescricao = tuOperator;
     dddRow.TrusteeUserRowByTrusteeUserFRDBaseDataDeDescricaoAuthority = tuAuthor;
     dddRow.DataEdicao = GISA.Utils.GUIHelper.getTruncatedCurrentDate();
     if (data == DateTime.MinValue)
         dddRow["DataAutoria"] = DBNull.Value;
     else
         dddRow.DataAutoria = data;
     dddRow.IDTipoNivelRelacionado = IDTipoNivelRelacionado > 0 ? IDTipoNivelRelacionado : CurrentFRDBase.NivelRow.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica()[0].IDTipoNivelRelacionado;
     dddRow.Importacao = isImportacao;
     dddRow.Versao = new byte[] { };
     dddRow.isDeleted = 0;
     
     return dddRow;
 }
Ejemplo n.º 33
0
			public void Visit(GISADataset CurrentDataSet, GISADataset.NivelRow[] ContextNivel)
			{
				Assert.IsTrue(ContextNivel.Length > 0);

				if (ContextNivel.Length == 1)
				{
					Assert.AreEqual(1, Count);
					Assert.AreSame(r1, ContextNivel[0]);
				}
				else if (ContextNivel.Length == 2)
				{
					Assert.AreEqual(2, Count);
					Assert.AreSame(r2, ContextNivel[0]);
					Assert.AreSame(r1, ContextNivel[1]);
				}
				else
				{
					Assert.Fail();
				}
				Count = Count + 1;
			}
Ejemplo n.º 34
0
        public static string GetConteudoInformacional(GISADataset ds, GISADataset.NivelRow nivelUF)
        {
            var ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection());

            try
            {
                DBAbstractDataLayer.DataAccessRules.UFRule.Current.LoadUFConteudoEstruturaData(ds, nivelUF.GetFRDBaseRows()[0].ID, ho.Connection);
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
                throw;
            }
            finally
            {
                ho.Dispose();
            }

            var ce = nivelUF.GetFRDBaseRows()[0].GetSFRDConteudoEEstruturaRows().FirstOrDefault();

            return(ce != null ? ce.ConteudoInformacional : "");
        }
Ejemplo n.º 35
0
		public static void CreateDerivedColumn(GISADataset CurrentDataSet, string Target, string Source, string ColumnName, string RelationName)
		{
			if (CurrentDataSet == null)
				throw new ArgumentNullException("CurrentDataSet");

			if (! (CurrentDataSet.Tables.Contains(Target)))
				throw new ArgumentException("DataTable " + Target + " not found.");

			if (! (CurrentDataSet.Tables.Contains(Source)))
				throw new ArgumentException("DataTable " + Source + " not found.");

			if (! (CurrentDataSet.Tables[Source].Columns.Contains(ColumnName)))
				throw new ArgumentException("DataColumn " + Source + "." + ColumnName + " not found.");

			if (! (CurrentDataSet.Relations.Contains(RelationName)))
				throw new ArgumentException("DataRelation " + RelationName + " not found.");

			string TargetColumnName = Source + ColumnName;
			if (CurrentDataSet.Tables[Target].Columns.Contains(TargetColumnName))
				return;

			CurrentDataSet.Tables[Target].Columns.Add(new DataColumn(TargetColumnName, CurrentDataSet.Tables[Source].Columns[ColumnName].DataType, "Parent(" + RelationName + ")." + ColumnName));
		}
Ejemplo n.º 36
0
        public void LoadData(GISADataset.FRDBaseRow FRDBase, IDbConnection conn) {
            this.CurrentFRDBase = FRDBase;

            var nivelUpper = this.CurrentFRDBase.NivelRow.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica().Single().NivelRowByNivelRelacaoHierarquicaUpper;
            var frdUpper = nivelUpper.GetFRDBaseRows().Single();

            FRDRule.Current.LoadDadosLicencasDeObras(GisaDataSetHelper.GetInstance(), CurrentFRDBase.ID, conn);
            FRDRule.Current.LoadDadosLicencasDeObras(GisaDataSetHelper.GetInstance(), frdUpper.ID, conn);
            var modRows = GisaDataSetHelper.GetInstance().IndexFRDCA.Cast<GISADataset.IndexFRDCARow>().Where(r => r.RowState != DataRowState.Unchanged).ToList();
            if (modRows.Count == 0)
            {
                FRDRule.Current.LoadConteudoEEstrutura(GisaDataSetHelper.GetInstance(), CurrentFRDBase.ID, conn);
                FRDRule.Current.LoadConteudoEEstrutura(GisaDataSetHelper.GetInstance(), frdUpper.ID, conn);
            }

            var licenca = GisaDataSetHelper.GetInstance().LicencaObra.Cast<GISADataset.LicencaObraRow>().Where(r => r.IDFRDBase == CurrentFRDBase.ID).SingleOrDefault();

            var tipoTipLicencaObra = GisaDataSetHelper.GetInstance().TipoTipologias.Cast<GISADataset.TipoTipologiasRow>().Single(r => r.BuiltInName.Equals("PROCESSO_DE_OBRAS"));
            var caLicencaObra = GisaDataSetHelper.GetInstance().IndexFRDCA.Cast<GISADataset.IndexFRDCARow>()
                .Where(idx => idx.RowState != DataRowState.Deleted && idx.IDFRDBase == frdUpper.ID && idx["Selector"] != DBNull.Value && idx.Selector == -1)
                .Select(idx => idx.ControloAutRow).SingleOrDefault(ca => ca.IDTipoNoticiaAut == (long)TipoNoticiaAut.TipologiaInformacional && ca.TipoTipologiasRow == tipoTipLicencaObra);

            if (licenca == null && caLicencaObra != null)
            {
                licenca = GisaDataSetHelper.GetInstance().LicencaObra.NewLicencaObraRow();
                licenca.FRDBaseRow = CurrentFRDBase;
                licenca.TipoObra = string.Empty;
                licenca.PropriedadeHorizontal = false;
                licenca.PHTexto = string.Empty;
                licenca.Versao = new byte[] { };
                licenca.isDeleted = 0;
                GisaDataSetHelper.GetInstance().LicencaObra.AddLicencaObraRow(licenca);
            }

            CurrentLicencaObra = licenca;
        }
Ejemplo n.º 37
0
		//TODO: FUNCAO MANTIDA PARA COMPATIBILIDADE DE CODIGO EXISTENTE, DEVERÁ DESAPARECER, SER UNIFICADA COM A ASSINATURA SEGUINTE, OU SER REFORMULADA ASSIM QUE POSSIVEL
		public static GISADataset.RelacaoHierarquicaRow[] GetParents(GISADataset CurrentDataSet, GISADataset.NivelRow CurrentNivel)
		{

			IDbConnection conn = GisaDataSetHelper.GetConnection();
			try
			{
				conn.Open();
				NivelRule.Current.LoadNivelGrandparents(CurrentNivel.ID, GisaDataSetHelper.GetInstance(), conn);
			}
			finally
			{
				conn.Close();
			}

			GISADataset.RelacaoHierarquicaRow[] Parents = null;
			ArrayList Result = new ArrayList();

			Parents = CurrentNivel.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica();
			foreach (GISADataset.RelacaoHierarquicaRow rhRow in Parents)
			{
				Result.AddRange(rhRow.NivelRowByNivelRelacaoHierarquicaUpper.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica());
			}
			return (GISADataset.RelacaoHierarquicaRow[])(Result.ToArray(typeof(GISADataset.RelacaoHierarquicaRow)));
		}
Ejemplo n.º 38
0
        public static void RegisterRecordModificationFRD(GISADataset.FRDBaseRow CurrentFRDBase, bool existsModifiedDataFromRels, GISADataset.TrusteeUserRow tuOperator, GISADataset.TrusteeUserRow tuAuthor, DateTime data)
        {
            // só é registada uma nova entrada no controlo de descrição se alguma informação relativa à FRD 
            // tiver sido modificada; é também possível que já tenha sido registado uma nova entrada no controlo mas
            // nesse caso não se adiciona outra
            if (CurrentFRDBase == null || CurrentFRDBase.RowState == DataRowState.Detached ||
                GisaDataSetHelper.GetInstance().FRDBaseDataDeDescricao.Select("IDFRDBase=" + CurrentFRDBase.ID.ToString(), "", DataViewRowState.Added).Length > 0)

                return;

            GISADataset.NivelUnidadeFisicaRow[] NivelUnidadeFisicaRows = new GISADataset.NivelUnidadeFisicaRow[] {};
            if (CurrentFRDBase.NivelRow.IDTipoNivel == TipoNivel.OUTRO) 
                NivelUnidadeFisicaRows = CurrentFRDBase.NivelRow.GetNivelDesignadoRows()[0].GetNivelUnidadeFisicaRows();

            if (existsModifiedDataFromRels ||
                CurrentFRDBase.RowState != DataRowState.Unchanged ||
                Concorrencia.WasRecordModified(CurrentFRDBase) ||
                Concorrencia.WasRecordModified(CurrentFRDBase.NivelRow) ||
                (NivelUnidadeFisicaRows.Length > 0 && Concorrencia.isModifiedRow(NivelUnidadeFisicaRows[0])))
            {
                var dddRow = CreateFRDBaseDataDeDescricaoRow(CurrentFRDBase, tuOperator, tuAuthor, data);
                GisaDataSetHelper.GetInstance().FRDBaseDataDeDescricao.AddFRDBaseDataDeDescricaoRow(dddRow);
            }
        }
Ejemplo n.º 39
0
        public static GISADataset.NivelRow CreateUF(GISADataset.NivelRow nivelED, string designacaoUF, string guiaUF)
        {
            GISADataset.TipoNivelRelacionadoRow tnrRow = (GISADataset.TipoNivelRelacionadoRow)(GisaDataSetHelper.GetInstance().TipoNivelRelacionado.Select(string.Format("ID={0}", TipoNivelRelacionado.UF))[0]);

            GISADataset.NivelRow              nufRow   = null;
            GISADataset.NivelDesignadoRow     ndufRow  = null;
            GISADataset.RelacaoHierarquicaRow rhufRow  = null;
            GISADataset.NivelUnidadeFisicaRow nufufRow = null;
            GISADataset.FRDBaseRow            frdufRow = null;

            // nivel
            nufRow = GisaDataSetHelper.GetInstance().Nivel.NewNivelRow();
            // nivelDesignado
            ndufRow = GisaDataSetHelper.GetInstance().NivelDesignado.NewNivelDesignadoRow();
            // RelacaoHierarquica
            rhufRow = GisaDataSetHelper.GetInstance().RelacaoHierarquica.NewRelacaoHierarquicaRow();
            // NivelUnidadeFisicaRow
            nufufRow = GisaDataSetHelper.GetInstance().NivelUnidadeFisica.NewNivelUnidadeFisicaRow();
            // FRDBaseRow
            frdufRow = GisaDataSetHelper.GetInstance().FRDBase.NewFRDBaseRow();

            GISADataset tempWith1 = GisaDataSetHelper.GetInstance();

            Trace.WriteLine("A criar unidade física...");
            nufRow.TipoNivelRow = tnrRow.TipoNivelRow;
            nufRow.Codigo       = UnidadesFisicasHelper.GenerateNewCodigoString(nivelED, System.DateTime.Now.Year);
            nufRow.CatCode      = "NVL";

            ndufRow.NivelRow   = nufRow;
            ndufRow.Designacao = designacaoUF;
            //CreateUF_edID = nivelED.ID;
            //CreateUF_designacao = designacaoUF;
            //CreateUF_guia = guiaUF;

            rhufRow.NivelRowByNivelRelacaoHierarquica = nufRow;
            rhufRow.TipoNivelRelacionadoRow           = (GISADataset.TipoNivelRelacionadoRow)(GisaDataSetHelper.GetInstance().TipoNivelRelacionado.Select(string.Format("ID={0}", TipoNivelRelacionado.UF))[0]);
            rhufRow["InicioAno"] = DBNull.Value;
            rhufRow["InicioMes"] = DBNull.Value;
            rhufRow["InicioDia"] = DBNull.Value;
            rhufRow["FimAno"]    = DBNull.Value;
            rhufRow["FimMes"]    = DBNull.Value;
            rhufRow["FimDia"]    = DBNull.Value;
            rhufRow.NivelRowByNivelRelacaoHierarquicaUpper = nivelED;

            nufufRow.GuiaIncorporacao  = guiaUF;
            nufufRow.NivelDesignadoRow = ndufRow;

            frdufRow.NivelRow           = nufRow;
            frdufRow.NotaDoArquivista   = string.Empty;
            frdufRow.TipoFRDBaseRow     = (GISADataset.TipoFRDBaseRow)(GisaDataSetHelper.GetInstance().TipoFRDBase.Select(string.Format("ID={0}", System.Enum.Format(typeof(TipoFRDBase), TipoFRDBase.FRDUnidadeFisica, "D")))[0]);
            frdufRow.RegrasOuConvencoes = string.Empty;

            tempWith1.Nivel.AddNivelRow(nufRow);
            tempWith1.NivelDesignado.AddNivelDesignadoRow(ndufRow);
            tempWith1.RelacaoHierarquica.AddRelacaoHierarquicaRow(rhufRow);
            tempWith1.NivelUnidadeFisica.AddNivelUnidadeFisicaRow(nufufRow);
            tempWith1.FRDBase.AddFRDBaseRow(frdufRow);

            var sfrdDatasProducaoRow = GisaDataSetHelper.GetInstance().SFRDDatasProducao.Cast <GISADataset.SFRDDatasProducaoRow>().Where(r => r.IDFRDBase == frdufRow.ID).SingleOrDefault();

            if (sfrdDatasProducaoRow == null)
            {
                GisaDataSetHelper.GetInstance().SFRDDatasProducao.AddSFRDDatasProducaoRow(frdufRow, "", "", "", "", false, "", "", "", "", false, new byte[] { }, 0);
            }

            return(nufRow);
        }
Ejemplo n.º 40
0
		private void DisplayEntidadeProdutora(GISADataset.ControloAutDicionarioRow ControloAutDicionario)
		{
			if (ControloAutDicionario.IDTipoControloAutForma == Convert.ToInt64(TipoControloAutForma.FormaAutorizada))
			{
                ListViewItem tempWith1 = lstVwIndexacao.Items.Add(ControloAutDicionario.DicionarioRow.Termo);
				tempWith1.SubItems.Add(ControloAutDicionario.ControloAutRow. TipoNoticiaAutRow.Designacao.ToString());
				tempWith1.SubItems.Add(TranslationHelper.FormatBoolean(ControloAutDicionario.ControloAutRow.Autorizado));
				tempWith1.SubItems.Add(TranslationHelper.FormatBoolean(ControloAutDicionario.ControloAutRow.Completo));
				tempWith1.Tag = TempIndexFRDCA;
			}
		}
Ejemplo n.º 41
0
		private void FilterControloAut(GISADataset.IndexFRDCARow IndexFRDCA)
		{
			if (IndexFRDCA.ControloAutRow.IDTipoNoticiaAut == Convert.ToInt64(TipoNoticiaAut.Ideografico) || IndexFRDCA.ControloAutRow.IDTipoNoticiaAut == Convert.ToInt64(TipoNoticiaAut.Onomastico) || IndexFRDCA.ControloAutRow.IDTipoNoticiaAut == Convert.ToInt64(TipoNoticiaAut.ToponimicoGeografico) )
			{
				TempIndexFRDCA = IndexFRDCA;
				GisaDataSetHelper.VisitControloAutDicionario(IndexFRDCA.ControloAutRow, DisplayEntidadeProdutora);
			}
		}
Ejemplo n.º 42
0
		private GISADataset.SFRDUnidadeFisicaRow AssociaNivel(GISADataset.NivelRow nRow)
		{
			GISADataset.SFRDUnidadeFisicaRow frdufRow = null;
			frdufRow = GisaDataSetHelper.GetInstance().SFRDUnidadeFisica.NewSFRDUnidadeFisicaRow();
			frdufRow.FRDBaseRow = nRow.GetFRDBaseRows()[0];
			frdufRow.NivelRow = CurrentNivel;
			GisaDataSetHelper.GetInstance().SFRDUnidadeFisica.AddSFRDUnidadeFisicaRow(frdufRow);
			return frdufRow;
		}
Ejemplo n.º 43
0
		public static GISADataset.RelacaoHierarquicaRow[] GetSelf(GISADataset CurrentDataSet, GISADataset.NivelRow CurrentNivel)
		{
			//TODO: chamar método que faz os fill: fillSelf(CurrentDataSet, CurrentNivel.ID, conn, tran)

			return CurrentNivel.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica();
		}
Ejemplo n.º 44
0
			protected override GISADataset.RelacaoHierarquicaRow[] GetNextNivelRows(GISADataset CurrentDataSet, GISADataset.NivelRow CurrentNivel)
			{
				return Nivel.GetChildren(CurrentDataSet, CurrentNivel);
			}
Ejemplo n.º 45
0
 public void TearDown()
 {
     ds = null;
 }
Ejemplo n.º 46
0
 public void SetUp()
 {
     ds = GisaDataSetHelper.GetInstance();
 }
Ejemplo n.º 47
0
		public static void VisitChildChains(GISADataset CurrentDataSet, GISADataset.NivelRow CurrentNivel, INivelChainVisitor CurrentVisitor)
		{
			// TODO Visit the graph downwards, Width-First.
			new WidthFirstVisitorChildren().Run(CurrentDataSet, CurrentNivel, CurrentVisitor);
		}
Ejemplo n.º 48
0
		private void btnAccept_Click(object sender, System.EventArgs e)
		{

			// A 1ª instancia demora sempre mais tempo, é necessário carregar uma série de dados
			this.Cursor = Cursors.WaitCursor;
			GISADataset ds = GisaDataSetHelper.GetInstance();
			this.Cursor = Cursors.Arrow;

			if (ds == null)
			{
				MessageBox.Show("A base de dados não se encontra disponível, por favor " + Environment.NewLine + "contacte o administrador de sistema.", "Acesso à base de dados", MessageBoxButtons.OK, MessageBoxIcon.Error);
				return;
			}

			frmMain main = null;
			try
			{
				string username = txtUser.Text.Replace("'", "''");
				string assemblyVersion = null;

                string modules = string.Empty;
                foreach(GISADataset.ModulesRow mRow in SessionHelper.AppConfiguration.GetCurrentAppconfiguration().Modules)
                {
                    modules += mRow.ID + ",";
                }
                modules = modules.TrimEnd(',');

                assemblyVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().FullName;
                
                // Validar utilizador
                TrusteeRule.IndexErrorMessages messageIndex = TrusteeRule.IndexErrorMessages.InvalidUser;

                // Carregar o utilizador 
				GISADataset.TrusteeUserRow tuRow = null;
				tuRow = LoadCurrentOperator(username);

                // LDAP Authentication
                string ldapServerName = SessionHelper.AppConfiguration.GetCurrentAppconfiguration().LDAPServerName;
                string ldapSettings = SessionHelper.AppConfiguration.GetCurrentAppconfiguration().LDAPServerSettings;

                if (ldapServerName != null && tuRow != null && tuRow.IsLDAPUser)
                {
                    LDAPHandler ldapH = new LDAPHandler(ldapServerName, ldapSettings, username, txtPassword.Text);
                    ldapH.ConnectToLDAP();

                    if (ldapH.IsLoggedIn)
                    {
                        messageIndex = 0;                        
                    }
                    else
                    {
                        messageIndex = TrusteeRule.IndexErrorMessages.InvalidUser;
                    }
                 
                }
                else
                {
                    messageIndex = Trustee.validateUser(username, CryptographyHelper.GetMD5(txtPassword.Text));
                }
				
				//verificar se ocorreu algum erro no processo de login
				if (messageIndex != 0)
				{
                    GUIHelper.GUIHelper.MessageBoxLoginErrorMessages(Convert.ToInt32(messageIndex));
					throw new LoginException();
				}
				
                // Adicionar o GisaPrincipal
                System.Threading.Thread.CurrentPrincipal = new GisaPrincipal(tuRow);
                                 
                if (SessionHelper.GetGisaPrincipal().TrusteePrivileges.Rows.Count == 0)
                {
                    GUIHelper.GUIHelper.MessageBoxLoginErrorMessages(Convert.ToInt32(DBAbstractDataLayer.DataAccessRules.TrusteeRule.IndexErrorMessages.UserWithoutPermissions));
                    throw new LoginException();
                }
                

				main = new frmMain(username);
			}
			catch (LoginException)
			{
				return;
			}
			catch (Exception ex)
			{
				Trace.WriteLine(ex);
				MessageBox.Show("Ocorreu um erro durante o processo de início da sessão, " + Environment.NewLine + "por favor contacte o administrador de sistema.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
				return;
			}
			this.Hide();
			main.ShowDialog();
			this.Close();
		}
Ejemplo n.º 49
0
        // Devolve os TipoNivelRalacionados possíveis de ralacionar com o TipoNivelRalacionado especificado
        public static GISADataset.TipoNivelRelacionadoRow[] GetSubTipoNivelRelacionado(GISADataset CurrentDataSet, GISADataset.TipoNivelRelacionadoRow CurrentRow)
        {
            GISADataset.RelacaoTipoNivelRelacionadoRow[] rtnrRow = CurrentRow.GetRelacaoTipoNivelRelacionadoRowsByTipoNivelRelacionadoRelacaoTipoNivelRelacionadoUpper();
            GISADataset.TipoNivelRelacionadoRow[]        Result  = null;

            Result = new GISADataset.TipoNivelRelacionadoRow[rtnrRow.Length + 1];
            int i = 0;

            Result[i] = CurrentRow;
            i         = i + 1;

            foreach (GISADataset.RelacaoTipoNivelRelacionadoRow r in rtnrRow)
            {
                Result[i] = r.TipoNivelRelacionadoRowByTipoNivelRelacionadoRelacaoTipoNivelRelacionado;
                i         = i + 1;
            }
            return(Result);
        }
Ejemplo n.º 50
0
 public static GISADataset.TipoNivelRelacionadoRow[] GetTipoNivelRelacionadoInicial(GISADataset CurrentDataSet)
 {
     DataRow[] dr = TipoNivelRule.Current.SelectTipoNivel(CurrentDataSet);
     GISADataset.TipoNivelRelacionadoRow[] tnrRows = null;
     // For some reason, Select(String) creates DataRow instead of using existing TipoNivelRow
     tnrRows = (GISADataset.TipoNivelRelacionadoRow[])(System.Array.CreateInstance(typeof(GISADataset.TipoNivelRelacionadoRow), dr.Length));
     System.Array.Copy(dr, tnrRows, dr.Length);
     return(tnrRows);
 }
Ejemplo n.º 51
0
        private ObjetoDigitalFedoraHelper.Contexto IdentifyViewMode(GISADataset.NivelRow nRow)
        {
            if (nRow.IDTipoNivel != (long)TipoNivel.DOCUMENTAL) return ObjetoDigitalFedoraHelper.Contexto.nenhum;

            var rhRow = currentNivel.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica().First();

            return rhRow.IDTipoNivelRelacionado == TipoNivelRelacionado.SD ? ObjetoDigitalFedoraHelper.Contexto.imagens : ObjetoDigitalFedoraHelper.Contexto.objetosDigitais;
        }
Ejemplo n.º 52
0
        private void ViewToModelObjsSimples(List<ObjDigSimples> odsSimples, ObjDigComposto odComp, GISADataset.ObjetoDigitalRow odRowComp)
        {
            odsSimples.ForEach(odSimples =>
            {
                var odRow = default(GISADataset.ObjetoDigitalRow);
                switch (odSimples.state)
                {
                    case State.added:
                        if (odComp != null && odComp.state != State.deleted)
                            CreateDatabaseObjDigSimples(odComp, odRowComp, odSimples);
                        else
                            CreateDatabaseObjDigSimplesSolto(odSimples);
                        break;
                    case State.modified:
                        odRow = GisaDataSetHelper.GetInstance().ObjetoDigital.Cast<GISADataset.ObjetoDigitalRow>().Single(r => r.RowState != DataRowState.Deleted && r.pid.Equals(odSimples.pid));
                        odRow.Titulo = odSimples.titulo;
                        odRow.Publicado = odSimples.publicado;
                        odRow.GUIOrder = odSimples.guiorder;

                        UpdateNvlDocSimplesOrderNr(odSimples);

                        if (odComp != null)
                            AddOrRemoveODRelations(odComp, odSimples, odRow);
                        break;
                    case State.deleted:
                        odRow = GisaDataSetHelper.GetInstance().ObjetoDigital.Cast<GISADataset.ObjetoDigitalRow>().Single(r => r.RowState != DataRowState.Deleted && r.pid.Equals(odSimples.pid));
                        FedoraHelper.DeleteObjDigitalRows(odRow);
                        break;
                    case State.unchanged: // apanhar o caso de a ordem do OD Simples ter mudado
                        odRow = GisaDataSetHelper.GetInstance().ObjetoDigital.Cast<GISADataset.ObjetoDigitalRow>().Single(r => r.RowState != DataRowState.Deleted && r.pid.Equals(odSimples.pid));
                        odRow.GUIOrder = odSimples.guiorder;

                        UpdateNvlDocSimplesOrderNr(odSimples);

                        if (odComp != null)
                            AddOrRemoveODRelations(odComp, odSimples, odRow);
                        break;
                }
            });

            // atualizar a tipologia e assuntos dos objetos simples
            // - se houver um objeto composto, nenhum dos seus simples não pode ter tipologia e assuntos definidos
            // - se não houver um objeto composto:
            //   * se o nro de objetos simples for um, então esse objeto simples pode ter tipologia e assuntos definidos
            //   * se o nro de objetos simples for maior que um, então nenhum desses objetos pode ter tipologia e assuntos definidos
            if (odComp == null || odComp.state == State.deleted)
            {
                var ods = odsSimples.Where(od => od.state != State.deleted);
                if (ods.Count() == 1)
                {
                    var odSimples = ods.Single();
                    var frdRow = currentNivel.GetFRDBaseRows().Single();
                    var idxTip = frdRow.GetIndexFRDCARows().SingleOrDefault(idx => idx["Selector"] != DBNull.Value && idx.Selector == -1);
                    if (idxTip != null)
                        odSimples.tipologia = idxTip.ControloAutRow.GetControloAutDicionarioRows().Single(cad => cad.IDTipoControloAutForma == (long)TipoControloAutForma.FormaAutorizada).DicionarioRow.Termo;

                    var assuntos = frdRow.GetIndexFRDCARows().Where(idx => idx.ControloAutRow.IDTipoNoticiaAut < 4).SelectMany(idx => idx.ControloAutRow.GetControloAutDicionarioRows()).Where(cad => cad.IDTipoControloAutForma == (long)TipoControloAutForma.FormaAutorizada).Select(cad => cad.DicionarioRow.Termo);
                    if (assuntos.Count() > 0)
                        odSimples.assuntos = assuntos.ToList();
                }
                else
                {
                    odsSimples.Where(od => od.state != State.deleted).ToList().ForEach(od =>
                    {
                        od.tipologia = "";
                        od.assuntos.Clear();
                        if (od.state == State.unchanged)
                            od.state = State.modified;
                    });
                }
            }
            else
            {
                odsSimples.Where(od => od.state != State.deleted).ToList().ForEach(od =>
                {
                    od.tipologia = "";
                    od.assuntos.Clear();
                    if (od.state == State.unchanged)
                        od.state = State.modified;
                });
            }
        }
Ejemplo n.º 53
0
			protected abstract GISADataset.RelacaoHierarquicaRow[] GetNextNivelRows(GISADataset CurrentDataSet, GISADataset.NivelRow CurrentNivel);
Ejemplo n.º 54
0
        public override void LoadData()
        {
            try
            {
                ((frmMain)TopLevelControl).EnterWaitMode();
                GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection());
                try
                {
                    GisaDataSetHelper.ManageDatasetConstraints(false);

                    if (!isLoaded)
                    {
                        if (CurrentContext.NivelUnidadeFisica == null)
                        {
                            CurrentFRDBase = null;
                            return;
                        }

                        // Recarregar a uf actual e guardar um contexto localmente
                        FRDRule.Current.LoadFRDUnidadeFisicaData(GisaDataSetHelper.GetInstance(), CurrentContext.NivelUnidadeFisica.ID, System.Enum.Format(typeof(TipoFRDBase), TipoFRDBase.FRDUnidadeFisica, "D"), ho.Connection);


                        string QueryFilter = "IDNivel=" + CurrentContext.NivelUnidadeFisica.ID.ToString() + " AND IDTipoFRDBase=" + System.Enum.Format(typeof(TipoFRDBase), TipoFRDBase.FRDUnidadeFisica, "D");


                        //TODO: INSTANT C# TODO TASK: The return type of the tempWith1 variable must be corrected.

                        GISADataset tempWith1 = GisaDataSetHelper.GetInstance();
                        try
                        {
                            CurrentFRDBase = (GISADataset.FRDBaseRow)(tempWith1.FRDBase.Select(QueryFilter)[0]);
                        }
                        catch (IndexOutOfRangeException)
                        {
                            CurrentFRDBase = tempWith1.FRDBase.AddFRDBaseRow(CurrentContext.NivelUnidadeFisica, (GISADataset.TipoFRDBaseRow)(tempWith1.TipoFRDBase.Select("ID=" + System.Enum.Format(typeof(TipoFRDBase), TipoFRDBase.FRDUnidadeFisica, "D"))[0]), "", "", new byte[] {}, 0);
                        }

                        //---

                        if (CurrentFRDBase == null || CurrentFRDBase.RowState == DataRowState.Detached || CurrentContext.NivelUnidadeFisica == null || CurrentContext.NivelUnidadeFisica.RowState == DataRowState.Detached)
                        {
                            return;
                        }
                        isLoaded = true;
                    }
                    GisaDataSetHelper.ManageDatasetConstraints(false);
                    GISAPanel selectedPanel = (GISAPanel)this.DropDownTreeView1.SelectedNode.Tag;
                    if (!selectedPanel.IsLoaded)
                    {
                        long startTicks = 0;
                        startTicks = DateTime.Now.Ticks;
                        selectedPanel.LoadData(CurrentFRDBase, ho.Connection);
                        Debug.WriteLine("Time dispend loading " + selectedPanel.ToString() + ": " + new TimeSpan(DateTime.Now.Ticks - startTicks).ToString());
                    }
                    GisaDataSetHelper.ManageDatasetConstraints(true);
                }
                catch (System.Data.ConstraintException Ex)
                {
                    Trace.WriteLine(Ex);
                    GisaDataSetHelper.FixDataSet(GisaDataSetHelper.GetInstance(), ho.Connection);
                }
                finally
                {
                    ho.Dispose();
                }
            }
            finally
            {
                ((frmMain)TopLevelControl).LeaveWaitMode();
            }
        }
Ejemplo n.º 55
0
		private void AddDetalhe(GISADataset.NivelRow nRow, string nCod)
		{
			if (detalhes[nRow.ID] == null)
			{
				ArrayList aux = new ArrayList();
				GISADataset.SFRDDatasProducaoRow sfrddprow = null;
				string ia = null;
				string im = null;
				string id = null;
				string fa = null;
				string fm = null;
				string fd = null;

				if (nRow.GetFRDBaseRows()[0].GetSFRDDatasProducaoRows().Length > 0)
				{
					sfrddprow = (GISADataset.SFRDDatasProducaoRow)(nRow.GetFRDBaseRows()[0].GetSFRDDatasProducaoRows()[0]);

					if (sfrddprow.IsInicioAnoNull())
						ia = "";
					else
						ia = sfrddprow.InicioAno;

					if (sfrddprow.IsInicioMesNull())
						im = "";
					else
						im = sfrddprow.InicioMes;

					if (sfrddprow.IsInicioDiaNull())
						id = "";
					else
						id = sfrddprow.InicioDia;

					if (sfrddprow.IsFimAnoNull())
						fa = "";
					else
						fa = sfrddprow.FimAno;

					if (sfrddprow.IsFimMesNull())
						fm = "";
					else
						fm = sfrddprow.FimMes;

					if (sfrddprow.IsFimDiaNull())
						fd = "";
					else
						fd = sfrddprow.FimDia;
				}
				else
				{
					ia = "";
					im = "";
					id = "";
					fa = "";
					fm = "";
					fd = "";
				}

                GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection());
                try
                {
                    if (nRow.IDTipoNivel == 3)
                        aux.Add(nRow.GetNivelDesignadoRows()[0].Designacao);
                    else
                    {
                        DBAbstractDataLayer.DataAccessRules.NivelRule.Current.FillNivelControloAutRows(GisaDataSetHelper.GetInstance(), nRow.ID, ho.Connection);
                        
                        if (nRow.GetNivelControloAutRows().Length > 0)
                            aux.Add(nRow.GetNivelControloAutRows()[0].ControloAutRow.GetControloAutDicionarioRows()[0].DicionarioRow.Termo);
                        else if (nRow.GetNivelDesignadoRows().Length > 0)
                            aux.Add(nRow.GetNivelDesignadoRows()[0].Designacao);
                    }

                    aux.Add(nRow.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica()[0].TipoNivelRelacionadoRow.ID);
                    aux.Add(ia);
                    aux.Add(im);
                    aux.Add(id);
                    aux.Add(fa);
                    aux.Add(fm);
                    aux.Add(fd);
                    aux.Add(nCod);
                    aux.Add("1"); // Se aparece aqui é porque temos permissao...

                    if (MovimentoRule.Current.estaRequisitado(nRow.ID, ho.Connection))
                        aux.Add(true);
                    else
                        aux.Add(false);
                }
                catch (Exception ex)
                {
                    Trace.WriteLine(ex);
                    throw;
                }
                finally
                {
                    ho.Dispose();
                }

				detalhes.Add(nRow.ID, aux);
			}
		}