Exemplo n.º 1
0
        public void CheckPostDataSet(TkDbContext context, IInputData inputData,
                                     string tableName, FieldErrorInfoCollection errorObjects)
        {
            DataSet   ds    = inputData.PostObject.Convert <DataSet>();
            DataTable table = ds.Tables[tableName];

            if (table == null)
            {
                return;
            }

            foreach (BaseConstraint constraint in fList)
            {
                string fieldName = constraint.Field.NickName;
                if (!table.Columns.Contains(fieldName))
                {
                    if (constraint.CoerceCheck)
                    {
                        constraint.InternalCheckError(inputData, null, -1, context);
                    }
                    continue;
                }

                int i = 0;
                foreach (DataRow row in table.Rows)
                {
                    if (row.RowState == DataRowState.Deleted)
                    {
                        ++i;
                        continue;
                    }
                    string value = row[fieldName].ToString();
                    if (!errorObjects.Contains(constraint, i))
                    {
                        FieldErrorInfo error = constraint.InternalCheckError(inputData, value, i,
                                                                             context, row, table, ds);
                        if (error != null)
                        {
                            errorObjects.Add(constraint, error, i);
                        }
                    }
                    ++i;
                }
            }
        }
Exemplo n.º 2
0
 public void CheckDbLater(TkDbContext context, IInputData inputData,
                          FieldErrorInfoCollection errorObjects)
 {
     fConstraints.CheckPostDataSet(context, inputData, TableName, errorObjects);
 }