public override bool Validate() { if (!base.Validate()) { return(false); } else { if (!this.IsNew) { return(true); //TODO: GJ: figure out how to run certain validation rules on an existing model } NameValueCollection values = new NameValueCollection(); foreach (SubSonic.TableSchema.TableColumnSetting column in this.GetColumnSettings()) { if (column.CurrentValue != null) { values.Add(column.ColumnName, column.CurrentValue.ToString()); } } UserValidationRules validationRules = new UserValidationRules(); //TODO: GJ: add error messages to SubSonic model //TODO: GJ: refactor to helper class return(validationRules.Validate(values)); } }
public override bool Validate() { if (!base.Validate()) { return false; } else { if(!this.IsNew) return true; //TODO: GJ: figure out how to run certain validation rules on an existing model NameValueCollection values = new NameValueCollection(); foreach (SubSonic.TableSchema.TableColumnSetting column in this.GetColumnSettings()) if (column.CurrentValue != null) values.Add(column.ColumnName, column.CurrentValue.ToString()); UserValidationRules validationRules = new UserValidationRules(); //TODO: GJ: add error messages to SubSonic model //TODO: GJ: refactor to helper class return validationRules.Validate(values); } }