Exemple #1
0
        private void nivelGrupoArquivosList1_BeforeNewListSelection(object sender, BeforeNewSelectionEventArgs e)
        {
            if (e.ItemToBeSelected.Tag != null)
            {
                PermissoesHelper.UpdateNivelPermissions((GISADataset.NivelRow)e.ItemToBeSelected.Tag, SessionHelper.GetGisaPrincipal().TrusteeUserOperator.ID);
            }

            try
            {
                Debug.WriteLine("nivelGrupoArquivosList1_BeforeNewListSelection");

                e.SelectionChange = UpdateContext(e.ItemToBeSelected);
                if (e.SelectionChange)
                {
                    updateContextStatusBar();
                    UpdateToolBarButtons(e.ItemToBeSelected);
                }
            }
            catch (GISA.Search.UpdateServerException)
            { }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
                throw;
            }
        }
        protected virtual void NivelDocumentalListNavigator1_BeforeNewListSelection(object sender, BeforeNewSelectionEventArgs e)
        {
            var topLevelControl = (frmMain)TopLevelControl;

            topLevelControl.EnterWaitMode();

            var nRow      = default(GISADataset.NivelRow);
            var nUpperRow = GisaDataSetHelper.GetInstance().Nivel.Cast <GISADataset.NivelRow>().FirstOrDefault(r => r.RowState != DataRowState.Deleted && r.ID == this.nivelNavigator1.ContextBreadCrumbsPathID);

            if (e.ItemToBeSelected != null)
            {
                nRow = e.ItemToBeSelected.Tag as GISADataset.NivelRow;
            }

            if (nUpperRow != null)
            {
                PermissoesHelper.UpdateNivelPermissions(nRow, nUpperRow, SessionHelper.GetGisaPrincipal().TrusteeUserOperator.ID);
            }

            if (topLevelControl != null && topLevelControl.MasterPanelCount == 1)
            {
                try
                {
                    Debug.WriteLine("NivelDocumentalListNavigator1_BeforeNewListSelection");
                    e.SelectionChange = UpdateContext(e.ItemToBeSelected);

                    if (e.SelectionChange)
                    {
                        UpdateToolBarButtons(e.ItemToBeSelected);
                        updateContextStatusBar(e.ItemToBeSelected);
                    }
                }
                catch (Exception ex)
                {
                    Trace.WriteLine(ex);
                    throw;
                }
            }

            ((frmMain)TopLevelControl).LeaveWaitMode();
        }
Exemple #3
0
        private void NivelDocumentalList1_ItemDrag(object sender, System.Windows.Forms.ItemDragEventArgs e)
        {
            object DragDropObject = null;

            GISADataset.NivelRow nRow = null;
            this.Cursor = Cursors.WaitCursor;

            if (e.Item == null)
            {
                return;
            }

            if (e.Item is ListViewItem)
            {
                if (NivelDocumentalList1.SelectedItems.Count > 1)
                {
                    List <ListViewItem>             lst  = new List <ListViewItem>();
                    Dictionary <long, ListViewItem> dick = new Dictionary <long, ListViewItem>();
                    List <long> nivelIDs = new List <long>();
                    var         perms    = new Dictionary <long, Dictionary <string, byte> >();
                    long        tmpID;
                    foreach (ListViewItem lvItem in NivelDocumentalList1.SelectedItems)
                    {
                        tmpID = ((GISADataset.NivelRow)lvItem.Tag).ID;
                        nivelIDs.Add(tmpID);
                        dick[tmpID] = lvItem;
                    }

                    GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection());
                    try
                    {
                        perms = PermissoesRule.Current.CalculateEffectivePermissions(nivelIDs, SessionHelper.GetGisaPrincipal().TrusteeUserOperator.ID, ho.Connection);
                    }
                    catch (Exception ex)
                    {
                        Trace.WriteLine(ex.ToString());
                        throw;
                    }
                    finally
                    {
                        ho.Dispose();
                    }

                    foreach (long idNivel in perms.Keys)
                    {
                        var nperm = perms[idNivel];
                        if (nperm.ContainsKey("Ler") && nperm["Ler"] == 1)
                        {
                            lst.Add(dick[idNivel]);
                        }
                    }
                    DragDropObject = lst.ToArray();
                }
                else if (e.Item != null)
                {
                    DragDropObject = (ListViewItem)e.Item;
                    nRow           = (GISADataset.NivelRow)(((ListViewItem)DragDropObject).Tag);
                    PermissoesHelper.UpdateNivelPermissions(nRow, SessionHelper.GetGisaPrincipal().TrusteeUserOperator.ID);
                    if (!PermissoesHelper.AllowRead)
                    {
                        return;
                    }
                }
            }

            if (DragDropObject == null)
            {
                return;
            }

            this.Cursor = Cursors.Default;
            Trace.WriteLine("Dragging " + DragDropObject.ToString().GetType().FullName);
            DoDragDrop(DragDropObject, DragDropEffects.Link);
        }