-
This commit is contained in:
@@ -72,7 +72,7 @@
|
||||
</div>
|
||||
<br />
|
||||
<div class="form-group form-md-line-input input-iconright" style="margin: unset; font-size: 14px">
|
||||
<div>
|
||||
<div runat="server" id="DivFileDropZone">
|
||||
<asp:Label runat="server" ID="LblDocumentoFile" Text="Documento" />
|
||||
<asp:TextBox ID="TxtDocumentoFile" CssClass="ADSdropzone hidden" runat="server" Style="height: 100px"></asp:TextBox>
|
||||
</div>
|
||||
@@ -99,7 +99,7 @@
|
||||
<asp:UpdatePanel ID="UpDatosUsuarios" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<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" Style="text-align: center; width: 100%; overflow-x: hidden"
|
||||
ToolTip="Listado de Categorías de Documentos" CssClass="table table-striped table-advance table-hover ScrollAD" Style="text-align: center; width: 100%; overflow-x: hidden"
|
||||
GridLines="None" OnRowDataBound="GvUsuarios_RowDataBound">
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Nombre" DataField="Nombre" ItemStyle-HorizontalAlign="Left" />
|
||||
@@ -110,13 +110,19 @@
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Aprobar" Visible="false">
|
||||
<ItemTemplate>
|
||||
<asp:CheckBox runat="server" ID="ChkAprobar" />
|
||||
<asp:CheckBox runat="server" ID="ChkAprobar" OnCheckedChanged="ChkAprobar_Checked" AutoPostBack="true" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Propuesta" Visible="false">
|
||||
<asp:TemplateField HeaderText="Propuesta" Visible="false" ItemStyle-Width="15%">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton runat="server" ID="LkbSubirPropuesta" OnClick="LkbSubirPropuesta_Click" AlternateText="Subir" CausesValidation="False" CssClass="btn btn-circle btn-sm green" Text="<i title='Subir Documento' class='fa fa-upload' title='Subir Documento' ></i>" />
|
||||
<asp:LinkButton runat="server" ID="LkbDescargarPropuesta" OnClick="LkbDescargarPropuesta_Click" AlternateText="Descargar" CausesValidation="False" CssClass="btn btn-circle btn-sm blue" Text="<i title='Subir Documento' class='fa fa-download' title='Descargar Documento' ></i>" />
|
||||
<div class="row">
|
||||
<div class="col-md-4" style="width:50%;text-align:right;padding-right:unset">
|
||||
<asp:LinkButton runat="server" ID="LkbSubirPropuesta" OnClick="LkbSubirPropuesta_Click" AlternateText="Subir" CausesValidation="False" s CssClass="btn btn-circle btn-sm green" Text="<i title='Subir Documento' class='fa fa-upload' title='Subir Documento' ></i>" />
|
||||
</div>
|
||||
<div class="col-md-4" style="width:50%;text-align:left;;padding-right:unset">
|
||||
<asp:LinkButton runat="server" ID="LkbDescargarPropuesta" OnClick="LkbDescargarPropuesta_Click" AlternateText="Descargar" CausesValidation="False" CssClass="btn btn-circle btn-sm blue" CssStyle="" Text="<i title='Subir Documento' class='fa fa-download' title='Descargar Documento' ></i>" />
|
||||
</div>
|
||||
</div>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
@@ -132,6 +138,7 @@
|
||||
<br />
|
||||
<asp:LinkButton runat="server" ID="LkbGuardar" OnClick="LblGuardar_Click" Text="Guardar" class="btn btn-primary" ValidationGroup="GrpDoc" />
|
||||
<asp:LinkButton runat="server" ID="LkbActualizar" OnClick="LbkActualizar_Click" Text="Actualizar" class="btn btn-primary" ValidationGroup="GrpDoc" Visible="false" />
|
||||
<asp:LinkButton runat="server" ID="LkbPublicar" OnClick="LkbPublicar_Click" Text="Publicar" class="btn btn-primary" ValidationGroup="GrpDoc" />
|
||||
<br />
|
||||
</div>
|
||||
</div>
|
||||
@@ -148,7 +155,8 @@
|
||||
<asp:Label runat="server" ID="Label1" Text="Subir Archivo de Propuesta:" style="font-size:15px"/>
|
||||
<br />
|
||||
<asp:TextBox ID="TxtArchivoPropuesta" CssClass="ADSdropzone hidden" runat="server" Style="height: 100px"></asp:TextBox>
|
||||
<asp:Label runat="server" ID="Label2" Text="Comentarios:" />
|
||||
<br />
|
||||
<asp:Label runat="server" ID="Label2" Text="Comentarios:" style="font-size:15px"/>
|
||||
<textarea runat="server" id="TxtComentarios" class="form-control" style="border: 1px solid #e5e5e5" rows="2"></textarea>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
||||
@@ -11,6 +11,19 @@ using System.Text;
|
||||
|
||||
public partial class OI_DocumentoDetalle : ClsPaginas
|
||||
{
|
||||
private int CveUsuarioResponsable
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["CveUsuarioResponsable"].ToString().ToEntero();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
ViewState["CveUsuarioResponsable"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
private int CveDocumento
|
||||
{
|
||||
get
|
||||
@@ -111,22 +124,40 @@ public partial class OI_DocumentoDetalle : ClsPaginas
|
||||
|
||||
private void CargarUsuarios()
|
||||
{
|
||||
if (this.CveDocumento > 0)
|
||||
{
|
||||
ClsOIEventos ObjOI = new ClsOIEventos();
|
||||
if (ObjOI.GetDocumentoAutorizacion(this.CveDocumento))
|
||||
{
|
||||
GvUsuarios.DataSource = ObjOI.DtResultados;
|
||||
}
|
||||
ObjOI.Dispose();
|
||||
}
|
||||
else
|
||||
{
|
||||
GvUsuarios.DataSource = get_GlobalDTUsuarios(CveEmpresa: UsuarioActual.CveEmpresa);
|
||||
}
|
||||
GvUsuarios.DataSource = get_GlobalDTUsuarios(CveEmpresa: UsuarioActual.CveEmpresa);
|
||||
GvUsuarios.DataBind();
|
||||
}
|
||||
|
||||
private void CargarUsuariosParticipantes()
|
||||
{
|
||||
|
||||
DataTable UsuariosAux = null;
|
||||
ClsOIEventos ObjOI = new ClsOIEventos();
|
||||
if (ObjOI.GetDocumentoAutorizacion(this.CveDocumento))
|
||||
{
|
||||
GvUsuarios.DataSource = ObjOI.DtResultados;
|
||||
UsuariosAux = ObjOI.DtResultados;
|
||||
}
|
||||
ObjOI.Dispose();
|
||||
GvUsuarios.DataBind();
|
||||
IndicarQuienesYaAutorizaron(UsuariosAux);
|
||||
|
||||
}
|
||||
|
||||
private void IndicarQuienesYaAutorizaron(DataTable Usuarios)
|
||||
{
|
||||
if (Usuarios != null)
|
||||
{
|
||||
GridViewRowCollection UsuariosEnGrid = GvUsuarios.Rows;
|
||||
foreach (GridViewRow Usuario in UsuariosEnGrid)
|
||||
{
|
||||
int CveUsuario = Usuario.DataKey("CveUsuario").ToEntero();
|
||||
string FechaAprobacion = Usuarios.FiltroPrimeroValor("FechaAprobacion", string.Format("CveUsuario = {0}", CveUsuario));
|
||||
Usuario.FCCheckBox("ChkAprobar").Checked = FechaAprobacion != "" || (UsuarioActual.CveUsuario == CveUsuarioResponsable && CveUsuario == UsuarioActual.CveUsuario);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void GvUsuarios_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
@@ -163,6 +194,7 @@ public partial class OI_DocumentoDetalle : ClsPaginas
|
||||
{
|
||||
DataRow Documento = ObjOI.DtResultados.Rows[0];
|
||||
|
||||
CveUsuarioResponsable = Documento["CveUsuario"].ToString().ToEntero();
|
||||
TxtDescripcion.Text = Documento["Descripcion"].ToString();
|
||||
DdlSubCategoria.SelectedValue = Documento["CveSubCategoria"].ToString();
|
||||
DdlEstatus.SelectedValue = Documento["CveEstatus"].ToString();
|
||||
@@ -173,11 +205,6 @@ public partial class OI_DocumentoDetalle : ClsPaginas
|
||||
ArchivoAdjuntoNombre = Documento["ArchivoFisico"].ToString();
|
||||
LkbDescargarArchivo.Text = ArchivoAdjuntoNombre;
|
||||
DivDescargarArchivo.Visible = true;
|
||||
//if (ArchivoAdjuntoNombre.Contains("_"))
|
||||
//{
|
||||
// string[] ArchivoAux = Documento["ArchivoFisico"].ToString().Split('_');
|
||||
// string ArchivoAdjunto = ArchivoAux[1];
|
||||
//}
|
||||
}
|
||||
}
|
||||
ObjOI.Dispose();
|
||||
@@ -208,6 +235,36 @@ public partial class OI_DocumentoDetalle : ClsPaginas
|
||||
GvUsuarios.Columns[3].Visible = true;
|
||||
}
|
||||
|
||||
private void ConfigurarGridUsuariosParticipantes()
|
||||
{
|
||||
int CveUsuarioActual = UsuarioActual.CveUsuario;
|
||||
GridViewRowCollection Usuarios = GvUsuarios.Rows;
|
||||
foreach (GridViewRow Usuario in Usuarios)
|
||||
{
|
||||
int CveUsuarioIteracion = Usuario.DataKey("CveUsuario").ToEntero();
|
||||
if (CveUsuarioIteracion != CveUsuarioActual)
|
||||
{
|
||||
Usuario.FCCheckBox("ChkAprobar").Enabled = false;
|
||||
Usuario.FCLinkButton("LkbSubirPropuesta").Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ConfigurarCamposDetalleSegunUsuario()
|
||||
{
|
||||
if (UsuarioActual.CveUsuario != CveUsuarioResponsable)
|
||||
{
|
||||
TxtDescripcion.Enabled = false;
|
||||
DdlSubCategoria.Enabled = false;
|
||||
DdlEstatus.Enabled = false;
|
||||
TxtVersion.Enabled = false;
|
||||
TxtResponsable.Enabled = false;
|
||||
TxtObs.Disabled = true;
|
||||
DivFileDropZone.Visible = false;
|
||||
LkbActualizar.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void Cargar()
|
||||
{
|
||||
CargarSubCategoria();
|
||||
@@ -217,8 +274,11 @@ public partial class OI_DocumentoDetalle : ClsPaginas
|
||||
if (this.CveDocumento > 0)
|
||||
{
|
||||
CargarDocumentoYaExistente();
|
||||
CargarUsuariosParticipantes();
|
||||
CargarUsuariosAutorizo();
|
||||
ConfiguracionActualizar();
|
||||
ConfigurarGridUsuariosParticipantes();
|
||||
ConfigurarCamposDetalleSegunUsuario();
|
||||
CargarMensajeNuevoEditado();
|
||||
}
|
||||
}
|
||||
@@ -474,7 +534,7 @@ public partial class OI_DocumentoDetalle : ClsPaginas
|
||||
ClsOIEventos ObjOI = new ClsOIEventos();
|
||||
if (ObjOI.GetDocumentoAutorizacion(this.CveDocumento))
|
||||
{
|
||||
UsuarioRetorno = ObjOI.DtResultados.FiltroPrimero(string.Format("CveUsuario = {0}",CveUsuario));
|
||||
UsuarioRetorno = ObjOI.DtResultados.FiltroPrimero(string.Format("CveUsuario = {0}", CveUsuario));
|
||||
}
|
||||
ObjOI.Dispose();
|
||||
return UsuarioRetorno;
|
||||
@@ -495,17 +555,24 @@ public partial class OI_DocumentoDetalle : ClsPaginas
|
||||
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
||||
int CveUsuario = GvRow.DataKey("CveUsuario").ToEntero();
|
||||
DataRow UsuarioSeleccionado = GetUsuarioParticipante(CveUsuario);
|
||||
string Propuesta = UsuarioSeleccionado["Adjunto"] == null?"": UsuarioSeleccionado["Adjunto"].ToString();
|
||||
string Propuesta = UsuarioSeleccionado["Adjunto"] == null ? "" : UsuarioSeleccionado["Adjunto"].ToString();
|
||||
string Ruta = string.Format("{0}Empresas/{1}/DocumentosRepo/{2}/{3}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, this.CveDocumento, Propuesta);
|
||||
byte[] archivoBytes = File.ReadAllBytes(Ruta);
|
||||
if (File.Exists(Ruta))
|
||||
{
|
||||
byte[] archivoBytes = File.ReadAllBytes(Ruta);
|
||||
|
||||
HttpContext.Current.Response.Clear();
|
||||
HttpContext.Current.Response.ClearContent();
|
||||
HttpContext.Current.Response.ContentType = "application/octet-stream";
|
||||
HttpContext.Current.Response.AddHeader("Content-Disposition", String.Format("attachment;filename={0}", Propuesta));
|
||||
HttpContext.Current.Response.AddHeader("Content-Length", archivoBytes.Length.ToString());
|
||||
HttpContext.Current.Response.OutputStream.Write(archivoBytes, 0, archivoBytes.Length);
|
||||
HttpContext.Current.Response.End();
|
||||
HttpContext.Current.Response.Clear();
|
||||
HttpContext.Current.Response.ClearContent();
|
||||
HttpContext.Current.Response.ContentType = "application/octet-stream";
|
||||
HttpContext.Current.Response.AddHeader("Content-Disposition", String.Format("attachment;filename={0}", Propuesta));
|
||||
HttpContext.Current.Response.AddHeader("Content-Length", archivoBytes.Length.ToString());
|
||||
HttpContext.Current.Response.OutputStream.Write(archivoBytes, 0, archivoBytes.Length);
|
||||
HttpContext.Current.Response.End();
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert("El Usuario no ha realizado una propuesta", ModExtensiones.TipoMensaje.MsgAdvertencia);
|
||||
}
|
||||
}
|
||||
|
||||
protected void BtnAgregarPropuesta_Click(object sender, EventArgs e)
|
||||
@@ -526,7 +593,7 @@ public partial class OI_DocumentoDetalle : ClsPaginas
|
||||
try
|
||||
{
|
||||
string NombreArchivo = fileItem.filenameO;
|
||||
fileNameReturn = string.Format("{0}_{1}",CveUsuario,NombreArchivo);
|
||||
fileNameReturn = string.Format("{0}_{1}", CveUsuario, NombreArchivo);
|
||||
string RutaDestino = string.Format(@"{0}DocumentosRepo\{1}\{2}_{3}", UsuarioActual.Empresa.Ruta, this.CveDocumento, CveUsuario, NombreArchivo);
|
||||
System.IO.File.Move(fileItem.FileUrl, RutaDestino);
|
||||
}
|
||||
@@ -542,7 +609,7 @@ public partial class OI_DocumentoDetalle : ClsPaginas
|
||||
private void ActualizarUsuario(int CveAutorizacion, string Archivo)
|
||||
{
|
||||
ClsOIEventos ObjOI = new ClsOIEventos();
|
||||
if (!ObjOI.UpdateDocumentoAutorizacion(CveAutorizacion,this.CveDocumento,TxtComentarios.InnerText,Archivo,ModExtensiones.MinFecha))
|
||||
if (!ObjOI.UpdateDocumentoAutorizacion(CveAutorizacion, this.CveDocumento, TxtComentarios.InnerText, Archivo, ModExtensiones.MinFecha))
|
||||
{
|
||||
Alert("Error al actualizar el archivo subido propuesto por el usuario");
|
||||
}
|
||||
@@ -550,4 +617,67 @@ public partial class OI_DocumentoDetalle : ClsPaginas
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region "APROBACIÓN DEL DOCUMENTO"
|
||||
protected void ChkAprobar_Checked(object sender, EventArgs e)
|
||||
{
|
||||
CheckBox SelectedCheckBox = (CheckBox)sender;
|
||||
GridViewRow UsuarioAux = (GridViewRow)((Control)sender).Parent.Parent;
|
||||
int CveUsuario = UsuarioAux.DataKey("CveUsuario").ToEntero();
|
||||
DataRow Usuario = GetUsuarioParticipante(CveUsuario);
|
||||
|
||||
AprobacionDeUsuario(Usuario, SelectedCheckBox.Checked);
|
||||
}
|
||||
|
||||
private void AprobacionDeUsuario(DataRow Usuario, bool Autorizar)
|
||||
{
|
||||
int CveAutorizacion = Usuario["CveAutorizacion"].ToString().ToEntero();
|
||||
ClsOIEventos ObjOI = new ClsOIEventos();
|
||||
if (Autorizar)
|
||||
{
|
||||
if (ObjOI.UpdateDocumentoAutorizacion(CveAutorizacion, -1, "-1", "-1", DateTime.Now))
|
||||
{
|
||||
Alert("Haz aprobado la versión actual del Documento");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ObjOI.DesaprobarDocumentoAutorizacion(CveAutorizacion))
|
||||
{
|
||||
Alert("Haz desaprobado la versión actual del Documento");
|
||||
}
|
||||
}
|
||||
ObjOI.Dispose();
|
||||
}
|
||||
|
||||
protected void LkbPublicar_Click(object sender, EventArgs e)
|
||||
{
|
||||
GridViewRowCollection Usuarios = GvUsuarios.Rows;
|
||||
bool Aprobado = true;
|
||||
foreach (GridViewRow Usuario in Usuarios)
|
||||
{
|
||||
if (!Usuario.FCCheckBox("ChkAprobar").Checked)
|
||||
{
|
||||
Aprobado = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Aprobado)
|
||||
{
|
||||
ClsOIEventos ObjOI = new ClsOIEventos();
|
||||
if (ObjOI.UpdateDocumento(this.CveDocumento, DdlSubCategoria.SelectedValue.ToEntero(), TxtDescripcion.Text, TxtObs.InnerText, TxtVersion.Text, 2, "-1", TxtResponsable.Text,
|
||||
DateTime.Now, -1, -1, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
Cargar();
|
||||
UpCliente.Update();
|
||||
Alert("Documento publicado");
|
||||
}
|
||||
ObjOI.Dispose();
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert("Los usuarios participantes aún no autorizan este Documento");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user