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); }
internal static bool AreDefault(this JqGridColumnRules columnRules) { return((columnRules.Custom == JqGridOptionsDefaults.ColumnModel.Rules.Custom) && (columnRules.Date == JqGridOptionsDefaults.ColumnModel.Rules.Date) && (columnRules.EditHidden == JqGridOptionsDefaults.ColumnModel.Rules.EditHidden) && (columnRules.Email == JqGridOptionsDefaults.ColumnModel.Rules.Email) && (columnRules.Integer == JqGridOptionsDefaults.ColumnModel.Rules.Integer) && !columnRules.MaxValue.HasValue && !columnRules.MinValue.HasValue && (columnRules.Number == JqGridOptionsDefaults.ColumnModel.Rules.Number) && (columnRules.Required == JqGridOptionsDefaults.ColumnModel.Rules.Required) && (columnRules.Time == JqGridOptionsDefaults.ColumnModel.Rules.Time) && (columnRules.Url == JqGridOptionsDefaults.ColumnModel.Rules.Url)); }
internal static void SetColumnSearchRules(this ModelMetadata metadata, JqGridColumnRules searchRules) { metadata.AdditionalValues.Add(_searchRulesKey, searchRules); }
internal static void SetColumnEditRules(this ModelMetadata metadata, JqGridColumnRules editRules) { metadata.AdditionalValues.Add(_editRulesKey, editRules); }
internal static void SetColumnSearchRules(this ModelMetadata metadata, JqGridColumnRules searchRules) { metadata.AdditionalValues.Add(_searchRulesKey, searchRules); }
internal static void SetColumnEditRules(this ModelMetadata metadata, JqGridColumnRules editRules) { metadata.AdditionalValues.Add(_editRulesKey, editRules); }
private static StringBuilder AppendColumnModelRules(this StringBuilder javaScriptBuilder, string fieldName, JqGridColumnRules columnRules) { if ((columnRules != null) && !columnRules.AreDefault()) { javaScriptBuilder.AppendJavaScriptObjectFieldOpening(fieldName); if (columnRules.Custom != JqGridOptionsDefaults.ColumnModel.Rules.Custom) { javaScriptBuilder.AppendJavaScriptObjectBooleanField(JqGridOptionsNames.ColumnModel.Rules.CUSTOM, columnRules.Custom) .AppendJavaScriptObjectFunctionField(JqGridOptionsNames.ColumnModel.Rules.CUSTOM_FUNCTION, columnRules.CustomFunction); } javaScriptBuilder.AppendJavaScriptObjectBooleanField(JqGridOptionsNames.ColumnModel.Rules.DATE, columnRules.Date, JqGridOptionsDefaults.ColumnModel.Rules.Date) .AppendJavaScriptObjectBooleanField(JqGridOptionsNames.ColumnModel.Rules.EDIT_HIDDEN, columnRules.EditHidden, JqGridOptionsDefaults.ColumnModel.Rules.EditHidden) .AppendJavaScriptObjectBooleanField(JqGridOptionsNames.ColumnModel.Rules.EMAIL, columnRules.Email, JqGridOptionsDefaults.ColumnModel.Rules.Email) .AppendJavaScriptObjectBooleanField(JqGridOptionsNames.ColumnModel.Rules.INTEGER, columnRules.Integer, JqGridOptionsDefaults.ColumnModel.Rules.Integer) .AppendJavaScriptObjectDoubleField(JqGridOptionsNames.ColumnModel.Rules.MAX_VALUE, columnRules.MaxValue) .AppendJavaScriptObjectDoubleField(JqGridOptionsNames.ColumnModel.Rules.MIN_VALUE, columnRules.MinValue) .AppendJavaScriptObjectBooleanField(JqGridOptionsNames.ColumnModel.Rules.NUMBER, columnRules.Number, JqGridOptionsDefaults.ColumnModel.Rules.Number) .AppendJavaScriptObjectBooleanField(JqGridOptionsNames.ColumnModel.Rules.REQUIRED, columnRules.Required, JqGridOptionsDefaults.ColumnModel.Rules.Required) .AppendJavaScriptObjectBooleanField(JqGridOptionsNames.ColumnModel.Rules.TIME, columnRules.Time, JqGridOptionsDefaults.ColumnModel.Rules.Time) .AppendJavaScriptObjectBooleanField(JqGridOptionsNames.ColumnModel.Rules.URL, columnRules.Url, JqGridOptionsDefaults.ColumnModel.Rules.Url) .AppendJavaScriptObjectFieldClosing(); } return(javaScriptBuilder); }
/// <summary> /// Initializes a new instance of the JqGridColumnElementAttribute class. /// </summary> public JqGridColumnElementAttribute() { Rules = new JqGridColumnRules(); }
/// <summary> /// Initializes a new instance of the JqGridColumnElementAttribute class. /// </summary> public JqGridColumnElementAttribute() { Rules = new JqGridColumnRules(); }
/// <summary> /// Initializes a new instance of the JqGridColumnElementAttribute class. /// </summary> protected JqGridColumnElementAttribute() { Rules = new JqGridColumnRules(); }