コード例 #1
0
        private void AddNewTimesheetCode(NodeView nodeView)
        {
            AddEditTimesheetCodeDialog dialog = new AddEditTimesheetCodeDialog();
            dialog.Title = "Add new Timesheet Code";

            dialog.Show();
            dialog.Closed +=
                (s1, e1) =>
                {
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                    {
                        NodeView child = new NodeView(nodeView)
                        {
                            Id = dialog.SavedTimesheetCode.Id,
                            Name = dialog.SavedTimesheetCode.Name.ToString(),
                            Description = dialog.SavedTimesheetCode.Description,
                            Icon = "/CmsEquipmentDatabase;component/Images/Timesheet.png",
                            Type = NodeType.TimesheetCodeNode,
                            HasChildren = false,
                            SortField = dialog.SavedTimesheetCode.Ordinal.ToString(),
                            IsActive = dialog.SavedTimesheetCode.IsActive
                        };
                        if (nodeView.ChildrenLoaded)
                        {
                            nodeView.Children.Add(child);
                            nodeView.Sort();
                        }
                    }
                    nodeView.Sort(true);
                };
        }
コード例 #2
0
        private void EditTimesheetCode(NodeView nodeView)
        {
            AddEditTimesheetCodeDialog dialog = new AddEditTimesheetCodeDialog(nodeView.Id);
            dialog.Title = "Edit Timesheet Code";
            dialog.Show();

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