public override string getValueDisplay(int component, Locale locale)
 {
     if (component < 1 || component > 4)
     {
         throw new System.ArgumentException("invalid component number " + component + " for field 281");
     }
     if (component == 1)
     {
         //time
         java.text.DateFormat f   = new java.text.SimpleDateFormat("HH:mm", notNull(locale));
         DateTime             cal = Component1AsCalendar;
         if (cal != null)
         {
             return(f.format(cal.Ticks));
         }
     }
     if (component == 2)
     {
         //default format (as is)
         return(getComponent(2));
     }
     if (component == 3)
     {
         //default format (as is)
         return(getComponent(3));
     }
     if (component == 4)
     {
         //default format (as is)
         return(getComponent(4));
     }
     return(null);
 }
Exemple #2
0
 public override string getValueDisplay(int component, Locale locale)
 {
     if (component < 1 || component > 3)
     {
         throw new System.ArgumentException("invalid component number " + component + " for field 109");
     }
     if (component == 1)
     {
         //date
         java.text.DateFormat f   = java.text.DateFormat.getDateInstance(java.text.DateFormat.DEFAULT, notNull(locale));
         DateTime             cal = Component1AsCalendar;
         if (cal != null)
         {
             return(f.format(cal.Ticks));
         }
     }
     if (component == 2)
     {
         //time with seconds
         java.text.DateFormat f   = new java.text.SimpleDateFormat("HH:mm:ss", notNull(locale));
         DateTime             cal = Component2AsCalendar;
         if (cal != null)
         {
             return(f.format(cal.Ticks));
         }
     }
     if (component == 3)
     {
         //default format (as is)
         return(getComponent(3));
     }
     return(null);
 }
 /// <summary>
 /// Returns a localized suitable for showing to humans string of a field component.<br>
 /// </summary>
 /// <param name="component"> number of the component to display </param>
 /// <param name="locale"> optional locale to format date and amounts, if null, the default locale is used </param>
 /// <returns> formatted component value or null if component number is invalid or not present </returns>
 /// <exception cref="IllegalArgumentException"> if component number is invalid for the field
 /// @since 7.8 </exception>
 public override string getValueDisplay(int component, Locale locale)
 {
     if (component < 1 || component > 2)
     {
         throw new System.ArgumentException("invalid component number " + component + " for field 172");
     }
     if (component == 1)
     {
         //monthday
         java.text.DateFormat f   = new java.text.SimpleDateFormat("MMM", notNull(locale));
         DateTime             cal = Component1AsCalendar;
         if (cal != null)
         {
             return(f.format(cal.Ticks));
         }
     }
     if (component == 2)
     {
         //monthday
         java.text.DateFormat f   = new java.text.SimpleDateFormat("MMM", notNull(locale));
         DateTime             cal = Component2AsCalendar;
         if (cal != null)
         {
             return(f.format(cal.Ticks));
         }
     }
     return(null);
 }
Exemple #4
0
 /// <summary>
 /// Returns a localized suitable for showing to humans string of a field component.<br>
 /// </summary>
 /// <param name="component"> number of the component to display </param>
 /// <param name="locale"> optional locale to format date and amounts, if null, the default locale is used </param>
 /// <returns> formatted component value or null if component number is invalid or not present </returns>
 /// <exception cref="IllegalArgumentException"> if component number is invalid for the field
 /// @since 7.8 </exception>
 public override string getValueDisplay(int component, Locale locale)
 {
     if (component < 1 || component > 6)
     {
         throw new System.ArgumentException("invalid component number " + component + " for field 258");
     }
     if (component == 1)
     {
         //default format (as is)
         return(getComponent(1));
     }
     if (component == 2)
     {
         //number, amount, rate
         java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(notNull(locale));
         f.MaximumFractionDigits = 13;
         Number n = Component2AsNumber;
         if (n != null)
         {
             return(f.format(n));
         }
     }
     if (component == 3)
     {
         //default format (as is)
         return(getComponent(3));
     }
     if (component == 4)
     {
         //date
         java.text.DateFormat f   = java.text.DateFormat.getDateInstance(java.text.DateFormat.DEFAULT, notNull(locale));
         DateTime             cal = Component4AsCalendar;
         if (cal != null)
         {
             return(f.format(cal.Ticks));
         }
     }
     if (component == 5)
     {
         //time
         java.text.DateFormat f   = new java.text.SimpleDateFormat("HH:mm", notNull(locale));
         DateTime             cal = Component5AsCalendar;
         if (cal != null)
         {
             return(f.format(cal.Ticks));
         }
     }
     if (component == 6)
     {
         //time
         java.text.DateFormat f   = new java.text.SimpleDateFormat("HH:mm", notNull(locale));
         DateTime             cal = Component6AsCalendar;
         if (cal != null)
         {
             return(f.format(cal.Ticks));
         }
     }
     return(null);
 }
