Пример #1
0
        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));
            }
        }
Пример #2
0
        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);
            }
        }