public override void LoadData() { //AddHandler CurrentContext.TrusteeChanged, AddressOf TrusteeChanged if (CurrentContext.Trustee == null) { CurrentTrustee = null; return; } this.CurrentTrustee = CurrentContext.Trustee; IDbConnection conn = GisaDataSetHelper.GetConnection(); try { conn.Open(); GISAPanel selectedPanel = (GISAPanel)this.DropDownTreeView1.SelectedNode.Tag; if (!selectedPanel.IsLoaded) { selectedPanel.LoadData(CurrentTrustee, conn); } } catch (Exception ex) { Trace.WriteLine(ex); throw; } finally { conn.Close(); } }
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 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.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 { 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(); } }