Ejemplo n.º 1
0
        private void EditDocumentType(NodeView nodeView)
        {
            AddEditDocumentTypeDialog dialog = new AddEditDocumentTypeDialog();
            dialog.Title = "Edit Document Type";

            AddEditDocumentTypeModel model = new AddEditDocumentTypeModel(nodeView.Id) { View = dialog };
            model.Loaded +=(obj) => { dialog.DataContext = model; };

            dialog.Show();
            dialog.Closed +=
                (s1, e1) =>
                {
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                    {
                        nodeView.Name = dialog.DocumentType.Name;
                        nodeView.Description = dialog.DocumentType.Description;
                        nodeView.SortField = dialog.DocumentType.Ordinal.ToString();
                        nodeView.Parent.Sort();
                    }
                };
        }
Ejemplo n.º 2
0
        private void AddNewDocumentType(NodeView nodeView)
        {
            AddEditDocumentTypeDialog dialog = new AddEditDocumentTypeDialog();
            dialog.DataContext = new AddEditDocumentTypeModel { View = dialog };
            dialog.Show();

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