Example #1
0
        private void lstatt_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                if (lstatt.SelectedItem != null)
                {
                    if (_current != null && _current.Key != null)
                    {
                        try
                        {
                            CheckSecurityForAttachmentView();
                        }
                        catch (AccessDeniedException)
                        {
                            ErrorHandler.Show("Funzionalità non abilitata. Accesso negato");
                            return;
                        }

                        if (!_current.Scope.IsVisibleFromProfile(SecurityManager.Instance.CurrentUser.Role.Profiles.Select(z => z.Description).ToList(), SecurityManager.Instance.CurrentUser.Username))
                        {
                            ErrorHandler.Show("Funzionalità non abilitata. Accesso negato");
                            return;
                        }
                    }



                    FrmViewAttachment cc = new FrmViewAttachment((lstatt.SelectedItem as DevExpress.XtraEditors.Controls.ImageListBoxItem).Value as AttachmentForDocument);
                    if (cc.ShowDialog() == DialogResult.OK)
                    {
                        lstatt.Items.RemoveAt(lstatt.SelectedIndex);
                        lstatt.Items.Add(cc.Attachment, GetFileImageIndex(cc.Attachment));
                        lstatt.SelectedIndex = lstatt.Items.Count - 1;
                        StartChangeOperation();
                    }
                    cc.Dispose();
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.Show(ex);
            }
        }
Example #2
0
        private void simpleButton3_Click(object sender, EventArgs e)
        {
            try
            {
                CreateNewDocumentIfNull();

                //scrivo la cartella corrente nel caso non sia avvenuto un salvataggio
                _current.Scope = cbocar.SelectedItem as DocumentScope;

                FrmViewAttachment cc = new FrmViewAttachment(_current);
                if (cc.ShowDialog() == DialogResult.OK)
                {
                    lstatt.Items.Add(cc.Attachment, GetFileImageIndex(cc.Attachment));
                    lstatt.SelectedIndex = lstatt.Items.Count - 1;
                    StartChangeOperation();
                }
                cc.Dispose();
            }
            catch (Exception ex)
            {
                ErrorHandler.Show(ex);
            }
        }