private void caList_BeforeNewListSelection(object sender, BeforeNewSelectionEventArgs e) { if (e.ItemToBeSelected.ListView == null || (e.ItemToBeSelected != null && e.ItemToBeSelected.ListView == null)) { relacaoCA.ContextNivelRow = null; } else { GISADataset.ControloAutRow caRow = null; caRow = ((GISADataset.ControloAutDicionarioRow)e.ItemToBeSelected.Tag).ControloAutRow; IDbConnection conn = GisaDataSetHelper.GetConnection(); try { conn.Open(); DBAbstractDataLayer.DataAccessRules.NivelRule.Current.LoadNivelByControloAut(caRow.ID, GisaDataSetHelper.GetInstance(), conn); } catch (Exception ex) { Trace.WriteLine(ex); throw; } finally { conn.Close(); } relacaoCA.ContextNivelRow = caRow.GetNivelControloAutRows()[0].NivelRow; } RefreshButtonState(e.ItemToBeSelected); }
public override void LoadData(DataRow CurrentDataRow, IDbConnection conn) { IsLoaded = false; byte[] Versao = null; CurrentControloAut = (GISADataset.ControloAutRow)CurrentDataRow; if (CurrentControloAut == null) { return; } ControloAutRule.Current.LoadDataPanelCADescricao(GisaDataSetHelper.GetInstance(), CurrentControloAut.ID, conn); GISADataset.ControloAutDatasExistenciaRow[] cadeRows = null; cadeRows = (GISADataset.ControloAutDatasExistenciaRow[])(GisaDataSetHelper.GetInstance().ControloAutDatasExistencia.Select(string.Format("IDControloAut = {0}", CurrentControloAut.ID))); if (cadeRows.Length > 0) { CurrentCadeRow = cadeRows[0]; } else { CurrentCadeRow = GisaDataSetHelper.GetInstance().ControloAutDatasExistencia.AddControloAutDatasExistenciaRow(CurrentControloAut, "", "", "", "", false, "", "", "", false, Versao, 0); } IsLoaded = true; }
public override void Deactivate() { DeactivatePanels(); isLoaded = false; CurrentControloAut = null; existsModifiedData = false; }
private void CreateNewRelation(GISADataset.ControloAutRow row) { if (row == null || PresentInIndex(row)) { return; } GISADataset.IndexFRDCARow IndexFRDCARow = null; GISADataset.IndexFRDCARow[] IndexFRDCADeletedRows = null; // se a row de IndexFRDCA já existir em memória como Deleted resuscitamo-la IndexFRDCADeletedRows = (GISADataset.IndexFRDCARow[])(GisaDataSetHelper.GetInstance().IndexFRDCA.Select(string.Format("IDFRDBase = {0} AND IDControloAut = {1}", CurrentFRDBase.ID, row.ID), string.Empty, DataViewRowState.Deleted)); if (IndexFRDCADeletedRows.Length > 0) { IndexFRDCARow = IndexFRDCADeletedRows[0]; IndexFRDCARow.RejectChanges(); } else { IndexFRDCARow = GisaDataSetHelper.GetInstance().IndexFRDCA.NewIndexFRDCARow(); IndexFRDCARow.FRDBaseRow = CurrentFRDBase; IndexFRDCARow.ControloAutRow = row; IndexFRDCARow["Selector"] = DBNull.Value; GisaDataSetHelper.GetInstance().IndexFRDCA.AddIndexFRDCARow(IndexFRDCARow); } }
// Adicionar uma localizacao actual (registo de autoridade geográfico): private void btnAdd_Localizacao_Actual_Click(object sender, EventArgs e) { GISADataset.ControloAutRow caRow = null; GISADataset.LicencaObraLocalizacaoObraActualRow locActualRow = null; GISADataset.ControloAutDicionarioRow dicionarioRow = null; FormLeituraLocalizacaoNumPolicia formLeitura = new FormLeituraLocalizacaoNumPolicia(); formLeitura.ModoTextoLivre = false; switch (formLeitura.ShowDialog()) { case DialogResult.OK: dicionarioRow = formLeitura.ControloAutDicionarioRow; caRow = dicionarioRow.ControloAutRow; if (!existe_LicencaObraLocalizacaoObraActual(caRow, formLeitura.NumeroPolicia)) { locActualRow = GisaDataSetHelper.GetInstance().LicencaObraLocalizacaoObraActual.NewLicencaObraLocalizacaoObraActualRow(); locActualRow.LicencaObraRow = CurrentLicencaObra; locActualRow.ControloAutRow = caRow; locActualRow.NumPolicia = formLeitura.NumeroPolicia; locActualRow.isDeleted = 0; // Dados: Add_Row_LocalizacaoActual(locActualRow); // GUI: adicionar `a lista: Add_ViewLocalizacaoActual(dicionarioRow, locActualRow); UpdateButtonState(); } break; default: break; } }
private void CADDataRowChangedHandler(object sender, DataRowChangeEventArgs e) { if (e.Action == DataRowAction.Add) { GISADataset.ControloAutDicionarioRow changedCadRow = null; changedCadRow = (GISADataset.ControloAutDicionarioRow)e.Row; GISADataset.ControloAutRow changedCaRow = null; changedCaRow = changedCadRow.ControloAutRow; Debug.WriteLine("[CONTROLO AUT DICIONARIO ADDED]" + new StackFrame(true).ToString()); Trace.Assert(e.Row is GISADataset.ControloAutDicionarioRow); foreach (ListViewItem item in lstVwIndexacao.Items) { GISADataset.IndexFRDCARow ifrdcaRow = null; ifrdcaRow = (GISADataset.IndexFRDCARow)item.Tag; if (changedCaRow == ifrdcaRow.ControloAutRow) { // actualizar a interface com a forma autorizada do CA em causa foreach (GISADataset.ControloAutDicionarioRow cadRow in GisaDataSetHelper.GetInstance().ControloAutDicionario.Select(string.Format("IDControloAut={0}", changedCaRow.ID))) { if (cadRow.TipoControloAutFormaRow.ID == Convert.ToInt64(TipoControloAutForma.FormaAutorizada)) { lstVwIndexacao.BeginUpdate(); item.SubItems[0].Text = cadRow.DicionarioRow.Termo; lstVwIndexacao.EndUpdate(); break; } } } } } }
//metodo responsavel por eliminar toda a nuvem do CA actual em memoria public static PersistencyHelper.DeleteCAXPreConcArguments DeleteCAX(GISADataset.ControloAutRow caRow) { GISADataset.ControloAutDicionarioRow[] cadRows = caRow.GetControloAutDicionarioRows(); GISADataset.DicionarioRow dRow = null; PersistencyHelper.DeleteCAXPreConcArguments args = new PersistencyHelper.DeleteCAXPreConcArguments(); // eliminar registos de "Dicionario" e de "ControloAutDicionario" cadRows.ToList().ForEach(cadRow => { dRow = cadRow.DicionarioRow; args.termos.Add(dRow); cadRow.Delete(); }); args.caRowID = caRow.ID; args.catCode = getCatCode(caRow.TipoNoticiaAutRow); // eliminar registos de IndexFRDCA caRow.GetIndexFRDCARows().ToList().ForEach(idx => idx.Delete()); // Somente para notícias de autoridade relacionaveis caRow.GetControloAutRelRowsByControloAutControloAutRel().ToList().ForEach(carRow => carRow.Delete()); caRow.GetControloAutRelRowsByControloAutControloAutRelAlias().ToList().ForEach(carRow => carRow.Delete()); caRow.GetControloAutEntidadeProdutoraRows().ToList().ForEach(caepRow => caepRow.Delete()); caRow.GetControloAutDatasExistenciaRows().ToList().ForEach(cadeRow => cadeRow.Delete()); caRow.Delete(); return args; }
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; }
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); }
private bool IsValidRelacaoHierarquica(GISADataset.ControloAutRow ControloAutRow) { if (GisaDataSetHelper.GetInstance().RelacaoHierarquica.Select(string.Format("ID={0} AND IDUpper={1} OR ID={1} AND IDUpper={0}", ControloAutRow.GetNivelControloAutRows()[0].NivelRow.ID, this.FRDBase.NivelRow.ID)).Length > 0) { return false; } return true; }
// Obtem a forma autorizada de uma determinada notícia de autoridade, // se não for encontrada é devolvido "nothing" private GISADataset.ControloAutDicionarioRow GetTermoAutorizado(GISADataset.ControloAutRow caRow) { DataRow[] cadRowsAutorizados = null; cadRowsAutorizados = GisaDataSetHelper.GetInstance().ControloAutDicionario.Select("IDControloAut = " + caRow.ID.ToString() + " AND IDTipoControloAutForma = " + System.Enum.Format(typeof(TipoControloAutForma), TipoControloAutForma.FormaAutorizada, "D")); if (cadRowsAutorizados.Length == 1) return (GISADataset.ControloAutDicionarioRow)(cadRowsAutorizados[0]); else return null; }
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); }
private void ConfigureControlsVisibility(IDbConnection conn) { if (!SessionHelper.AppConfiguration.GetCurrentAppconfiguration().IsLicObrEnable() && this.IDTipoNivelRelacionado != TipoNivelRelacionado.D && this.IDTipoNivelRelacionado != TipoNivelRelacionado.SD) { this.contInfLicencaObras1.Visible = false; this.contInfLicencaObrasSD1.Visible = false; this.txtConteudoInformacional.Visible = true; return; } // Pre-definicao: this.contInfLicencaObras1.Visible = false; this.contInfLicencaObrasSD1.Visible = false; this.txtConteudoInformacional.Visible = true; if (this.IDTipoNivelRelacionado == TipoNivelRelacionado.D) { var currentIndexFRDCA = GisaDataSetHelper.GetInstance().IndexFRDCA.Cast <GISADataset.IndexFRDCARow>().Where( r => (r.RowState == DataRowState.Added || r.RowState == DataRowState.Modified || r.RowState == DataRowState.Unchanged) && r.IDFRDBase == CurrentFRDBase.ID && !r.IsSelectorNull() && r.Selector == -1).SingleOrDefault(); if (currentIndexFRDCA != null) { GISADataset.ControloAutRow currentControloAut = currentIndexFRDCA.ControloAutRow; if (IsRelatedToProcessoObras(currentControloAut)) { this.contInfLicencaObras1.Visible = true; this.contInfLicencaObrasSD1.Visible = false; this.txtConteudoInformacional.Visible = false; } } else { var indexFRDCADeletedList = GisaDataSetHelper.GetInstance().IndexFRDCA.Cast <GISADataset.IndexFRDCARow>().Where( r => r.RowState == DataRowState.Deleted && (long)r["IDFRDBase", DataRowVersion.Original] == CurrentFRDBase.ID && r["Selector", DataRowVersion.Original] != null && r["Selector", DataRowVersion.Original].ToString().Equals("-1")).ToArray(); if (indexFRDCADeletedList.Length == 0 && FRDRule.Current.possuiDadosLicencaDeObras(GisaDataSetHelper.GetInstance(), CurrentFRDBase.ID, conn)) { this.contInfLicencaObras1.Visible = true; this.contInfLicencaObrasSD1.Visible = false; this.txtConteudoInformacional.Visible = false; } } } else if (this.IDTipoNivelRelacionado == TipoNivelRelacionado.SD && FRDRule.Current.isDocumentoProcessoObra(CurrentFRDBase.ID, conn)) { this.contInfLicencaObras1.Visible = false; this.contInfLicencaObrasSD1.Visible = true; this.txtConteudoInformacional.Visible = false; } }
// 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); }
private void AddRegistration(GISADataset.ControloAutRow caRow, bool existsModifiedData) { GISADataset.TrusteeUserRow tuAuthor = GetSelectedAuthor(); GISADataset.TrusteeUserRow tuOperator = SessionHelper.GetGisaPrincipal().TrusteeUserOperator; DateTime data; if (PanelCAControlo1 != null) data = PanelCAControlo1.ControloRevisoes1.dtpRecolha.Value; else data = DateTime.Now; GISA.Model.RecordRegisterHelper.RegisterRecordModificationCA(caRow, existsModifiedData, tuOperator, tuAuthor, data); }
private void UpdateEditedItem(ListViewItem item) { // prever a situação de se ter tentado editar uma relação entretanto apagada por // outro utilizador (nesse caso, a interface não é actualizada) if (((DataRow)item.Tag).RowState == DataRowState.Detached) { return; } if (item.Tag is GISADataset.ControloAutRelRow) { GISADataset.ControloAutRelRow carRow = null; carRow = (GISADataset.ControloAutRelRow)item.Tag; if (carRow.ControloAutRowByControloAutControloAutRelAlias.IsChaveColectividadeNull()) { item.SubItems[colIdentificador.Index].Text = string.Empty; } else { item.SubItems[colIdentificador.Index].Text = carRow.ControloAutRowByControloAutControloAutRelAlias.ChaveColectividade; } item.SubItems[colCategoria.Index].Text = carRow.TipoControloAutRelRow.Designacao; item.SubItems[colDataInicio.Index].Text = GISA.Utils.GUIHelper.FormatDate(carRow.InicioAno, carRow.InicioMes, carRow.InicioDia); item.SubItems[colDataFim.Index].Text = GISA.Utils.GUIHelper.FormatDate(carRow.FimAno, carRow.FimMes, carRow.FimDia); item.SubItems[colDescricao.Index].Text = GUIHelper.GUIHelper.ClipText(carRow.Descricao); txtDescricaoRelacao.Text = carRow.Descricao; } else if (item.Tag is GISADataset.RelacaoHierarquicaRow) { GISADataset.RelacaoHierarquicaRow rhRow = null; rhRow = (GISADataset.RelacaoHierarquicaRow)item.Tag; GISADataset.ControloAutRow relatedCA = null; relatedCA = rhRow.NivelRowByNivelRelacaoHierarquica.GetNivelControloAutRows()[0].ControloAutRow; GISADataset.TipoControloAutRelRow tcarHierarquicaRow = null; tcarHierarquicaRow = (GISADataset.TipoControloAutRelRow)(GisaDataSetHelper.GetInstance().TipoControloAutRel.Select(string.Format("ID={0:d}", TipoControloAutRel.Hierarquica))[0]); if (relatedCA.IsChaveColectividadeNull()) { item.SubItems[colIdentificador.Index].Text = string.Empty; } else { item.SubItems[colIdentificador.Index].Text = relatedCA.ChaveColectividade; } // nao actualizar a categoria uma vez que este valor nunca poderá ser editado nas relações hierarquicas item.SubItems[colDataInicio.Index].Text = GISA.Utils.GUIHelper.FormatDate(rhRow.InicioAno, rhRow.InicioMes, rhRow.InicioDia); item.SubItems[colDataFim.Index].Text = GISA.Utils.GUIHelper.FormatDate(rhRow.FimAno, rhRow.FimMes, rhRow.FimDia); item.SubItems[colDescricao.Index].Text = GUIHelper.GUIHelper.ClipText(rhRow.Descricao); txtDescricaoRelacao.Text = rhRow.Descricao; } }
public override void LoadData(DataRow CurrentDataRow, IDbConnection conn) { IsLoaded = false; CurrentControloAut = (GISADataset.ControloAutRow)CurrentDataRow; DBAbstractDataLayer.DataAccessRules.NivelRule.Current.LoadControloAutChildren(CurrentControloAut.ID, GisaDataSetHelper.GetInstance(), conn); DBAbstractDataLayer.DataAccessRules.NivelRule.Current.LoadNivelControloAutChildrenByCA(CurrentControloAut.ID, GisaDataSetHelper.GetInstance(), conn); DBAbstractDataLayer.DataAccessRules.NivelRule.Current.LoadControloAutParents(CurrentControloAut.ID, GisaDataSetHelper.GetInstance(), conn); DBAbstractDataLayer.DataAccessRules.NivelRule.Current.LoadNivelControloAutParentsByCA(CurrentControloAut.ID, GisaDataSetHelper.GetInstance(), conn); IsLoaded = true; }
// A verificacao de igualdade baseia-se nos IDs do ControloAut e FRDBase e no numero de policia: private bool existe_LicencaObraLocalizacaoObraActual(GISADataset.ControloAutRow caRow, string numeroPolicia) { GISADataset.LicencaObraLocalizacaoObraActualRow[] licencasLoc = (GISADataset.LicencaObraLocalizacaoObraActualRow[])(GisaDataSetHelper.GetInstance().Tables["LicencaObraLocalizacaoObraActual"].Select("IDFRDBase = " + CurrentFRDBase.ID)); foreach (GISADataset.LicencaObraLocalizacaoObraActualRow locRow in licencasLoc) { if (locRow.isDeleted == 0 && locRow.NumPolicia.Equals(numeroPolicia) && locRow.IDFRDBase == CurrentFRDBase.ID && locRow.IDControloAut == caRow.ID) { return(true); } } return(false); }
private GISADataset.ControloAutRow[] GetlstVwIndexacaoControloAutRowArray() { GISADataset.ControloAutRow[] cas = null; cas = new GISADataset.ControloAutRow[lstVwIndexacao.SelectedItems.Count]; int i = 0; foreach (ListViewItem li in lstVwIndexacao.SelectedItems) { cas[i] = ((GISADataset.IndexFRDCARow)li.Tag).ControloAutRow; i = i + 1; } return cas; }
private bool existe_LicencaObraTecnicoObra(GISADataset.ControloAutRow caRow) { GISADataset.LicencaObraTecnicoObraRow[] tecnicos = (GISADataset.LicencaObraTecnicoObraRow[])(GisaDataSetHelper.GetInstance().Tables["LicencaObraTecnicoObra"].Select("IDFRDBase = " + CurrentFRDBase.ID)); foreach (GISADataset.LicencaObraTecnicoObraRow tRow in tecnicos) { if (tRow.isDeleted == 0 && tRow.IDFRDBase == CurrentFRDBase.ID && tRow.IDControloAut == caRow.ID) { return(true); } } return(false); }
public override void LoadData(DataRow CurrentDataRow, IDbConnection conn) { IsLoaded = false; CurrentControloAut = (GISADataset.ControloAutRow)CurrentDataRow; if (CurrentControloAut == null) { return; } ControloAutRule.Current.LoadDataPanelCAControlo(GisaDataSetHelper.GetInstance(), CurrentControloAut.ID, conn); QueryFilter = "IDControloAut=" + CurrentControloAut.ID.ToString(); IsLoaded = true; }
// Adiciona ao dataset interno a forma autorizada de uma determinada // notícia de autoridade devolvendo a row adicionanda private GISADataset.ControloAutDicionarioRow GetTermoAutorizadoFromDB(GISADataset.ControloAutRow caRow) { GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection()); try { ControloAutRule.Current.LoadFormaAutorizada(GisaDataSetHelper.GetInstance(), caRow.ID, System.Enum.Format(typeof(TipoControloAutForma), TipoControloAutForma.FormaAutorizada, "D"), ho.Connection); } finally { ho.Dispose(); } return GetTermoAutorizado(caRow); }
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; }
private void AddRelacaoHierarquicaToList(ListViewItem ListViewItem) { GISADataset.RelacaoHierarquicaRow rhRow = null; rhRow = (GISADataset.RelacaoHierarquicaRow)ListViewItem.Tag; GISADataset.ControloAutRow caRow = null; GISADataset.ControloAutRow caUpperRow = null; caRow = rhRow.NivelRowByNivelRelacaoHierarquica.GetNivelControloAutRows()[0].ControloAutRow; caUpperRow = rhRow.NivelRowByNivelRelacaoHierarquicaUpper.GetNivelControloAutRows()[0].ControloAutRow; GISADataset.TipoControloAutRelRow tcarHierarquicaRow = null; tcarHierarquicaRow = (GISADataset.TipoControloAutRelRow)(GisaDataSetHelper.GetInstance().TipoControloAutRel.Select(string.Format("ID={0:d}", TipoControloAutRel.Hierarquica))[0]); if (caRow.ID != CurrentControloAut.ID) { if (caRow.IsChaveColectividadeNull()) { ListViewItem.SubItems.Add(string.Empty); } else { ListViewItem.SubItems.Add(caRow.ChaveColectividade); } } else { if (caUpperRow.IsChaveColectividadeNull()) { ListViewItem.SubItems.Add(string.Empty); } else { ListViewItem.SubItems.Add(caUpperRow.ChaveColectividade); } } string tipoRelacao = null; if (caRow.ID != CurrentControloAut.ID) { tipoRelacao = string.Format("{0} ({1})", tcarHierarquicaRow.DesignacaoInversa, rhRow.TipoNivelRelacionadoRow.Designacao); } else { tipoRelacao = string.Format("{0} ({1})", tcarHierarquicaRow.Designacao, rhRow.TipoNivelRelacionadoRow.Designacao); } ListViewItem.SubItems.Add(tipoRelacao); ListViewItem.SubItems.Add(GUIHelper.GUIHelper.FormatStartDate(rhRow)); ListViewItem.SubItems.Add(GUIHelper.GUIHelper.FormatEndDate(rhRow)); ListViewItem.SubItems.Add(GUIHelper.GUIHelper.ClipText(GISA.Model.GisaDataSetHelper.GetDBNullableText(rhRow, "Descricao"))); }
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; }
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); } }
// Adicionar um tecnico de obra (registo de autoridade onomastico): private void btnAddTecnicoObra_Click(object sender, EventArgs e) { FormPickControloAut frmPick = new FormPickControloAut(); frmPick.Text = "Notícia de autoridade - Pesquisar registo de autoridade onomástico"; frmPick.caList.AllowedNoticiaAut(TipoNoticiaAut.Onomastico); frmPick.caList.ReloadList(); GISADataset.ControloAutRow caRow = null; GISADataset.LicencaObraTecnicoObraRow tecnicoRow = null; GISADataset.ControloAutDicionarioRow dicionarioRow = null; if (frmPick.caList.Items.Count > 0) { frmPick.caList.SelectItem(frmPick.caList.Items[0]); } switch (frmPick.ShowDialog()) { case DialogResult.OK: foreach (ListViewItem li in frmPick.caList.SelectedItems) { dicionarioRow = (GISADataset.ControloAutDicionarioRow)li.Tag; caRow = dicionarioRow.ControloAutRow; if (!existe_LicencaObraTecnicoObra(caRow)) { tecnicoRow = GisaDataSetHelper.GetInstance().LicencaObraTecnicoObra.NewLicencaObraTecnicoObraRow(); tecnicoRow.LicencaObraRow = CurrentLicencaObra; tecnicoRow.ControloAutRow = caRow; tecnicoRow.isDeleted = 0; // Dados: Add_RowTecnicoObra(tecnicoRow); // GUI: adicionar `a lista: Add_ViewTecnicoObra(dicionarioRow, tecnicoRow); } } break; default: break; } }
private void UpdateCA(GISADataset.ControloAutRow caRow) { switch (caRow.IDTipoNoticiaAut) { case (long)TipoNoticiaAut.EntidadeProdutora: GISA.Search.Updater.updateProdutor(caRow.ID); GISA.Search.Updater.updateNivelDocumentalComProdutores(caRow.GetNivelControloAutRows()[0].ID); break; case (long)TipoNoticiaAut.Onomastico: case (long)TipoNoticiaAut.Ideografico: case (long)TipoNoticiaAut.ToponimicoGeografico: GISA.Search.Updater.updateAssunto(caRow.ID); break; case (long)TipoNoticiaAut.TipologiaInformacional: GISA.Search.Updater.updateTipologia(caRow.ID); break; } }
private void trVwTermoIndexacao_DoubleClick(object sender, EventArgs e) { if (!NavigationMode || this.SelectedNode == null || this.SelectedNode.Tag == null) { return; } var branchNode = GetBranchNode(this.SelectedNode); // Permite-se navegar só nos ControloAutRels (Excepto ControloAutDicionario que seja termo de topo) if (branchNode == this.SelectedNode || !(this.SelectedNode.Tag is GISADataset.ControloAutRelRow || (this.SelectedNode.Tag is GISADataset.ControloAutDicionarioRow && branchNode.Text.Equals("Termo de topo")))) { return; } if (this.SelectedNode.Tag is GISADataset.ControloAutDicionarioRow) { currentControloAut = ((GISADataset.ControloAutDicionarioRow) this.SelectedNode.Tag).ControloAutRow; } else { var tcarRow = this.SelectedNode.Tag as GISADataset.ControloAutRelRow; currentControloAut = currentControloAut.ID == tcarRow.ControloAutRowByControloAutControloAutRelAlias.ID ? tcarRow.ControloAutRowByControloAutControloAutRel : tcarRow.ControloAutRowByControloAutControloAutRelAlias; } GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection()); try { this.trVwTermoIndexacao.Nodes.Clear(); this.LoadData(currentControloAut, ho.Connection); } catch (Exception) { throw; } finally { ho.Dispose(); } }
private void CADataRowChangedHandler(object sender, DataRowChangeEventArgs e) { if (e.Action == DataRowAction.Delete) { Trace.Assert(e.Row is GISADataset.ControloAutRow); GISADataset.ControloAutRow changedCaRow = null; changedCaRow = (GISADataset.ControloAutRow)e.Row; foreach (ListViewItem item in lstVwIndexacao.Items) { GISADataset.IndexFRDCARow ifrdcaRow = null; ifrdcaRow = (GISADataset.IndexFRDCARow)item.Tag; // prever os que ainda nao tivessem sido persistidos e os que tinham sido persistidos mas foram agora eliminados if (ifrdcaRow.RowState == DataRowState.Detached || System.Convert.ToInt32(changedCaRow["ID", DataRowVersion.Original]) == System.Convert.ToInt32(ifrdcaRow["IDControloAut", DataRowVersion.Original])) { //GisaDataSetHelper.GetInstance().IndexFRDCA.Rows.Remove(ifrdcaRow) // a row ja foi eliminada no modelo de dados. elimina-se agora da interface item.Remove(); } } } }
private void trVwTermoIndexacao_DoubleClick(object sender, EventArgs e) { if (!NavigationMode || this.SelectedNode == null || this.SelectedNode.Tag == null) return; var branchNode = GetBranchNode(this.SelectedNode); // Permite-se navegar só nos ControloAutRels (Excepto ControloAutDicionario que seja termo de topo) if (branchNode == this.SelectedNode || !(this.SelectedNode.Tag is GISADataset.ControloAutRelRow || (this.SelectedNode.Tag is GISADataset.ControloAutDicionarioRow && branchNode.Text.Equals("Termo de topo")))) return; if (this.SelectedNode.Tag is GISADataset.ControloAutDicionarioRow) currentControloAut = ((GISADataset.ControloAutDicionarioRow)this.SelectedNode.Tag).ControloAutRow; else { var tcarRow = this.SelectedNode.Tag as GISADataset.ControloAutRelRow; currentControloAut = currentControloAut.ID == tcarRow.ControloAutRowByControloAutControloAutRelAlias.ID ? tcarRow.ControloAutRowByControloAutControloAutRel : tcarRow.ControloAutRowByControloAutControloAutRelAlias; } GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection()); try { this.trVwTermoIndexacao.Nodes.Clear(); this.LoadData(currentControloAut, ho.Connection); } catch (Exception) { throw; } finally { ho.Dispose(); } }
protected override void AcceptContents(object Value) { this.ControloAutRow = (GISADataset.ControloAutRow)Value; if (FRDBaseRow != null) { NotPresentInIndexResults indexPresence = NotPresentInIndex(ControloAutRow); switch (indexPresence) { case NotPresentInIndexResults.NotPresentInIndex: { TempIndexFRDCA = NewRow(ControloAutRow); GISADataset.ControloAutDicionarioRow[] cadRows = null; cadRows = (GISADataset.ControloAutDicionarioRow[])(GisaDataSetHelper.GetInstance().ControloAutDicionario.Select(string.Format("IDControloAut={0} AND IDTipoControloAutForma = {1:d}", ControloAutRow.ID, TipoControloAutForma.FormaAutorizada))); if (cadRows.Length == 0) { GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection()); try { DBAbstractDataLayer.DataAccessRules.ControloAutRule.Current.LoadFormaAutorizada(ControloAutRow.ID, GisaDataSetHelper.GetInstance(), ho.Connection); } finally { ho.Dispose(); } cadRows = (GISADataset.ControloAutDicionarioRow[])(GisaDataSetHelper.GetInstance().ControloAutDicionario.Select(string.Format("IDControloAut={0} AND IDTipoControloAutForma = {1:d}", ControloAutRow.ID, TipoControloAutForma.FormaAutorizada))); } if (cadRows.Length > 0) { DisplayFormaAutorizada(cadRows[0]); } break; } case NotPresentInIndexResults.PresentInIndex: { MessageBox.Show("Não é possível a existência de items repetidos.", "Adição", MessageBoxButtons.OK, MessageBoxIcon.Warning); break; } case NotPresentInIndexResults.PresentInIndexDeleted: { GISADataset.ControloAutDicionarioRow[] cadRows = null; TempIndexFRDCA = GetRow(); cadRows = (GISADataset.ControloAutDicionarioRow[])(GisaDataSetHelper.GetInstance().ControloAutDicionario.Select(string.Format("IDControloAut={0} AND IDTipoControloAutForma = {1:d}", ControloAutRow.ID, TipoControloAutForma.FormaAutorizada))); if (cadRows.Length == 0) { GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection()); try { DBAbstractDataLayer.DataAccessRules.ControloAutRule.Current.LoadFormaAutorizada(ControloAutRow.ID, GisaDataSetHelper.GetInstance(), ho.Connection); } finally { ho.Dispose(); } cadRows = (GISADataset.ControloAutDicionarioRow[])(GisaDataSetHelper.GetInstance().ControloAutDicionario.Select(string.Format("IDControloAut={0} AND IDTipoControloAutForma = {1:d}", ControloAutRow.ID, TipoControloAutForma.FormaAutorizada))); } if (cadRows.Length > 0) { DisplayFormaAutorizada(cadRows[0]); } break; } } } else if (this.ControloAutRow != null) { // TODO: FIXME legibilidade // Determinar se Value já se encontra em ControloAutRel try { // make sure we do not relate an item to itself if (ControloAutRow.ID == this.ControloAutRow.ID) { return; } // If the dropped item was not already added to the selected // item (or vice versa) if (GisaDataSetHelper.GetInstance().ControloAutRel.Select(GetRelConstraint(ControloAutRow, this.ControloAutRow) + " OR " + GetRelConstraint(this.ControloAutRow, ControloAutRow)).Length == 0) { // adicionar nova relação FormControloAutRel frm = new FormControloAutRel(ControloAutRow, parent); switch (frm.ShowDialog()) { case DialogResult.OK: TempIndexFRDCA = GisaDataSetHelper.GetInstance().ControloAutRel.NewControloAutRelRow(); GISADataset.ControloAutRelRow tempWith1 = (GISADataset.ControloAutRelRow)TempIndexFRDCA; tempWith1.IDControloAut = this.ControloAutRow.ID; tempWith1.IDControloAutAlias = ControloAutRow.ID; tempWith1["IDTipoRel"] = ((GISADataset.TipoControloAutRelRow)(((DataRowView)frm.relacaoCA.cbTipoControloAutRel.SelectedItem).Row)).ID; tempWith1.Descricao = frm.relacaoCA.txtDescricao.Text; GisaDataSetHelper.GetInstance().ControloAutRel.AddControloAutRelRow((GISADataset.ControloAutRelRow)TempIndexFRDCA); break; case DialogResult.Cancel: return; } GisaDataSetHelper. VisitControloAutDicionario(ControloAutRow, DisplayFormaAutorizada); } } catch (Exception ex) { Trace.WriteLine(ex); } } }
public override void LoadData(DataRow CurrentDataRow, IDbConnection conn) { IsLoaded = false; CurrentControloAut = (GISADataset.ControloAutRow)CurrentDataRow; if (CurrentControloAut == null) return; ControloAutRule.Current.LoadDataPanelCAControlo(GisaDataSetHelper.GetInstance(), CurrentControloAut.ID, conn); QueryFilter = "IDControloAut=" + CurrentControloAut.ID.ToString(); IsLoaded = true; }
private GISADataset.ControloAutRow[] GetlstVwControloAutRowArray() { GISADataset.ControloAutRow[] cas = null; cas = new GISADataset.ControloAutRow[caList.SelectedItems.Count]; int i = 0; foreach (ListViewItem li in caList.SelectedItems) { cas[i] = ((GISADataset.ControloAutDicionarioRow)li.Tag).ControloAutRow; i = i + 1; } return cas; }
public override void LoadData() { try { ((frmMain)TopLevelControl).EnterWaitMode(); GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection()); try { if (! isLoaded) { if (CurrentContext.ControloAutDicionario == null) { CurrentControloAut = null; return; } CurrentControloAut = CurrentContext.ControloAutDicionario.ControloAutRow; GisaDataSetHelper.ManageDatasetConstraints(false); // Recarregar o próprio registo de autoridade para despistar // o caso em que alguem o possa entretanto já ter eliminado ControloAutRule.Current.LoadControloAut(GisaDataSetHelper.GetInstance(), CurrentContext.ControloAutDicionario.IDControloAut, ho.Connection); if (CurrentControloAut == null || CurrentControloAut.RowState == DataRowState.Detached) { return; } ControloAutRule.Current.LoadControloAutData(GisaDataSetHelper.GetInstance(), CurrentContext.ControloAutDicionario.IDControloAut, ho.Connection); GisaDataSetHelper.ManageDatasetConstraints(true); isLoaded = true; } GISAPanel selectedPanel = (GISAPanel)this.DropDownTreeView1.SelectedNode.Tag; if (! selectedPanel.IsLoaded) { GisaDataSetHelper.ManageDatasetConstraints(false); long startTicks = 0; startTicks = DateTime.Now.Ticks; selectedPanel.LoadData(CurrentContext.ControloAutDicionario.ControloAutRow, 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(); } }
public void LoadData(GISADataset.ControloAutRow caRow, IDbConnection conn) { GisaDataSetHelper.HoldOpen ho = null; TreeNode node = null; currentControloAut = caRow; nodeList = new Dictionary<DataRow, TreeNode>(); ControloAutRule.Current.LoadThesaurus(GisaDataSetHelper.GetInstance(), currentControloAut.ID, conn); ReloadTermoDeTopo(conn); // adicionar ramos trVwTermoIndexacao.BeginUpdate(); foreach (GISADataset.TipoNoticiaATipoControloAFormaRow nacaf in GisaDataSetHelper.GetInstance().TipoNoticiaATipoControloAForma.Select(string.Format("IDTipoNoticiaAut={0}", caRow.IDTipoNoticiaAut))) { node = trVwTermoIndexacao.Nodes.Add(nacaf.TipoControloAutFormaRow.Designacao); node.Tag = nacaf.TipoControloAutFormaRow; } if (caRow.IDTipoNoticiaAut == Convert.ToInt64(TipoNoticiaAut.Ideografico) || caRow.IDTipoNoticiaAut == Convert.ToInt64(TipoNoticiaAut.Onomastico) || caRow.IDTipoNoticiaAut == Convert.ToInt64(TipoNoticiaAut.ToponimicoGeografico)) { // Activate thesaurus relations trVwTermoIndexacao.Nodes.Add("Termo de topo"); foreach (GISADataset.TipoControloAutRelRow tcar in GisaDataSetHelper.GetInstance().TipoControloAutRel.Select("Thesaurus=1")) { node = trVwTermoIndexacao.Nodes.Add(tcar.Designacao); node.Tag = tcar; if (tcar.Designacao != tcar.DesignacaoInversa) { node = trVwTermoIndexacao.Nodes.Add(tcar.DesignacaoInversa); node.Tag = tcar; } } ClearThesaurus(); ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection()); try { PopulateThesaurus(ho.Connection); } catch (Exception ex) { Trace.WriteLine(ex); throw; } finally { ho.Dispose(); } RepopulateTermoDeTopo(); } else if (caRow.IDTipoNoticiaAut == Convert.ToInt64(TipoNoticiaAut.TipologiaInformacional)) { // activate "Termo Relacionado" foreach (GISADataset.TipoControloAutRelRow tcar in GisaDataSetHelper.GetInstance().TipoControloAutRel.Select("Thesaurus=1")) { if (tcar.Designacao == tcar.DesignacaoInversa) { //TODO: INSTANT C# TODO TASK: The return type of the tempWith4 variable must be corrected. //ORIGINAL LINE: With trVwTermoIndexacao.Nodes.Add(tcar.Designacao) node = trVwTermoIndexacao.Nodes.Add(tcar.Designacao); node.Tag = tcar; } } ClearThesaurus(); ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection()); try { PopulateThesaurus(ho.Connection); } catch (Exception ex) { Trace.WriteLine(ex); throw; } finally { ho.Dispose(); } RepopulateTermoDeTopo(); } GisaDataSetHelper.VisitControloAutDicionario(caRow, PutDicionarioInTreeView); trVwTermoIndexacao.ExpandAll(); trVwTermoIndexacao.EndUpdate(); }