Exemple #1
0
      private IWebServiceSenasaPortType GetClient()
      {
          CustomBinding customBinding = (CustomBinding)CreateMultiFactorAuthenticationBinding();

          EndpointAddress endpointAddress = new EndpointAddress(this.EndPointAddr);


          IWebServiceSenasaPortType proxy = ChannelFactory <IWebServiceSenasaPortType> .CreateChannel(customBinding, endpointAddress);

          ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(customXertificateValidation);
          ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Ssl3;

          ChannelFactory _bankChannel = new ChannelFactory <IWebServiceSenasaPortType>(customBinding, this.EndPointAddr);


          ChannelFactory <IWebServiceSenasaPortType> channelFactory = null;
          IWebServiceSenasaPortType client = null;

          channelFactory = new ChannelFactory <IWebServiceSenasaPortType>(customBinding, endpointAddress);
          channelFactory.Credentials.UserName.UserName = this.WsUser;
          channelFactory.Credentials.UserName.Password = this.WsPass;

          client = channelFactory.CreateChannel();

          return(client);
      }
Exemple #2
0
      /*public sendCancelaTransacResponse SendCancelacTransac(long idTransaccion, string usr, string pass)
       * {
       *  IWebServiceSDRNPortType client = GetClient();
       *
       *  try
       *  {
       *      sendCancelaTransac request = new sendCancelaTransac(idTransaccion, usr, pass);
       *      sendCancelaTransacResponse response = client.sendCancelaTransac(request);    //.sendCancelacTransacc(request);)
       *      return response;
       *  }
       *  catch (Exception e)
       *  {
       *      throw e;
       *  }
       * }
       */

      #endregion


      #region Desarrolladas


/// <summary>
/// Confirma las transacciones pendientes
/// </summary>
/// <param name="usr">Usuario del sistema</param>
/// <param name="pass">Password del sistema</param>
/// <param name="transacciones">Un array de la estructura de confirma transacciones</param>
/// <returns></returns>
      public sendConfirmaTransaccResponse SendConfirmaTransac(string usr, string pass, confirmacionTransaccionSenasaDTO[] transacciones)
      {
          //para cargar los proxis del sistema y no los de SENASA
          //UsaProxyDelSistema();

          //Esto carga un nuevo cliente para el web service
          IWebServiceSenasaPortType client = GetClient();



          try
          {
              //Crea el request para enviar a trazabilidad
              sendConfirmaTransacc request = new sendConfirmaTransacc(usr, pass, transacciones);


              //Escribe un XML en el disco con los datos del request
              Contable.Modulos.Escribir_XML.EscribirTicketSenasaRequest(request);

              //Envia la transaccion y guarda la respuesta
              sendConfirmaTransaccResponse response = client.sendConfirmaTransacc(request);

              //Escribe un XML en el disco con los datos del request
              Contable.Modulos.Escribir_XML.EscribirTicketSenasaResponse(response);

              return(response);
          }
          catch (Exception e)
          {
              MessageBox.Show(e.Message);
              throw e;
          }
      }
Exemple #3
0
      public saveTransaccionesResponse SendTransaccion(transaccionSenasaDTO[] transacciones, string usr, string pass)
      {
          //Esto carga un nuevo cliente para el web service
          IWebServiceSenasaPortType client = GetClient();


          try
          {
              //Crea el request para enviar a trazabilidad
              saveTransacciones request = new saveTransacciones(transacciones, usr, pass);



              //Escribe un XML en el disco con los datos del request
              Contable.Modulos.Escribir_XML.EscribirTicketSenasaRequest(request);

              //Envia la transaccion y guarda la respuesta
              saveTransaccionesResponse response = client.saveTransacciones(request);

              //Escribe un XML en el disco con los datos del request
              Contable.Modulos.Escribir_XML.EscribirTicketSenasaResponse(response);

              return(response);
          }
          catch (Exception e)
          {
              throw e;
          }
      }
