コード例 #1
0
        private void btnEnviar_Click(object sender, EventArgs e)
        {
            try
            {
                if (!validacion())
                {
                    return;
                }

                Cursor = Cursors.WaitCursor;

                string correos = "";
                foreach (DataGridViewRow row in dgvCorreos.Rows)
                {
                    var correo = row.Cells["cnCorreo"].Value;

                    if (correo != null)
                    {
                        correos += correo.ToString().Trim() + ",";
                    }
                    else
                    {
                        break;
                    }
                }

                string adjunto = "";
                foreach (DataGridViewRow rowAdjunto in dgvArchivos.Rows)
                {
                    string rutaArchivo = rowAdjunto.Cells["cnArchivo"].Value.ToString();

                    if (File.Exists(rutaArchivo))
                    {
                        adjunto += rutaArchivo + "|";
                    }
                }

                if (SendMail(correos, txtAsunto.Text, adjunto, txtCuerpo.Text))
                {
                    MessageBox.Show("Envio de Correo finalizado", Aplicacion.Software, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Aplicacion.Software, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            finally
            {
                Cursor = Cursors.Default;

                if (!fn.Premium())
                {
                    Process.Start(Link.Publicidad);
                }
            }
        }
コード例 #2
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;

                if (myInfo == null)
                {
                    myInfo = new EmpresaBeta();
                }

                CookieContainer cookie  = new CookieContainer();
                bool            premium = Aplicacion.Licencia.Equals("PREMIUM");

                int cantidad = 0;
                int Total    = dgvDatos.RowCount;

                foreach (DataGridViewRow row in dgvDatos.Rows)
                {
                    cantidad++;

                    if (row.Cells["cnRuc"].Value != null)
                    {
                        string ruc = row.Cells["cnRuc"].Value.ToString();

                        string codigoCatcher = myInfo.UseTesseract();

                        Empresa empresa = myInfo.GetInfo(ruc, codigoCatcher);

                        if (empresa != null)
                        {
                            row.Cells["cnActividadComercioExterior"].Value = empresa.ActividadComercioExterior;
                            row.Cells["cnCondicionContribuyente"].Value    = empresa.CondicionContribuyente;
                            row.Cells["cnDireccion"].Value                 = empresa.Direccion;
                            row.Cells["cnEstadoContribuyente"].Value       = empresa.EstadoContribuyente;
                            row.Cells["cnFechaInicioActividad"].Value      = empresa.FechaInicioActividad;
                            row.Cells["cnFechaInscripcion"].Value          = empresa.FechaInscripcion;
                            row.Cells["cnNombreComercial"].Value           = empresa.NombreComercial;
                            row.Cells["cnRazonSocial"].Value               = empresa.RazonSocial;
                            row.Cells["cnSistemaContabilidad"].Value       = empresa.SistemaContabilidad;
                            row.Cells["cnSistemaEmisionComprobante"].Value = empresa.SistemaEmisionComprobante;
                            row.Cells["cnTipoContribuyente"].Value         = empresa.TipoContribuyente;
                        }
                    }

                    progressBar1.Value = cantidad * 100 / Total;

                    if (!premium && cantidad.Equals(5))
                    {
                        break;
                    }
                }


                if (!premium)
                {
                    MessageBox.Show("La Version Beta, solo permite 5 Ruc(s) por busqueda", Aplicacion.Software, MessageBoxButtons.OK);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                Cursor             = Cursors.Default;
                progressBar1.Value = 0;

                if (!fn.Premium())
                {
                    Process.Start(Link.Publicidad);
                }
            }
        }