public string GetValidationErrors(MessageSendArgument argument)
        {
            var errors = new List <string>();

            if (argument.DocumentType == null)
            {
                errors.Add("Тип документа не может быть пустым");
            }
            else
            {
                if (argument.DocumentType.UID <= 0)
                {
                    errors.Add("Некорректный тип документа");
                }
            }

            if (_validationHelper.FileIsEmpty(argument.File, argument))
            {
                errors.Add("Не добавлен файл!");
            }

            if (!_validationHelper.FileNameIsCorrect(argument.File, argument))
            {
                errors.Add("Не корректное имя файла!");
            }
            else
            {
                if (!_validationHelper.CheckFileExtension(new[] { ".pdf" }, argument.File, argument))
                {
                    errors.Add("Файл должен быть в формате \".pdf\"");
                }
            }
            if (errors.Count == 0)
            {
                return(null);
            }
            return(string.Join(Environment.NewLine, errors.ToArray()));
        }
        private string[] GetArgumentErrorRequisitionSendAttachedFiles(RequisitionSendArgument argument,
                                                                      SystemInfoMessage infoMessage)
        {
            var errors = new List <string>();

            var arg    = new GetAttachedFileMetadataArgument();
            var result = new GetAttachedFileMetadataResult();

            arg.MainDocumentType   = argument.PatentType;
            arg.JurApplicantExists = ExistsInApplicants(DicCustomerTypeCodes.Juridical, argument);
            arg.IpApplicantExists  = ExistsInApplicants(DicCustomerTypeCodes.SoloEntrepreneur, argument);
            //todo Поменялся механизм по которому определяется яввляется ли контрагент резидентом или нет. Не понятно как разруливать с интеграцией
            arg.NonResidentApplicantExists = ExistsInApplicants(DicCustomerTypeCodes.Nonresident, argument);
            _attachedFileMetadata.Handle(arg, result);
            var addedFileTypes = new List <int>();

            if (argument.BlockFile != null)
            {
                foreach (var attachedFile in argument.BlockFile)
                {
                    if (attachedFile == null)
                    {
                        errors.Add("BlockFile AttachedFile == null");
                        continue;
                    }

                    if (attachedFile.Type == null || attachedFile.Type.UID == 0)
                    {
                        errors.Add("Не указан тип документа BlockFile: AttachedFile.Type");
                        continue;
                    }

                    //var metaData = GetMetaData(attachedFile.Type, result.Data);

                    //if (metaData == null)
                    //{
                    //    errors.Add("BlockFile AttachedFile.Type.UID = " + attachedFile.Type.UID +
                    //               ". Данный документ не относится к этому типу патента.");
                    //    continue;
                    //}

                    if (_validationHelper.FileIsEmpty(attachedFile.File, infoMessage))
                    {
                        errors.Add("Не добавлен файл для документа BlockFile: AttachedFile.Type.UID = " +
                                   attachedFile.Type.UID);
                        continue;
                    }

                    if (!_validationHelper.FileNameIsCorrect(attachedFile.File, infoMessage))
                    {
                        errors.Add(
                            "Не указано имя файла или некорректное имя файла BlockFile: AttachedFile.File, Type.UID = " +
                            attachedFile.Type.UID);
                        continue;
                    }

                    //if (!_validationHelper.CheckFileExtension(metaData.Extensions, attachedFile.File, infoMessage))
                    //{
                    //    errors.Add(
                    //        "Неправильный формат файла для данного типа документа BlockFile: AttachedFile.Type.UID = "
                    //        + attachedFile.Type.UID + ", файл должен быть в формате\"" +
                    //        string.Join(", ", metaData.Extensions) + "\"");
                    //    continue;
                    //}

                    addedFileTypes.Add(attachedFile.Type.UID);
                }
            }

            //foreach (var metadata in result.Data)
            //{
            //    if (metadata.Required && !addedFileTypes.Contains(metadata.AttachedFileType.UID))
            //    {
            //        errors.Add("Не добавлен обязательный документ BlockFile: AttachedFile.Type.UID = " +
            //                   metadata.AttachedFileType.UID);
            //    }
            //}

            return(errors.ToArray());
        }