protected void Button2_Click(object sender, EventArgs e) { try { DataTable table = null; table = Transaccion.InsertaDocuDigitalizado(this.txtRut.Text.ToString(), this.txtFolio.Text.ToString(), this.cliente.SelectedValue.ToString(), this.descripcion.SelectedValue.ToString()); if ((table != null) && (table.Rows.Count > 0)) { string idDocumento = table.Rows[0][0].ToString(); if (this.filesubir.PostedFile.ContentLength > 0) { string nomArchivo = ""; string path = base.Server.MapPath(@"~\DIGITALIZADOS"); nomArchivo = "DocuDigi" + idDocumento.ToString() + Path.GetExtension(this.filesubir.PostedFile.FileName); string str4 = UTIL.SubirArchivo(this.filesubir, path, nomArchivo); if (!(str4 == "OK")) { this.Page.RegisterClientScriptBlock("Mensaje", "<script>alert('" + str4.ToString() + "');</script>"); } else if (!string.IsNullOrEmpty(nomArchivo)) { Transaccion.UpdateDocumentoDigitalizado(idDocumento, nomArchivo); this.Page.RegisterClientScriptBlock("Mensaje", "<script>alert('Documento digitalizado exitosamente');</script>"); this.CargaGrilla(); this.filesubir.Enabled = true; this.Button2.Visible = true; this.Button1.Visible = false; this.cliente.Enabled = true; this.descripcion.Enabled = true; this.filesubir.Focus(); } } } } catch (Exception) { this.Page.RegisterClientScriptBlock("Mensaje", "<script>alert('Revise bien la informaci\x00f3n e intentelo de nuevo');</script>"); } }