コード例 #1
0
        private void AddNewMilestoneType(NodeView nodeView)
        {
            AddEditMilestoneTypeDialog dialog = new AddEditMilestoneTypeDialog();
            dialog.Show();
            dialog.Closed += (s1, e1) =>
            {
                if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                {
                    NodeView child = new NodeView(nodeView)
                    {
                        Id = dialog.MilestoneType.Id,
                        Name = dialog.MilestoneType.FormattedName,
                        Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png",
                        Type = NodeType.MilestoneType,
                        HasChildren = false,
                        SortField = dialog.MilestoneType.Ordinal.ToString()
                    };

                    if (nodeView.ChildrenLoaded)
                    {
                        nodeView.Children.Add(child);
                        nodeView.Sort();
                    }
                }
            };
        }
コード例 #2
0
        private void EditMilestoneType(NodeView nodeView)
        {
            AddEditMilestoneTypeDialog dialog = new AddEditMilestoneTypeDialog(nodeView.Id)
            {
                Title = "Edit Milestone Type"
            };
            dialog.Show();
            dialog.Closed +=
                (s1, e1) =>
                {
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                    {
                        nodeView.Name = dialog.MilestoneType.Name.ToString();
                        nodeView.Description = dialog.MilestoneType.Description;
                        nodeView.SortField = dialog.MilestoneType.Ordinal.ToString();

                        var cacheMatch = (from x in CMS.Cache.IssueSubTypes where x.Id == nodeView.Id select x).FirstOrDefault();
                        if (cacheMatch != null)
                        {
                            cacheMatch.Name = dialog.MilestoneType.Name;
                            cacheMatch.Description = dialog.MilestoneType.Name;
                            cacheMatch.Code = dialog.MilestoneType.Name;
                            cacheMatch.Ordinal = dialog.MilestoneType.Ordinal;
                        }

                    }
                    nodeView.Parent.Sort(false);
                };
        }