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;
            }
        }