Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            DateTime thisDay = DateTime.Now;
            String   fch     = String.Format("{0:yyyy-MM-ddTHH:mm:ss}", thisDay);
            String   fchName = String.Format("{0:yyyyMMddTHHmmss}", thisDay);

            String    dirCurrentFile = String.Empty;
            TxtReader lec            = new TxtReader();
            Documento doc            = new Documento();

            doc = lec.lectura("", true, dirCurrentFile);

            if (doc != null)
            {
                Connect conn = new Connect();
                User    user = new User();
                user = conn.login("*****@*****.**", "10207640-0");

                Console.WriteLine("Token " + user.token);
                Console.WriteLine("Uid  " + user.uid);

                String fileName = @"C:/AdmToFebosFiles/files/DTE_" + doc.RUTEmisor + "_" + doc.TipoDTE + "_" + doc.Folio + "_" + fchName + ".txt";

                lec.createTxtFbos(doc, fileName);

                conn.sendInvoice(fileName, user, doc.Folio.ToString());
            }
        }
Example #2
0
        public void DoProcessIat()
        {
            while (!_shouldStop)
            {
                Console.WriteLine("ProcessIat thread: working...");
                Thread.Sleep(5000);

                DateTime thisDay = DateTime.Now;
                String   fch     = String.Format("{0:yyyy-MM-ddTHH:mm:ss}", thisDay);
                String   fchName = String.Format("{0:yyyyMMddTHHmmss}", thisDay);

                String    dirCurrentFile = String.Empty;
                TxtReader lec            = new TxtReader();
                Documento doc            = new Documento();
                doc = lec.lectura("", true, dirCurrentFile);
                if (doc != null)
                {
                    Connect conn = new Connect();
                    User    user = new User();
                    user = conn.login("*****@*****.**", "10207640-0");
                    Console.WriteLine("Token " + user.token);
                    Console.WriteLine("Uid  " + user.uid);
                    String fileName = @"C:/AdmToFebosFiles/files/DTE_" + doc.RUTEmisor + "_" + doc.TipoDTE + "_" + doc.Folio + "_" + fchName + ".txt";
                    lec.createTxtFbos(doc, fileName);
                    String febosID = conn.sendInvoice(fileName, user, doc.Folio.ToString());

                    String folioFiscal = conn.getFolioFiscal(user, febosID);
                    Thread.Sleep(2000);
                    conn.updFolioAdm(doc, febosID, folioFiscal);
                }
            }
            Console.WriteLine("ProcessIat thread: terminating gracefully.");
        }
Example #3
0
        public void DoProcessIat()
        {
            while (!_shouldStop)
            {
                Console.WriteLine("ProcessIat thread: working...");
                Thread.Sleep(5000);

                DateTime thisDay = DateTime.Now;
                String fch = String.Format("{0:yyyy-MM-ddTHH:mm:ss}", thisDay);
                String fchName = String.Format("{0:yyyyMMddTHHmmss}", thisDay);

                String dirCurrentFile = String.Empty;
                TxtReader lec = new TxtReader();
                Documento doc = new Documento();
                doc = lec.lectura("", true, dirCurrentFile);
                if (doc != null)
                {
                    Connect conn = new Connect();
                    User user = new User();
                    user = conn.login("*****@*****.**", "10207640-0");
                    Console.WriteLine("Token " + user.token);
                    Console.WriteLine("Uid  " + user.uid);
                    String fileName = @"C:/AdmToFebosFiles/files/DTE_" + doc.RUTEmisor + "_" + doc.TipoDTE + "_" + doc.Folio + "_" + fchName + ".txt";
                    lec.createTxtFbos(doc, fileName);
                    String febosID = conn.sendInvoice(fileName, user, doc.Folio.ToString());

                    String folioFiscal = conn.getFolioFiscal(user, febosID);
                    Thread.Sleep(2000);
                    conn.updFolioAdm(doc, febosID, folioFiscal);
                }
            }
            Console.WriteLine("ProcessIat thread: terminating gracefully.");
        }
Example #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            DateTime thisDay = DateTime.Now;
            String fch = String.Format("{0:yyyy-MM-ddTHH:mm:ss}", thisDay);
            String fchName = String.Format("{0:yyyyMMddTHHmmss}", thisDay);

            String dirCurrentFile = String.Empty;
            TxtReader lec = new TxtReader();
            Documento doc = new Documento();

            doc = lec.lectura("", true, dirCurrentFile);

            if (doc != null)
            {
                Connect conn = new Connect();
                User user = new User();
                user = conn.login("*****@*****.**", "10207640-0");

                Console.WriteLine("Token " + user.token);
                Console.WriteLine("Uid  " + user.uid);

                String fileName = @"C:/AdmToFebosFiles/files/DTE_" + doc.RUTEmisor + "_" + doc.TipoDTE + "_" + doc.Folio + "_" + fchName + ".txt";

                lec.createTxtFbos(doc, fileName);

                conn.sendInvoice(fileName, user, doc.Folio.ToString());
            }
        }