예제 #1
0
        private void AddNewVendor(NodeView nodeView)
        {
            AddEditVendorDialog dialog = new AddEditVendorDialog();
            dialog.Title = "Add new Vendor";

            dialog.Show();
            dialog.Closed +=
                (s1, e1) =>
                {
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                    {
                        NodeView child = new NodeView(nodeView)
                        {
                            Id = dialog.SavedVendor.Id,
                            Name = dialog.SavedVendor.Name.ToString(),
                            Description = dialog.SavedVendor.Description,
                            Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png",
                            Type = NodeType.VendorNode,
                            HasChildren = false,
                            SortField = dialog.SavedVendor.Ordinal.ToString(),
                            IsActive = dialog.SavedVendor.IsActive
                        };
                        if (nodeView.ChildrenLoaded)
                        {
                            nodeView.Children.Add(child);
                            nodeView.Sort();
                        }
                    }
                    nodeView.Sort(true);
                };
        }
예제 #2
0
        private void EditVendor(NodeView nodeView)
        {
            AddEditVendorDialog dialog = new AddEditVendorDialog(nodeView.Id);
            dialog.Title = "Edit Vendor";
            dialog.Show();

            dialog.Closed +=
                (s1, e1) =>
                {
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                    {
                        nodeView.Name = dialog.SavedVendor.Name.ToString();
                        nodeView.Description = dialog.SavedVendor.Description;
                        nodeView.SortField = dialog.SavedVendor.Ordinal.ToString();
                        nodeView.IsActive = dialog.SavedVendor.IsActive;
                    }
                    nodeView.Parent.Sort(true);
                };
        }