コード例 #1
0
ファイル: Worklist.cs プロジェクト: hksonngan/Xian
        private static IValidationRuleSet GetValidationRules()
        {
            // ensure that not both the procedure type and procedure type groups filters are being applied
            var procedureTypeRule = new ValidationRule <Worklist>(
                delegate(Worklist w)
            {
                var filterByBothProcedureTypeAndProcedureTypeGroup = w.ProcedureTypeFilter.IsEnabled &&
                                                                     w.ProcedureTypeGroupFilter.IsEnabled;

                return(new TestResult(!filterByBothProcedureTypeAndProcedureTypeGroup, SR.MessageValidateWorklistProcedureTypeAndGroupFilters));
            });

            // ensure time filter meets constraints specified in settings
            var timeFilterRule = new ValidationRule <Worklist>(
                delegate(Worklist w)
            {
                var settings = new WorklistSettings();
                var maxDays  = settings.TimeWindowMaxSpanDays;
                if (settings.TimeWindowRequired && maxDays > 0)
                {
                    return(new TestResult(w.CheckTimeFilterSpan(TimeSpan.FromDays(maxDays)),
                                          string.Format(SR.MessageValidateWorklistTimeFilter, maxDays)));
                }
                return(new TestResult(true));
            });

            return(new ValidationRuleSet(new[] { procedureTypeRule, timeFilterRule }));
        }
コード例 #2
0
ファイル: Worklist.cs プロジェクト: hksonngan/Xian
        public static int CurrentServerConfigurationMaxSpanDays()
        {
            var settings = new WorklistSettings();

            return(settings.TimeWindowMaxSpanDays);
        }
コード例 #3
0
ファイル: Worklist.cs プロジェクト: hksonngan/Xian
        public static bool CurrentServerConfigurationRequiresTimeFilter()
        {
            var settings = new WorklistSettings();

            return(settings.TimeWindowRequired);
        }
コード例 #4
0
ファイル: Worklist.cs プロジェクト: nhannd/Xian
		private static IValidationRuleSet GetValidationRules()
		{
			// ensure that not both the procedure type and procedure type groups filters are being applied
			var procedureTypeRule = new ValidationRule<Worklist>(
				delegate(Worklist w)
				{
					var filterByBothProcedureTypeAndProcedureTypeGroup = w.ProcedureTypeFilter.IsEnabled &&
																		 w.ProcedureTypeGroupFilter.IsEnabled;

					return new TestResult(!filterByBothProcedureTypeAndProcedureTypeGroup, SR.MessageValidateWorklistProcedureTypeAndGroupFilters);
				});

			// ensure time filter meets constraints specified in settings
			var timeFilterRule = new ValidationRule<Worklist>(
				delegate(Worklist w)
				{
					var settings = new WorklistSettings();
					var maxDays = settings.TimeWindowMaxSpanDays;
					if (settings.TimeWindowRequired && maxDays > 0)
					{
						return new TestResult(w.CheckTimeFilterSpan(TimeSpan.FromDays(maxDays)),
							string.Format(SR.MessageValidateWorklistTimeFilter, maxDays));
					}
					return new TestResult(true);
				});

			return new ValidationRuleSet(new[] { procedureTypeRule, timeFilterRule });
		}
コード例 #5
0
ファイル: Worklist.cs プロジェクト: nhannd/Xian
		public static int CurrentServerConfigurationMaxSpanDays()
		{
			var settings = new WorklistSettings();
			return settings.TimeWindowMaxSpanDays;
		}
コード例 #6
0
ファイル: Worklist.cs プロジェクト: nhannd/Xian
		public static bool CurrentServerConfigurationRequiresTimeFilter()
		{
			var settings = new WorklistSettings();
			return settings.TimeWindowRequired;
		}
コード例 #7
0
		/// <summary>
		/// Checks whether the current user has access to worklists owned by the specified worklist owner.
		/// </summary>
		/// <param name="owner"></param>
		/// <remarks>Throws a RequestValidationException if the worklist count exceed the configured maximum.</remarks>
		private void CheckWorklistCountRestriction(WorklistOwner owner)
		{
			// admin can have unlimited worklists
			if (owner.IsAdminOwner)
				return;

			var worklistCount = PersistenceContext.GetBroker<IWorklistBroker>().Count(owner);

			var settings = new WorklistSettings();
			if (owner.IsStaffOwner)
			{
				if (worklistCount >= settings.MaxPersonalOwnedWorklists)
					throw new RequestValidationException(SR.ExceptionMaximumWorklistsReachedForStaff);
			}
			else if (owner.IsGroupOwner)
			{
				if (worklistCount >= settings.MaxGroupOwnedWorklists)
					throw new RequestValidationException(SR.ExceptionMaximumWorklistsReachedForStaffGroup);
			}
		}