protected void UpSubirCalendario_FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
        {
            try
            {
                if (UpSubirCalendario.UploadedFiles != null && UpSubirCalendario.UploadedFiles.Length > 0)
                {
                    int           validarExiste = 0;
                    LogicaNegocio ln            = new LogicaNegocio();

                    //var dt = new DataTable();
                    //var a = Path.Combine(AppDomain.CurrentDomain.BaseDirectory);
                    //var fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "File1.xlsx");
                    //var query = "SELECT * C FROM [Hoja1$]";
                    //using (OleDbConnection cn = new OleDbConnection { ConnectionString = ConnectionString(fileName, "No") })
                    //{
                    //    using (OleDbCommand cmd = new OleDbCommand { CommandText = query, Connection = cn })
                    //    {
                    //        cn.Open();

                    //        OleDbDataReader dr = cmd.ExecuteReader();
                    //        dt.Load(dr);
                    //    }

                    //}
                    //if (dt.Rows.Count > 1)
                    //{
                    //    // remove header
                    //    dt.Rows[0].Delete();
                    //}
                    //dt.AcceptChanges();
                    //
                    //DataRow dr = new DataRow();
                    string MonedaCertificado = string.Empty;
                    var    dtCsv             = util.CSVtoDataTable(e.UploadedFile, ";");

                    for (var i = 0; i < dtCsv.Rows.Count - 1; i++)
                    {
                        var NroCertificado = dtCsv.Rows[i]["NCertificado"].ToString().Trim();
                        if (string.IsNullOrEmpty(NroCertificado.ToString()))
                        {
                            throw new Exception("El numero de certificado no puede estar vacio, linea " + i);
                        }

                        //validar si existe nro certificado en tabla calendario pago
                        if (i > 0)
                        {
                            if (NroCertificado != dtCsv.Rows[i - 1]["NCertificado"].ToString().Trim())
                            {
                                validarExiste = ln.CP_VerificarCertificado(NroCertificado);
                                //if(validarExiste != 0)
                                //    throw new Exception("El número de certificado ya existe en la tabla calendario de pago, linea " + i);
                            }
                        }
                        else
                        {
                            validarExiste = ln.CP_VerificarCertificado(NroCertificado);
                        }

                        if (validarExiste != 0)
                        {
                            throw new Exception("El número de certificado ya existe en la tabla calendario de pago, linea " + i);
                        }

                        var NroCredito = dtCsv.Rows[i]["NCredito"].ToString().Trim();
                        if (string.IsNullOrEmpty(NroCredito.ToString()))
                        {
                            throw new Exception("El numero de credito no puede estar vacio, linea " + i);
                        }

                        var CuotaNro = dtCsv.Rows[i]["CuotaN"].ToString().Trim();
                        if (string.IsNullOrEmpty(CuotaNro.ToString()))
                        {
                            throw new Exception("El numero de cuota no puede estar vacio, linea " + i);
                        }

                        var NroCuotas = dtCsv.Rows[i]["NCuota"].ToString().Trim();
                        if (string.IsNullOrEmpty(NroCuotas.ToString()))
                        {
                            throw new Exception("El total de cuotas no puede estar vacio, linea " + i);
                        }

                        var FechaVencimiento = dtCsv.Rows[i]["FechaVencimiento"].ToString().Trim();
                        if (string.IsNullOrEmpty(FechaVencimiento.ToString()))
                        {
                            throw new Exception("La fecha de vencimiento no puede estar vacia, linea " + i);
                        }

                        var ValorCuota = dtCsv.Rows[i]["MontoCuota"].ToString().Trim();
                        if (string.IsNullOrEmpty(ValorCuota.ToString()))
                        {
                            throw new Exception("El monto de la cuota no puede estar vacio, linea " + i);
                        }

                        var Capital = dtCsv.Rows[i]["Capital"].ToString().Trim();
                        if (string.IsNullOrEmpty(Capital.ToString()))
                        {
                            throw new Exception("El valor capital no puede estar vacio, linea " + i);
                        }

                        var Interes = dtCsv.Rows[i]["Interes"].ToString().Trim();
                        if (string.IsNullOrEmpty(Interes.ToString()))
                        {
                            throw new Exception("El valor Interes no puede estar vacio, linea " + i);
                        }

                        //double A = (util.GetValorDouble(Capital) + util.GetValorDouble(Interes)).Redondear(4);

                        if ((Capital.GetValorDouble() + Interes.GetValorDouble()).Redondear(4) != ValorCuota.GetValorDouble().Redondear(4))
                        {
                            throw new Exception("La suma de capital e interes es distinto del monto cuota, linea " + i);
                        }

                        var TipoMoneda = dtCsv.Rows[i]["Moneda"].ToString().Trim();
                        if (string.IsNullOrEmpty(TipoMoneda.ToString()))
                        {
                            throw new Exception("El valor Moneda no puede estar vacio, linea " + i);
                        }

                        if (i == 0)
                        {
                            MonedaCertificado = ln.CP_VerificarMonedaOperacion(dtCsv.Rows[i]["NCertificado"].ToString().Trim());

                            if (MonedaCertificado.ToLower().Trim() != dtCsv.Rows[i]["Moneda"].ToString().ToLower().Trim())
                            {
                                throw new Exception("La moneda especificada en la operacion es distinta de la ingresada en el archivo excel");
                            }
                        }
                    }

                    //validar texto capital inicial igual a sumatoria de capital
                    double totalCapital = dtCsv.AsEnumerable().Sum(x => x["Capital"].ToString().GetValorDouble());
                    if (totalCapital.Redondear(4) != txtCapitalInicial.Text.Trim().GetValorDouble().Redondear(4))
                    {
                        throw new Exception("el capital inicial ingresado debe ser igual a la sumatoria de la columna capital del excel");
                    }

                    Page.Session["dtArchivo"] = dtCsv;

                    gvPreCargaCP.DataSource = dtCsv;
                    gvPreCargaCP.DataBind();
                    e.CallbackData = "OK";
                }
            }
            catch (Exception ex)
            {
                e.CallbackData = ex.Message;
            }
        }