private void InitializeComponent() { this.btnAccept = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button(); this.GroupBox1 = new System.Windows.Forms.GroupBox(); this.caList = new ControloAutList(); this.relacaoCA = new GISA.RelacaoControloAut(); this.GroupBox1.SuspendLayout(); this.SuspendLayout(); // //btnAccept // this.btnAccept.Anchor = (System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)); this.btnAccept.Enabled = false; this.btnAccept.Location = new System.Drawing.Point(506, 436); this.btnAccept.Name = "btnAccept"; this.btnAccept.TabIndex = 6; this.btnAccept.Text = "Aceitar"; // //btnCancel // this.btnCancel.Anchor = (System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)); this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnCancel.Location = new System.Drawing.Point(586, 436); this.btnCancel.Name = "btnCancel"; this.btnCancel.TabIndex = 7; this.btnCancel.Text = "Cancelar"; // //GroupBox1 // this.GroupBox1.Anchor = (System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)); this.GroupBox1.Controls.Add(this.caList); this.GroupBox1.Location = new System.Drawing.Point(7, 4); this.GroupBox1.Name = "GroupBox1"; this.GroupBox1.Size = new System.Drawing.Size(674, 258); this.GroupBox1.TabIndex = 1; this.GroupBox1.TabStop = false; this.GroupBox1.Text = "Notícia de autoridade relacionada"; // //caList // this.caList.AllowedNoticiaAutLocked = false; this.caList.Dock = System.Windows.Forms.DockStyle.Fill; this.caList.DockPadding.Bottom = 6; this.caList.DockPadding.Left = 6; this.caList.DockPadding.Right = 6; this.caList.DockPadding.Top = 6; //this.caList.ListHandler = null; this.caList.Location = new System.Drawing.Point(3, 16); this.caList.Name = "caList"; //this.caList.originalLabel = "Notícias de autoridade encontradas"; this.caList.Size = new System.Drawing.Size(668, 239); this.caList.TabIndex = 1; // //relacaoCA // this.relacaoCA.ContextNivelRow = null; this.relacaoCA.Location = new System.Drawing.Point(5, 266); this.relacaoCA.Name = "relacaoCA"; this.relacaoCA.Size = new System.Drawing.Size(678, 160); this.relacaoCA.TabIndex = 2; // //FormControloAutRel // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.CancelButton = this.btnCancel; this.ClientSize = new System.Drawing.Size(690, 468); this.Controls.Add(this.relacaoCA); this.Controls.Add(this.GroupBox1); this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnAccept); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "FormControloAutRel"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Relação entre entidades produtoras"; this.GroupBox1.ResumeLayout(false); this.ResumeLayout(false); //INSTANT C# NOTE: Converted event handlers: }
private void InitializeComponent() { this.grpControloAut = new System.Windows.Forms.GroupBox(); this.caList = new ControloAutList(); this.grpTitulo.SuspendLayout(); this.grpCodigo.SuspendLayout(); this.grpControloAut.SuspendLayout(); this.SuspendLayout(); // // txtCodigo // this.txtCodigo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.txtCodigo.ReadOnly = true; this.txtCodigo.Size = new System.Drawing.Size(378, 20); // // grpTitulo // this.grpTitulo.Size = new System.Drawing.Size(618, 43); this.grpTitulo.Visible = false; // // txtDesignacao // this.txtDesignacao.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.txtDesignacao.ReadOnly = true; this.txtDesignacao.Size = new System.Drawing.Size(604, 20); // // grpCodigo // this.grpCodigo.Size = new System.Drawing.Size(394, 43); this.grpCodigo.Visible = false; // // btnCancel // this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnCancel.Location = new System.Drawing.Point(552, 334); // // btnAccept // this.btnAccept.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnAccept.Location = new System.Drawing.Point(472, 334); // // grpControloAut // this.grpControloAut.Controls.Add(this.caList); this.grpControloAut.Location = new System.Drawing.Point(5, 5); this.grpControloAut.Name = "grpControloAut"; this.grpControloAut.Size = new System.Drawing.Size(622, 320); this.grpControloAut.TabIndex = 3; this.grpControloAut.TabStop = false; this.grpControloAut.Text = "Notícia de autoridade"; // // caList // this.caList.AllowedNoticiaAutLocked = false; this.caList.Dock = System.Windows.Forms.DockStyle.Fill; //this.caList.ListHandler = null; this.caList.Location = new System.Drawing.Point(3, 16); this.caList.Name = "caList"; //this.caList.originalLabel = "Notícias de autoridade encontradas"; this.caList.Padding = new System.Windows.Forms.Padding(6, 6, 6, 6); this.caList.Size = new System.Drawing.Size(616, 301); this.caList.TabIndex = 13; this.caList.BeforeNewListSelection += new ControloAutList.BeforeNewListSelectionEventHandler(this.caList_BeforeNewListSelection); // // FormNivelEstrutural // this.ClientSize = new System.Drawing.Size(634, 365); this.Controls.Add(this.grpControloAut); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "FormNivelEstrutural"; this.Controls.SetChildIndex(this.grpCodigo, 0); this.Controls.SetChildIndex(this.grpTitulo, 0); this.Controls.SetChildIndex(this.btnCancel, 0); this.Controls.SetChildIndex(this.btnAccept, 0); this.Controls.SetChildIndex(this.grpControloAut, 0); this.grpTitulo.ResumeLayout(false); this.grpTitulo.PerformLayout(); this.grpCodigo.ResumeLayout(false); this.grpCodigo.PerformLayout(); this.grpControloAut.ResumeLayout(false); this.ResumeLayout(false); }
private void InitializeComponent() { this.caList = new ControloAutList(); this.btnAdicionar = new System.Windows.Forms.Button(); this.btnCancelar = new System.Windows.Forms.Button(); this.SuspendLayout(); // //caList // this.caList.AllowedNoticiaAutLocked = false; this.caList.Anchor = (System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)); this.caList.DockPadding.Bottom = 6; this.caList.DockPadding.Left = 6; this.caList.DockPadding.Right = 6; this.caList.DockPadding.Top = 6; //this.caList.ListHandler = null; this.caList.Location = new System.Drawing.Point(2, 2); this.caList.Name = "caList"; this.caList.Size = new System.Drawing.Size(630, 339); this.caList.TabIndex = 1; // //btnAdicionar // this.btnAdicionar.Anchor = (System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)); this.btnAdicionar.Enabled = false; this.btnAdicionar.Location = new System.Drawing.Point(464, 346); this.btnAdicionar.Name = "btnAdicionar"; this.btnAdicionar.Size = new System.Drawing.Size(72, 24); this.btnAdicionar.TabIndex = 2; this.btnAdicionar.Text = "A&dicionar"; // //btnCancelar // this.btnCancelar.Anchor = (System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)); this.btnCancelar.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnCancelar.Location = new System.Drawing.Point(544, 346); this.btnCancelar.Name = "btnCancelar"; this.btnCancelar.Size = new System.Drawing.Size(72, 24); this.btnCancelar.TabIndex = 3; this.btnCancelar.Text = "&Cancelar"; // //FormPickControloAut // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.CancelButton = this.btnCancelar; this.ClientSize = new System.Drawing.Size(634, 383); this.Controls.Add(this.caList); this.Controls.Add(this.btnAdicionar); this.Controls.Add(this.btnCancelar); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "FormPickControloAut"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.ResumeLayout(false); //INSTANT C# NOTE: Converted event handlers: }
private void InitializeComponent() { this.caList = new ControloAutList(); this.btnOk = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button(); this.ToolBar1 = new System.Windows.Forms.ToolBar(); this.ToolBarButtonNew = new System.Windows.Forms.ToolBarButton(); this.ToolBarButtonEdit = new System.Windows.Forms.ToolBarButton(); this.ToolBarButtonDelete = new System.Windows.Forms.ToolBarButton(); this.ToolBarButton2 = new System.Windows.Forms.ToolBarButton(); this.ToolBarButtonFilter = new System.Windows.Forms.ToolBarButton(); this.SuspendLayout(); // // caList // this.caList.AllowedNoticiaAutLocked = false; this.caList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); //this.caList.ListHandler = null; this.caList.Location = new System.Drawing.Point(0, 26); this.caList.Name = "caList"; //this.caList.originalLabel = "Notícias de autoridade encontradas"; this.caList.Padding = new System.Windows.Forms.Padding(6, 6, 6, 6); this.caList.Size = new System.Drawing.Size(568, 264); this.caList.TabIndex = 3; // // btnOk // this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK; this.btnOk.Location = new System.Drawing.Point(376, 300); this.btnOk.Name = "btnOk"; this.btnOk.Size = new System.Drawing.Size(75, 23); this.btnOk.TabIndex = 4; this.btnOk.Text = "Aceitar"; // // btnCancel // this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnCancel.Location = new System.Drawing.Point(464, 300); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(75, 23); this.btnCancel.TabIndex = 5; this.btnCancel.Text = "Cancelar"; // // ToolBar1 // this.ToolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat; this.ToolBar1.AutoSize = false; this.ToolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { this.ToolBarButtonNew, this.ToolBarButtonEdit, this.ToolBarButtonDelete, this.ToolBarButton2, this.ToolBarButtonFilter}); this.ToolBar1.DropDownArrows = true; this.ToolBar1.Location = new System.Drawing.Point(0, 0); this.ToolBar1.Name = "ToolBar1"; this.ToolBar1.ShowToolTips = true; this.ToolBar1.Size = new System.Drawing.Size(568, 26); this.ToolBar1.TabIndex = 6; // // ToolBarButtonNew // this.ToolBarButtonNew.ImageIndex = 0; this.ToolBarButtonNew.Name = "ToolBarButtonNew"; // // ToolBarButtonEdit // this.ToolBarButtonEdit.ImageIndex = 1; this.ToolBarButtonEdit.Name = "ToolBarButtonEdit"; // // ToolBarButtonDelete // this.ToolBarButtonDelete.ImageIndex = 2; this.ToolBarButtonDelete.Name = "ToolBarButtonDelete"; // // ToolBarButton2 // this.ToolBarButton2.Name = "ToolBarButton2"; this.ToolBarButton2.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; // // ToolBarButtonFilter // this.ToolBarButtonFilter.ImageIndex = 3; this.ToolBarButtonFilter.Name = "ToolBarButtonFilter"; this.ToolBarButtonFilter.Style = System.Windows.Forms.ToolBarButtonStyle.ToggleButton; // // FormPickDiplomaModelo // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.CancelButton = this.btnCancel; this.ClientSize = new System.Drawing.Size(568, 333); this.ControlBox = false; this.Controls.Add(this.caList); this.Controls.Add(this.ToolBar1); this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnOk); this.MaximizeBox = false; this.Name = "FormPickDiplomaModelo"; this.ShowInTaskbar = false; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Diplomas e modelos"; this.ResumeLayout(false); }
//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(); } }
public static void DeleteControloAut(ControloAutList caList, string Caption, string Interrogacao, string MessageBoxText) { DeleteControloAut(caList, Caption, Interrogacao, MessageBoxText, null); }