Ejemplo n.º 1
0
        public void Start()
        {
            InvoiceModel  currentRequest;
            ResponseModel currentResponse;

            for (int i = 0; i < dtRequests.Rows.Count; i++)
            {
                Console.WriteLine(DateTime.Now.ToLongTimeString() + ": " + (dtRequests.Rows.Count - i) + " requests are in step 5");
                Thread.Sleep(500);
                String type = dtRequests.Rows[i][2].ToString();
                currentRequest  = new InvoiceModel(Int64.Parse(dtRequests.Rows[i][0].ToString()), RequestType.PDF, dtRequests.Rows[i][10].ToString());
                currentResponse = EConfirmState.ConfirmStateProcess.ConfirmState(currentRequest);
                if (currentResponse.success)
                {
                    Request.Update_Estado(currentRequest.Id, (int)InvoiceState.received);
                }
                else
                {
                    if (currentResponse.error == Error.decline)
                    {
                        Request.Update_Estado(currentRequest.Id, (int)InvoiceState.notAccepted);
                    }
                    else
                    {
                        Request.Update_Estado(currentRequest.Id, (int)InvoiceState.connectionConfirmError);
                    }
                }
            }
            Console.WriteLine(DateTime.Now.ToLongTimeString() + ": There are no requests in step 5");
            dtRequests = Request.SelectStatus((int)InvoiceState.sended, (int)InvoiceState.connectionConfirmError);
            if (dtRequests.Rows.Count > 0)
            {
                Start();
            }
        }
Ejemplo n.º 2
0
        public void Start()
        {
            InvoiceModel  currentRequest;
            ResponseModel currentResponse;

            for (int i = 0; i < dtRequests.Rows.Count; i++)
            {
                Console.WriteLine(DateTime.Now.ToLongTimeString() + " " + (dtRequests.Rows.Count - i) + " requests are in step 3");
                Thread.Sleep(500);
                String type = dtRequests.Rows[i][2].ToString();
                currentRequest  = new InvoiceModel(Int64.Parse(dtRequests.Rows[i][0].ToString()), RequestType.PDF, dtRequests.Rows[i][10].ToString());
                currentResponse = CXsdValidator.XsdValidatorProcess.ValidateInvoice(currentRequest);
                if (currentResponse.success)
                {
                    Request.Update_Estado(currentRequest.Id, (int)InvoiceState.xsdValidated);
                    if (SendInvoiceThread.ThreadState != ThreadState.Running && SendInvoiceThread.ThreadState != ThreadState.WaitSleepJoin)
                    {
                        SendInvoiceThread = new Thread(SendInvoiceDelegate);
                        SendInvoiceThread.Start();
                    }
                }
                else
                {
                    Request.Update_Estado(currentRequest.Id, (int)InvoiceState.xsdValidationError);
                }
            }
            Console.WriteLine(DateTime.Now.ToLongTimeString() + " There are no requests in step 3");

            dtRequests = Request.SelectStatus((int)InvoiceState.signed);
            if (dtRequests.Rows.Count > 0)
            {
                Start();
            }
        }
Ejemplo n.º 3
0
 public StepEServer()
 {
     dtRequests = Request.SelectStatus((int)InvoiceState.sended, (int)InvoiceState.connectionConfirmError);
 }
Ejemplo n.º 4
0
 public StepCServer()
 {
     dtRequests = Request.SelectStatus((int)InvoiceState.signed);
 }
Ejemplo n.º 5
0
 public StepDServer()
 {
     dtRequests = Request.SelectStatus((int)InvoiceState.xsdValidated, (int)InvoiceState.connectionError);
 }