//guardar archivo en bd protected void save() { clsPorteoAutomatico clsShiping = new clsPorteoAutomatico(); string strEmail = (string)Session["email"]; string strIdUsuario = (string)Session["IdUsuario"]; try { DataTable dtResultado = new DataTable(); dtResultado = (DataTable)Session["dt_Sess_Porteo"]; StringBuilder strBullResultado = new StringBuilder(); clsShiping.dtResult = (DataTable)Session["dt_Sess_Porteo"]; string strCentral = this.cmbCentral.Items[cmbCentral.SelectedIndex].Value; clsShiping.strCentral = strCentral; clsShiping.strIdUsuario = int.Parse(strIdUsuario); strBullResultado = clsShiping.RPU(); //clsShiping.dtShiping = (DataTable)Session["dt_Sess_Porteo"]; //clsShiping.strRPUrepeated = clsShiping.RPU(); //if (clsShiping.strRPUrepeated.Length > 0) if (strBullResultado.Length > 0) { //ErrorMsg.InnerHtml = "<div class='alert alert-warning alert-dismissible' role='alert'><button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button><strong>Los siguientes RPU's ya están en la base de datos y no se importaron: <br></strong> " + clsShiping.strRPUrepeated + "</div>"; pnlErrorLoad.Visible = true; pnlErrorLoadDiv.Visible = true; //pnlErrorLoadDiv.InnerHtml = "<div class='alert alert-warning alert-dismissible' role='alert'><button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button><strong>Los siguientes RPU's ya están en la base de datos y no se importaron: <br></strong> " + clsShiping.strRPUrepeated + "</div>"; //pnlErrorLoadDiv.InnerHtml = "<div class='alert alert-warning alert-dismissible' role='alert'><button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button><strong>Los siguientes RPU's ya están en la base de datos y no se importaron: <br></strong> " + strBullResultado + "</div>"; pnlErrorLoadDiv.InnerHtml = "<strong>Los siguientes registros contienen fallas y no se importaron: <br></strong> " + strBullResultado + ""; clsPorteo clsBusinessPorteo = new clsPorteo(); clsBusinessPorteo.dtShiping = (DataTable)Session["dt_Sess_Porteo"]; StringBuilder strHtmlTablePorteo = new StringBuilder(); strHtmlTablePorteo = clsBusinessPorteo.CreateTableHTML(); //CreateTableHTML(dtRsponseImport2Grid); DBDataPlaceHolder.Controls.Add(new Literal { Text = strHtmlTablePorteo.ToString() }); //Button1.Enabled = false; btnCancel.Enabled = true; ScriptManager.RegisterStartupScript(this, GetType(), "muestraError", "swal('Cargado!', 'Su archivo se ha cargado correctamente.', 'success');", true); } else { pnlMuestraDatos.Visible = false; pnlSuccessLoad.Visible = true; //Label1.Text = "convenio generado: " + strBullResultado; //Button1.Visible = false; btnCancel.Visible = false; btnRegresar.Enabled = true; btnRegresar.Visible = true; cmbCentral.SelectedValue = ""; ScriptManager.RegisterStartupScript(this, GetType(), "muestraError", "swal('Cargado!', 'Su archivo se ha cargado correctamente.', 'success');", true); } } catch (Exception ex) { clsError.logMessage = ex.ToString(); clsError.logModule = "btnUpload_Click"; clsError.LogWrite(); JavaScriptSerializer serializer = new JavaScriptSerializer(); string mensaje = serializer.Serialize(ex.Message); ScriptManager.RegisterStartupScript(this, GetType(), "muestraError", "swal('Error Detalle: " + mensaje + "');", true); } finally { Session["dt_Sess_Porteo"] = null; clsShiping = null; } }