Exemple #4
0
      /*public sendCancelaTransacResponse SendCancelacTransac(long idTransaccion, string usr, string pass)
       * {
       *  IWebServiceSDRNPortType client = GetClient();
       *
       *  try
       *  {
       *      sendCancelaTransac request = new sendCancelaTransac(idTransaccion, usr, pass);
       *      sendCancelaTransacResponse response = client.sendCancelaTransac(request);    //.sendCancelacTransacc(request);)
       *      return response;
       *  }
       *  catch (Exception e)
       *  {
       *      throw e;
       *  }
       * }
       */

      public getTransaccionesResponse GetTransacciones(string usser,
                                                       string pass,

                                                       string IdTransaccion,   //JCF
                                                       string IdEvento,        //JCF
                                                       string GLNOrigen,
                                                       string fechaTransDesde, //JCF
                                                       string fechaTransHasta, //JCF
                                                       string fechaOpeDesde,
                                                       string fechaOpeHasta,
                                                       string GLNInformador,
                                                       string IdTipoTransaccion, //JCF
                                                       string GTINElemento,      //JCF
                                                       string NroLote,
                                                       string NroSerie,
                                                       string NroRemitoFC,
                                                                                 //long GLNDestino,
                                                                                 //DateTime fechaVencimientoDesde,
                                                                                 //DateTime fechaVencimientoHasta,
                                                                                 //long nroRemito,
                                                                                 //long nroFactura,
                                                       string estadoTransaccion) //string usr, string pass, long GLNInformador, long GLNOrigen, long GLNDestino, string GTIN, long idEvento, string fechaOpeDesde, string fechaOpeHasta, string fechaTranDesde, string fechaTranHasta, string fechaVencimientoDesde, string fechaVencimientoHasta, long nroRemito, long nroFactura, long estadoTransaccion
      {
          IWebServiceSenasaPortType client = GetClient();

          try
          {
              getTransacciones request = new getTransacciones(usser,
                                                              pass,

                                                              IdTransaccion,   //JCF
                                                              IdEvento,        //JCF
                                                              GLNOrigen,
                                                              fechaTransDesde, //JCF
                                                              fechaTransHasta, //JCF
                                                              fechaOpeDesde,
                                                              fechaOpeHasta,
                                                              GLNInformador,
                                                              IdTipoTransaccion, //JCF
                                                              GTINElemento,      //JCF
                                                              NroLote,
                                                              NroSerie,
                                                              NroRemitoFC,
                                                              estadoTransaccion);

              getTransaccionesResponse response = client.getTransacciones(request);

              return(response);
          }
          catch (Exception e)
          {
              throw e;
          }
      }
Exemple #5
0
      public saveTransaccionesResponse SendTransaccion(transaccionSenasaDTO[] transacciones, string usr, string pass)
      {
          IWebServiceSenasaPortType client = GetClient();

          try
          {
              saveTransacciones         request  = new saveTransacciones(transacciones, usr, pass);
              saveTransaccionesResponse response = client.saveTransacciones(request);
              return(response);
          }
          catch (Exception e)
          {
              throw e;
          }
      }
Exemple #6
0
/// <summary>
/// Obtiene las transacciones pendientes de aceptacion.
/// </summary>
/// <param name="usser">Usuario del sistema</param>
/// <param name="pass">Password del sistema</param>
/// <param name="consulta">Estrucutra con los datos de la consulta</param>
/// <returns>Devuelve un array con los productos no aceptrados aun</returns>
      public getTransaccionesResponse GetTransacciones(string usser,
                                                       string pass,
                                                       Operaciones.vpConsultaSENASA consulta)
      {
          //Esto carga un nuevo cliente para el web service
          IWebServiceSenasaPortType client = GetClient();

          try
          {
              getTransacciones request = new getTransacciones(usser,
                                                              pass,

                                                              consulta.IdTransaccion,                       //JCF
                                                              consulta.IdEvento,                            //JCF
                                                              consulta.GLNOrigen,
                                                              consulta.fechaTransDesde.ToShortDateString(), //JCF
                                                              consulta.fechaTransHasta.ToShortDateString(), //JCF
                                                              consulta.fechaOpeDesde.ToShortDateString(),
                                                              consulta.fechaOpeHasta.ToShortDateString(),
                                                              consulta.GLNInformador,
                                                              consulta.IdTipoTransaccion, //JCF
                                                              consulta.GTINElemento,      //JCF
                                                              consulta.NroLote,
                                                              consulta.NroSerie,
                                                              consulta.NroRemitoFC,
                                                              consulta.estadoTransaccion);


              //Carga en la respuesta el resultado del getTransacciones
              getTransaccionesResponse response = client.getTransacciones(request);


              //retorno
              return(response);
          }
          catch (Exception e)
          {
              throw e;
          }
      }