예제 #1
0
        public override void ModelToView()
        {
            // se nao existir um contexto definido os slavepanels não devem ser apresentados
            if (CurrentTrustee == null || CurrentTrustee.RowState == DataRowState.Detached || CurrentContext.Trustee.RowState == DataRowState.Detached)
            {
                this.Visible = false;
                return;
            }

            this.Visible = true;
            GISAPanel selectedPanel = (GISAPanel)this.DropDownTreeView1.SelectedNode.Tag;

            if (selectedPanel.IsLoaded && !selectedPanel.IsPopulated)
            {
                selectedPanel.ModelToView();
            }
            try
            {
                GisaPrincipalPermission tempWith1 = new GisaPrincipalPermission(SessionHelper.GetGisaPrincipal(), this.GetType().FullName, GisaPrincipalPermission.WRITE);
                tempWith1.Demand();
            }
            catch (System.Security.SecurityException)
            {
                GUIHelper.GUIHelper.makeReadOnly(this.GisaPanelScroller);
            }
        }
예제 #2
0
        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();
            }
        }
예제 #3
0
        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();
            }
        }