Example #1
0
 public FrmViewAttachment(AttachmentForDocument attachment)
 {
     //se uso questo costruttore sto aggiornamndo un attachment esistente
     InitializeComponent();
     _document = attachment.Parent;
     _current  = attachment;
     _new      = false;
     LoadEditors();
 }
Example #2
0
 public FrmViewAttachment(Document document)
 {
     //se uso questo costruttore sto creando un nuovo attachment
     InitializeComponent();
     _document = document;
     _current  = new AttachmentForDocument(document);
     _changed  = true;
     _new      = true;
     LoadEditors();
 }
Example #3
0
 private void imageListBoxControl1_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         if (imageListBoxControl1.SelectedItem != null)
         {
             AttachmentForDocument c = (imageListBoxControl1.SelectedItem as DevExpress.XtraEditors.Controls.ImageListBoxItem).Value as AttachmentForDocument;
             XtraMessageBox.Show(c.AttachmentCompletePath, "Percorso file", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
Example #4
0
        private void imageListBoxControl1_DoubleClick(object sender, EventArgs e)
        {
            if (_previewDoc == null)
            {
                return;
            }
            try
            {
                if (imageListBoxControl1.SelectedItem != null)
                {
                    try
                    {
                        CheckSecurityForAttachmentView();
                    }
                    catch (AccessDeniedException)
                    {
                        ErrorHandler.Show("Funzionalità non abilitata. Accesso negato");
                        return;
                    }

                    //una volta verificata la sicurezza devo verificare se l'utente loggato ha il profilo per vedere l'allegato
                    if (!_previewDoc.Scope.IsVisibleFromProfile(SecurityManager.Instance.CurrentUser.Role.Profiles.Select(z => z.Description).ToList(), SecurityManager.Instance.CurrentUser.Username))
                    {
                        ErrorHandler.Show("Funzionalità non abilitata. Accesso negato");
                        return;
                    }

                    AttachmentForDocument c = (imageListBoxControl1.SelectedItem as DevExpress.XtraEditors.Controls.ImageListBoxItem).Value as AttachmentForDocument;
                    if (c.AttachmentExist)
                    {
                        NetworkFileSystemUtilsProxy p = new NetworkFileSystemUtilsProxy();
                        string temp = p.CopyUncFileToLocalTempFolder(c.AttachmentCompletePath);

                        Process.Start(temp);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.Show(ex);
            }
        }
Example #5
0
        private void lstatt_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Delete)
            {
                if (lstatt.SelectedItem != null)
                {
                    if (_current != null && _current.Key != null)
                    {
                        try
                        {
                            CheckSecurityForAttachmentDeletion();
                        }
                        catch (AccessDeniedException)
                        {
                            ErrorHandler.Show("Funzionalità non abilitata. Accesso negato");
                            return;
                        }
                    }

                    FrmEliminaAllegato frm = new FrmEliminaAllegato();
                    if (frm.ShowDialog() == DialogResult.Yes)
                    {
                        if (frm.EliminaFile)
                        {
                            AttachmentForDocument g = (lstatt.SelectedItem as DevExpress.XtraEditors.Controls.ImageListBoxItem).Value as AttachmentForDocument;
                            if (g != null)
                            {
                                if (g.AttachmentExist)
                                {
                                    NetworkFileSystemUtilsProxy p = new NetworkFileSystemUtilsProxy();
                                    p.DeleteUncFile(g.AttachmentCompletePath);
                                }
                            }
                        }
                        lstatt.Items.RemoveAt(lstatt.SelectedIndex);
                        StartChangeOperation();
                    }
                }
            }
        }
Example #6
0
        private int GetFileImageIndex(AttachmentForDocument attachmentForDocument)
        {
            if (attachmentForDocument == null)
            {
                throw new ArgumentException("Allegato");
            }

            if (!attachmentForDocument.AttachmentExist)
            {
                //aggiungo l'icona di warning all'imagecollection
                imageList1.Images.Add(Properties.Resources.warning_16);
                return(imageList1.Images.Count - 1);
            }

            SHFILEINFO shinfo = new SHFILEINFO();
            //SHFILEINFO shinfo1 = new SHFILEINFO();
            IntPtr hImgSmall; //the handle to the system image list
            //IntPtr hImgLarge; //the handle to the system image list

            //copio il file localmente per fare in modo che possa trarne le informazioni per l'icona

            NetworkFileSystemUtilsProxy p = new NetworkFileSystemUtilsProxy();
            string temp = p.CopyUncFileToLocalTempFolder(attachmentForDocument.AttachmentCompletePath);

            //Use this to get the small Icon
            hImgSmall = Win32.SHGetFileInfo(temp, 0, ref shinfo, (uint)Marshal.SizeOf(shinfo), Win32.SHGFI_ICON | Win32.SHGFI_SMALLICON);
            //The icon is returned in the hIcon member of the shinfo struct
            System.Drawing.Icon myIcon = System.Drawing.Icon.FromHandle(shinfo.hIcon);

            ////Use this to get the large Icon
            //hImgLarge = Win32.SHGetFileInfo(fName, 0, ref shinfo1, (uint)Marshal.SizeOf(shinfo1), Win32.SHGFI_ICON | Win32.SHGFI_LARGEICON);
            ////The icon is returned in the hIcon member of the shinfo struct
            //System.Drawing.Icon myIcon1 = System.Drawing.Icon.FromHandle(shinfo1.hIcon);

            imageList1.Images.Add(myIcon);


            return(imageList1.Images.Count - 1);
        }