// Rutinas el programador
void DeleteDocumento(Int32 DocumentoId)
{
ENTDocumento oENTDocumento = new ENTDocumento();
ENTResponse oENTResponse = new ENTResponse();
BPDocumento oBPDocumento = new BPDocumento();
try
{
// Formulario
oENTDocumento.DocumentoId = DocumentoId;
// Consultar información del archivo
oENTResponse = oBPDocumento.SelectDocumento_Path(oENTDocumento);
// Errores y Warnings
if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); }
if (oENTResponse.sMessage != "") { throw (new Exception(oENTResponse.sMessage)); }
// Eliminar físicamente el archivo
if (File.Exists(oENTResponse.dsResponse.Tables[1].Rows[0]["Ruta"].ToString())) { File.Delete(oENTResponse.dsResponse.Tables[1].Rows[0]["Ruta"].ToString()); }
// Eliminar la referencia del archivo en la base de datos
oENTResponse = oBPDocumento.DeleteDocumento(oENTDocumento);
// Errores y Warnings
if (oENTResponse.GeneratesException) { throw (new Exception(oENTResponse.sErrorMessage)); }
if (oENTResponse.sMessage != "") { throw (new Exception(oENTResponse.sMessage)); }
// Estado inicial del formulario
this.ckeDescripcion.Text = "";
// Refrescar el formulario
SelectSolicitud();
// Foco
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Convert.ToString(Guid.NewGuid()), "function pageLoad(){ focusControl('" + this.fupArchivo.ClientID + "'); }", true);
}catch ( IOException ioEx){
throw (ioEx);
}catch (Exception ex){
throw (ex);
}
}