public override void UpdateToolBarButtons(ListViewItem item) { if (this.nivelNavigator1.PanelToggleState == NivelNavigator.ToggleState.Estrutural) { //vista estrutural GISADataset.NivelRow nRow = null; GISADataset.TipoNivelRelacionadoRow tnrRow = null; if (this.nivelNavigator1.EPFilterMode) // modo filtro { if (item != null && item.ListView != null && !(((GISADataset.NivelRow)item.Tag).RowState == DataRowState.Detached)) { //contexto da listview nRow = (GISADataset.NivelRow)item.Tag; } if (nRow != null && !(nRow.RowState == DataRowState.Detached)) { tnrRow = TipoNivelRelacionado.GetTipoNivelRelacionadoFromRelacaoHierarquica(nRow.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica().FirstOrDefault()); } } this.ToolBarButtonToggleEstruturaSeries.Enabled = this.nivelNavigator1.isTogglable(nRow, tnrRow) && PermissoesHelper.AllowExpand; } else { this.ToolBarButtonToggleEstruturaSeries.Enabled = true; } SetButtonFiltroState(); }
private void LoadNivelRoot(TreeView trvw) { long startTicks = DateTime.Now.Ticks; GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection()); try { long[] edIDs = DBAbstractDataLayer.DataAccessRules.NivelRule.Current.LoadEntidadesDetentoras(GisaDataSetHelper.GetInstance(), ho.Connection); trvw.Nodes.Clear(); GISADataset.NivelRow nRow = null; GISADataset.TipoNivelRelacionadoRow tnrRow = null; foreach (long edID in edIDs) { nRow = (GISADataset.NivelRow)(GisaDataSetHelper.GetInstance().Nivel.Select("ID=" + edID.ToString())[0]); tnrRow = (GISADataset.TipoNivelRelacionadoRow)(GisaDataSetHelper.GetInstance().TipoNivelRelacionado.Select(string.Format("ID={0}", TipoNivelRelacionado.ED))[0]); AddNivelDesignado(trvw.Nodes, nRow, null, tnrRow, ho.Connection); } } catch (Exception ex) { Trace.WriteLine(ex); throw; } finally { ho.Dispose(); } Debug.WriteLine("<<LoadNivelRoot>>: " + new TimeSpan(DateTime.Now.Ticks - startTicks).ToString()); }
protected virtual void updateContextStatusBar(GISATreeNode node) { if (!(MasterPanel.isContextPanel(this))) { return; } if (node == null || node.NivelRow.RowState == DataRowState.Detached) { ((frmMain)TopLevelControl).StatusBarPanelHint.Text = string.Empty; } else { GISADataset.RelacaoHierarquicaRow rhRow = ((GISATreeNode)node).RelacaoHierarquicaRow; GISADataset.TipoNivelRelacionadoRow tnrRow = TipoNivelRelacionado.GetTipoNivelRelacionadoFromRelacaoHierarquica(rhRow); ArrayList pathEstrut = ControloNivelList.GetCodigoCompletoCaminhoUnico(node); if (pathEstrut.Count == 0) { ((frmMain)TopLevelControl).StatusBarPanelHint.Text = string.Format(" {0}: {1}", tnrRow.Designacao, node.NivelRow.Codigo); } else { ((frmMain)TopLevelControl).StatusBarPanelHint.Text = string.Format(" {0}: {1}", tnrRow.Designacao, Nivel.buildPath(pathEstrut)); } } }
private void ToolBarButtonCreateMenuItemClick(object sender, EventArgs e) { ((frmMain)TopLevelControl).EnterWaitMode(); GISADataset.TipoNivelRelacionadoRow tnrRow = ((TipoNivelMenuItem)sender).Row; var nivelRow = GisaDataSetHelper.GetInstance().Nivel.Cast <GISADataset.NivelRow>().Single(r => r.ID == this.nivelNavigator1.ContextBreadCrumbsPathID); var frm = new FormNivelDocumentalFedora(); frm.IDTipoNivelRelacionado = tnrRow.ID; // necessário para validação do código parcial bool successfulSave = handleNewNivel(frm, nivelRow, tnrRow); ((frmMain)TopLevelControl).LeaveWaitMode(); // O UpdateToolBarButtons não é executado quando é adicionado um novo nível documental pois // esta operação já é feita durante a inserção do nó (caso essa inserção não aconteça por // motivos de conflito de concorrência o método pode ser executado de forma a impedir o // acesso de opções ao utilizador que poderiam levar a um crash da aplicação). Executar o // UpdateToolBarButtons neste ponto para a situação acima mencionada vai alterar // erradamente o estado dos botões if ((this.nivelNavigator1.PanelToggleState == NivelNavigator.ToggleState.Estrutural && successfulSave) || (this.nivelNavigator1.PanelToggleState == NivelNavigator.ToggleState.Documental && !successfulSave)) { if (this.nivelNavigator1.SelectedItems.Count > 0) { UpdateToolBarButtons(this.nivelNavigator1.SelectedItems[0]); } else { UpdateToolBarButtons(); } } }
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); } } } }
public bool isTogglable(GISADataset.NivelRow nivelRow, GISADataset.TipoNivelRelacionadoRow tnrRow) { if (this.nivelDocumentalListNavigator1.Visible) { return(true); } if (nivelRow == null && tnrRow == null) { SeleccaoActual(out nivelRow, out tnrRow); if (nivelRow == null || nivelRow.IDTipoNivel == TipoNivel.LOGICO) { return(false); } } bool result = false; // Determinar se existe pelo menos 1 nível documental // pendurado no nível selecionado foreach (GISADataset.RelacaoHierarquicaRow rhRow in GisaDataSetHelper.GetInstance().RelacaoHierarquica.Select(string.Format("IDUpper={0}", nivelRow.ID))) { if (rhRow.NivelRowByNivelRelacaoHierarquica.TipoNivelRow.IsDocument) { result = true; break; } } // No caso de não existirem níveis documentais pendurados no // nível selecionado verificamos se é possível faze-lo. Caso // seja podemos da mesma forma passar à vista documental onde // poderemos criar novos níveis. if (!result) { if (TipoNivelRelacionado.GetSubTipoNivelRelacionado(GisaDataSetHelper.GetInstance(), tnrRow).Length == 0) { return(result); } foreach (GISADataset.TipoNivelRelacionadoRow subtnrRow in TipoNivelRelacionado.GetSubTipoNivelRelacionado(GisaDataSetHelper.GetInstance(), tnrRow)) { if (subtnrRow.TipoNivelRow.IsDocument) { result = true; break; } } } return(result); }
// 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); }
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); }
private static void AddMenuOption(Menu.MenuItemCollection CurrentMenu, GISADataset.TipoNivelRelacionadoRow existingRow, GISADataset.TipoNivelRelacionadoRow newRow, EventHandler CurrentHandler, ImageList ImgList) { // If this nivel allows infinite recursivity *OR* // allows at least one more recursivity level for this type of nivel if (!existingRow.IsRecursivoNull() && existingRow.Recursivo == 0 && existingRow.ID == newRow.ID) { return; } PXMenuItem pxmi = new TipoNivelMenuItem("Criar " + newRow.Designacao, newRow, ImgList); MenuItem mi = (MenuItem)pxmi; if (CurrentHandler != null) { mi.Click += CurrentHandler; } CurrentMenu.Add(mi); }
private string GetCodigoCompleto(object element) { MasterPanelPermissoesPlanoClassificacao mpPPC = (MasterPanelPermissoesPlanoClassificacao)(((frmMain)this.TopLevelControl).MasterPanel); string nCod = null; if (element is GISATreeNode) { GISATreeNode node = (GISATreeNode)element; ArrayList pathEstrut = ControloNivelList.GetCodigoCompletoCaminhoUnico(node); if (pathEstrut.Count == 0) { nCod = node.NivelRow.Codigo; } else { nCod = Nivel.buildPath(pathEstrut); } } else if (element is ListViewItem) { ListViewItem item = (ListViewItem)element; GISADataset.RelacaoHierarquicaRow rhRow = (GISADataset.RelacaoHierarquicaRow)(GisaDataSetHelper.GetInstance().RelacaoHierarquica.Select(string.Format("ID={0} AND IDUpper={1}", ((GISADataset.NivelRow)item.Tag).ID, mpPPC.nivelNavigator1.ContextBreadCrumbsPathID))[0]); GISADataset.TipoNivelRelacionadoRow tnrRow = TipoNivelRelacionado.GetTipoNivelRelacionadoFromRelacaoHierarquica(rhRow); ArrayList pathEstrut = ControloNivelList.GetCodigoCompletoCaminhoUnico(mpPPC.nivelNavigator1.SelectedNode); ArrayList pathDoc = mpPPC.nivelNavigator1.GetCodigoCompletoCaminhoUnico(item); if (pathDoc.Count == 0 && pathEstrut.Count == 0) { nCod = tnrRow.Designacao; } else { nCod = string.Format("{0}/{1}", Nivel.buildPath(pathEstrut), Nivel.buildPath(pathDoc)); } } return(nCod); }
private ListViewItem PopulateAssociacao(GISADataset.SFRDUnidadeFisicaRow sfrdufRow) { GISADataset.NivelRow nRow = null; GISADataset.TipoNivelRow tnRow = null; GISADataset.TipoNivelRelacionadoRow tnrRow = null; nRow = sfrdufRow.FRDBaseRow.NivelRow; tnRow = nRow.TipoNivelRow; tnrRow = (GISADataset.TipoNivelRelacionadoRow)(GisaDataSetHelper.GetInstance().TipoNivelRelacionado.Select(string.Format("ID = {0}", System.Convert.ToString(((ArrayList)(detalhes[sfrdufRow.FRDBaseRow.IDNivel]))[1])))[0]); ListViewItem item = new ListViewItem(new string[] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty }); GISADataset.FRDBaseRow frdbaseRow = nRow.GetFRDBaseRows()[0]; item.SubItems.AddRange(new string[] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty }); item.ImageIndex = SharedResourcesOld.CurrentSharedResources.NivelImageBase(System.Convert.ToInt32(tnrRow.GUIOrder)); item.StateImageIndex = 0; item.SubItems[chCodigo.Index].Text = System.Convert.ToString(((ArrayList)(detalhes[sfrdufRow.FRDBaseRow.IDNivel]))[8]); item.SubItems[chDesignacao.Index].Text = System.Convert.ToString(((ArrayList)(detalhes[sfrdufRow.FRDBaseRow.IDNivel]))[0]); item.SubItems[chNivelDesc.Index].Text = tnrRow.Designacao; item.SubItems[chDatasProd.Index].Text = GISA.Utils.GUIHelper.FormatDate(((ArrayList)(detalhes[sfrdufRow.FRDBaseRow.IDNivel]))[2].ToString(), ((ArrayList)(detalhes[sfrdufRow.FRDBaseRow.IDNivel]))[3].ToString(), ((ArrayList)(detalhes[sfrdufRow.FRDBaseRow.IDNivel]))[4].ToString(), false) + " - " + GISA.Utils.GUIHelper.FormatDate(((ArrayList)(detalhes[sfrdufRow.FRDBaseRow.IDNivel]))[5].ToString(), ((ArrayList)(detalhes[sfrdufRow.FRDBaseRow.IDNivel]))[6].ToString(), ((ArrayList)(detalhes[sfrdufRow.FRDBaseRow.IDNivel]))[7].ToString(), false); item.SubItems[chCota.Index].Text = sfrdufRow["Cota"] == DBNull.Value ? "" : sfrdufRow.Cota; if (this.lstVwNiveisAssoc.Columns.Contains(this.chRequisitado)) { if (System.Convert.ToBoolean(((ArrayList)(detalhes[sfrdufRow.FRDBaseRow.IDNivel]))[10])) { item.SubItems[this.chRequisitado.Index].Text = "Sim"; } else { item.SubItems[this.chRequisitado.Index].Text = "Não"; } } item.Tag = sfrdufRow; return(item); }
protected virtual void updateContextStatusBar(ListViewItem listViewItem) { if (!(MasterPanel.isContextPanel(this))) { return; } if (listViewItem == null || (listViewItem != null && listViewItem.ListView == null) || ((GISADataset.NivelRow)listViewItem.Tag).RowState == DataRowState.Detached) { ((frmMain)TopLevelControl).StatusBarPanelHint.Text = string.Empty; } else { // prever a situação onde, concorrentemente, outro utilizador fez cut/paste do nível em(questão) // mudando assim, o caminho actual do mesmo if (GisaDataSetHelper.GetInstance().RelacaoHierarquica.Select(string.Format("ID={0} AND IDUpper={1}", ((GISADataset.NivelRow)listViewItem.Tag).ID, this.nivelNavigator1.ContextBreadCrumbsPathID)).Length > 0) { GISADataset.RelacaoHierarquicaRow rhRow = (GISADataset.RelacaoHierarquicaRow)(GisaDataSetHelper.GetInstance().RelacaoHierarquica.Select(string.Format("ID={0} AND IDUpper={1}", ((GISADataset.NivelRow)listViewItem.Tag).ID, this.nivelNavigator1.ContextBreadCrumbsPathID))[0]); GISADataset.TipoNivelRelacionadoRow tnrRow = TipoNivelRelacionado.GetTipoNivelRelacionadoFromRelacaoHierarquica(rhRow); ArrayList pathEstrut = ControloNivelList.GetCodigoCompletoCaminhoUnico(this.nivelNavigator1.SelectedNode); ArrayList pathDoc = this.nivelNavigator1.GetCodigoCompletoCaminhoUnico(listViewItem); if (pathDoc.Count == 0 && pathEstrut.Count == 0) { ((frmMain)TopLevelControl).StatusBarPanelHint.Text = string.Format(" {0}", tnrRow.Designacao); } else { ((frmMain)TopLevelControl).StatusBarPanelHint.Text = string.Format(" {0}: {1}/{2}", tnrRow.Designacao, Nivel.buildPath(pathEstrut), Nivel.buildPath(pathDoc)); } } else { ((frmMain)TopLevelControl).StatusBarPanelHint.Text = string.Empty; } } }
//Filtro public void PopulateFiltro() { GISADataset.TipoNivelRelacionadoRow emptyRow = GisaDataSetHelper.GetInstance().TipoNivelRelacionado.NewTipoNivelRelacionadoRow(); emptyRow.ID = 0; emptyRow.Designacao = "<Todos>"; ArrayList ds = new ArrayList(); ds.Add(emptyRow); ds.AddRange(GisaDataSetHelper.GetInstance().TipoNivelRelacionado.Select("ID < 11")); cbTipoNivelRelacionado.DataSource = ds; cbTipoNivelRelacionado.DisplayMember = "Designacao"; cbTipoNivelRelacionado.ValueMember = "ID"; SelectFirstTipo(); cbTipoNivelRelacionado.ImageList = TipoNivelRelacionado.GetImageList(); cbTipoNivelRelacionado.ImageIndexes.Clear(); cbTipoNivelRelacionado.ImageIndexes.Add(-1); foreach (GISADataset.TipoNivelRelacionadoRow tnrRow in GisaDataSetHelper.GetInstance().TipoNivelRelacionado.Select("ID < 11")) { cbTipoNivelRelacionado.ImageIndexes.Add(SharedResourcesOld.CurrentSharedResources.NivelImageBase(System.Convert.ToInt32(tnrRow.GUIOrder))); } }
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); }
// Trata a criação de novos níveis e respectivas relações. Caso se trate // de um nível orgânico (estrutural e que esteja associado a uma EP) o // nível correspondente deverá já existir e não será por isso criado, // será criada apenas a relação. private bool handleNewNivel(Form frm, GISADataset.NivelRow parentNivelRow, GISADataset.TipoNivelRelacionadoRow tnrRow) { frm.Text = "Criar " + tnrRow.Designacao; bool successfulSave = true; switch (frm.ShowDialog()) { case DialogResult.OK: Trace.WriteLine("A criar nível..."); long click = DateTime.Now.Ticks; string designacaoUFAssociada = string.Empty; PostSaveAction postSaveAction = null; var nRow = GisaDataSetHelper.GetInstance().Nivel.AddNivelRow(tnrRow.TipoNivelRow, ((FormAddNivel)frm).txtCodigo.Text.Trim(), "NVL", new byte[] { }, 0); var ndRow = GisaDataSetHelper.GetInstance().NivelDesignado.AddNivelDesignadoRow(nRow, ((FormAddNivel)frm).txtDesignacao.Text.Trim(), new byte[] { }, 0); var frdRow = GisaDataSetHelper.GetInstance().FRDBase.AddFRDBaseRow(nRow, (GISADataset.TipoFRDBaseRow)(GisaDataSetHelper.GetInstance().TipoFRDBase.Select("ID=" + DomainValuesHelper.stringifyEnumValue(TipoFRDBase.FRDOIRecolha))[0]), "", "", new byte[] { }, 0); var rhRow = GisaDataSetHelper.GetInstance().RelacaoHierarquica.AddRelacaoHierarquicaRow(nRow, parentNivelRow, tnrRow, null, null, null, null, null, null, null, new byte[] { }, 0); //valores por omissão var globalConfig = GisaDataSetHelper.GetInstance().GlobalConfig.Cast <GISADataset.GlobalConfigRow>().Single(); if (globalConfig.ApplyDefaultValues) { var sfrdcaRow = GisaDataSetHelper.GetInstance().SFRDCondicaoDeAcesso .AddSFRDCondicaoDeAcessoRow(frdRow, "", globalConfig.IsCondicaoDeAcessoNull() ? "" : globalConfig.CondicaoDeAcesso, globalConfig.IsCondicaoDeReproducaoNull() ? "" : globalConfig.CondicaoDeReproducao, "", new byte[] {}, 0); foreach (GISADataset.ConfigLinguaRow r in globalConfig.GetConfigLinguaRows()) { GisaDataSetHelper.GetInstance().SFRDLingua.AddSFRDLinguaRow(sfrdcaRow, r.Iso639Row, new byte[] { }, 0); } foreach (GISADataset.ConfigAlfabetoRow r in globalConfig.GetConfigAlfabetoRows()) { GisaDataSetHelper.GetInstance().SFRDAlfabeto.AddSFRDAlfabetoRow(sfrdcaRow, r.Iso15924Row, new byte[] { }, 0); } } var selectedTipologia = ((FormNivelDocumentalFedora)frm).Tipologia; if (selectedTipologia != null) { GisaDataSetHelper.GetInstance().IndexFRDCA.AddIndexFRDCARow(frdRow, selectedTipologia.ControloAutRow, -1, new byte[] { }, 0); } // Só adicionar permissões ao grupo TODOS dos níveis lógicos e a níveis documentais imediatamente // abaixo de níveis orgânicos (Documentos soltos e séries); caso se se trate de um nível estrutural // controlado, as permissões já foram atribuidas aquando da criação do controlo de autoridade if (nRow.IDTipoNivel == TipoNivel.DOCUMENTAL && parentNivelRow.IDTipoNivel == TipoNivel.ESTRUTURAL) { var nUpperRow = rhRow == null ? default(GISADataset.NivelRow) : rhRow.NivelRowByNivelRelacaoHierarquicaUpper; PermissoesHelper.AddNewNivelGrantPermissions(nRow, nUpperRow); } postSaveAction = new PostSaveAction(); var args = new PersistencyHelper.GenericPostSaveArguments(); postSaveAction.args = args; postSaveAction.postSaveDelegate = delegate(PersistencyHelper.PostSaveArguments postSaveArgs) { if (!postSaveArgs.cancelAction && nRow != null && nRow.RowState != DataRowState.Detached && nRow.RowState != DataRowState.Deleted) { // registar a criação do nivel documental GISADataset.FRDBaseRow frdDocRow = null; GISADataset.FRDBaseRow[] frdDocRows = nRow.GetFRDBaseRows(); if (frdDocRows.Length > 0) { frdDocRow = frdDocRows[0]; } CurrentContext.RaiseRegisterModificationEvent(frdDocRow); PersistencyHelperRule.Current.saveRows(GisaDataSetHelper.GetInstance().FRDBaseDataDeDescricao, GisaDataSetHelper.GetInstance().FRDBaseDataDeDescricao.Cast <GISADataset.FRDBaseDataDeDescricaoRow>().Where(frd => frd.RowState == DataRowState.Added).ToArray(), postSaveArgs.tran); } }; // se se tratar de um (sub)documento é necessário garantir que se trata de um código // único dentro da sua série (se constituir série) ou nivel estrutural superior PersistencyHelper.ValidateNivelAddAndAssocNewUFPreConcArguments pcArgs = new PersistencyHelper.ValidateNivelAddAndAssocNewUFPreConcArguments(); PersistencyHelper.SetNewCodigosPreSaveArguments psArgs = new PersistencyHelper.SetNewCodigosPreSaveArguments(); PersistencyHelper.EnsureUniqueCodigoNivelPreConcArguments pcArgsNivel = new PersistencyHelper.EnsureUniqueCodigoNivelPreConcArguments(); pcArgs.argsNivel = pcArgsNivel; // dados que serão usados no delegate responsável pela criação do nível documental pcArgsNivel.nRowID = nRow.ID; pcArgsNivel.ndRowID = ndRow.ID; pcArgsNivel.rhRowID = rhRow.ID; pcArgsNivel.rhRowIDUpper = rhRow.IDUpper; pcArgsNivel.frdBaseID = frdRow.ID; pcArgsNivel.testOnlyWithinNivel = true; // permitir ao delegate selecionar o delegate correspondente ao tipo de nível que se está a criar pcArgs.IDTipoNivelRelacionado = tnrRow.ID; psArgs.createNewNivelCodigo = false; psArgs.createNewUFCodigo = false; psArgs.setNewCodigo = rhRow.IDTipoNivelRelacionado == TipoNivelRelacionado.SD; psArgs.argsNivelDocSimples = NiveisHelper.AddNivelDocumentoSimplesWithDelegateArgs(nRow.GetNivelDesignadoRows().Single(), rhRow.IDUpper, rhRow.IDTipoNivelRelacionado); PersistencyHelper.save(DelegatesHelper.ValidateNivelAddAndAssocNewUF, pcArgs, DelegatesHelper.SetNewCodigos, psArgs, postSaveAction); if (!pcArgsNivel.successful) { successfulSave = false; MessageBox.Show(pcArgsNivel.message, "Criação de unidade de descrição", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (parentNivelRow.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica()[0].TipoNivelRelacionadoRow.ID == TipoNivelRelacionado.SR) { GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection()); try { DBAbstractDataLayer.DataAccessRules.FRDRule.Current.LoadSFRDAvaliacaoData(GisaDataSetHelper.GetInstance(), parentNivelRow.ID, ho.Connection); } finally { ho.Dispose(); } } PersistencyHelper.cleanDeletedData(new List <TableDepthOrdered.TableCloudType>(new TableDepthOrdered.TableCloudType[] { PersistencyHelper.determinaNuvem("RelacaoHierarquica"), PersistencyHelper.determinaNuvem("FRDBase") })); if (!successfulSave) { return(successfulSave); } GISA.Search.Updater.updateNivelDocumentalComProdutores(nRow.ID); GISA.Search.Updater.updateNivelDocumental(nRow.ID); this.nivelNavigator1.AddNivel(nRow); Debug.WriteLine("<<A criar nível...>> " + new TimeSpan(DateTime.Now.Ticks - click).ToString()); break; case DialogResult.Cancel: successfulSave = false; break; } return(successfulSave); }
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; }
private void ConfigureContextMenu(GISADataset.NivelRow NivelRow, GISADataset.NivelRow NivelUpperRow, GISADataset.TipoNivelRelacionadoRow tnrRow, GISADataset.TipoNivelRelacionadoRow tnrRowBC) { ContextMenu CurrentMenu = new ContextMenu(); ToolBarButtonCreateAny.DropDownMenu = CurrentMenu; // force an update to the button's icon int i = ToolBarButtonCreateAny.ImageIndex; ToolBarButtonCreateAny.ImageIndex = -1; ImageList toolbarImageList = ToolBar.ImageList; ImageList niveisImageList = TipoNivelRelacionado.GetImageList(); toolbarImageList.Images[2] = niveisImageList.Images[SharedResourcesOld.CurrentSharedResources.NivelImageEditar(System.Convert.ToInt32(tnrRow.GUIOrder))]; toolbarImageList.Images[3] = niveisImageList.Images[SharedResourcesOld.CurrentSharedResources.NivelImageEliminar(System.Convert.ToInt32(tnrRow.GUIOrder))]; ToolBarButtonCreateAny.ImageIndex = i; if (tnrRowBC == null) { TipoNivelRelacionado.ConfigureMenu(GisaDataSetHelper.GetInstance(), tnrRow, ref ToolBarButtonCreateAny, ToolBarButtonCreateMenuItemClick); // IsDocumentView) } else { TipoNivelRelacionado.ConfigureMenu(GisaDataSetHelper.GetInstance(), tnrRowBC, ref ToolBarButtonCreateAny, ToolBarButtonCreateMenuItemClick); // IsDocumentView) } }
private Bitmap getIconCriarTipoNivel(GISADataset.TipoNivelRelacionadoRow row, ImageList ImgList) { return((Bitmap)(ImgList.Images[SharedResources.SharedResourcesOld.CurrentSharedResources.NivelImageCriar(System.Convert.ToInt32(row.ID))])); }
public TipoNivelMenuItem(string Text, GISADataset.TipoNivelRelacionadoRow CurrentRow, ImageList ImgList) : base(Text) { base.Icon = getIconCriarTipoNivel(CurrentRow, ImgList); mRow = CurrentRow; }
private void SeleccaoActual(out GISADataset.NivelRow NivelRow, out GISADataset.TipoNivelRelacionadoRow TnrRow) { //Obter selecção actual GISATreeNode selectedNode = null; GISADataset.NivelRow nRow = null; GISADataset.NivelRow nUpperRow = null; GISADataset.RelacaoHierarquicaRow rhRow = null; GISADataset.TipoNivelRelacionadoRow tnrRow = null; // Estas variaveis identificam o contexto definido pelo breadcrumbspath da vista documental // (só são usadas quando a vista actual é a documental) GISADataset.NivelRow nRowBC = null; GISADataset.NivelRow nUpperRowBC = null; GISADataset.RelacaoHierarquicaRow rhRowBC = null; GISADataset.TipoNivelRelacionadoRow tnrRowBC = null; if (this.mPanelToggleState == ToggleState.Estrutural) { //vista estrutural if (mEPFilterMode) { var selItem = this.nivelEstruturalList1.SelectedItems.FirstOrDefault(); if (selItem != null) { nRow = selItem.Tag as GISADataset.NivelRow; } } else { selectedNode = (GISATreeNode)this.controloNivelListEstrutural1.SelectedNode; if (selectedNode != null && !(selectedNode.NivelRow.RowState == DataRowState.Detached)) { nRow = selectedNode.NivelRow; nUpperRow = selectedNode.NivelUpperRow; } } } else { //vista documental if (!(this.nivelDocumentalListNavigator1.SelectedItems.Count == 0)) { nRow = (GISADataset.NivelRow)(this.nivelDocumentalListNavigator1.SelectedItems[0].Tag); } if (nRow != null && !(nRow.RowState == DataRowState.Detached)) { nUpperRow = nRow.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica()[0].NivelRowByNivelRelacaoHierarquicaUpper; } } if (nRow != null && !(nRow.RowState == DataRowState.Detached) && nUpperRow == null) { if (this.mPanelToggleState == ToggleState.Estrutural && this.mEPFilterMode) { rhRow = nRow.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica().FirstOrDefault(); tnrRow = TipoNivelRelacionado.GetTipoNivelRelacionadoFromRelacaoHierarquica(rhRow); } else { tnrRow = TipoNivelRelacionado.GetTipoNivelRelacionadoFromRelacaoHierarquica(null); } } else if (nUpperRow != null && !(nUpperRow.RowState == DataRowState.Detached) && nRow != null && !(nRow.RowState == DataRowState.Detached)) { if (this.mPanelToggleState == ToggleState.Estrutural) { rhRow = selectedNode.RelacaoHierarquicaRow; // excluimos desta forma as relacoes hirarquicas entretanto eliminadas (as que seriam NULL mas cujo nó respectivo teria um NivelUpper) if (selectedNode.NivelUpperRow != null && rhRow != null) { tnrRow = TipoNivelRelacionado.GetTipoNivelRelacionadoFromRelacaoHierarquica(rhRow); } } else { //Documental if (nRow != null) { DataRow[] rhRows = GisaDataSetHelper.GetInstance().RelacaoHierarquica.Select(string.Format("ID={0} AND IDUpper={1}", nRow.ID.ToString(), nUpperRow.ID.ToString())); // A relação pode ter desaparecido por algum motivo (ie, concorrencia). if (rhRows.Length > 0) { rhRow = (GISADataset.RelacaoHierarquicaRow)(rhRows[0]); tnrRow = TipoNivelRelacionado.GetTipoNivelRelacionadoFromRelacaoHierarquica(rhRow); } } if (nRowBC != null && nUpperRowBC != null) { DataRow[] rhRowBCs = GisaDataSetHelper.GetInstance().RelacaoHierarquica.Select(string.Format("ID={0} AND IDUpper={1}", nRowBC.ID.ToString(), nUpperRowBC.ID.ToString())); // A relação pode ter desaparecido por algum motivo (ie, concorrencia). if (rhRowBCs.Length > 0) { rhRowBC = (GISADataset.RelacaoHierarquicaRow)(rhRowBCs[0]); tnrRowBC = TipoNivelRelacionado.GetTipoNivelRelacionadoFromRelacaoHierarquica(rhRowBC); } } } } NivelRow = nRow; TnrRow = tnrRow; }
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); }
public override void UpdateToolBarButtons(ListViewItem item) { base.UpdateToolBarButtons(item); //Obter selecção actual GISATreeNode selectedNode = null; GISADataset.NivelRow nRow = null; GISADataset.NivelRow nUpperRow = null; GISADataset.RelacaoHierarquicaRow rhRow = null; GISADataset.TipoNivelRelacionadoRow tnrRow = null; // Estas variaveis identificam o contexto definido pelo breadcrumbspath da vista documental // (só são usadas quando a vista actual é a documental) GISADataset.NivelRow nRowBC = null; GISADataset.NivelRow nUpperRowBC = null; GISADataset.RelacaoHierarquicaRow rhRowBC = null; GISADataset.TipoNivelRelacionadoRow tnrRowBC = null; if (this.nivelNavigator1.PanelToggleState == NivelNavigator.ToggleState.Estrutural) { //vista estrutural if (this.nivelNavigator1.EPFilterMode) // modo filtro { if (item != null && item.ListView != null && !(((GISADataset.NivelRow)item.Tag).RowState == DataRowState.Detached)) { //contexto da listview nRow = (GISADataset.NivelRow)item.Tag; } } else //modo árvore { //vista estrutural selectedNode = (GISATreeNode)this.nivelNavigator1.SelectedNode; if (selectedNode != null && !(selectedNode.NivelRow.RowState == DataRowState.Detached)) { nRow = selectedNode.NivelRow; nUpperRow = selectedNode.NivelUpperRow; } } } else { //vista documental if (item != null && item.ListView != null && !(((GISADataset.NivelRow)item.Tag).RowState == DataRowState.Detached)) { //contexto da listview nRow = (GISADataset.NivelRow)item.Tag; nUpperRow = nRow.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica()[0].NivelRowByNivelRelacaoHierarquicaUpper; } //contexto do breadcrumbspath nRowBC = GisaDataSetHelper.GetInstance().Nivel.Cast <GISADataset.NivelRow>().SingleOrDefault(r => r.RowState != DataRowState.Deleted && r.ID == this.nivelNavigator1.ContextBreadCrumbsPathID); nUpperRowBC = GisaDataSetHelper.GetInstance().Nivel.Cast <GISADataset.NivelRow>().SingleOrDefault(r => r.RowState != DataRowState.Deleted && r.ID == this.nivelNavigator1.ContextBreadCrumbsPathIDUpper); } if (nRow != null && !(nRow.RowState == DataRowState.Detached) && nUpperRow == null) { tnrRow = TipoNivelRelacionado.GetTipoNivelRelacionadoFromRelacaoHierarquica(null); } else if (nUpperRow != null && !(nUpperRow.RowState == DataRowState.Detached) && nRow != null && !(nRow.RowState == DataRowState.Detached)) { if (this.nivelNavigator1.PanelToggleState == NivelNavigator.ToggleState.Estrutural) { rhRow = selectedNode.RelacaoHierarquicaRow; // excluimos desta forma as relacoes hirarquicas entretanto eliminadas (as que seriam NULL mas cujo nó respectivo teria um NivelUpper) if (selectedNode.NivelUpperRow != null && rhRow != null) { tnrRow = TipoNivelRelacionado.GetTipoNivelRelacionadoFromRelacaoHierarquica(rhRow); } } else { if (item != null && item.ListView != null) { DataRow[] rhRows = GisaDataSetHelper.GetInstance().RelacaoHierarquica.Select(string.Format("ID={0} AND IDUpper={1}", nRow.ID.ToString(), nUpperRow.ID.ToString())); // A relação pode ter desaparecido por algum motivo (ie, concorrencia). if (rhRows.Length > 0) { rhRow = (GISADataset.RelacaoHierarquicaRow)(rhRows[0]); tnrRow = TipoNivelRelacionado.GetTipoNivelRelacionadoFromRelacaoHierarquica(rhRow); } } if (nRowBC != null && nUpperRowBC != null) { DataRow[] rhRowBCs = GisaDataSetHelper.GetInstance().RelacaoHierarquica.Select(string.Format("ID={0} AND IDUpper={1}", nRowBC.ID.ToString(), nUpperRowBC.ID.ToString())); // A relação pode ter desaparecido por algum motivo (ie, concorrencia). if (rhRowBCs.Length > 0) { rhRowBC = (GISADataset.RelacaoHierarquicaRow)(rhRowBCs[0]); tnrRowBC = TipoNivelRelacionado.GetTipoNivelRelacionadoFromRelacaoHierarquica(rhRowBC); } } } } if (nRow == null && this.nivelNavigator1.PanelToggleState == NivelNavigator.ToggleState.Documental && nRowBC != null && nUpperRowBC != null) { GISADataset.RelacaoHierarquicaRow[] bcRHRow = (GISADataset.RelacaoHierarquicaRow[])(GisaDataSetHelper.GetInstance().RelacaoHierarquica.Select(string.Format("ID={0} AND IDUpper={1}", nRowBC.ID.ToString(), nUpperRowBC.ID.ToString()))); if (bcRHRow.Length > 0) { if (bcRHRow[0].IDTipoNivelRelacionado < TipoNivelRelacionado.SD) { ToolBarButtonCreateAny.Enabled = AllowCreate && PermissoesHelper.AllowCreate; } else { ToolBarButtonCreateAny.Enabled = false; } rhRowBC = (GISADataset.RelacaoHierarquicaRow)(GisaDataSetHelper.GetInstance().RelacaoHierarquica.Select(string.Format("ID={0} AND IDUpper={1}", nRowBC.ID.ToString(), nUpperRowBC.ID.ToString()))[0]); tnrRowBC = TipoNivelRelacionado.GetTipoNivelRelacionadoFromRelacaoHierarquica(rhRowBC); ConfigureContextMenu(nRowBC, nUpperRowBC, tnrRowBC, tnrRowBC); ToolBarButtonEdit.Enabled = false; ToolBarButtonRemove.Enabled = false; } else { ToolBarButtonCreateAny.Enabled = false; ToolBarButtonPaste.Enabled = false; } } else if (TipoNivel.isNivelDocumental(nRow)) { ToolBarButtonCreateAny.Enabled = AllowCreate && PermissoesHelper.AllowCreate; ConfigureContextMenu(nRowBC, nUpperRowBC, tnrRow, tnrRowBC); if (rhRow.IDTipoNivelRelacionado == TipoNivelRelacionado.D) { ToolBarButtonEdit.Enabled = AllowEdit && PermissoesHelper.AllowEdit; ToolBarButtonRemove.Enabled = NiveisHelper.isRemovable(nRow, nUpperRow, false) && AllowDelete && PermissoesHelper.AllowDelete; } else if (rhRow.IDTipoNivelRelacionado == TipoNivelRelacionado.SD) { ToolBarButtonEdit.Enabled = AllowEdit && PermissoesHelper.AllowEdit; ToolBarButtonRemove.Enabled = NiveisHelper.isRemovable(nRow, nUpperRow, false) && AllowDelete && PermissoesHelper.AllowDelete && PermissoesHelper.ObjDigAllowWrite; } else { ToolBarButtonEdit.Enabled = false; ToolBarButtonRemove.Enabled = false; } } else { ToolBarButtonCreateAny.Enabled = false; ToolBarButtonEdit.Enabled = false; ToolBarButtonRemove.Enabled = false; } }