Exemplo n.º 1
0
        private void ValidarArchivo()
        {
            var resultado = this._application.ValidarArchivoEmail(ofdArchivoExcel.FileName);

            if (resultado)
            {
                btnVer.Enabled = true;

                this.personaSeleccionadas = this._application.ObtenerDestinatarios(txtArchivoExcel.Text);
                txtTotalDestinatario.Text = string.Format("{0}", this.personaSeleccionadas.Where(x => x.Valido).Count());

                int     factorGrupo = int.Parse(this._application.ObtenerParametro(Parametros.FACTOR_AGRUPADOR));
                decimal totalEnvios = 0;
                if (this.personaSeleccionadas.Where(x => x.Valido).Count() < factorGrupo)
                {
                    totalEnvios = 1;
                }
                else
                {
                    totalEnvios = Math.Round(Convert.ToDecimal(this.personaSeleccionadas.Where(x => x.Valido).Count()) / Convert.ToDecimal(factorGrupo), 0, MidpointRounding.AwayFromZero);
                }

                txtEnvios.Text = string.Format("{0}", totalEnvios);

                frmVerDestinatarios frm = new frmVerDestinatarios();
                frm.ListaPersona = this.personaSeleccionadas;
                frm.ShowDialog();
            }
            else
            {
                throw new ApplicationException(string.Format("Ha ocurrido un error al leer el archivo {0}", txtArchivoExcel.Text));
            }
        }
Exemplo n.º 2
0
 private void btnVer_Click(object sender, EventArgs e)
 {
     if (txtArchivoExcel.Text.Length > 0)
     {
         frmVerDestinatarios frm = new frmVerDestinatarios();
         frm.ListaPersona = this.personaSeleccionadas;
         frm.ShowDialog();
     }
 }