private void RemoveNivel() { GISATreeNode node = null; GISATreeNode parentNode = null; GISADataset.NivelRow nUpperRow = null; GISADataset.RelacaoHierarquicaRow rhRow = null; GISADataset.NivelRow nRow = null; var objDigital = default(ObjDigital); if (this.nivelNavigator1.PanelToggleState == NivelNavigator.ToggleState.Estrutural) { if (this.nivelNavigator1.SelectedNode != null) { nRow = ((GISATreeNode)this.nivelNavigator1.SelectedNode).NivelRow; rhRow = ((GISATreeNode)this.nivelNavigator1.SelectedNode).RelacaoHierarquicaRow; } node = (GISATreeNode)this.nivelNavigator1.SelectedNode; parentNode = (GISATreeNode)node.Parent; nUpperRow = (GISADataset.NivelRow)node.NivelUpperRow; } else { nRow = this.nivelNavigator1.SelectedNivel; // Verificar se a relacção hierárquica ainda é a mesma apresentada na interface (se o // utilizador estiver a ver a lista que contem o nível a apagar e entretanto outro utilizador // o ter colocado noutro ponto da árvore, a relação hierárquica presente em memória deixa // de corresponder com aquela que é apresentada na interface quando esse nível é selecionado; // quando o nível é selecionado a informação no DataSet de trabalho é actualizado mas não // actualiza a interface) if (GisaDataSetHelper.GetInstance().RelacaoHierarquica.Select(string.Format("ID={0} AND IDUpper={1}", nRow.ID, this.nivelNavigator1.ContextBreadCrumbsPathID)).Length > 0) rhRow = (GISADataset.RelacaoHierarquicaRow)(GisaDataSetHelper.GetInstance().RelacaoHierarquica.Select(string.Format("ID={0} AND IDUpper={1}", nRow.ID, this.nivelNavigator1.ContextBreadCrumbsPathID))[0]); else { MessageBox.Show("Esta operação não pode ser concluída pelo facto de a localização na estrutura " + System.Environment.NewLine + "do nível selecionado ter sido alterada por outro utilizador.", "Eliminar Nível", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } nUpperRow = (GISADataset.NivelRow)(GisaDataSetHelper.GetInstance().Nivel.Select(string.Format("ID={0}", this.nivelNavigator1.ContextBreadCrumbsPathID))[0]); if (!FedoraHelper.CanDeleteODsAssociated2UI(nRow, out objDigital)) return; } // Não permitir a eliminação de relações entre EPs if (TipoNivel.isNivelOrganico(nRow) && TipoNivel.isNivelOrganico(nUpperRow)) { MessageBox.Show("A alteração de relações entre entidades produtoras deverão ser efectuadas através do controlo de autoridade.", "Eliminação de relação", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } var assocODs = FedoraHelper.GetAssociatedODsDetailsMsg(nRow.ID); if (assocODs.Length > 0) { FormDeletionReport form = new FormDeletionReport(); form.Text = "Eliminação de unidade de informação"; form.Interrogacao = "A unidade de informação selecionada tem objeto(s) digital(ais) associado(s). " + System.Environment.NewLine + "Se eliminar esta unidade de informação, os objeto(s) digital(ais) " + System.Environment.NewLine + " também serão eliminado(s)." + System.Environment.NewLine + "Pretende continuar?"; form.Detalhes = assocODs; if (form.ShowDialog() == DialogResult.Cancel) return; } else if (MessageBox.Show("Tem a certeza que deseja eliminar o nível selecionado?", "Eliminação de relação", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel) return; Trace.WriteLine("A apagar nível..."); // actualizar objecto digital caso exista var preTransactionAction = new PreTransactionAction(); var fedArgs = new PersistencyHelper.FedoraIngestPreTransactionArguments(); preTransactionAction.args = fedArgs; preTransactionAction.preTransactionDelegate = delegate(PersistencyHelper.PreTransactionArguments preTransactionArgs) { bool ingestSuccess = true; string msg = null; var odsToIngest = FedoraHelper.DeleteObjDigital(nRow); odsToIngest.ForEach(od => ingestSuccess &= SessionHelper.AppConfiguration.GetCurrentAppconfiguration().FedoraHelperSingleton.Ingest(od, out msg)); preTransactionArgs.cancelAction = !ingestSuccess; preTransactionArgs.message = msg; }; // Se se tratar da relação entre um nível orgânico e uma ED ou GA // ou se se tratar da relação entre um nível documental e um nível // orgânio é necessário proceder de outras formas if (TipoNivel.isNivelOrganico(nRow) && TipoNivel.isNivelLogico(nUpperRow)) { if (MessageBox.Show( "Por favor tenha em atenção que a entidade produtora propriamente " + System.Environment.NewLine + "dita não será eliminada, apenas a relação ao nível superior o será.", "Eliminação de relação", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.Cancel) return; ((frmMain)TopLevelControl).EnterWaitMode(); string key = ControloNivelList.getKey(node); PersistencyHelper.canDeleteRHRowPreConcArguments args = new PersistencyHelper.canDeleteRHRowPreConcArguments(); args.nRowID = node.NivelRow.ID; args.nUpperRowID = node.NivelUpperRow.ID; args.rhRowID = node.RelacaoHierarquicaRow.ID; args.rhRowIDUpper = node.RelacaoHierarquicaRow.IDUpper; CurrentContext.RaiseRegisterModificationEvent(nRow.GetFRDBaseRows()[0]); var successfulSave = PersistencyHelper.save(DelegatesHelper.verifyIfCanDeleteRH, args); //tds.Add(GisaDataSetHelper.GetInstance().Tables["RelacaoHierarquica"]); PersistencyHelper.cleanDeletedData(PersistencyHelper.determinaNuvem("RelacaoHierarquica")); if (args.deleteSuccessful) { GISA.Search.Updater.updateProdutor(node.NivelRow.GetNivelControloAutRows()[0].IDControloAut); //Prevenir o beforeNewSelection que o Remove ia desencadear. this.nivelNavigator1.AddHandlers(); this.nivelNavigator1.RemoveFromTreeview(node, key); this.nivelNavigator1.RemoveHandlers(); } else MessageBox.Show(args.message, "Eliminação de relação", MessageBoxButtons.OK, MessageBoxIcon.Information); ((frmMain)TopLevelControl).LeaveWaitMode(); } else if (TipoNivel.isNivelDocumental(nRow) && TipoNivel.isNivelOrganico(nUpperRow)) { // Verificar que existem várias relações hierárquicas deste // nível documental a entidades produtoras superiores. Nesse // caso deverá ser removida a relação, caso contrário, se não // existirem subníveis documentais, será eliminado o próprio // nível(documental) int numRHs = nRow.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica().Length; if (numRHs > 1) { if (MessageBox.Show( "Por favor tenha em atenção que são vários os produtores deste " + System.Environment.NewLine + "nível documental. O nível documental propriamente dito não " + System.Environment.NewLine + "será eliminado, apenas a sua relação ao nível orgânico " + System.Environment.NewLine + "superior o será.", "Eliminação de relação", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.Cancel) return; ((frmMain)TopLevelControl).EnterWaitMode(); CurrentContext.RaiseRegisterModificationEvent(nRow.GetFRDBaseRows()[0]); PersistencyHelper.canDeleteRHRowPreConcArguments args = new PersistencyHelper.canDeleteRHRowPreConcArguments(); args.nRowID = nRow.ID; args.nUpperRowID = nUpperRow.ID; args.rhRowID = rhRow.ID; args.rhRowIDUpper = rhRow.IDUpper; PersistencyHelper.SaveResult successfulSave = PersistencyHelper.save(DelegatesHelper.verifyIfCanDeleteRH, args); PersistencyHelper.cleanDeletedData(PersistencyHelper.determinaNuvem("RelacaoHierarquica")); if (args.deleteSuccessful) { if (successfulSave == PersistencyHelper.SaveResult.successful) { List<string> IDNiveis = new List<string>(); IDNiveis.Add(args.nRowID.ToString()); GISA.Search.Updater.updateNivelDocumental(IDNiveis); GISA.Search.Updater.updateNivelDocumentalComProdutores(nRow.ID); this.nivelNavigator1.RemoveSelectedLVItem(); } } else MessageBox.Show(args.message, "Eliminação de relação", MessageBoxButtons.OK, MessageBoxIcon.Information); ((frmMain)TopLevelControl).LeaveWaitMode(); } else if (numRHs == 1) { // Verificar que não existem subníveis documentais int numSubRHs = GisaDataSetHelper.GetInstance().RelacaoHierarquica.Select(string.Format("IDUpper={0}", nRow.ID)).Length; if (numSubRHs > 0) { MessageBox.Show("Só é possível eliminar os níveis que não tenham outros directamente associados", "Eliminação de relação", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { if (MessageBox.Show( "Por favor tenha em atenção que este nível documental é produzido" + System.Environment.NewLine + "por apenas uma entidade. Ao remover esta relação será perdida " + System.Environment.NewLine + "não só a relação como o nível documental propriamente dito.", "Eliminação de relação", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.Cancel) return; ((frmMain)TopLevelControl).EnterWaitMode(); CurrentContext.RaiseRegisterModificationEvent(nRow.GetFRDBaseRows()[0]); PersistencyHelper.canDeleteRHRowPreConcArguments argsPca = new PersistencyHelper.canDeleteRHRowPreConcArguments(); argsPca.nRowID = nRow.ID; argsPca.nUpperRowID = nUpperRow.ID; argsPca.rhRowID = 0; argsPca.rhRowIDUpper = 0; PersistencyHelper.DeleteIDXPreSaveArguments argsPsa = new PersistencyHelper.DeleteIDXPreSaveArguments(); argsPsa.ID = nRow.ID; PersistencyHelper.SaveResult successfulSave = PersistencyHelper.save(DelegatesHelper.verifyIfCanDeleteRH, argsPca, Nivel.DeleteNivelXInDataBase, argsPsa, preTransactionAction); if (argsPca.deleteSuccessful) { if (successfulSave == PersistencyHelper.SaveResult.successful) { List<string> IDNiveis = new List<string>(); IDNiveis.Add(nRow.ID.ToString()); GISA.Search.Updater.updateNivelDocumental(IDNiveis); GISA.Search.Updater.updateNivelDocumentalComProdutores(nRow.ID); this.nivelNavigator1.RemoveSelectedLVItem(); } } else { // se o nível a eliminar se tratar de uma série ou documento solto mas que // por motivos de conflito de concorrência não foi possível executar, // o refrescamento dos botões é feito tendo como o contexto o próprio // nível que se pretendeu eliminar para desta forma o estado dos mesmos // estar correcta (caso contrário o estado dos botões referir-se-ia a // não haver qualquer item selecionado MessageBox.Show(argsPca.message, "Eliminação de relação", MessageBoxButtons.OK, MessageBoxIcon.Information); UpdateToolBarButtons(this.nivelNavigator1.SelectedItems[0]); } PersistencyHelper.cleanDeletedData(new List<TableDepthOrdered.TableCloudType>(new TableDepthOrdered.TableCloudType[] { PersistencyHelper.determinaNuvem("RelacaoHierarquica"), PersistencyHelper.determinaNuvem("FRDBase") })); ((frmMain)TopLevelControl).LeaveWaitMode(); } } else Debug.Assert(false, "Should never happen. There must be a relation with an upper Nivel."); } else { // Entre todos os outros tipos de nível proceder normalmente if (this.nivelNavigator1.PanelToggleState == NivelNavigator.ToggleState.Estrutural) { ((frmMain)TopLevelControl).EnterWaitMode(); string key = ControloNivelList.getKey(node); PersistencyHelper.canDeleteRHRowPreConcArguments argsPca = new PersistencyHelper.canDeleteRHRowPreConcArguments(); argsPca.nRowID = node.NivelRow.ID; //se não se tratar de uma entidade detentora nem de um grupo de arquivos não é necessário criar uma entrada na tabela de controlo de descrição if (node.NivelUpperRow != null && node.NivelRow.IDTipoNivel != TipoNivel.LOGICO) { argsPca.nUpperRowID = node.NivelUpperRow.ID; CurrentContext.RaiseRegisterModificationEvent(nRow.GetFRDBaseRows()[0]); } else argsPca.nUpperRowID = 0; argsPca.rhRowID = 0; argsPca.rhRowIDUpper = 0; PersistencyHelper.DeleteIDXPreSaveArguments argsPsa = new PersistencyHelper.DeleteIDXPreSaveArguments(); argsPsa.ID = nRow.ID; PersistencyHelper.save(DelegatesHelper.verifyIfCanDeleteRH, argsPca, Nivel.DeleteNivelXInDataBase, argsPsa); PersistencyHelper.cleanDeletedData(new List<TableDepthOrdered.TableCloudType>(new TableDepthOrdered.TableCloudType[] { PersistencyHelper.determinaNuvem("RelacaoHierarquica"), PersistencyHelper.determinaNuvem("FRDBase") })); if (argsPca.deleteSuccessful) this.nivelNavigator1.RemoveFromTreeview(node, key); else MessageBox.Show(argsPca.message, "Eliminação de relação", MessageBoxButtons.OK, MessageBoxIcon.Information); ((frmMain)TopLevelControl).LeaveWaitMode(); } else { if ((nRow.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica()[0].IDTipoNivelRelacionado == TipoNivelRelacionado.D || nRow.GetRelacaoHierarquicaRowsByNivelRelacaoHierarquica()[0].IDTipoNivelRelacionado == TipoNivelRelacionado.SD) && NiveisHelper.NivelFoiMovimentado(nRow.ID)) { if (MessageBox.Show( "Por favor tenha em atenção que este nível documental já foi " + System.Environment.NewLine + "requisitado/devolvido. Ao remover nível documental serão perdidos " + System.Environment.NewLine + "todos os seus registos referentes a requisições e devoluções.", "Eliminação de nível documental", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.Cancel) return; } ((frmMain)TopLevelControl).EnterWaitMode(); CurrentContext.RaiseRegisterModificationEvent(nRow.GetFRDBaseRows()[0]); PersistencyHelper.canDeleteRHRowPreConcArguments argsPca = new PersistencyHelper.canDeleteRHRowPreConcArguments(); argsPca.nRowID = nRow.ID; argsPca.nUpperRowID = nUpperRow.ID; argsPca.rhRowID = 0; argsPca.rhRowIDUpper = 0; PersistencyHelper.DeleteIDXPreSaveArguments argsPsa = new PersistencyHelper.DeleteIDXPreSaveArguments(); argsPsa.ID = nRow.ID; PersistencyHelper.SaveResult successfulSave = PersistencyHelper.save(DelegatesHelper.verifyIfCanDeleteRH, argsPca, Nivel.DeleteNivelXInDataBase, argsPsa, preTransactionAction); PersistencyHelper.cleanDeletedData(new List<TableDepthOrdered.TableCloudType>(new TableDepthOrdered.TableCloudType[] { PersistencyHelper.determinaNuvem("RelacaoHierarquica"), PersistencyHelper.determinaNuvem("FRDBase"), PersistencyHelper.determinaNuvem("ObjetoDigital") })); if (argsPca.deleteSuccessful) { if (successfulSave == PersistencyHelper.SaveResult.successful) { List<string> IDNiveis = new List<string>(); IDNiveis.Add(argsPsa.ID.ToString()); GISA.Search.Updater.updateNivelDocumental(IDNiveis); if (nRow.RowState == DataRowState.Detached) GISA.Search.Updater.updateNivelDocumentalComProdutores(argsPsa.ID); else GISA.Search.Updater.updateNivelDocumentalComProdutores(nRow.ID); this.nivelNavigator1.RemoveSelectedLVItem(); } } else MessageBox.Show(argsPca.message, "Eliminação de relação", MessageBoxButtons.OK, MessageBoxIcon.Information); ((frmMain)TopLevelControl).LeaveWaitMode(); } } RevalidateClipboardNivelItem(); if (this.nivelNavigator1.PanelToggleState == NivelNavigator.ToggleState.Estrutural && parentNode != null) { //remover o nó do controlo embora sem refrescar a interface this.nivelNavigator1.SelectParentNode(parentNode); UpdateContext(); } else { //A selecção foi limpa aquando da eliminação do item UpdateToolBarButtons(); } }
public static void CascadeDeleteFRD(GISADataset.FRDBaseRow FRDRow) { PersistencyHelper.DeleteIDXPreSaveArguments args = new PersistencyHelper.DeleteIDXPreSaveArguments(); args.ID = FRDRow.ID; DeleteInDataSet(FRDRow); PersistencyHelper.save(new PersistencyHelper.preSaveDelegate(DeleteFRDBaseXInDataBase), args); PersistencyHelper.cleanDeletedData(); }
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; }
//INSTANT C# NOTE: C# does not support optional parameters. Overloaded method(s) are created above. //ORIGINAL LINE: Public Shared Sub DeleteControloAut(ByVal caList As ControloAutList, ByVal Caption As String, ByVal Interrogacao As String, ByVal MessageBoxText As String, Optional ByVal caller As Control = null) public static void DeleteControloAut(ControloAutList caList, string Caption, string Interrogacao, string MessageBoxText, Control caller) { bool HasDocumentData = false; List<string> nivelIDsAssoc = new List<string>(); string Detalhes = null; if (caller != null) ((frmMain)caller.TopLevelControl).EnterWaitMode(); Detalhes = ControloAutHelper.GetControloAutUsage(caList.SelectedItems.Cast<ListViewItem>().Select(i => i.Tag as GISADataset.ControloAutDicionarioRow).ToList(), ref HasDocumentData, ref nivelIDsAssoc); if (caller != null) ((frmMain)caller.TopLevelControl).LeaveWaitMode(); if (Detalhes.Length > 0) { FormDeletionReport form = new FormDeletionReport(); form.Text = Caption; form.Interrogacao = Interrogacao; form.Detalhes = Detalhes; if (HasDocumentData) { form.SetBtnOKVisible(false); form.Interrogacao = "Este elemento não pode ser removido enquanto lhe existirem associados níveis documentais."; } if (form.ShowDialog() == DialogResult.Cancel) return; } else { switch (MessageBox.Show(MessageBoxText, Caption, MessageBoxButtons.OKCancel)) { case System.Windows.Forms.DialogResult.OK: break; case System.Windows.Forms.DialogResult.Cancel: return; default: Debug.Assert(false, "Unexpected DialogResult."); break; } } Trace.WriteLine("A apagar notícia de autoridade..."); ListViewItem selectedItem = null; if (caList.SelectedItems.Count > 0) { Debug.Assert(caList.SelectedItems.Count == 1, "Só deveria existir 1 item selecionado."); selectedItem = caList.SelectedItems[0]; GISADataset.ControloAutDicionarioRow cadRow = null; GISADataset.ControloAutRow caRow = null; cadRow = (GISADataset.ControloAutDicionarioRow)selectedItem.Tag; caRow = cadRow.ControloAutRow; // Remover a selecção do item vai provocar uma mudança de contexto que // por sua vez vai provocar uma gravação dos dados caList.ClearItemSelection(selectedItem); var ho = default(GisaDataSetHelper.HoldOpen); if (caller != null && caller.GetType() == typeof(MasterPanelControloAut)) { ((MasterPanelControloAut)caller).CurrentContext.RaiseRegisterModificationEvent(caRow); if (caRow.IDTipoNoticiaAut == (long)TipoNoticiaAut.EntidadeProdutora) { var frdRow = default(GISADataset.FRDBaseRow); long IDTipoNivelRelacionado = -1; ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection()); try { DBAbstractDataLayer.DataAccessRules.FRDRule.Current.LoadFRD(GisaDataSetHelper.GetInstance(), caRow.GetNivelControloAutRows().Single().ID, ho.Connection); frdRow = caRow.GetNivelControloAutRows().Single().NivelRow.GetFRDBaseRows().SingleOrDefault(); DBAbstractDataLayer.DataAccessRules.NivelRule.Current.LoadNivelParents(caRow.GetNivelControloAutRows().Single().ID, GisaDataSetHelper.GetInstance(), ho.Connection); if (frdRow != null) IDTipoNivelRelacionado = DBAbstractDataLayer.DataAccessRules.NivelRule.Current.GetNivelLastIDTipoNivelRelacionado(frdRow.ID, ho.Connection); } finally { ho.Dispose(); } if (frdRow != null) // frd pode ainda não ter sido criado { var caRegRow = GisaDataSetHelper.GetInstance().ControloAutDataDeDescricao.Cast<GISADataset.ControloAutDataDeDescricaoRow>().Single(r => r.RowState == DataRowState.Added); var nvlRegRow = RecordRegisterHelper .CreateFRDBaseDataDeDescricaoRow(frdRow, caRegRow.TrusteeUserRowByTrusteeUserControloAutDataDeDescricao, caRegRow.TrusteeUserRowByTrusteeUserControloAutDataDeDescricaoAuthority, caRegRow.DataAutoria, IDTipoNivelRelacionado); nvlRegRow.DataEdicao = caRegRow.DataEdicao; GisaDataSetHelper.GetInstance().FRDBaseDataDeDescricao.AddFRDBaseDataDeDescricaoRow(nvlRegRow); } } } selectedItem.Remove(); ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection()); List<long> lowerIDsList = new List<long>(); try { lowerIDsList = DiplomaModeloRule.Current.GetIDLowers(caRow.ID, ho.Connection); } finally { ho.Dispose(); } // Como os dados acabaram de ser gravados pode ter-se chegado à conclusão que o contexto existente já não existia, daí este teste if (caRow.RowState != DataRowState.Detached) { try { var oldTermo = caRow.GetControloAutDicionarioRows().Single(cad => cad.IDTipoControloAutForma == (long)TipoControloAutForma.FormaAutorizada).DicionarioRow.Termo; var IDTipoNoticiaAut = caRow.IDTipoNoticiaAut; PersistencyHelper.DeleteIDXPreSaveArguments preSaveArgs = new PersistencyHelper.DeleteIDXPreSaveArguments(); GISADataset.NivelControloAutRow[] ncaRows = null; GISADataset.NivelRow nRow = null; ncaRows = caRow.GetNivelControloAutRows(); if (ncaRows.Length > 0) { nRow = ((GISADataset.NivelControloAutRow)(ncaRows[0])).NivelRow; preSaveArgs.ID = nRow.ID; } PersistencyHelper.DeleteCAXPreConcArguments preConcArgs = DeleteCAX(caRow); PersistencyHelper.SaveResult successfulSave = PersistencyHelper.save(deleteCAXTermos, preConcArgs, Nivel.DeleteNivelXInDataBase, preSaveArgs); PersistencyHelper.cleanDeletedData(); if (successfulSave == PersistencyHelper.SaveResult.successful) { if (SessionHelper.AppConfiguration.GetCurrentAppconfiguration().IsFedoraEnable()) SessionHelper.AppConfiguration.GetCurrentAppconfiguration().FedoraHelperSingleton.ActualizaObjDigitaisPorNivel(nivelIDsAssoc, oldTermo, null, IDTipoNoticiaAut); Search.Updater.updateNivelDocumental(nivelIDsAssoc); Search.Updater.updateNivelDocumentalComProdutores(lowerIDsList.Select(t => t.ToString()).ToList<string>()); } } catch (Exception ex) { Trace.WriteLine(ex); throw; } } else GisaDataSetHelper.GetInstance().ControloAutDataDeDescricao.Cast<GISADataset.ControloAutDataDeDescricaoRow>().Single(r => r.RowState == DataRowState.Added && r.IDControloAut == caRow.ID).RejectChanges(); } }