当前位置: 首页>>代码示例>>C#>>正文


C# RangeBoundaryType类代码示例

本文整理汇总了C#中RangeBoundaryType的典型用法代码示例。如果您正苦于以下问题:C# RangeBoundaryType类的具体用法?C# RangeBoundaryType怎么用?C# RangeBoundaryType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RangeBoundaryType类属于命名空间,在下文中一共展示了RangeBoundaryType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ValidateRelativeDatimeValidator

 internal static void ValidateRelativeDatimeValidator(int lowerBound, DateTimeUnit lowerUnit, RangeBoundaryType lowerBoundType, int upperBound, DateTimeUnit upperUnit, RangeBoundaryType upperBoundType)
 {
     if ((((lowerBound != 0) && (lowerUnit == DateTimeUnit.None)) && (lowerBoundType != RangeBoundaryType.Ignore)) || (((upperBound != 0) && (upperUnit == DateTimeUnit.None)) && (upperBoundType != RangeBoundaryType.Ignore)))
     {
         throw new ArgumentException(Resources.RelativeDateTimeValidatorNotValidDateTimeUnit);
     }
 }
开发者ID:davinx,项目名称:himedi,代码行数:7,代码来源:ValidatorArgumentsValidatorHelper.cs

示例2: DateTimeRangeValidatorAttribute

 /// <summary>
 /// Initializes a new instance with lower and upper bounds, and bound types.
 /// </summary>
 /// <param name="lowerBound">An ISO8601 formatted string representing the lower bound, like "2006-01-20T00:00:00".</param>
 /// <param name="lowerBoundType">The bound type for the lower bound.</param>
 /// <param name="upperBound">An ISO8601 formatted string representing the upper bound, like "2006-01-20T00:00:00".</param>
 /// <param name="upperBoundType">The bound type for the upper bound.</param>
 public DateTimeRangeValidatorAttribute(
     string lowerBound,
     RangeBoundaryType lowerBoundType,
     string upperBound,
     RangeBoundaryType upperBoundType)
     : this(lowerBound, ConvertToISO8601Date(lowerBound, "lowerBound"), lowerBoundType, upperBound, ConvertToISO8601Date(upperBound, "upperBound"), upperBoundType)
 { }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:14,代码来源:DateTimeRangeValidatorAttribute.cs

示例3: DateTimeRangeValidatorAttribute

 public DateTimeRangeValidatorAttribute(DateTime lowerBound, RangeBoundaryType lowerBoundType, DateTime upperBound, RangeBoundaryType upperBoundType)
 {
     this.lowerBound = lowerBound;
     this.lowerBoundType = lowerBoundType;
     this.upperBound = upperBound;
     this.upperBoundType = upperBoundType;
 }
开发者ID:davinx,项目名称:himedi,代码行数:7,代码来源:DateTimeRangeValidatorAttribute.cs

示例4: StringLengthValidatorAttribute

 public StringLengthValidatorAttribute(int lowerBound, RangeBoundaryType lowerBoundType, int upperBound, RangeBoundaryType upperBoundType)
 {
     this.lowerBound = lowerBound;
     this.lowerBoundType = lowerBoundType;
     this.upperBound = upperBound;
     this.upperBoundType = upperBoundType;
 }
开发者ID:davinx,项目名称:himedi,代码行数:7,代码来源:StringLengthValidatorAttribute.cs

示例5: RangeValidatorAttribute

 RangeValidatorAttribute(IComparable lowerBound, RangeBoundaryType lowerBoundType, IComparable upperBound, RangeBoundaryType upperBoundType)
 {
     ValidatorArgumentsValidatorHelper.ValidateRangeValidator(lowerBound, lowerBoundType, upperBound, upperBoundType);
     this.lowerBound = lowerBound;
     this.lowerBoundType = lowerBoundType;
     this.upperBound = upperBound;
     this.upperBoundType = upperBoundType;
 }
开发者ID:davinx,项目名称:himedi,代码行数:8,代码来源:RangeValidatorAttribute.cs

示例6: NumericRangeValidator

        public NumericRangeValidator(NameValueCollection attributes)
            : base(null, null)
        {
            lowerBoundType = (RangeBoundaryType)Enum.Parse(typeof(RangeBoundaryType), attributes.Get("lowerBoundType"));
            upperBoundType = (RangeBoundaryType)Enum.Parse(typeof(RangeBoundaryType), attributes.Get("upperBoundType"));

            int lower;
            if (int.TryParse(attributes.Get("lowerBound"), out lower))
            {
                lowerBound = lower;
            }
            else
            {
                lowerBound = int.MinValue;
            }

            int upper;
            if (int.TryParse(attributes.Get("upperBound"), out upper))
            {
                upperBound = upper;
            }
            else
            {
                upperBound = int.MaxValue;
            }

            int max;
            if (int.TryParse(attributes.Get("maxLength"), out max))
            {
                maxLength = max;
            }
            else
            {
                maxLength = int.MaxValue;
            }

            if (attributes.Get("mandatoryMessageTemplate") != null)
            {
                this.mandatoryMessageTemplate = attributes.Get("mandatoryMessageTemplate").ToString();
            }

            if (attributes.Get("invalidMessageTemplate") != null)
            {
                this.invalidMessageTemplate = attributes.Get("invalidMessageTemplate").ToString();
            }

            if (attributes.Get("rangeMessageTemplate") != null)
            {
                this.rangeMessageTemplate = attributes.Get("rangeMessageTemplate").ToString();
            }

            if (attributes.Get("maxLengthMessageTemplate") != null)
            {
                this.maxLengthMessageTemplate = attributes.Get("maxLengthMessageTemplate").ToString();
            }
        }
