notificacón por correo agregada
This commit is contained in:
@@ -2922,6 +2922,26 @@ Public Class ClsOIEventos
|
|||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region "Documentos"
|
#Region "Documentos"
|
||||||
|
Public Function ListadoDocumentos(CveEmpresa As Integer) As Boolean
|
||||||
|
|
||||||
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
|
DataAdapter("PA_OI_ListarDocumentos")
|
||||||
|
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||||
|
End With
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al obtener el listado de documento", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
|
|
||||||
Public Function GetDocumento(CveDocumento As Integer, CveEmpresa As Integer) As Boolean
|
Public Function GetDocumento(CveDocumento As Integer, CveEmpresa As Integer) As Boolean
|
||||||
|
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
|
|||||||
@@ -97,7 +97,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<asp:UpdatePanel ID="UpDatosUsuarios" runat="server" UpdateMode="Conditional">
|
<asp:UpdatePanel ID="UpDatosUsuarios" runat="server" UpdateMode="Conditional">
|
||||||
<ContentTemplate>
|
<ContentTemplate>
|
||||||
<asp:GridView ID="GvUsuarios" runat="server" AutoGenerateColumns="False" DataKeyNames="CveUsuario,Usuario" EmptyDataText="No se encontraron Categorías de Documentos Registrados"
|
<asp:GridView ID="GvUsuarios" runat="server" AutoGenerateColumns="False" DataKeyNames="CveUsuario,Usuario,Correo" EmptyDataText="No se encontraron Categorías de Documentos Registrados"
|
||||||
ToolTip="Listado de Categorías de Documentos" CssClass="table table-striped table-advance table-hover Widthall ScrollAD"
|
ToolTip="Listado de Categorías de Documentos" CssClass="table table-striped table-advance table-hover Widthall ScrollAD"
|
||||||
Style="margin-top: -10px; text-align: center; width: 100%; overflow-x: hidden" GridLines="None">
|
Style="margin-top: -10px; text-align: center; width: 100%; overflow-x: hidden" GridLines="None">
|
||||||
<Columns>
|
<Columns>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using System.Web.UI.WebControls;
|
|||||||
using Extensiones;
|
using Extensiones;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
public partial class OI_DocumentoDetalle : ClsPaginas
|
public partial class OI_DocumentoDetalle : ClsPaginas
|
||||||
{
|
{
|
||||||
@@ -155,7 +156,7 @@ public partial class OI_DocumentoDetalle : ClsPaginas
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region "GENERAR DOCUMENTO"
|
#region "GENERAR DOCUMENTO"
|
||||||
|
|
||||||
|
|
||||||
protected void LblGuardar_Click(object sender, EventArgs e)
|
protected void LblGuardar_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@@ -166,19 +167,24 @@ public partial class OI_DocumentoDetalle : ClsPaginas
|
|||||||
//Esta variable es requerida más adelante
|
//Esta variable es requerida más adelante
|
||||||
int CveDocumento = 0;
|
int CveDocumento = 0;
|
||||||
string RutaArchivo = "-1";
|
string RutaArchivo = "-1";
|
||||||
|
string CorreosNotificacion = "";
|
||||||
|
byte[] ArchivoNotifiacion = null;
|
||||||
|
|
||||||
CveDocumento = GuardarDocumento(ref ObjOI, ref TieneError);//Se crea el Documento
|
CveDocumento = GuardarDocumento(ref ObjOI, ref TieneError);//Se crea el Documento
|
||||||
if (!TieneError) { RutaArchivo = AsignarArchivoAlDocumento(CveDocumento, ref ObjOI, ref TieneError); }//Se guarda el archivo fisico y se asigna al Documento generado
|
if (!TieneError) { RutaArchivo = AsignarArchivoAlDocumento(CveDocumento, ref ObjOI, ref TieneError); }//Se guarda el archivo fisico y se asigna al Documento generado
|
||||||
if (!TieneError) { GuardarUsuariosQueAutorizan(CveDocumento, RutaArchivo, ref ObjOI, ref TieneError); }//asignamos a los usuarios que participaran en aprovar este documento
|
if (!TieneError) { CorreosNotificacion = GuardarUsuariosQueAutorizan(CveDocumento, RutaArchivo, ref ObjOI, ref TieneError); }//asignamos a los usuarios que participaran en aprovar este documento
|
||||||
|
if (!TieneError)
|
||||||
|
{
|
||||||
|
ArchivoNotifiacion = GenerarArchivoByte(RutaArchivo);
|
||||||
|
NotificarPorCorreo(CorreosNotificacion, RutaArchivo, ArchivoNotifiacion);
|
||||||
|
}
|
||||||
|
|
||||||
//Gestión de errores y resultados
|
//Gestión de errores y resultados
|
||||||
if (!TieneError)
|
if (!TieneError)
|
||||||
{
|
{
|
||||||
ObjOI.Commit();
|
ObjOI.Commit();
|
||||||
Alert("Documento guardado correctamente");
|
Alert("Documento guardado correctamente");
|
||||||
//this.CveDocumento = CveDocumento;
|
Response.Redirect(string.Format("/OI/DocumentoDetalle.aspx?CveDocumento={0}", CveDocumento));
|
||||||
Response.Redirect(string.Format("/OI/DocumentoDetalle.aspx?CveDocumento={0}",CveDocumento));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -215,7 +221,7 @@ public partial class OI_DocumentoDetalle : ClsPaginas
|
|||||||
this.ErrorMensaje = "Hubo un error al asignar el archivo";
|
this.ErrorMensaje = "Hubo un error al asignar el archivo";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(RutaArchivo == "Error")
|
else if (RutaArchivo == "Error")
|
||||||
{
|
{
|
||||||
TieneError = true;
|
TieneError = true;
|
||||||
this.ErrorMensaje = "Hubo un error al guardar el archivo";
|
this.ErrorMensaje = "Hubo un error al guardar el archivo";
|
||||||
@@ -223,8 +229,9 @@ public partial class OI_DocumentoDetalle : ClsPaginas
|
|||||||
return RutaArchivo;
|
return RutaArchivo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GuardarUsuariosQueAutorizan(int CveDocumento, string RutaArchivo, ref ClsOIEventos ObjOI, ref bool TieneError)
|
private string GuardarUsuariosQueAutorizan(int CveDocumento, string RutaArchivo, ref ClsOIEventos ObjOI, ref bool TieneError)
|
||||||
{
|
{
|
||||||
|
StringBuilder CorreosReturn = new StringBuilder("");
|
||||||
GridViewRowCollection GridUsuarios = GvUsuarios.Rows;
|
GridViewRowCollection GridUsuarios = GvUsuarios.Rows;
|
||||||
foreach (GridViewRow GvRow in GridUsuarios)
|
foreach (GridViewRow GvRow in GridUsuarios)
|
||||||
{
|
{
|
||||||
@@ -237,12 +244,19 @@ public partial class OI_DocumentoDetalle : ClsPaginas
|
|||||||
this.ErrorMensaje = "Hubo un error al asignar los usuarios a este documento";
|
this.ErrorMensaje = "Hubo un error al asignar los usuarios a este documento";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CorreosReturn.AppendFormat("{0},", GvRow.DataKey("Correo"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return CorreosReturn.ToString();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region "ARCHIVO ADJUNTO"
|
#region "ARCHIVO ADJUNTO"
|
||||||
|
|
||||||
private string GuardarArchivo(int CveDocumento)
|
private string GuardarArchivo(int CveDocumento)
|
||||||
{
|
{
|
||||||
string RutaArchivo = "-1";
|
string RutaArchivo = "-1";
|
||||||
@@ -278,9 +292,7 @@ public partial class OI_DocumentoDetalle : ClsPaginas
|
|||||||
return RutaArchivo;
|
return RutaArchivo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void LkbDescargarArchivo_Click(object sender, EventArgs e)
|
||||||
|
|
||||||
protected void LkbDescargarArchivo_Click(object sender,EventArgs e)
|
|
||||||
{
|
{
|
||||||
string Ruta = string.Format("{0}Empresas/{1}/DocumentosRepo/{2}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, ArchivoAdjuntoNombre);
|
string Ruta = string.Format("{0}Empresas/{1}/DocumentosRepo/{2}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, ArchivoAdjuntoNombre);
|
||||||
byte[] archivoBytes = File.ReadAllBytes(Ruta);
|
byte[] archivoBytes = File.ReadAllBytes(Ruta);
|
||||||
@@ -295,5 +307,57 @@ public partial class OI_DocumentoDetalle : ClsPaginas
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region "NOTIFICACIONES CORREO"
|
||||||
|
private void NotificarPorCorreo(string Para, string NombreArchivo, byte[] Adjunto)
|
||||||
|
{
|
||||||
|
string Descripcion = TxtDescripcion.Text;
|
||||||
|
string Asunto = "Se le ha agregado como participante en el desarrollo de un Documento";
|
||||||
|
string a = string.Format("{0} -- {1} --- {2}", Descripcion, Para, "");
|
||||||
|
a.GuardaLog();
|
||||||
|
|
||||||
|
ClsSisMail Mail = new ClsSisMail();
|
||||||
|
|
||||||
|
if (Adjunto != null)
|
||||||
|
{
|
||||||
|
List<ClsSisMail.ArchivoMail> LSRutasMail = new List<ClsSisMail.ArchivoMail>();
|
||||||
|
ClsSisMail.ArchivoMail itemMail = new ClsSisMail.ArchivoMail();
|
||||||
|
|
||||||
|
{
|
||||||
|
var withBlock = itemMail;
|
||||||
|
itemMail.ArchivoBinario = Adjunto;
|
||||||
|
itemMail.NombreArchivo = NombreArchivo;
|
||||||
|
}
|
||||||
|
|
||||||
|
LSRutasMail.Add(itemMail);
|
||||||
|
|
||||||
|
|
||||||
|
Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Descripcion, "", LSRutasMail);
|
||||||
|
Mail = null/* TODO Change to default(_) if this is not a reference type */;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Descripcion, "");
|
||||||
|
Mail = null/* TODO Change to default(_) if this is not a reference type */;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private byte[] GenerarArchivoByte(string NombreArchivo)
|
||||||
|
{
|
||||||
|
string ArchivoEnviar = string.Format(@"{0}DocumentosRepo\{1}", UsuarioActual.Empresa.Ruta, NombreArchivo);
|
||||||
|
if (File.Exists(ArchivoEnviar))
|
||||||
|
{
|
||||||
|
System.IO.FileStream fs = System.IO.File.Open(ArchivoEnviar, System.IO.FileMode.Open, System.IO.FileAccess.Read);
|
||||||
|
byte[] buff = new byte[fs.Length + 1];
|
||||||
|
if (fs.Length > 0)
|
||||||
|
{
|
||||||
|
fs.Read(buff, 0, (fs.Length.ToString().ToEntero() - 1));
|
||||||
|
fs.Close();
|
||||||
|
}
|
||||||
|
return buff;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new byte[] { };
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -32,18 +32,13 @@
|
|||||||
EmptyDataText="No se encontraron Documentos Registrados" ToolTip="Listado de Documentos" CssClass="table table-striped table-advance table-hover"
|
EmptyDataText="No se encontraron Documentos Registrados" ToolTip="Listado de Documentos" CssClass="table table-striped table-advance table-hover"
|
||||||
Style="margin-top: -10px; text-align: center; width: 100%" GridLines="None">
|
Style="margin-top: -10px; text-align: center; width: 100%" GridLines="None">
|
||||||
<Columns>
|
<Columns>
|
||||||
<asp:BoundField HeaderText="Descripcion" DataField="Descripcion" />
|
<asp:HyperLinkField HeaderText="Descripcion" DataTextField="Descripcion" DataNavigateUrlFields="CveDocumento" DataNavigateUrlFormatString="/OI/DocumentoDetalle.aspx?CveDocumento={0}" ItemStyle-HorizontalAlign="Left"/>
|
||||||
<asp:BoundField HeaderText="Observacion" DataField="Observacion" />
|
<asp:HyperLinkField HeaderText="Observación" DataTextField="Observacion" DataNavigateUrlFields="CveDocumento" DataNavigateUrlFormatString="/OI/DocumentoDetalle.aspx?CveDocumento={0}" ItemStyle-HorizontalAlign="Left"/>
|
||||||
<asp:BoundField HeaderText="Versión" DataField="Version" />
|
<asp:HyperLinkField HeaderText="Versión" DataTextField="Version" DataNavigateUrlFields="CveDocumento" DataNavigateUrlFormatString="/OI/DocumentoDetalle.aspx?CveDocumento={0}"/>
|
||||||
<asp:BoundField HeaderText="Responsable" DataField="Responsable" />
|
<asp:HyperLinkField HeaderText="SubCategoria" DataTextField="SubCategoria" DataNavigateUrlFields="CveDocumento" DataNavigateUrlFormatString="/OI/DocumentoDetalle.aspx?CveDocumento={0}"/>
|
||||||
<asp:BoundField HeaderText="Fecha Aprobacion" DataField="FechaAprobacion" />
|
<asp:HyperLinkField HeaderText="Responsable" DataTextField="Responsable" DataNavigateUrlFields="CveDocumento" DataNavigateUrlFormatString="/OI/DocumentoDetalle.aspx?CveDocumento={0}" ItemStyle-HorizontalAlign="Left"/>
|
||||||
<asp:BoundField HeaderText="Fecha Inicio Vigencia" DataField="FechaInicioVigencia" />
|
<%--<asp:HyperLinkField HeaderText="Fecha Aprobacion" DataTextField="FechaAprobacion" DataNavigateUrlFields="CveDocumento" DataNavigateUrlFormatString="/OI/DocumentoDetalle.aspx?CveDocumento={0}"/>--%>
|
||||||
<asp:TemplateField ItemStyle-Width="13%" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Left" HeaderText="Editar">
|
<asp:HyperLinkField HeaderText="Fecha Inicio Vigencia" DataTextField="FechaInicioVigencia" DataNavigateUrlFields="CveDocumento" DataNavigateUrlFormatString="/OI/DocumentoDetalle.aspx?CveDocumento={0}"/>
|
||||||
<ItemTemplate>
|
|
||||||
<%--<asp:LinkButton ID="LnkEditar" OnClick="LnkEditar_Click" runat="server" Visible="true" AlternateText="Subir" CausesValidation="False" CssClass="btn btn-circle btn-sm green" Text="<i title='Editar' class='fa fa-pencil' title='Editar' ></i>" />
|
|
||||||
<asp:LinkButton ID="LnkEliminar" OnClick="LnkEliminar_Click" runat="server" Visible="true" AlternateText="Reasignar" CausesValidation="False" CssClass="btn btn-circle btn-sm red" Text="<i title='Reasignar' class='icon-trash' title='Eliminar' ></i>" data-toggle="confirmation" data-popout="true" data-original-title="Confirmar" data-btn-ok-label="si" />--%>
|
|
||||||
</ItemTemplate>
|
|
||||||
</asp:TemplateField>
|
|
||||||
</Columns>
|
</Columns>
|
||||||
</asp:GridView>
|
</asp:GridView>
|
||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public partial class OI_Documentos : ClsPaginas
|
|||||||
private void CargaDatos()
|
private void CargaDatos()
|
||||||
{
|
{
|
||||||
ClsOIEventos ObjOI = new ClsOIEventos();
|
ClsOIEventos ObjOI = new ClsOIEventos();
|
||||||
if (ObjOI.GetDocumento(-1,UsuarioActual.CveEmpresa))
|
if (ObjOI.ListadoDocumentos(UsuarioActual.CveEmpresa))
|
||||||
{
|
{
|
||||||
GvDatos.DataSource = ObjOI.DtResultados;
|
GvDatos.DataSource = ObjOI.DtResultados;
|
||||||
GvDatos.DataBind();
|
GvDatos.DataBind();
|
||||||
|
|||||||
Reference in New Issue
Block a user