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); }
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(); }
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) } }
// Actualiza o contexto de acordo com o nível especificado protected override bool UpdateContext(GISADataset.NivelRow row) { bool result = CurrentContext.SetFedoraNivel(row); UpdateToolBarButtons(); return(result); }
public void TearDown() { ds = null; r1 = null; r2 = null; r3 = null; }
public static void AddNewNivelGrantPermissions(GISADataset.NivelRow NivelRow) { var trusteeRow = SessionHelper.GetGisaPrincipal().TrusteeUserOperator.TrusteeRow; GisaDataSetHelper.GetInstance().TrusteeNivelPrivilege.AddTrusteeNivelPrivilegeRow(trusteeRow, NivelRow, 1, 1, 1, 1, 1, new byte[] { }, 0); GisaDataSetHelper.GetInstance().TrusteeNivelPrivilege.AddTrusteeNivelPrivilegeRow(GrpAcessoCompleto, NivelRow, 1, 1, 1, 1, 1, new byte[] { }, 0); }
public static void UndoAddNivelGrantPermissions(GISADataset.NivelRow NivelRow, GISADataset.TrusteeRow trusteeRow) { Trace.WriteLine("Removing privileges from nivel with ID " + NivelRow.ID.ToString()); GisaDataSetHelper.GetInstance().TrusteeNivelPrivilege.Cast <GISADataset.TrusteeNivelPrivilegeRow>(). Where(tnp => tnp.RowState != DataRowState.Deleted && tnp.IDNivel == NivelRow.ID && tnp.IDTrustee == trusteeRow.ID).ToList().ForEach(r => r.Delete()); }
// Actualiza o contexto de acordo com o nível especificado protected virtual bool UpdateContext(GISADataset.NivelRow row) { bool result = CurrentContext.SetNivelEstrututalDocumental(row); UpdateToolBarButtons(); return(result); }
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(); }
protected virtual bool UpdateContext(GISATreeNode node) { // foi selecionado um nível estrutural bool successfulSave = false; GISADataset.NivelRow nRow = null; if (this.nivelNavigator1.SelectedNode != null) { node = this.nivelNavigator1.SelectedNode; nRow = ((GISATreeNode)node).NivelRow; successfulSave = UpdateContext(nRow); } else { nRow = null; successfulSave = UpdateContext(nRow); } if (successfulSave) { updateContextStatusBar(node); } return(successfulSave); }
public static void SetCodigo(PersistencyHelper.PreSaveArguments args) { PersistencyHelper.IsCodigoUFBeingUsedPreSaveArguments psa = null; psa = (PersistencyHelper.IsCodigoUFBeingUsedPreSaveArguments)args; GISADataset.NivelUnidadeFisicaCodigoRow codRow = null; // a atribuição de um código de referência ocorre quando se cria uma // UF nova ou se está a mudar a ED de uma UF e é atribuído só se não houver // qualquer conflito de concorrência if (!psa.cancelSetNewCodigo) { GISADataset.NivelRow nivelUFRow = (GISADataset.NivelRow)(GisaDataSetHelper.GetInstance().Nivel.Select("ID=" + psa.nivelUFRowID.ToString())[0]); codRow = UnidadesFisicasHelper.GetNewCodigoRow(nivelUFRow, System.DateTime.Now.Year); decimal newCounterValue = DBAbstractDataLayer.DataAccessRules.UFRule.Current.IsCodigoUFBeingUsed(codRow.ID, codRow.Ano, psa.tran); if (newCounterValue != 0M) { nivelUFRow.Codigo = "UF" + codRow.Ano.ToString() + "-" + newCounterValue.ToString(); } else { nivelUFRow.Codigo = "UF" + codRow.Ano.ToString() + "-" + codRow.Contador.ToString(); } //quer tenha sido adicionada uma entrada na tabela NivelUnidadeFisicaCodigo quer so tenha sido actualizado //o contador de uma das linhas, essa operação foi executada directamente na base de dados pelo que para //manter a coerência é necessário confirmar a mesma operação do lado do dataset codRow.AcceptChanges(); DBAbstractDataLayer.DataAccessRules.UFRule.Current.ReloadNivelUFCodigo(GisaDataSetHelper.GetInstance(), codRow.ID, codRow.Ano, psa.tran); } }
protected override bool UpdateContext(GISADataset.NivelRow row) { bool result = CurrentContext.SetPermissoesObjDigital(row, currentUser); UpdateToolBarButtons(); return(result); }
public virtual int Compare(object x, object y) { GISADataset.NivelRow nRow1 = (GISADataset.NivelRow)x; GISADataset.NivelRow nRow2 = (GISADataset.NivelRow)y; string xcod = nRow1.Codigo; string ycod = nRow2.Codigo; if (MathHelper.IsInteger(xcod) && MathHelper.IsInteger(ycod)) { int xdec = int.Parse(xcod); int ydec = int.Parse(ycod); if (xdec < ydec) { return -1; } if (xdec > ydec) { return 1; } return 0; } else { // Fall through if Codigo is not numeric return string.Compare(xcod, ycod); } }
private void lstVwEstruturaDocs_SelectedIndexChanged(object sender, EventArgs e) { if (lstVwEstruturaDocs.SelectedItems.Count == 1) { // é utilizada a primeira relação encontrada GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection()); try { GISADataset.NivelRow nRow = null; nRow = (GISADataset.NivelRow)(lstVwEstruturaDocs.SelectedItems[0].Tag); panelInfoEPs1.BuildTree(nRow, ho.Connection); } catch (Exception ex) { Trace.WriteLine(ex); throw; } finally { ho.Dispose(); } } else if (lstVwEstruturaDocs.SelectedItems.Count == 0) { panelInfoEPs1.ClearAll(); } UpdateToolBarButtons(); }
private void AcceptNivelRow(GISADataset.NivelRow NivelRow) { // aceitar o drop apenas se se tratar de uma UF ainda não associada var nufRow = NivelRow.GetNivelDesignadoRows()[0].GetNivelUnidadeFisicaRows()[0]; var ufs = GetUFInfo(NivelRow); var nufdRow = nufRow.GetNivelUnidadeFisicaDepositoRows().SingleOrDefault(); if (nufdRow == null) { nufdRow = GisaDataSetHelper.GetInstance().NivelUnidadeFisicaDeposito.NewNivelUnidadeFisicaDepositoRow(); nufdRow.NivelUnidadeFisicaRow = nufRow; nufdRow.DepositoRow = CurrentDeposito; nufdRow.Versao = new byte[] {}; nufdRow.isDeleted = 0; GisaDataSetHelper.GetInstance().NivelUnidadeFisicaDeposito.AddNivelUnidadeFisicaDepositoRow(nufdRow); PopulateAssociacoes(ufs); ufsAssociadas.Add(ufs.ToList().Single()); } else if (nufdRow.IDDeposito != CurrentDeposito.ID) { // ToDo: deixa-se substituir? } else if (nufdRow.IDDeposito == CurrentDeposito.ID && !ufsAssociadas.Contains(ufs.ToList().Single())) { PopulateAssociacoes(ufs); ufsAssociadas.Add(ufs.ToList().Single()); } }
public static void UpdateNivelPermissions(GISADataset.NivelRow NivelRow, long trusteeUserOperatorID) { ClearPermissons(); if (NivelRow == null) { return; } if (NivelRow.RowState == DataRowState.Detached) { return; } byte[] permissoes = null; GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetTempConnection()); try { permissoes = GetPermissons(NivelRow.ID, trusteeUserOperatorID, ho.Connection); } catch (Exception ex) { Trace.WriteLine(ex.ToString()); throw ex; } finally { ho.Dispose(); } mAllowCreate = permissoes[0] == 1; mAllowRead = permissoes[1] == 1; mAllowEdit = permissoes[2] == 1; mAllowDelete = permissoes[3] == 1; mAllowExpand = permissoes[4] == 1; }
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()); }
public static GISADataset.RelacaoHierarquicaRow GetPrimeiraRelacaoEncontrada(GISADataset.NivelRow nivelRow) { GISADataset.RelacaoHierarquicaRow[] rhRows = null; GISADataset.RelacaoHierarquicaRow rhRow = null; try { rhRows = nivelRow.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica(); if (rhRows.Length > 0) { return(rhRows[0]); } rhRows = Nivel.GetSelf(GisaDataSetHelper.GetInstance(), nivelRow); if (rhRows.Length == 0) { return(null); } rhRow = rhRows[0]; } catch (Exception ex) { Trace.WriteLine(ex); throw; } return(rhRow); }
protected override void AcceptContents(object Value) { GISADataset.NivelRow nivelRow = null; GISATreeNode node = null; ListViewItem item = null; if (Value is GISADataset.NivelRow) { nivelRow = (GISADataset.NivelRow)Value; if (AcceptNivelRow != null) { AcceptNivelRow(nivelRow); } } else if (Value is GISATreeNode) { node = (GISATreeNode)Value; if (AcceptNode != null) { AcceptNode(node); } } else if (Value is ListViewItem) { item = (ListViewItem)Value; if (AcceptItem != null) { AcceptItem(item); } } }
public override ArrayList GetCodigoCompletoCaminhoUnico(ListViewItem item) { GISADataset.RelacaoHierarquicaRow rhCurrentRow = null; ArrayList result = new ArrayList(); foreach (BreadCrumbsPath.BreadCrumb bc in BreadCrumbsPath1.Path) { if (!(BreadCrumbsPath1.Path[0] == bc)) { // No caso de faltar uma parte do código returnar um arraylist vazio if (GisaDataSetHelper.GetInstance().RelacaoHierarquica.Select(string.Format("ID={0} AND IDUpper={1}", bc.idNivel, bc.idUpperNivel)).Length > 0) { rhCurrentRow = (GISADataset.RelacaoHierarquicaRow)(GisaDataSetHelper.GetInstance().RelacaoHierarquica.Select(string.Format("ID={0} AND IDUpper={1}", bc.idNivel, bc.idUpperNivel))[0]); result.Add(rhCurrentRow); } else { return(new ArrayList()); } } } GISADataset.NivelRow nRow = (GISADataset.NivelRow)(item.Tag); if (nRow.RowState != DataRowState.Detached) { if (GisaDataSetHelper.GetInstance().RelacaoHierarquica.Select(string.Format("ID={0} AND IDUpper={1}", nRow.ID, BreadCrumbsPath1.getBreadCrumbsPathContextID)).Length > 0) { rhCurrentRow = (GISADataset.RelacaoHierarquicaRow)(GisaDataSetHelper.GetInstance().RelacaoHierarquica.Select(string.Format("ID={0} AND IDUpper={1}", nRow.ID, BreadCrumbsPath1.getBreadCrumbsPathContextID))[0]); result.Add(rhCurrentRow); } } return(result); }
public static bool IsNivelEntidadeDetentora(GISADataset.NivelRow nRow) { if (Nivel.GetSelf(GisaDataSetHelper.GetInstance(), nRow).Length == 0) { return(true); } return(false); }
public override void Deactivate() { currentGARow = null; currentImage = null; currentImgRow = null; updateImage = false; currentFileName = null; imageViewerControl1.UpdatePreviewImage(null); }
public static bool isNivelTematicoFuncional(GISADataset.NivelRow nivelRow) { if (nivelRow == null) { return(false); } return("NVL".Equals(nivelRow.CatCode.Trim()) && nivelRow.IDTipoNivel == TipoNivel.ESTRUTURAL); }
public static bool isNivelDocumental(GISADataset.NivelRow nivelRow) { if (nivelRow == null) { return(false); } return(nivelRow.TipoNivelRow.IsDocument); }
public static bool isNivelLogico(GISADataset.NivelRow nivelRow) { if (nivelRow == null) { return(false); } return(nivelRow.TipoNivelRow.BuiltInName.Equals("LOGICO")); }
public static bool isNivelEstrutural(GISADataset.NivelRow nivelRow) { if (nivelRow == null) { return(false); } return(nivelRow.TipoNivelRow.IsStructure); }
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); }
public static bool isNivelOrganico(GISADataset.NivelRow nivelRow) { if (nivelRow == null) { return(false); } return("CA".Equals(nivelRow.CatCode.Trim()) && nivelRow.IDTipoNivel == TipoNivel.ESTRUTURAL); }
// Neste caso adiciona apenas um protected override ArrayList GetPossibleSubItems(GISADataset.NivelRow nRow) { ArrayList subItems = new ArrayList(); TipoNivelRelacionado.PossibleSubNivel subItem = new TipoNivelRelacionado.PossibleSubNivel(); subItem.SubIDTipoNivelRelacionado = TipoNivelRelacionadoRow.ID; subItem.Designacao = TipoNivelRelacionadoRow.Designacao; subItems.Add(subItem); return subItems; }
public static PersistencyHelper.SaveResult CascadeDeleteNivel(GISADataset.NivelRow NivelRow) { //DeleteNivelInDataBase(NivelRow) PersistencyHelper.DeleteIDXPreSaveArguments args = new PersistencyHelper.DeleteIDXPreSaveArguments(); args.ID = NivelRow.ID; DeleteInDataSet(NivelRow); // é possível que esta linha não seja já precisa uma vez que o cleandeleteddata seguinte irá limpar do DS de trabalho as linhas que já não existam PersistencyHelper.SaveResult saveSuccess = PersistencyHelper.save(new PersistencyHelper.preSaveDelegate(DeleteNivelXInDataBase), args); PersistencyHelper.cleanDeletedData(); return saveSuccess; }
public override void LoadData() { GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection()); try { NivelRule.Current.LoadImagemIlustracao(CurrentContext.GrupoArquivo.ID, GisaDataSetHelper.GetInstance(), ho.Connection); currentGARow = CurrentContext.GrupoArquivo; } catch (Exception ex) { Trace.WriteLine(ex); throw; } finally { ho.Dispose(); } }
public itemDragSelectionEventArgs(GISATreeNode node, GISADataset.NivelRow nivel) { this.node = node; this.nivel = nivel; }
// Actualiza o contexto de acordo com o nível especificado private bool UpdateContext(GISADataset.NivelRow row) { if (((frmMain)this.TopLevelControl).isSuportPanel) { // prever a situação onde este painel está a ser usado como suporte na área // de Unidades Fisicas e onde é permitida múltipla selecção; // neste caso não é necessário que a informação referente aos items selecionados // seja carregada bool rez = false; rez = CurrentContext.SetNivelEstrututalDocumental(null); pseudoContextNivel = row; return rez; } else return CurrentContext.SetNivelEstrututalDocumental(row); }
private void PermissoesNivelList1_BeforeNewListSelection(object sender, BeforeNewSelectionEventArgs e) { ((frmMain)TopLevelControl).EnterWaitMode(); GISADataset.NivelRow nivelRow = null; nivelRow = (GISADataset.NivelRow)e.ItemToBeSelected.Tag; //verificar se o nivel selecciona está apagado if (nivelRow == null) { ControloLocalizacao1.ClearTree(); } else if (nRowSelected == nivelRow) { // não actualizar a árvore } else { //popular árvore GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection()); try { ControloLocalizacao1.BuildTree(nivelRow.ID, ho.Connection, SessionHelper.GetGisaPrincipal().TrusteeUserOperator.ID); } catch (Exception ex) { Debug.WriteLine(ex); throw ex; } finally { ho.Dispose(); } } nRowSelected = nivelRow; ((frmMain)TopLevelControl).LeaveWaitMode(); }
protected GISADataset.NivelRow CurrentNivel; //Nivel da UF!! Não da selecção. public override void LoadData(DataRow CurrentDataRow, IDbConnection conn) { IsLoaded = false; CurrentNivel = ((GISADataset.FRDBaseRow)CurrentDataRow).NivelRow; ordem = FRDRule.Current.LoadUFUnidadesDescricaoData(GisaDataSetHelper.GetInstance(), CurrentNivel.ID, conn); detalhes = FRDRule.Current.LoadUFUnidadesDescricaoDetalhe(GisaDataSetHelper.GetInstance(), CurrentNivel.ID, SessionHelper.GetGisaPrincipal().TrusteeUserOperator.ID, conn); if (filtered && filter.Count > 0) filter = FRDRule.Current.FilterUFUnidadesDescricao(TextFilterDesignacao, FilterTipoNivelRelacionado, CurrentNivel.ID, conn); IsLoaded = true; }
private GISADataset.NivelRow[] GetlstVwNivelRowArray() { GISADataset.NivelRow[] ns = null; ns = new GISADataset.NivelRow[ufList.SelectedItems.Count]; int i = 0; foreach (ListViewItem li in ufList.SelectedItems) { ns[i] = (GISADataset.NivelRow)li.Tag; i = i + 1; } return ns; }
public BeforeNewSelectionEventArgs(GISATreeNode node, GISADataset.NivelRow nivel) : base() { this.node = node; this.nivel = nivel; }
public override void Deactivate() { this.ClearFilter(); GUIHelper.GUIHelper.clearField(lstVwNiveisAssoc); CurrentNivel = null; }
void nivelNavigator1_BeforeListItemSelection(object sender, BeforeNewSelectionEventArgs e) { selectedDocument = e.ItemToBeSelected.Tag as GISADataset.NivelRow; btnOk.Enabled = ((selectedDocument != null) && SelectableType.Contains(selectedDocument.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica()[0].IDTipoNivelRelacionado)); }