private static JqGridColumnRules GetRules(Type modelType, JqGridColumnElementAttribute jqGridColumnElementAttribute, RangeAttribute rangeAttribute, RequiredAttribute requiredAttribute) { JqGridColumnRules rules = jqGridColumnElementAttribute.Rules; if (rules != null) { if (requiredAttribute != null) { rules.Required = true; } if (rangeAttribute != null) { rules.MaxValue = Convert.ToDouble(rangeAttribute.Maximum); rules.MinValue = Convert.ToDouble(rangeAttribute.Minimum); } if ((modelType == typeof(Int16)) || (modelType == typeof(Int32)) || (modelType == typeof(Int64)) || (modelType == typeof(UInt16)) || (modelType == typeof(UInt32)) || (modelType == typeof(UInt32))) { rules.Integer = true; } else if ((modelType == typeof(Decimal)) || (modelType == typeof(Double)) || (modelType == typeof(Single))) { rules.Number = true; } } return(rules); }
private static TElementOptions GetElementOptions <TElementOptions>(TElementOptions elementOptions, IUrlHelper urlHelper, JqGridColumnElementAttribute jqGridColumnElementAttribute) where TElementOptions : JqGridColumnElementOptions { elementOptions.DataEvents = jqGridColumnElementAttribute.DataEvents; if (!String.IsNullOrWhiteSpace(jqGridColumnElementAttribute.DataAction)) { elementOptions.DataUrl = String.IsNullOrWhiteSpace(jqGridColumnElementAttribute.DataController) ? urlHelper.Action(jqGridColumnElementAttribute.DataAction) : urlHelper.Action(jqGridColumnElementAttribute.DataAction, jqGridColumnElementAttribute.DataController); } else if (!String.IsNullOrWhiteSpace(jqGridColumnElementAttribute.DataRoute)) { elementOptions.DataUrl = urlHelper.RouteUrl(jqGridColumnElementAttribute.DataRoute); } elementOptions.HtmlAttributes = jqGridColumnElementAttribute.HtmlAttributes; return(elementOptions); }