Exemplo n.º 1
0
        private void AddNewIssueSubType(NodeView nodeView)
        {
            AddEditIssueSubTypeDialog dialog = new AddEditIssueSubTypeDialog();
            dialog.Show();
            dialog.Closed += (s1, e1) =>
                {
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                    {
                        NodeView child = new NodeView(nodeView)
                        {
                            Id = dialog.IssueSubType.Id,
                            Name = dialog.IssueSubType.FormattedName,
                            Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png",
                            Type = NodeType.IssueSubType,
                            HasChildren = false,
                            SortField = dialog.IssueSubType.Ordinal.ToString()
                        };

                        CMS.Cache.IssueSubTypes.Add(dialog.IssueSubType);

                        if (nodeView.ChildrenLoaded)
                        {
                            nodeView.Children.Add(child);
                            nodeView.Sort();
                        }
                    }
                };
        }
Exemplo n.º 2
0
        private void EditIssueSubType(NodeView nodeView)
        {
            AddEditIssueSubTypeDialog dialog = new AddEditIssueSubTypeDialog(nodeView.Id)
            {
                Title = "Edit Issue Sub Type"
            };
            dialog.Show();
            dialog.Closed +=
                (s1, e1) =>
                {
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                    {
                        nodeView.Name = dialog.IssueSubType.Name.ToString();
                        nodeView.Description = dialog.IssueSubType.Description;
                        nodeView.SortField = dialog.IssueSubType.Ordinal.ToString();

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

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