示例#1
0
        // TAREA hacer los cambios en todos los formularios de clientes y proveedores ver lo de paises
        private async void textNIdentificacion_KeyPress(object sender, KeyPressEventArgs e)
        {
            String aux = textNIdentificacion.Text;

            int nroCarateres = aux.Length;

            if (nroCarateres == 11 || nroCarateres == 8)
            {
                if ((int)e.KeyChar == (int)Keys.Enter)
                {
                    try
                    {
                        respuestaSunat = await sunatModel.obtenerDatos(aux);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Error: " + ex.Message, "consulta sunat", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    // Ver(aux);
                }
            }
            if (respuestaSunat != null)
            {
                dataSunat = respuestaSunat.result;
                textNIdentificacion.Text = dataSunat.RUC;
                textCelular.Text         = dataSunat.Telefono.Substring(1, dataSunat.Telefono.Length - 1);
                txtNombreCliente.Text    = dataSunat.RazonSocial;
                textDireccion.Text       = concidencias(dataSunat.Direccion);
                respuestaSunat           = null;
            }
        }
示例#2
0
        private async void textNIdentificacion_TextChanged(object sender, EventArgs e)
        {
            String aux = textNIdentificacion.Text;

            int nroCarateres = aux.Length;

            if (nroCarateres == 11 || nroCarateres == 8)
            {
                try
                {
                    respuestaSunat = await sunatModel.obtenerDatos(aux);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error: " + ex.Message, "consulta sunat", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                // Ver(aux);
            }
            if (respuestaSunat != null)
            {
                dataSunat = respuestaSunat.result;
                textNIdentificacion.Text    = dataSunat.RUC;
                textTelefono.Text           = dataSunat.Telefono.Substring(1, dataSunat.Telefono.Length - 1);
                textNombreEmpresa.Text      = dataSunat.RazonSocial;
                textActividadPrincipal.Text = dataSunat.Oficio;


                textDireccion.Text = concidencias(dataSunat.Direccion);
                //cbxPaises.Text = concidencias(dataSunat.Pais);


                respuestaSunat = null;
            }
        }
示例#3
0
        // TAREA hacer los cambios en todos los formularios de clientes y proveedores ver lo de paises
        private async void textNIdentificacion_KeyPress(object sender, KeyPressEventArgs e)
        {
            String aux = textNIdentificacion.Text;

            int nroCarateres = aux.Length;

            if (nroCarateres == 11 || nroCarateres == 8)
            {
                if ((int)e.KeyChar == (int)Keys.Enter)
                {
                    try
                    {
                        respuestaSunat = await sunatModel.obtenerDatos(aux);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Error: " + ex.Message, "consulta sunat", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    // Ver(aux);
                }
            }
            if (respuestaSunat != null)
            {
                if (respuestaSunat.success)
                {
                    dataSunat = respuestaSunat.result;
                    textNIdentificacion.Text = dataSunat.RUC;
                    string telefonos = dataSunat.Telefono;
                    //textTelefono.Text.PadRight.
                    string[] split = telefonos.Split('/');

                    if (split[0].Length > 1)
                    {
                        textTelefono.Text = split[0];
                    }
                    else
                    {
                        textTelefono.Text = split[1];
                    }

                    textNombreEmpresa.Text      = dataSunat.RazonSocial;
                    textActividadPrincipal.Text = dataSunat.Oficio;


                    textDireccion.Text = concidencias(dataSunat.Direccion);
                    //cbxPaises.Text = concidencias(dataSunat.Pais);
                    respuestaSunat = null;
                }
                else
                {
                    respuestaSunat = null;
                    if (textNIdentificacion.Text.Length > 0)
                    {
                        textNIdentificacion.Text = textNIdentificacion.Text.Substring(0, textNIdentificacion.Text.Length - 1);
                    }
                    MessageBox.Show("Error: " + "no exite este ruc o DNI", "consulta sunat", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
示例#4
0
        // TAREA hacer los cambios en todos los formularios de clientes y proveedores ver lo de paises
        private async void textNIdentificacion_KeyPress(object sender, KeyPressEventArgs e)
        {
            String aux = textNIdentificacion.Text;

            int nroCarateres = aux.Length;

            if (nroCarateres == 11 || nroCarateres == 8)
            {
                if ((int)e.KeyChar == (int)Keys.Enter)
                {
                    try
                    {
                        respuestaSunat = await sunatModel.obtenerDatos(aux);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Error: " + ex.Message, "consulta sunat", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    // Ver(aux);
                    int i = 0;
                }
            }
            if (respuestaSunat != null)
            {
                dataSunat = respuestaSunat.result;
                textNIdentificacion.Text    = dataSunat.RUC;
                textTelefono.Text           = dataSunat.Telefono;
                textNombreEmpresa.Text      = dataSunat.RazonSocial;
                textActividadPrincipal.Text = dataSunat.Tipo;
            }
        }
示例#5
0
        // TAREA hacer los cambios en todos los formularios de clientes y proveedores ver lo de paises
        private async void textNIdentificacion_KeyPress(object sender, KeyPressEventArgs e)
        {
            String aux          = textNIdentificacion.Text;
            int    nroCarateres = aux.Length;

            Validator.isNroDocumento(e, nroCarateres, nroMaximoCaracteres);


            if (nroCarateres == nroMaximoCaracteres)
            {
                if (e.KeyChar == (char)Keys.Enter)


                {
                    try
                    {
                        this.formClienteNuevo.loadStateApp(true);
                        //respuestaSunat
                        respuestaSunat = await sunatModel.obtenerDatos(aux);
                    }
                    catch (Exception ex)
                    {
                        JsonReaderException ex1 = new JsonReaderException();;
                        if (Object.ReferenceEquals(ex.GetType(), ex1.GetType()))
                        {
                            MessageBox.Show("tiempo de respuesta terminado", "consulta sunat", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        else
                        {
                            MessageBox.Show("Error: " + ex.Message, "consulta sunat", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
                // Ver(aux);
            }
            try
            {
                if (respuestaSunat != null)
                {
                    if (respuestaSunat.success)
                    {
                        dataSunat = respuestaSunat.result;
                        if (dataSunat.RUC.Length == nroMaximoCaracteres)
                        {
                            textNIdentificacion.Text = dataSunat.RUC;
                        }
                        textCelular.Text      = dataSunat.Telefono.Substring(1, dataSunat.Telefono.Length - 1);
                        txtNombreCliente.Text = dataSunat.RazonSocial;
                        textDireccion.Text    = concidencias(dataSunat.Direccion);
                        respuestaSunat        = null;
                    }
                    else
                    {
                        this.formClienteNuevo.loadStateApp(false);
                        MessageBox.Show("Error: " + " no exite en la sunat", "consulta sunat", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        respuestaSunat = null;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message, "cargando datos sunat", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            finally
            {
                this.formClienteNuevo.loadStateApp(false);
            }
        }
示例#6
0
        // TAREA hacer los cambios en todos los formularios de clientes y proveedores ver lo de paises
        private async void textNIdentificacion_KeyPress(object sender, KeyPressEventArgs e)
        {
            Validator.isDecimal(e, textNIdentificacion.Text);

            String aux = textNIdentificacion.Text;


            int nroCarateres = aux.Length;

            if (nroCarateres == 11 || nroCarateres == 8)

            {
                if (e.KeyChar == (char)Keys.Enter)
                {
                    try
                    {
                        load(true);
                        respuestaSunat = await sunatModel.obtenerDatos(aux);
                    }
                    catch (Exception ex)
                    {
                        JsonReaderException ex1 = new JsonReaderException();;
                        if (Object.ReferenceEquals(ex.GetType(), ex1.GetType()))
                        {
                            MessageBox.Show("tiempo de respuesta terminado", "consulta sunat", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            this.load(false);
                            return;
                        }
                        else
                        {
                            MessageBox.Show("Error: " + ex.Message, "consulta sunat", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            this.load(false);
                            return;
                        }
                    }
                }
                // Ver(aux);
            }
            if (respuestaSunat != null)
            {
                if (respuestaSunat.success)
                {
                    dataSunat = respuestaSunat.result;
                    textNIdentificacion.Text = dataSunat.RUC;


                    //string telefonos = dataSunat.Telefono;
                    ////textTelefono.Text.PadRight.
                    //string[] split = telefonos.Split('/');

                    //if (split[0].Length > 1)
                    //    textTelefono.Text = split[0];
                    //else
                    //    textTelefono.Text = split[1];

                    textNombreEmpresa.Text      = dataSunat.RazonSocial;
                    textActividadPrincipal.Text = dataSunat.Oficio;


                    textDireccion.Text = concidencias(dataSunat.Direccion);
                    //cbxPaises.Text = concidencias(dataSunat.Pais);
                    respuestaSunat = null;
                }
                else
                {
                    respuestaSunat = null;
                    if (textNIdentificacion.Text.Length > 0)
                    {
                        textNIdentificacion.Text = textNIdentificacion.Text.Substring(0, textNIdentificacion.Text.Length - 1);
                    }
                    MessageBox.Show("Error: " + "no exite este ruc o DNI", "consulta sunat", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            load(false);
        }