Example #1
0
 private void tileDocument_RightItemClick(object sender, TileItemEventArgs e)
 {
     try
     {
         Model.Internal.Document.DocNode node = (TIS.Model.Internal.Document.DocNode)(e.Item.Tag);
         if (node.Document == null)
         {
             DocumentFile df = new DocumentFile(iclExtraLarge, node.Name, node.ImageIndex, "Map");
             df.ShowDialog(this);
             if (df.DialogResult == DialogResult.OK)
             {
                 if (df.isDeleted)
                 {
                     if (node.childDocNode.Count == 0)
                     {
                         Uow.Delete(node);
                     }
                     else
                     {
                         DevExpress.XtraEditors.XtraMessageBox.Show("Onmogelijk om te verwijderen terwijl de map niet leeg is", "Verwijderen mislukt", MessageBoxButtons.OK,
                                                                    MessageBoxIcon.Exclamation);
                     }
                 }
                 else
                 {
                     node.ImageIndex = df.Index >= iclExtraLarge.Images.Count ? -1 : df.Index;
                     node.Name       = df.DocName;
                 }
                 Uow.CommitChanges();
                 SelectNode(_selectedNode);
             }
             //this.Uow = new UnitOfWork();
         }
         else
         {
             if (node.Document.DocTypeDisplay == Enumeration.Document.DocumentType.Link)
             {
                 DocumentLink dl = new DocumentLink(iclExtraLarge, node.Name, node.ImageIndex, node.Document.Name);
                 dl.ShowDialog();
                 if (dl.DialogResult == DialogResult.OK)
                 {
                     if (dl.isDeleted)
                     {
                         Uow.Delete(node.Document);
                         Uow.Delete(node);
                     }
                     else
                     {
                         node.Name          = dl.NodeName;
                         node.ImageIndex    = dl.Index >= iclExtraLarge.Images.Count ? -1 : dl.Index;
                         node.Document.Name = dl.Url;
                     }
                     Uow.CommitChanges();
                     SelectNode(_selectedNode);
                 }
             }
             else
             //if (node.Document.DocTypeDisplay == Enumeration.Document.DocumentType.Document)
             {
                 DocumentFile df = new DocumentFile(iclExtraLarge, node.Name, node.ImageIndex,
                                                    node.Document.DocTypeDisplay == Enumeration.Document.DocumentType.Document ? "Document" :
                                                    node.Document.DocTypeDisplay == Enumeration.Document.DocumentType.Application ? "Programma" : "");
                 df.ShowDialog(this);
                 if (df.DialogResult == DialogResult.OK)
                 {
                     if (df.isDeleted)
                     {
                         if (node.childDocNode.Count == 0)
                         {
                             Uow.Delete(node);
                         }
                         else
                         {
                             DevExpress.XtraEditors.XtraMessageBox.Show("Onmogelijk om te verwijderen terwijl de map niet leeg is", "Verwijderen mislukt", MessageBoxButtons.OK,
                                                                        MessageBoxIcon.Exclamation);
                         }
                     }
                     else
                     {
                         node.ImageIndex = df.Index >= iclExtraLarge.Images.Count ? -1 : df.Index;
                         node.Name       = df.DocName;
                     }
                     Uow.CommitChanges();
                     SelectNode(_selectedNode);
                 }
                 //this.Uow = new UnitOfWork();
             }
         }
     }
     catch (Exception exception1)
     {
         System.Exception thisException = exception1;
         Management.ShowException(thisException);
     }
 }