Exemplo n.º 1
0
        public virtual async Task <IdInStoreValidationResult> ValidateIds(IExcelRowParseResult parseResult, IExcelRowParseRequest request)
        {
            var result = new IdInStoreValidationResult();

            if (!parseResult.InvalidIdValue.Value)
            {
                var found = await repo.RowRecordExists(request.Row.Sheet, parseResult.UserDefinedId.Value);

                if (found.HasValue)
                {
                    result.IdDuplicate = true;
                }
            }

            if (parseResult.ForeignUserDefinedId.HasValue)
            {
                var found = await repo.RowRecordExists(request.Row.Sheet.Parent.Sheets.FirstOrDefault(x => x.Index == 0)
                                                       , parseResult.ForeignUserDefinedId.Value);

                if (!found.HasValue)
                {
                    result.ForeignIdNotFound = true;
                }
                else
                {
                    result.ForeignId = found.Value;
                }
            }

            return(result);
        }
Exemplo n.º 2
0
 public void Populate(IdInStoreValidationResult result)
 {
     IdDuplicate       = result.IdDuplicate;
     ForeignIdNotFound = result.ForeignIdNotFound;
     ForeignId         = result.ForeignId;
 }