Exemple #5
0
 /// <summary>
 /// Returns a localized suitable for showing to humans string of a field component.<br>
 /// </summary>
 /// <param name="component"> number of the component to display </param>
 /// <param name="locale"> optional locale to format date and amounts, if null, the default locale is used </param>
 /// <returns> formatted component value or null if component number is invalid or not present </returns>
 /// <exception cref="IllegalArgumentException"> if component number is invalid for the field
 /// @since 7.8 </exception>
 public override string getValueDisplay(int component, Locale locale)
 {
     if (component < 1 || component > 1)
     {
         throw new System.ArgumentException("invalid component number " + component + " for field 142");
     }
     if (component == 1)
     {
         //date + time
         java.text.DateFormat df  = java.text.DateFormat.getDateInstance(java.text.DateFormat.DEFAULT, notNull(locale));
         java.text.DateFormat tf  = new java.text.SimpleDateFormat("HH:mm", notNull(locale));
         DateTime             cal = Component1AsCalendar;
         if (cal != null)
         {
             return(df.format(cal.Ticks) + " " + tf.format(cal.Ticks));
         }
     }
     return(null);
 }
Exemple #6
0
 /// <summary>
 /// The date format to change to. This should be a format understood by
 /// Java's SimpleDateFormat class.
 /// </summary>
 public ChangeDateFormat DateFormat(java.text.SimpleDateFormat dateFormat)
 {
     Impl.setDateFormat(dateFormat);
     return(this);
 }
Exemple #7
0
        public void autorizarComprobante(String claveAcceso)
        {
            sriAutorizacion.AutorizacionComprobantesOfflineService servicio = new sriAutorizacion.AutorizacionComprobantesOfflineService();
            object[] resAutorizacion = null;
            try
            {
                resAutorizacion = servicio.autorizacionComprobante(claveAcceso);
            }
            catch (Exception ex)
            {
                return;
            }
            this.respuestaAutorizacion.setClaveAccesoConsultada((((System.Xml.XmlNode[])(((object[])(resAutorizacion[0]))[0]))[0]).InnerText);
            this.respuestaAutorizacion.setNumeroComprobantes((((System.Xml.XmlNode[])(((object[])(resAutorizacion[0]))[0]))[1]).InnerText);
            Autorizaciones autorizaciones = new Autorizaciones();;
            Autorizacion   autorizacion   = new Autorizacion();
            XmlNode        nodoAutorizaciones;

            if (((System.Xml.XmlNode[])(((object[])(resAutorizacion[0]))[0])).Length <= 2)
            {
                nodoAutorizaciones = (((System.Xml.XmlNode[])(((object[])(resAutorizacion[0]))[0]))[1]);
            }
            else
            {
                nodoAutorizaciones = (((System.Xml.XmlNode[])(((object[])(resAutorizacion[0]))[0]))[2]);
            }

            foreach (XmlNode nodo in nodoAutorizaciones.SelectNodes("/autorizaciones"))
            {
                autorizacion = new Autorizacion();
                if (nodo.InnerText.Equals("EN PROCESO"))
                {
                    autorizacion.setComprobante(null);
                    autorizacion.setEstado(nodo["autorizacion"]["estado"].InnerText);
                    autorizacion.setNumeroAutorizacion(nodo["autorizacion"]["numeroAutorizacion"].InnerText);
                    Autorizacion.Mensajes msjs = new Autorizacion.Mensajes();
                    foreach (XmlNode nodoMensajes in nodo["autorizacion"]["mensajes"])
                    {
                        Mensaje mensaje = new Mensaje();
                        mensaje.setIdentificador(nodoMensajes["identificador"].InnerText);
                        mensaje.setMensaje(nodoMensajes["mensaje"].InnerText);
                        mensaje.setTipo(nodoMensajes["tipo"].InnerText);
                        msjs.getMensaje().Add(mensaje);
                        autorizacion.setMensajes(msjs);
                    }
                }
                else
                {
                    java.text.DateFormat format = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
                    Date date             = format.parse(nodo["autorizacion"]["fechaAutorizacion"].InnerText);
                    GregorianCalendar cal = new GregorianCalendar();
                    cal.setTime(date);
                    XMLGregorianCalendar xmlGregCal = DatatypeFactory.newInstance().newXMLGregorianCalendar(cal);
                    autorizacion.setComprobante(nodo["autorizacion"]["comprobante"].InnerText);
                    autorizacion.setEstado(nodo["autorizacion"]["estado"].InnerText);
                    autorizacion.setFechaAutorizacion(xmlGregCal);
                    autorizacion.setNumeroAutorizacion(nodo["autorizacion"]["numeroAutorizacion"].InnerText);
                    Autorizacion.Mensajes msjs = new Autorizacion.Mensajes();
                    foreach (XmlNode nodoMensajes in nodo["autorizacion"]["mensajes"])
                    {
                        Mensaje mensaje = new Mensaje();
                        mensaje.setIdentificador(nodoMensajes["identificador"].InnerText);
                        mensaje.setMensaje(nodoMensajes["mensaje"].InnerText);
                        mensaje.setTipo(nodoMensajes["tipo"].InnerText);
                        msjs.getMensaje().Add(mensaje);
                        autorizacion.setMensajes(msjs);
                    }
                    autorizaciones.getAutorizacion().Add(autorizacion);
                }
            }
            this.respuestaAutorizacion.setAutorizaciones(autorizaciones);
        }