public override void Verify(WDBContext context)
        {
            WDBField field = GetField(context);
            WDBCell  cell  = GetCell(context);

            string cellContent = cell.GetContent(field);

            if (!DateTime.TryParse(cellContent, out _))
            {
                context.AppendError(string.Format(WDBErrorMessages.CELL_CONTENT_CONVERT_ERROR, cellContent, cell.Row, cell.Column, typeof(DateTime)));
            }
        }
Exemplo n.º 2
0
        public void Check(WDBContext context)
        {
            context.Add(WDBContextKey.CURRENT_SHEET_NAME, this);
            {
                if (string.IsNullOrEmpty(Name))
                {
                    context.AppendError(WDBErrorMessages.SHEET_NAME_EMPTY_ERROR);
                }
                else if (!Regex.IsMatch(Name, NAME_REGEX_PATTERN))
                {
                    context.AppendError(string.Format(WDBErrorMessages.SHEET_NAME_FORMAT_ERROR, Name));
                }

                if (FieldCount == 0)
                {
                    context.AppendError(string.Format(WDBErrorMessages.SHEET_FIELD_EMPTY_ERROR, Name));
                }
                if (RowCount == 0)
                {
                    context.AppendError(string.Format(WDBErrorMessages.SHEET_ROW_EMPTY_ERROR, Name));
                }

                for (int i = 0; i < fields.Count; i++)
                {
                    context.Add(WDBContextKey.CURRENT_FIELD_NAME, fields[i]);
                    {
                        fields[i].Check(context);
                    }
                    context.Remove(WDBContextKey.CURRENT_FIELD_NAME);
                }

                for (int i = 0; i < rows.Count; i++)
                {
                    rows[i].Check(context);
                }
            }
            context.Remove(WDBContextKey.CURRENT_SHEET_NAME);
        }
Exemplo n.º 3
0
        public void Check(WDBContext context)
        {
            WDBSheet sheet = context.Get <WDBSheet>(WDBContextKey.CURRENT_SHEET_NAME);

            context.Add(WDBContextKey.CURRENT_ROW_NAME, this);
            {
                if (sheet.FieldCount != CellCount)
                {
                    context.AppendError(string.Format(WDBErrorMessages.ROW_CELL_COUNT_ERROR, CellCount, Row, sheet.FieldCount));
                }
                else
                {
                    for (int i = 0; i < CellCount; i++)
                    {
                        context.Add(WDBContextKey.CURRENT_FIELD_NAME, sheet.GetFieldAtIndex(i));
                        {
                            cells[i].Check(context);
                        }
                        context.Remove(WDBContextKey.CURRENT_FIELD_NAME);
                    }
                }
            }
            context.Remove(WDBContextKey.CURRENT_ROW_NAME);
        }
Exemplo n.º 4
0
 public abstract void Verify(WDBContext context);
Exemplo n.º 5
0
 protected WDBCell GetCell(WDBContext context)
 {
     return(context.Get <WDBCell>(WDBContextKey.CURRENT_CELL_NAME));
 }
Exemplo n.º 6
0
 protected WDBField GetField(WDBContext context)
 {
     return(context.Get <WDBField>(WDBContextKey.CURRENT_FIELD_NAME));
 }