开发者ID:rentianhua,项目名称:AgileMVC,代码行数:56,代码来源:NumericRangeValidator.cs

示例7: RelativeDateTimeValidatorAttribute

 public RelativeDateTimeValidatorAttribute(int lowerBound, DateTimeUnit lowerUnit, RangeBoundaryType lowerBoundType, int upperBound, DateTimeUnit upperUnit, RangeBoundaryType upperBoundType)
 {
     ValidatorArgumentsValidatorHelper.ValidateRelativeDatimeValidator(lowerBound, lowerUnit, lowerBoundType, upperBound, upperUnit, upperBoundType);
     this.lowerBound = lowerBound;
     this.lowerUnit = lowerUnit;
     this.lowerBoundType = lowerBoundType;
     this.upperBound = upperBound;
     this.upperUnit = upperUnit;
     this.upperBoundType = upperBoundType;
 }
开发者ID:davinx,项目名称:himedi,代码行数:10,代码来源:RelativeDateTimeValidatorAttribute.cs

示例8: ValidRelativeMonthYear

        internal static bool ValidRelativeMonthYear(MonthYear input,
                                                    int lowerBound, MonthYearUnit lowerUnit, RangeBoundaryType lowerBoundType,
                                                    int upperBound, MonthYearUnit upperUnit, RangeBoundaryType upperBoundType)
        {
            DateTime now = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            DateTime lowerDate = DateTime.MinValue;
            DateTime upperDate = DateTime.MaxValue;
            DateTime inputDate = new DateTime(input.Year, input.Month, 1);

            switch (lowerUnit)
            {
                case MonthYearUnit.Month:
                    lowerDate = now.AddMonths(lowerBound * -1);
                    break;
                case MonthYearUnit.Year:
                    lowerDate = now.AddYears(lowerBound * -1);
                    break;
            }
            switch (upperUnit)
            {
                case MonthYearUnit.Month:
                    upperDate = now.AddMonths(upperBound);
                    break;
                case MonthYearUnit.Year:
                    upperDate = now.AddYears(upperBound);
                    break;
            }

            //default the bound check to true - if lowerBoundType is Ignore, no test will be performed.
            bool lowerBoundOk = true;
            if (lowerBoundType == RangeBoundaryType.Inclusive)
            {
                lowerBoundOk = inputDate.CompareTo(lowerDate) >= 0;
            }
            else if (lowerBoundType == RangeBoundaryType.Exclusive)
            {
                lowerBoundOk = inputDate.CompareTo(lowerDate) > 0;
            }

            //default the bound check to true - if upperBoundType is Ignore, no test will be performed.
            bool upperBoundOk = true;
            if (upperBoundType == RangeBoundaryType.Inclusive)
            {
                upperBoundOk = inputDate.CompareTo(upperDate) <= 0;
            }
            else if (upperBoundType == RangeBoundaryType.Exclusive)
            {
                upperBoundOk = inputDate.CompareTo(upperDate) < 0;
            }

            return lowerBoundOk && upperBoundOk;
        }
开发者ID:GrahamClark,项目名称:TestConsoleApp,代码行数:52,代码来源:Runner.cs

示例9: NumericRangeValidatorAttribute

 public NumericRangeValidatorAttribute(int lowerBound, RangeBoundaryType lowerBoundType,
     int upperBound, RangeBoundaryType upperBoundType, int maxLength,
     string mandatoryMessageTemplate, string invalidMessageTemplate,
     string rangeMessageTemplate, string maxLengthMessageTemplate)
 {
     this.lowerBound = lowerBound;
     this.lowerBoundType = lowerBoundType;
     this.upperBound = upperBound;
     this.upperBoundType = upperBoundType;
     this.maxLength = maxLength;
     this.mandatoryMessageTemplate = mandatoryMessageTemplate;
     this.invalidMessageTemplate = invalidMessageTemplate;
     this.rangeMessageTemplate = rangeMessageTemplate;
     this.maxLengthMessageTemplate = maxLengthMessageTemplate;
 }
开发者ID:rentianhua,项目名称:AgileMVC,代码行数:15,代码来源:NumericRangeValidatorAttribute.cs

