Exemplo n.º 1
0
    protected void brnProcesar_Click(object sender, EventArgs e)
    {
        string pathArchivo = "";

        pop1_areaErrores.Value = "";
        try
        {
            if (fupArchivo.FileBytes.Length > 0)
            {
                ParametrosGeneralesBM objParamGenerales = new ParametrosGeneralesBM();
                DataTable             dt = objParamGenerales.SeleccionarPorFiltro(Constantes.ParametrosGenerales.RUTA_TEMP, "", "", "", DatosRequest);
                //string nombreArchivo = System.Guid.NewGuid().ToString().Substring(0, 8) + "_" + fupArchivo.FileName;
                string nombreArchivo = dt.Rows[0]["Valor"].ToString() + "_" + fupArchivo.FileName;
                //pathArchivo = System.Web.HttpContext.Current.Server.MapPath("temp_files\\" + nombreArchivo);
                pathArchivo = nombreArchivo;
                fupArchivo.SaveAs(pathArchivo);
                string resul = ProcesarArchivo(pathArchivo);
                // resul // Mostramos los resultado en un panel de texto
                pop1_areaErrores.Value = resul;
            }
            else
            {
                AlertaJS("Seleccionar archivo.");
            }
        }
        catch (Exception ex)
        {
            AlertaJS("Seleccionar archivo.");
        }
        finally
        {
            try
            {
                if (pathArchivo.Length > 0)
                {
                    System.IO.File.Delete(pathArchivo);
                }
            }
            catch { }
        }
    }
    public static List <listado> CargarTipoValorizacion(string clasificacion)
    {
        ParametrosGeneralesBM objParamGeneral = new ParametrosGeneralesBM();
        List <listado>        lista           = new List <listado>();
        DataTable             dt;

        dt = objParamGeneral.Listar("TipoValorizacion", null);
        if (dt != null)
        {
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    lista.Add(new listado()
                    {
                        id = dt.Rows[i]["Valor"].ToString(), descripcion = dt.Rows[i]["Nombre"].ToString()
                    });
                }
            }
        }
        return(lista);
    }