Exemplo n.º 1
0
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtNombre.Text))
            {
                erpMensaje.SetError(txtNombre, "Ingresar su nombre");
                return;
            }
            else
            {
                erpMensaje.SetError(txtNombre, "");
            }

            if (string.IsNullOrEmpty(txtNumDocumento.Text))
            {
                erpMensaje.SetError(txtNumDocumento, "Ingrese su numero de documento");
                return;
            }

            if (Convert.ToInt64(txtNumDocumento.Text) <= 0)
            {
                erpMensaje.SetError(txtNumDocumento, "Ingrese numero mayor a 0");
                return;
            }


            if (((TipoDocumento)cbTipoDocumento.SelectedItem).Id == 3)


            {
                if (Convert.ToInt64(txtNumDocumento.Text) <= 1000000000)
                {
                    MessageBox.Show("debe ingresar un numero mayor a 1000000000");
                }

                if (Convert.ToInt64(txtNumDocumento.Text) >= 9999999999)
                {
                    MessageBox.Show("debe ingresar un numero menor  a 9999999999");
                }
                return;
            }

            if (string.IsNullOrEmpty(txtCosto.Text))
            {
                erpMensaje.SetError(txtCosto, "costo del servicio");
                return;
            }

            if (Convert.ToInt64(txtCosto.Text) <= 0)
            {
                erpMensaje.SetError(txtCosto, "Ingrese numero mayor a 0");
                return;
            }
            Elementos.RPS Registro = new Elementos.RPS();
            Registro.Nombre          = txtNombre.Text;
            Registro.NumeroDocumento = Convert.ToInt64(txtNumDocumento.Text);
            Registro.CostoServicio   = Convert.ToInt64(txtCosto.Text);

            MessageBox.Show("En hora buena!");
        }
Exemplo n.º 2
0
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            // validar nombre

            if (string.IsNullOrEmpty(txtNombre.Text))
            {
                erpMensaje.SetError(txtNombre, "Debe ingresar un nombre");
                return;
            }
            else
            {
                erpMensaje.SetError(txtNombre, "");
            }

            // no permitir  numero de documento vacio
            if (string.IsNullOrEmpty(txtNumDocumento.Text))
            {
                erpMensaje.SetError(txtNumDocumento, "Debe ingresar un numero de documento");
                return;
            }
            // SOLO PERMITIR NUMERO DE DOCUMENTO MAYOR A 0
            if (Convert.ToInt64(txtNumDocumento.Text) <= 0)
            {
                erpMensaje.SetError(txtNumDocumento, "El numero ingresado debe ser mayor a 0");
                return;
            }


            // NUIP ENTRE  1.000.000.000y 9.999.999.999.

            if (((TipoDocumento)cboTipoDocumento.SelectedItem).Id == 3)


            {
                if (Convert.ToInt64(txtNumDocumento.Text) <= 1000000000)
                {
                    MessageBox.Show("debe ingresar un numero mayor a 1.000.000.000");
                }

                if (Convert.ToInt64(txtNumDocumento.Text) >= 9999999999)
                {
                    MessageBox.Show("debe ingresar un numero menor  a 9.999.999.999");
                }
                return;
            }


            // no permitir costo del servicio vacio
            if (string.IsNullOrEmpty(txtCosto.Text))
            {
                erpMensaje.SetError(txtCosto, "Debe ingresar un  costo del servicio");
                return;
            }
            // SOLO PERMITIR COSTO DEL SERVICIO MAYOR  A 0
            if (Convert.ToInt64(txtCosto.Text) <= 0)
            {
                erpMensaje.SetError(txtCosto, "El numero ingresado debe ser mayor a 0");
                return;
            }



            // mostrar mensaje de  registro ingresado exitosamente
            Elementos.RPS Registro = new Elementos.RPS();
            Registro.Nombre          = txtNombre.Text;
            Registro.NumeroDocumento = Convert.ToInt64(txtNumDocumento.Text);
            Registro.CostoServicio   = Convert.ToInt64(txtCosto.Text);

            MessageBox.Show("Registro Ingresado Exitosamente");
        }