private void AddNewStatus(NodeView nodeView) { AddEditIssueStatusDialog dialog = new AddEditIssueStatusDialog(); dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { NodeView child = new NodeView(nodeView) { Id = dialog.IssueStatus.Id, Name = dialog.IssueStatus.Name, Icon = "/CmsEquipmentDatabase;component/Images/Configuration.png", Type = NodeType.IssueStatusNode, HasChildren = false, SortField = dialog.IssueStatus.Ordinal.ToString(), IsActive = dialog.IssueStatus.IsActive }; if (nodeView.ChildrenLoaded) { nodeView.Children.Add(child); nodeView.Sort(); } } }; }
private void EditIssueStatus(NodeView nodeView) { AddEditIssueStatusDialog dialog = new AddEditIssueStatusDialog(nodeView.Id); dialog.Title = "Edit Issue Status"; dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { nodeView.Name = dialog.IssueStatus.Name; nodeView.SortField = dialog.IssueStatus.Ordinal.ToString(); nodeView.IsActive = dialog.IssueStatus.IsActive; nodeView.Parent.Sort(); //Update Cache var existingStatus = CMS.Cache.IssueStatuses.FirstOrDefault(x => x.Id == dialog.IssueStatus.Id); if (existingStatus != null) { existingStatus.Name = dialog.IssueStatus.Name; existingStatus.Ordinal = dialog.IssueStatus.Ordinal; existingStatus.IsActive = dialog.IssueStatus.IsActive; } } }; dialog.Show(); }