private static int? GetMaxlength(FeatureContext context) {
            if (context is PropertyContext) {
                return (context as PropertyContext).Property.MaxLength;
            }
            if (context is ParameterContext) {
                return (context as ParameterContext).Parameter.MaxLength;
            }
            // todo is this correct exception
            throw new BadRequestNOSException(String.Format("Unexpected context type {0}", context.GetType()));

            //throw new UnexpectedCallException(string.Format("Unexpected context type {0}", context.GetType()));
        }
        private static RangeData GetRange(FeatureContext context) {
            if (context is PropertyContext) {
                return new RangeData((context as PropertyContext).Property.Range);
            }
            if (context is ParameterContext) {
                return new RangeData((context as ParameterContext).Parameter.Range);
            }
            // todo is this correct exception
            throw new BadRequestNOSException(String.Format("Unexpected context type {0}", context.GetType()));

            //throw new UnexpectedCallException(string.Format("Unexpected context type {0}", context.GetType()));
        }
        private static bool IsAutoComplete(FeatureContext context) {
            if (context is PropertyContext) {
                return (context as PropertyContext).Property.IsAutoCompleteEnabled;
            }
            if (context is ParameterContext) {
                return (context as ParameterContext).Parameter.IsAutoCompleteEnabled;
            }
            // todo is this correct exception
            throw new BadRequestNOSException(String.Format("Unexpected context type {0}", context.GetType()));

            // throw new UnexpectedCallException(string.Format("Unexpected context type {0}", context.GetType()));
        }
        private static bool IsMandatory(this HtmlHelper html, FeatureContext context) {
            if (context is PropertyContext) {
                return html.IsMandatory(context as PropertyContext);
            }
            if (context is ParameterContext) {
                return html.IsMandatory(context as ParameterContext);
            }
            // todo is this correct exception
            throw new BadRequestNOSException(String.Format("Unexpected context type {0}", context.GetType()));

            //throw new UnexpectedCallException(string.Format("Unexpected context type {0}", context.GetType()));
        }
 private static IEnumerable<SelectListItem> GetItems(this HtmlHelper html, string id, FeatureContext context) {
     if (context is PropertyContext) {
         return html.GetItems(id, context as PropertyContext);
     }
     if (context is ParameterContext) {
         return html.GetItems(id, context as ParameterContext);
     }
     // todo is this correct exception
     throw new BadRequestNOSException(String.Format("Unexpected context type {0}", context.GetType()));
     //throw new UnexpectedCallException(string.Format("Unexpected context type {0}", context.GetType()));
 }
Пример #6
0
 private static bool IsAutoComplete(FeatureContext context) {
     if (context is PropertyContext) {
         var assoc = ((context as PropertyContext).Property) as IOneToOneAssociation;
         return assoc != null && assoc.IsAutoCompleteEnabled;
     }
     if (context is ParameterContext) {
         return (context as ParameterContext).Parameter.IsAutoCompleteEnabled;
     }
     throw new UnexpectedCallException(string.Format("Unexpected context type {0}", context.GetType()));
 }
Пример #7
0
 private static bool IsMandatory(FeatureContext context) {
     if (context is PropertyContext) {
         return IsMandatory(context as PropertyContext);
     }
     if (context is ParameterContext) {
         return IsMandatory(context as ParameterContext);
     }
     throw new UnexpectedCallException(string.Format("Unexpected context type {0}", context.GetType()));
 }