private void EditDocumentPurchaseOrder(NodeView nodeView)
 {
     AddEditDocumentPurchaseOrderDialog dialog = new AddEditDocumentPurchaseOrderDialog(nodeView.Id);
     dialog.Show();
     dialog.Closed +=
         (s1, e1) =>
         {
             if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
             {
                 nodeView.Name = dialog.DocumentPurchaseOrder.Name;
                 nodeView.Description = dialog.DocumentPurchaseOrder.Description;
                 nodeView.IsActive = dialog.DocumentPurchaseOrder.IsActive;
                 nodeView.SortField = dialog.DocumentPurchaseOrder.Name;
                 nodeView.Parent.Sort(true);
             }
         };
 }
        private void AddNewDocumentPurchaseOrder(NodeView nodeView)
        {
            AddEditDocumentPurchaseOrderDialog dialog = new AddEditDocumentPurchaseOrderDialog();

            dialog.Show();

            dialog.Closed +=
                (s1, e1) =>
                {
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                    {
                        NodeView child = new NodeView(nodeView)
                        {
                            Id = dialog.DocumentPurchaseOrder.Id,
                            Name = dialog.DocumentPurchaseOrder.Name,
                            Description = dialog.DocumentPurchaseOrder.Description,
                            Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png",
                            Type = NodeType.DocumentPurchaseOrderNode,
                            SortField = dialog.DocumentPurchaseOrder.Name.ToString(),
                            HasChildren = false
                        };
                        if (nodeView.ChildrenLoaded)
                        {
                            nodeView.Children.Add(child);
                            nodeView.Sort(true);
                        }
                    }
                };
        }