Example #1
0
    // Cargar datos del archivo
    protected void btnCargarDatos_Click(object sender, EventArgs e)
    {
        if (fupSoportes.HasFile)
        {
            DataTable dtSoportes = LeerExcel();
            foreach (DataRow row in dtSoportes.Rows)
            {
                string identificacion = row["Identificacion"].ToString();
                string tipoDocumento  = row["TipoDocumento"].ToString();

                if (identificacion != "" && (tipoDocumento != "7" || tipoDocumento != "8"))
                {
                    AdministrarSoportesBancarios.InsertarSoporteBancario(row["InformacionBanco"].ToString(), row["FormaPago"].ToString(), DateTime.Parse(row["FechaMovimiento"].ToString()), row["TipoDocumento"].ToString(), long.Parse(row["Identificacion"].ToString()), double.Parse(row["Valor"].ToString()), row["Referencia"].ToString(), row["Localidad"].ToString(), txtNomSoporte.Text);
                }
                else if (identificacion == "" && (tipoDocumento == "7" || tipoDocumento == "8"))
                {
                    identificacion = "0";
                    AdministrarSoportesBancarios.InsertarSoporteBancario(row["InformacionBanco"].ToString(), row["FormaPago"].ToString(), DateTime.Parse(row["FechaMovimiento"].ToString()), row["TipoDocumento"].ToString(), long.Parse(identificacion), double.Parse(row["Valor"].ToString()), row["Referencia"].ToString(), row["Localidad"].ToString(), txtNomSoporte.Text);
                }
                else
                {
                    ClientScript.RegisterStartupScript(GetType(), "alert", "alert('" + "Archivo cargado." + "');window.location.replace('/gestion/recaudoypago/soportebancario')", true);
                    //ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Archivo cargado.');", true);
                    CargarListas();
                }
            }

            int soportes = AdministrarSoportesBancarios.ConsutarTempSoporteBancario();
            if (soportes == 0)
            {
                ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Los soportes que intenta cargar ya existen por favor validar.');", true);
                CargarListas();
            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Archivo cargado.');", true);
                CargarListas();
                ListarSoportes();
            }
        }
    }