Beispiel #1
0
        protected void bSubir_Click(object sender, EventArgs e)
        {
            table_error.Clear();
            generar_tabla_errores(records);
            bool bandExtranjero = false;

            if (CheckExtranjero.Checked == true)
            {
                bandExtranjero = true;
            }
            if (examAdi.HasFile)
            {
                lMsj.Visible = false;
                string extencion = System.IO.Path.GetExtension(examAdi.FileName).ToLower();
                if (extencion == ".xls" || extencion == ".xlsx")
                {
                    string rutaXLS = ConfigurationManager.AppSettings.Get("RutaXLS");
                    examAdi.PostedFile.SaveAs(rutaXLS + examAdi.FileName);
                    try
                    {
                        records        = loadxls.Iniciar(rutaXLS + examAdi.FileName, bandExtranjero, uuidPermiso);
                        NombreInterfaz = loadxls.GetOutputName();
                    }
                    catch (Exception ex) { }
                    if (records.Count > 0)
                    {
                        lberrorResgistros.Font.Bold = true;
                        //btnEnviar_registros.Visible = true;
                        lberrorResgistros.Visible = true;
                        generar_tabla_errores(records);
                    }
                    lMsj.Text      = "El archivo se ha cargado";
                    lMsj.ForeColor = System.Drawing.Color.Green;
                    lMsj.Visible   = true;
                }
                else
                {
                    lMsj.Text    = "El archivo seleccionado no es compatible con Excel";
                    lMsj.Visible = true;
                }
            }
            else
            {
                lMsj.Text    = "Debe seleccionar un archivo";
                lMsj.Visible = true;
            }
        }
Beispiel #2
0
        private void btnEnviar_Click(object sender, EventArgs e)
        {
            DialogResult rta = DialogResult.OK;

            if (string.IsNullOrEmpty(txtCuenta.Text))
            {
                MessageBox.Show("Falta completar campo 'cuenta'"); return;
            }
            if (!txtCuenta.Text.Contains('@') || !txtCuenta.Text.Contains('.'))
            {
                txtCuenta.Text += "@gmail.com";
            }
            if (string.IsNullOrEmpty(txtClave.Text))
            {
                MessageBox.Show("Falta completar campo 'Clave'");
                return;
            }
            if (txtClave.Text.Trim().Length < 6)
            {
                MessageBox.Show("El campo 'Clave' está incompleto");
                return;
            }
            if (string.IsNullOrEmpty(txtAsunto.Text) && !string.IsNullOrEmpty(txtCuerpo.Text))
            {
                rta = MessageBox.Show("El mail no tiene 'asunto', desea enviarlo de todos modos?", "Confirmar", MessageBoxButtons.OKCancel);
            }
            if (string.IsNullOrEmpty(txtCuerpo.Text) && !string.IsNullOrEmpty(txtAsunto.Text))
            {
                rta = MessageBox.Show("El mail no tiene 'cuerpo', desea enviarlo de todos modos?", "Confirmar", MessageBoxButtons.OKCancel);
            }
            if (string.IsNullOrEmpty(txtCuerpo.Text) && string.IsNullOrEmpty(txtAsunto.Text))
            {
                MessageBox.Show("No puede enviar un mail vacío.");
                return;
            }
            if (rta == DialogResult.OK)
            {
                try
                {
                    Dato    dato    = new Dato(txtCuenta.Text, txtClave.Text, txtAsunto.Text, txtCuerpo.Text, null);
                    Proceso proceso = new Proceso();
                    if (proceso.Iniciar(dato))
                    {
                        MessageBox.Show("Mails enviados exitosamente!");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Console.Write("Ingrese cuenta: ");
            var origen = Console.ReadLine();

            Console.Write("Password: "******"Ingrese asunto: ");
            var asunto = Console.ReadLine();

            Console.Write("Ingrese: ");
            var     cuerpo  = Console.ReadLine();
            Dato    dato    = new Dato(origen, pass, asunto, cuerpo, cuerpo);
            Proceso proceso = new Proceso();

            proceso.Iniciar(dato);
        }