Example #1
0
        private void sendResponse(HttpListenerResponse response, string JSONstring)
        {
            try
            {
                byte[] buffer = System.Text.Encoding.UTF8.GetBytes(JSONstring);

                response.ContentLength64 = buffer.Length;

                System.IO.Stream output = response.OutputStream;

                output.Write(buffer, 0, buffer.Length);

                output.Close();
                if (dg.state == "Waiting")
                {
                    if (ie == null)
                    {
                        ie             = new Cronos(afterEndIVRTime);
                        ie.onFinished += new Cronos.Finish(this.onIVREndTimeFinished);
                        log.Info("Se inicia conteo despues del colgado de IVR: " + dg.state);
                        ie.start();
                    }
                    else if (!ie.alive)
                    {
                        ie             = new Cronos(afterEndIVRTime);
                        ie.onFinished += new Cronos.Finish(this.onIVREndTimeFinished);
                        log.Info("Se inicia conteo despues del colgado de IVR: " + dg.state);
                        ie.start();
                    }
                }
                if (dg.state == "NotReady")
                {
                    if (tx == null)
                    {
                        txCount        = 1;
                        tx             = new Cronos(notReadyTime);
                        tx.onFinished += new Cronos.Finish(this.onTxTimeFinished);
                        log.Info("Se inicia conteo despues de la Xfer a IVR: " + dg.state);
                        tx.start();
                    }
                    else if (!tx.alive)
                    {
                        txCount        = 1;
                        tx             = new Cronos(notReadyTime);
                        tx.onFinished += new Cronos.Finish(this.onTxTimeFinished);
                        log.Info("Se inicia conteo despues de la Xfer a IVR: " + dg.state);
                        tx.start();
                    }
                }
            }
            catch (Exception e)
            {
                log.Error(e);
            }
        }
Example #2
0
 public Transaction NewRequestEvent(NewRequestArg e)
 {
     dg = new DataGadget();
     log.Debug("---------------   Request parameters for " + (e.param.op == 1 ? "Venta" : "Devolución") + " -----------------");
     dg.op    = e.param.op;
     dg.ip    = e.param.ip;
     dg.state = e.param.state;
     if (dg.op == 1)
     {
         log.Debug("nor: " + e.param.nor);
         log.Debug("bnc: " + e.param.bnc);
         log.Debug("mnt: " + e.param.mnt);
         log.Debug("loc: " + e.param.loc);
         log.Debug("arm: " + e.param.arm);
         if (e.param.nor == "")
         {
             throw new NullFieldException("Número de orden vacio.");
         }
         else
         {
             dg.nor = e.param.nor;
         }
         if (e.param.bnc == "")
         {
             throw new NullFieldException("Banco vacio.");
         }
         else
         {
             dg.bnc = e.param.bnc;
         }
         if (e.param.mnt == "")
         {
             throw new NullFieldException("Monto vacio.");
         }
         else
         {
             dg.mnt = e.param.mnt;
         }
         if (e.param.loc == "")
         {
             throw new NullFieldException("Localidad vacia.");
         }
         else
         {
             dg.loc = e.param.loc;
         }
         dg.arm    = e.param.arm;
         trans.nor = dg.nor;
         trans.mnt = dg.mnt;
         trans.mne = new MensajeNegocio();
     }
     else
     {
         log.Debug("nor: " + e.param.nor);
         log.Debug("tct: " + e.param.tct);
         log.Debug("mnt: " + e.param.mnt);
         if (e.param.nor == "")
         {
             throw new NullFieldException("Número de orden vacio.");
         }
         else
         {
             dg.nor = e.param.nor;
         }
         if (e.param.tct == "")
         {
             throw new NullFieldException("Número de tarjeta trunco vacio.");
         }
         else
         {
             dg.tct = e.param.tct;
         }
         if (e.param.mnt == "")
         {
             throw new NullFieldException("Monto vacio.");
         }
         else
         {
             dg.mnt = e.param.mnt;
         }
         trans.nor = dg.nor;
         trans.mnt = dg.mnt;
         trans.mne = new MensajeNegocio();
     }
     tr             = new Cronos(timeResponse);
     tr.onFinished += new Cronos.Finish(this.onTrTimeFinished);
     log.Debug("Inicia el conteo");
     tr.start();
     return(trans);
 }