public override void LoadData() { try { ((frmMain)TopLevelControl).EnterWaitMode(); GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection()); try { GisaDataSetHelper.ManageDatasetConstraints(false); if (!isLoaded) { if (CurrentContext.Deposito == null) { return; } // Recarregar a uf actual e guardar um contexto localmente DepositoRule.Current.LoadDepositoData(GisaDataSetHelper.GetInstance(), CurrentContext.Deposito.ID, ho.Connection); CurrentDeposito = GisaDataSetHelper.GetInstance().Deposito.Cast <GISADataset.DepositoRow>().SingleOrDefault(d => d.ID == CurrentContext.Deposito.ID); if (CurrentDeposito == null || CurrentDeposito.RowState == DataRowState.Detached || CurrentContext.Deposito == null || CurrentContext.Deposito.RowState == DataRowState.Detached) { return; } isLoaded = true; } GisaDataSetHelper.ManageDatasetConstraints(false); GISAPanel selectedPanel = (GISAPanel)this.DropDownTreeView1.SelectedNode.Tag; if (!selectedPanel.IsLoaded) { long startTicks = 0; startTicks = DateTime.Now.Ticks; selectedPanel.LoadData(CurrentDeposito, 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 override void ModelToView() { try { ((frmMain)TopLevelControl).EnterWaitMode(); // se nao existir um contexto definido os slavepanels não devem ser apresentados if (CurrentFRDBase == null || CurrentFRDBase.RowState == DataRowState.Detached) { this.Visible = false; return; } try { //TODO: INSTANT C# TODO TASK: C# does not have an equivalent to VB.NET's 'MyClass' keyword //ORIGINAL LINE: With New GisaPrincipalPermission(SessionHelper.GetGisaPrincipal(), this.GetType().FullName, GisaPrincipalPermission.WRITE) GisaPrincipalPermission tempWith1 = new GisaPrincipalPermission(SessionHelper.GetGisaPrincipal(), this.GetType().FullName, GisaPrincipalPermission.WRITE); tempWith1.Demand(); } catch (System.Security.SecurityException) { //Me.GisaPanelScroller.Enabled = False GUIHelper.GUIHelper.makeReadOnly(this.GisaPanelScroller); } this.Visible = true; GISAPanel selectedPanel = (GISAPanel)this.DropDownTreeView1.SelectedNode.Tag; if (selectedPanel.IsLoaded && !selectedPanel.IsPopulated) { long startTicks = 0; startTicks = DateTime.Now.Ticks; selectedPanel.ModelToView(); Debug.WriteLine("Time dispend model to view " + selectedPanel.ToString() + ": " + new TimeSpan(DateTime.Now.Ticks - startTicks).ToString()); } } finally { ((frmMain)TopLevelControl).LeaveWaitMode(); } }
public override void ModelToView() { try { ((frmMain)TopLevelControl).EnterWaitMode(); // se nao existir um contexto definido os slavepanels não devem ser apresentados if (CurrentFRDBase == null || CurrentFRDBase.RowState == DataRowState.Detached || CurrentContext.NivelEstrututalDocumental.RowState == DataRowState.Detached) { this.Visible = false; return; } this.Visible = true; GISAPanel selectedPanel = null; try { GisaPrincipalPermission tempWith1 = new GisaPrincipalPermission(SessionHelper.GetGisaPrincipal(), this.GetType().FullName, GisaPrincipalPermission.WRITE); tempWith1.Demand(); if (!PermissoesHelper.AllowEdit) { throw new System.Security.SecurityException(); } else if (!LastStateEditPermisson) { // Para garantir que o estado dos controlos está de acordo com as regras definidas quando a transição é feita // de um contexto sem permissão de edição para um com, é necessário colocar o estado desses controlos a true // para em seguida se redefinir esse estado no ModelToViewPanels() selectedPanel = (GISAPanel)this.DropDownTreeView1.SelectedNode.Tag; if (selectedPanel.IsLoaded && !selectedPanel.IsPopulated) { selectedPanel.ModelToView(); } GUIHelper.GUIHelper.makeReadable(selectedPanel); } else { selectedPanel = (GISAPanel)this.DropDownTreeView1.SelectedNode.Tag; if (selectedPanel.IsLoaded && !selectedPanel.IsPopulated) { long startTicks = 0; startTicks = DateTime.Now.Ticks; selectedPanel.ModelToView(); Debug.WriteLine("Time dispend model to view " + selectedPanel.ToString() + ": " + new TimeSpan(DateTime.Now.Ticks - startTicks).ToString()); } } LastStateEditPermisson = true; } catch (System.Security.SecurityException) { selectedPanel = (GISAPanel)this.DropDownTreeView1.SelectedNode.Tag; selectedPanel.ModelToView(); LastStateEditPermisson = false; GUIHelper.GUIHelper.makeReadOnly(selectedPanel); } } finally { ((frmMain)TopLevelControl).LeaveWaitMode(); } }
public override void LoadData() { try { ((frmMain)TopLevelControl).EnterWaitMode(); GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection()); try { GisaDataSetHelper.ManageDatasetConstraints(false); if (!isLoaded) { if (CurrentContext.NivelEstrututalDocumental == null) { CurrentFRDBase = null; return; } FRDRule.Current.ReloadPubNivelActualData(GisaDataSetHelper.GetInstance(), CurrentContext.NivelEstrututalDocumental.ID, ho.Connection); string QueryFilter = "IDNivel=" + CurrentContext.NivelEstrututalDocumental.ID.ToString() + " AND IDTipoFRDBase=" + System.Enum.Format(typeof(TipoFRDBase), TipoFRDBase.FRDOIRecolha, "D"); try { // Tentar obter o FRD pretendido, caso não exista cria-se um vazio CurrentFRDBase = (GISADataset.FRDBaseRow)(GisaDataSetHelper.GetInstance().FRDBase.Select(QueryFilter)[0]); } catch (IndexOutOfRangeException) { CurrentFRDBase = GisaDataSetHelper.GetInstance().FRDBase.AddFRDBaseRow(CurrentContext.NivelEstrututalDocumental, (GISADataset.TipoFRDBaseRow)(GisaDataSetHelper.GetInstance().TipoFRDBase.Select("ID=" + DomainValuesHelper.stringifyEnumValue(TipoFRDBase.FRDOIRecolha))[0]), "", "", new byte[] {}, 0); } if (CurrentFRDBase == null || CurrentFRDBase.RowState == DataRowState.Detached || CurrentContext.NivelEstrututalDocumental.RowState == DataRowState.Detached) { return; } if (CurrentContext.NivelEstrututalDocumental.CatCode.Trim().Equals("CA")) { FRDRule.Current.LoadFRDOIRecolhaData(GisaDataSetHelper.GetInstance(), CurrentContext.NivelEstrututalDocumental.ID, System.Enum.Format(typeof(TipoFRDBase), TipoFRDBase.FRDOIRecolha, "D"), ho.Connection); } isLoaded = true; } GISAPanel selectedPanel = (GISAPanel)this.DropDownTreeView1.SelectedNode.Tag; if (!selectedPanel.IsLoaded) { long startTicks = 0; startTicks = DateTime.Now.Ticks; selectedPanel.LoadData(CurrentFRDBase, 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); } catch (Exception e) { Trace.WriteLine(e); throw; } finally { ho.Dispose(); } } finally { ((frmMain)TopLevelControl).LeaveWaitMode(); } }
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 override void LoadData() { try { ((frmMain)TopLevelControl).EnterWaitMode(); GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection()); try { GisaDataSetHelper.ManageDatasetConstraints(false); if (!isLoaded) { if (CurrentContext.NivelUnidadeFisica == null) { CurrentFRDBase = null; return; } // Recarregar a uf actual e guardar um contexto localmente FRDRule.Current.LoadFRDUnidadeFisicaData(GisaDataSetHelper.GetInstance(), CurrentContext.NivelUnidadeFisica.ID, System.Enum.Format(typeof(TipoFRDBase), TipoFRDBase.FRDUnidadeFisica, "D"), ho.Connection); string QueryFilter = "IDNivel=" + CurrentContext.NivelUnidadeFisica.ID.ToString() + " AND IDTipoFRDBase=" + System.Enum.Format(typeof(TipoFRDBase), TipoFRDBase.FRDUnidadeFisica, "D"); //TODO: INSTANT C# TODO TASK: The return type of the tempWith1 variable must be corrected. GISADataset tempWith1 = GisaDataSetHelper.GetInstance(); try { CurrentFRDBase = (GISADataset.FRDBaseRow)(tempWith1.FRDBase.Select(QueryFilter)[0]); } catch (IndexOutOfRangeException) { CurrentFRDBase = tempWith1.FRDBase.AddFRDBaseRow(CurrentContext.NivelUnidadeFisica, (GISADataset.TipoFRDBaseRow)(tempWith1.TipoFRDBase.Select("ID=" + System.Enum.Format(typeof(TipoFRDBase), TipoFRDBase.FRDUnidadeFisica, "D"))[0]), "", "", new byte[] {}, 0); } //--- if (CurrentFRDBase == null || CurrentFRDBase.RowState == DataRowState.Detached || CurrentContext.NivelUnidadeFisica == null || CurrentContext.NivelUnidadeFisica.RowState == DataRowState.Detached) { return; } isLoaded = true; } GisaDataSetHelper.ManageDatasetConstraints(false); GISAPanel selectedPanel = (GISAPanel)this.DropDownTreeView1.SelectedNode.Tag; if (!selectedPanel.IsLoaded) { long startTicks = 0; startTicks = DateTime.Now.Ticks; selectedPanel.LoadData(CurrentFRDBase, 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(); } }