示例10: DateTimeRangeValidatorOperation

        public DateTimeRangeValidatorOperation(
            string keyToValidate,
            string resultKey,
            DateTime lowerBound,
            RangeBoundaryType lowerBoundary,
            DateTime upperBound,
            RangeBoundaryType upperBoundary,

            bool negated) : base(keyToValidate, resultKey) {

            Validator = new DateTimeRangeValidator(
                lowerBound,
                lowerBoundary,
                upperBound,
                upperBoundary,
                negated
            ) { Tag = keyToValidate };
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:18,代码来源:DateTimeRangeValidatorOperation.cs

示例11: StringLengthValidatorOperation

        public StringLengthValidatorOperation(
            string keyToValidate,
            string resultKey,
            int lowerBound,
            RangeBoundaryType lowerBoundaryType,
            int upperBound,
            RangeBoundaryType upperBoundaryType,
            bool negated)
            : base(keyToValidate, resultKey) {

            Validator = new StringLengthValidator(
                lowerBound,
                lowerBoundaryType,
                upperBound,
                upperBoundaryType,
                string.Empty,
                negated
                );
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:19,代码来源:StringLengthValidatorOperation.cs

示例12: ValidateRangeValidator

 internal static void ValidateRangeValidator(IComparable lowerBound, RangeBoundaryType lowerBoundaryType, IComparable upperBound, RangeBoundaryType upperBoundaryType)
 {
     if ((lowerBoundaryType != RangeBoundaryType.Ignore) && (lowerBound == null))
     {
         throw new ArgumentNullException("lowerBound");
     }
     if ((upperBoundaryType != RangeBoundaryType.Ignore) && (upperBound == null))
     {
         throw new ArgumentNullException("upperBound");
     }
     if ((lowerBoundaryType == RangeBoundaryType.Ignore) && (upperBoundaryType == RangeBoundaryType.Ignore))
     {
         throw new ArgumentException(Resources.ExceptionCannotIgnoreBothBoundariesInRange, "lowerBound");
     }
     if (((lowerBound != null) && (upperBound != null)) && (lowerBound.GetType() != upperBound.GetType()))
     {
         throw new ArgumentException(Resources.ExceptionTypeOfBoundsMustMatch, "upperBound");
     }
 }
开发者ID:davinx,项目名称:himedi,代码行数:19,代码来源:ValidatorArgumentsValidatorHelper.cs

示例13: RangeValidatorOperation

        public RangeValidatorOperation(
            string keyToValidate,
            string resultKey,
            IComparable lowerBound,
            RangeBoundaryType lowerBoundary,
            IComparable upperBound,
            RangeBoundaryType upperBoundary,
            bool negated)
            : base(keyToValidate, resultKey) {

            Validator = new RangeValidator(
                lowerBound,
                lowerBoundary,
                upperBound,
                upperBoundary,
                string.Empty,
                negated
                ) { Tag = keyToValidate };

            }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:20,代码来源:RangeValidatorOperation.cs

示例14: RelativeDateTimeValidatorOperation

        public RelativeDateTimeValidatorOperation(
            string keyToValidate,
            string resultKey,
            int lowerBound,
            DateTimeUnit lowerUnit,
            RangeBoundaryType lowerBoundaryType,
            int upperBound,
            DateTimeUnit upperUnit,
            RangeBoundaryType upperBoundaryType,
            bool negated)
            : base(keyToValidate, resultKey) {

            Validator = new RelativeDateTimeValidator(
                lowerBound,
                lowerUnit,
                lowerBoundaryType,
                upperBound,
                upperUnit,
                upperBoundaryType,
                string.Empty,
                negated
            ) { Tag = keyToValidate };
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:23,代码来源:RelativeDateTimeValidatorOperation.cs

示例15: StringDateTimeRangeValidator

 /// <summary>
 /// Initializes a new instance of the  <see cref="StringDateTimeRangeValidator"/>
 /// class with fully specified bound constraints and a message template.
 /// </summary>
 /// <param name="lowerBound">The lower bound.</param>
 /// <param name="lowerBoundType">The indication of how to perform the lower bound check.</param>
 /// <param name="upperBound">The upper bound.</param>
 /// <param name="upperBoundType">The indication of how to perform the upper bound check.</param>
 /// <param name="messageTemplate">The message template to use when logging results.</param>
 /// <param name="negated">True if the validator must negate the result of the validation.</param>
 public StringDateTimeRangeValidator(DateTime lowerBound, RangeBoundaryType lowerBoundType, DateTime upperBound, RangeBoundaryType upperBoundType, string messageTemplate, bool negated)
     : base(lowerBound, lowerBoundType, upperBound, upperBoundType, messageTemplate, negated)
 {
 }
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:14,代码来源:StringDateTimeRangeValidator.cs


注:本文中的RangeBoundaryType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。