Пример #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 1, in the validator 3");
                Thread.Sleep(500);
                String type = dtRequests.Rows[i][2].ToString();
                if (type == "PDF")
                {
                    currentRequest  = new InvoiceModel(Int64.Parse(dtRequests.Rows[i][0].ToString()), RequestType.PDF, dtRequests.Rows[i][7].ToString());
                    currentResponse = Software1Validator.Process.AttachPDF(currentRequest);
                }
                else
                {
                    currentRequest  = new InvoiceModel(Int64.Parse(dtRequests.Rows[i][0].ToString()), RequestType.XML, dtRequests.Rows[i][8].ToString());
                    currentResponse = Software1Validator.Process.ProcesInvoice(currentRequest);
                }
                if (currentResponse.success)
                {
                    Request.Update_Estado(currentRequest.Id, (int)InvoiceState.saved);
                    Validator1Server.CompleteProcess();
                }
                else
                {
                    if (currentResponse.error == Error.validate)
                    {
                        Request.Update_Estado(currentRequest.Id, (int)InvoiceState.validationError);
                    }
                    else
                    {
                        Request.Update_Estado(currentRequest.Id, (int)InvoiceState.saveError);
                    }
                }
            }
            Console.WriteLine(DateTime.Now.ToLongTimeString() + " The validator 3 has no requests");
        }
        static void validator1()
        {
            Validator1Server vs = new Validator1Server();

            vs.Start();
        }