Ejemplo n.º 1
0
        /// <summary>
        /// A method for printing all the failed documents and the reason for their failure.
        /// </summary>
        /// <param name="failedDocument"></param>
        private static void PrintFailedDocumentDetails(FailedDocument failedDocument)
        {
            if (failedDocument == null)
            {
                return;
            }

            Console.WriteLine("Document Key : " + failedDocument.DocumentKey);
            Console.WriteLine("Error Code : " + failedDocument.ErrorCode);
            Console.WriteLine("Error Message : " + failedDocument.ErrorMessage + "\n");
        }
Ejemplo n.º 2
0
        public void AddFailedDocument(FailedDocument document)
        {
            if (document != null)
            {
                if (_failedDocumentsList == null)
                {
                    _failedDocumentsList = new List <FailedDocument>();
                }

                _failedDocumentsList.Add(document);
            }
        }
Ejemplo n.º 3
0
        public DeleteDocumentsResponse(Alachisoft.NosDB.Common.Protobuf.Response response) : base(response.ToBuilder())
        {
            _deleteResponse = response.DeleteDocumentsResponse.ToBuilder();

            if (_deleteResponse.FailedDocumentsList != null && _deleteResponse.FailedDocumentsCount > 0)
            {
                _failedDocumentsList = new List <FailedDocument>();
                foreach (var document in _deleteResponse.FailedDocumentsList)
                {
                    FailedDocument failedDocument = new FailedDocument();
                    failedDocument.DocumentKey     = document.DocumentId;
                    failedDocument.ErrorCode       = document.ErrorCode;
                    failedDocument.ErrorParameters = document.ErrorParamsList.ToArray();
                    _failedDocumentsList.Add(failedDocument);
                }
            }
            base.ResponseMessage = this;
        }
Ejemplo n.º 4
0
        public InsertDocumentsResponse(Alachisoft.NosDB.Common.Protobuf.Response response) : base(response.ToBuilder())
        {
            _insertResponse = response.InsertDocumentsResponse.ToBuilder();

            if (_insertResponse.FailedDocumentsList != null && _insertResponse.FailedDocumentsList.Count > 0)
            {
                _failedDocumentsList = new List <FailedDocument>();
                foreach (Protobuf.FailedDocument document in _insertResponse.FailedDocumentsList)
                {
                    FailedDocument failedDocument = new FailedDocument();
                    failedDocument.DocumentKey     = document.DocumentId;
                    failedDocument.ErrorCode       = document.ErrorCode;
                    failedDocument.ErrorParameters = document.ErrorParamsList.ToArray();
                    failedDocument.ErrorMessage    = string.Format(ErrorHandling.ErrorMessages.GetErrorMessage(document.ErrorCode), failedDocument.ErrorParameters);
                    _failedDocumentsList.Add(failedDocument);
                }
            }

            base.ResponseMessage = this;
        }