Пример #1
0
        /// <summary>
        /// Private constructor.
        /// </summary>
        /// <param name="entityRef"></param>
        /// <param name="adminMode"></param>
        /// <param name="editMode"></param>
        /// <param name="worklistClassChoices"></param>
        /// <param name="selectedClass"></param>
        private WorklistEditorComponent(EntityRef entityRef, bool adminMode, WorklistEditorMode editMode, IList <string> worklistClassChoices, string selectedClass)
        {
            _worklistRef          = entityRef;
            _adminMode            = adminMode;
            _mode                 = editMode;
            _worklistClassChoices = worklistClassChoices;
            _initialClassName     = selectedClass;

            // start with entire tree expanded
            this.StartFullyExpanded = true;
        }
Пример #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public WorklistDetailEditorComponent(WorklistAdminDetail detail, List <WorklistClassSummary> worklistClasses, List <StaffGroupSummary> ownerGroupChoices, WorklistEditorMode editorMode, bool adminMode, bool dialogMode)
            : base(worklistClasses, GetDefaultWorklistClass(worklistClasses, detail))
        {
            _worklistDetail = detail;
            _dialogMode     = dialogMode;
            _editorMode     = editorMode;
            _adminMode      = adminMode;
            _groupChoices   = ownerGroupChoices;

            if (_editorMode == WorklistEditorMode.Add)
            {
                // default to "personal" if user has authority
                _isPersonal = HasPersonalAdminAuthority;
            }
            else
            {
                // default to "personal" if not a user worklist (this could happen when duplicating from an admin worklist)
                _isPersonal = !_worklistDetail.IsUserWorklist || _worklistDetail.IsStaffOwned;
            }

            // update the class to the default (if this is a new worklist)
            _worklistDetail.WorklistClass = GetDefaultWorklistClass(worklistClasses, detail);

            this.Validation.Add(
                new ValidationRule("SelectedGroup",
                                   delegate
            {
                var success = _adminMode || this.IsPersonal || (this.IsGroup && this.SelectedGroup != null);
                return(new ValidationResult(success, SR.MessageValueRequired));
            }));

            this.Validation.Add(new ValidationRule("IsPersonal",
                                                   delegate
            {
                var showValidation = this.IsPersonalGroupSelectionEnabled && this.IsPersonal && _hasWorklistCountError;
                return(new ValidationResult(!showValidation, _worklistCountErrorMessage));
            }));

            this.Validation.Add(new ValidationRule("SelectedGroup",
                                                   delegate
            {
                var showValidation = this.IsPersonalGroupSelectionEnabled && this.IsGroup && _worklistDetail.OwnerGroup != null && _hasWorklistCountError;
                return(new ValidationResult(!showValidation, _worklistCountErrorMessage));
            }));
        }