Esempio n. 1
0
        /// <summary>
        /// IMZALI XML DISKE KAYDET
        /// </summary>

        public bool isGetInvoiceSingnedXml(string direction)
        {
            using (new OperationContextScope(eInvoiceOIBPortClient.InnerChannel))
            {
                GetInvoiceRequest req = new GetInvoiceRequest();
                req.REQUEST_HEADER                            = RequestHeader.getRequestHeaderOib;
                req.REQUEST_HEADER.COMPRESSED                 = nameof(EI.ActiveOrPasive.Y);
                req.INVOICE_SEARCH_KEY                        = InvoiceSearchKey.invoiceSearchKeyGetInvoice;
                req.INVOICE_SEARCH_KEY.READ_INCLUDED          = true; //okunmusları da al
                req.INVOICE_SEARCH_KEY.READ_INCLUDEDSpecified = true;
                req.HEADER_ONLY = EI.ActiveOrPasive.N.ToString();
                req.INVOICE_SEARCH_KEY.DIRECTION = direction;
                if (direction == nameof(EI.Direction.DRAFT))
                {
                    req.INVOICE_SEARCH_KEY.DIRECTION  = nameof(EI.Direction.OUT);
                    req.INVOICE_SEARCH_KEY.DRAFT_FLAG = nameof(EI.ActiveOrPasive.Y);
                }

                INVOICE[] invoiceArr = eInvoiceOIBPortClient.GetInvoice(req);
                if (invoiceArr == null || invoiceArr.Length != 0)
                {
                    foreach (var invoice in invoiceArr)
                    {
                        FolderControl.saveInvDocContentWithByte(Compress.UncompressFile(invoice.CONTENT.Value), direction, invoice.ID, nameof(EI.DocumentType.XML));
                    }
                    //db ye kaydetmedıgım ıcın aldıgım faturaları mark ınv yapmadım

                    if (invoiceArr.Length == 100) //butun okunmamısları almak ıcın ... limit 100 vermıstık
                    {
                        isGetInvoiceSingnedXml(direction);
                    }
                    return(true);
                }
                return(false);
            }
        }