nuevo catálogo de checadores
This commit is contained in:
@@ -4860,6 +4860,7 @@ Public Class ClsPaginas
|
||||
PaginaDict.Add("/RH/SolicitudViaticos.aspx".ToUpper(), 663)
|
||||
PaginaDict.Add("/RH/ReporteViaticos.aspx".ToUpper(), 664)
|
||||
PaginaDict.Add("/RH/MiPerfil.aspx".ToUpper(), -1) ' se dejará libre el módulo para que cualquier que tenga cvepersonal, pueda acceder
|
||||
PaginaDict.Add("/RH/CatChecadores.aspx".ToUpper(), 694)
|
||||
#End Region
|
||||
#Region "Sistema"
|
||||
'Cargo las páginas que deben tener restricción
|
||||
|
||||
@@ -6879,6 +6879,81 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "Checador"
|
||||
Public Function GetChecadores(CveChecador As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_RH_ChecadorGet")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveChecador", SqlDbType.Int).Value = CveChecador
|
||||
.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 checadores", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function AddChecadores(Checador As String, CveSubProyecto As Integer, IPLocal As String, Puerto As String, CveUsuario As Integer, Optional CveModelo As Integer = 1, Optional Estatus As Integer = 1) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_RH_ChecadorAdd")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@Checador", SqlDbType.NVarChar).Value = Checador
|
||||
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
|
||||
.Add("@IPLocal", SqlDbType.NVarChar).Value = IPLocal
|
||||
.Add("@Puerto", SqlDbType.NVarChar).Value = Puerto
|
||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||
.Add("@CveModelo", SqlDbType.Int).Value = CveModelo
|
||||
.Add("@Estatus", SqlDbType.Int).Value = Estatus
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al agregar el checador", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function UpdateChecadores(CveChecador As Integer, Checador As String, CveSubProyecto As Integer, IPLocal As String, Puerto As String, Optional CveModelo As Integer = 1, Optional Estatus As Boolean = True) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_RH_ChecadorUpdate")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveChecador", SqlDbType.Int).Value = CveChecador
|
||||
.Add("@Checador", SqlDbType.NVarChar).Value = Checador
|
||||
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
|
||||
.Add("@IPLocal", SqlDbType.NVarChar).Value = IPLocal
|
||||
.Add("@Puerto", SqlDbType.NVarChar).Value = Puerto
|
||||
.Add("@CveModelo", SqlDbType.Int).Value = CveModelo
|
||||
.Add("@Estatus", SqlDbType.Bit).Value = Estatus
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al actualizar el checador", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function RemoveChecadores(CveChecador As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_RH_ChecadorDelete")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveChecador", SqlDbType.Int).Value = CveChecador
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al eliminar el checador", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
|
||||
'Public msgsError As New StringBuilder()
|
||||
'Public Sub OnError(Mensaje As String, Exeption As Exception, Optional InfoAdicional As String = "")
|
||||
|
||||
101
RH/CatChecadores.aspx
Normal file
101
RH/CatChecadores.aspx
Normal file
@@ -0,0 +1,101 @@
|
||||
<%@ Page Title="RH - Catálogo de Checadores" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="CatChecadores.aspx.cs" Inherits="RH_CatChecadores" %>
|
||||
|
||||
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="HB" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="E" runat="Server">
|
||||
Catálogo de Checadores
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
<asp:UpdatePanel runat="server" ID="UpAgregar">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton runat="server" ID="BtnAgregarChecador" OnClick="BtnAgregarChecador_Click" data-toggle="tooltip" data-placement="left" title="Agregar un Checador" Text="<i class='fa fa-plus'></i>Agregar Checador"></asp:LinkButton>
|
||||
</li>
|
||||
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
|
||||
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="CveChecador,Checador,CveModelo,CveSubProyecto,SubProyecto,CveUsuario,Estatus,FechaIng,IPLocal,Puerto" EmptyDataText="No se encontraron Tipo Gasto" ToolTip="Listado de Tipo Gasto " CssClass="table table-striped table-advance table-hover" Style="margin-top: -10px; width: 100%" GridLines="None">
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Checador" DataField="Checador" />
|
||||
<asp:BoundField HeaderText="SubProyecto" DataField="SubProyecto" />
|
||||
<asp:BoundField HeaderText="IP Local" DataField="IPLocal" />
|
||||
<asp:BoundField HeaderText="Puerto" DataField="Puerto" />
|
||||
<asp:BoundField HeaderText="Usuario" DataField="Usuario" />
|
||||
<asp:BoundField HeaderText="Estatus" DataField="Estatus" />
|
||||
<asp:BoundField HeaderText="Fecha" DataField="FechaIng" DataFormatString="{0:d}" />
|
||||
<asp:TemplateField ItemStyle-Width="13%" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Left" HeaderText="Editar">
|
||||
<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>
|
||||
</asp:GridView>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
<div id="DivAgregarTiposD" class="modal ADS fade" role="dialog">
|
||||
<div class="modal-dialog" style="width: 450px;">
|
||||
<asp:UpdatePanel runat="server" class="modal-content" ID="UpModalTiposD" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="modal-header ">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">
|
||||
<asp:Literal ID="LtlTituloModalTiposD" runat="server">Checadores</asp:Literal></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtChecador" CssClass="form-control " runat="server" MaxLength="70" CausesValidation="true"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="RfvTxtChecador" runat="server" ControlToValidate="TxtChecador" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Checador''</b> es necesario, por favor ingréselo." ValidationGroup="GrpTiposD"></asp:RequiredFieldValidator>
|
||||
<label for="TxtChecador">Checador:</label>
|
||||
<i></i>
|
||||
</div>
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<label for="DdlSubProyecto">Subproyecto:</label>
|
||||
<asp:DropDownList ID="DdlSubProyecto" Width="100%" runat="server" AppendDataBoundItems="true" DataValueField="CveSubProyecto" DataTextField="SubProyecto" ValidationGroup="GrpGuardar" CssClass="select2me">
|
||||
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RFVDdlSubProyecto" runat="server" ControlToValidate="DdlSubProyecto" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Sub Proyecto''</b> es necesario, por favor ingréselo." InitialValue="-1" ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCODdlSubProyecto" runat="server" HighlightCssClass="vco" TargetControlID="RFVDdlSubProyecto" Width="300px"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtIPLocal" CssClass="form-control " runat="server" MaxLength="70" CausesValidation="true"></asp:TextBox>
|
||||
<asp:RegularExpressionValidator ID="RfvTxtIPLocal" runat="server"
|
||||
ValidationExpression="\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"
|
||||
ControlToValidate="TxtIPLocal" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''IP Local''</b> es necesario, por favor ingréselo." ValidationGroup="GrpTiposD" />
|
||||
<label for="TxtChecador">IP Local:</label>
|
||||
<i></i>
|
||||
</div>
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtPuerto" CssClass="form-control " runat="server" MaxLength="70" CausesValidation="true"></asp:TextBox>
|
||||
<asp:RegularExpressionValidator ID="RfvTxtPuerto" runat="server" ValidationExpression="\d*" ControlToValidate="TxtPuerto" CssClass="help-block errorimput"
|
||||
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Puerto''</b> es necesario, por favor ingréselo." ValidationGroup="GrpTiposD" />
|
||||
<label for="TxtPuerto">Puerto:</label>
|
||||
<i></i>
|
||||
</div>
|
||||
<div id="divChkEstatus" runat="server" class="form-group form-md-line-input input-iconright">
|
||||
<label for="ChkEstatus">Estatus:</label>
|
||||
<asp:CheckBox runat="server" ID="ChkEstatus" CssClass="make-switchsd" data-size="small" Text=" " />
|
||||
</div>
|
||||
</div>
|
||||
</br>
|
||||
<div class="modal-footer">
|
||||
<asp:Button ID="BtnChecadorAgregar" OnClick="BtnChecadorAgregar_Click" runat="server" class="btn btn-success" Text="Agregar" ValidationGroup="GrpTiposD" />
|
||||
<button id="Button3" runat="server" type="button" class="btn default" data-dismiss="modal">Cancelar</button>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
|
||||
</asp:Content>
|
||||
115
RH/CatChecadores.aspx.cs
Normal file
115
RH/CatChecadores.aspx.cs
Normal file
@@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Extensiones;
|
||||
using System.Data;
|
||||
|
||||
public partial class RH_CatChecadores : ClsPaginas
|
||||
{
|
||||
private int CveChecador
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["CveChecador"].ToString().ToEntero();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
ViewState["CveChecador"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
CargaDatos();
|
||||
CargaSubProyectos();
|
||||
}
|
||||
}
|
||||
|
||||
private void CargaDatos()
|
||||
{
|
||||
ClsRH ObjRH = new ClsRH();
|
||||
if (ObjRH.GetChecadores(-1, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
GvDatos.DataSource = ObjRH.DtResultados;
|
||||
}
|
||||
ObjRH.Dispose();
|
||||
GvDatos.DataBind();
|
||||
}
|
||||
|
||||
private void CargaSubProyectos()
|
||||
{
|
||||
DdlSubProyecto.DataSource = get_GlobalDTSubProyectos(-1, CveEmpresa: UsuarioActual.CveEmpresa);
|
||||
DdlSubProyecto.DataBind();
|
||||
}
|
||||
|
||||
protected void BtnAgregarChecador_Click(object sender, EventArgs e)
|
||||
{
|
||||
TxtChecador.Text = "";
|
||||
DdlSubProyecto.SelectedValue = "-1";
|
||||
TxtIPLocal.Text = "";
|
||||
TxtPuerto.Text = "";
|
||||
BtnChecadorAgregar.Text = "Agregar";
|
||||
divChkEstatus.Visible = false;
|
||||
UpModalTiposD.Update();
|
||||
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposD"));
|
||||
}
|
||||
|
||||
protected void BtnChecadorAgregar_Click(object sender, EventArgs e)
|
||||
{
|
||||
ClsRH ObjRH = new ClsRH();
|
||||
if (BtnChecadorAgregar.Text == "Agregar")
|
||||
{
|
||||
if (ObjRH.AddChecadores(TxtChecador.Text, DdlSubProyecto.SelectedValue.ToEntero(), TxtIPLocal.Text, TxtPuerto.Text, UsuarioActual.CveUsuario))
|
||||
{
|
||||
Alert("Checador agregado correctamente");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ObjRH.UpdateChecadores(CveChecador,TxtChecador.Text,DdlSubProyecto.SelectedValue.ToEntero(),TxtIPLocal.Text,TxtPuerto.Text,Estatus: ChkEstatus.Checked))
|
||||
{
|
||||
Alert("Checador actualizado correctamente");
|
||||
}
|
||||
}
|
||||
ObjRH.Dispose();
|
||||
CargaDatos();
|
||||
UpDatos.Update();
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposD"));
|
||||
}
|
||||
|
||||
protected void LnkEditar_Click(object sender, EventArgs e)
|
||||
{
|
||||
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
||||
|
||||
CveChecador = GvRow.DataKey("CveChecador").ToEntero();
|
||||
TxtChecador.Text = GvRow.DataKey("Checador");
|
||||
DdlSubProyecto.SelectedValue = GvRow.DataKey("CveSubProyecto");
|
||||
TxtIPLocal.Text = GvRow.DataKey("IPLocal");
|
||||
TxtPuerto.Text = GvRow.DataKey("Puerto");
|
||||
BtnChecadorAgregar.Text = "Actualizar";
|
||||
ChkEstatus.Checked = GvRow.DataKey("Estatus") == "Activo";
|
||||
divChkEstatus.Visible = true;
|
||||
UpModalTiposD.Update();
|
||||
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposD"));
|
||||
}
|
||||
|
||||
protected void LnkEliminar_Click(object sender, EventArgs e)
|
||||
{
|
||||
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
||||
|
||||
ClsRH ObjRH = new ClsRH();
|
||||
if (ObjRH.RemoveChecadores(GvRow.DataKey("CveChecador").ToEntero()))
|
||||
{
|
||||
Alert("Checador eliminado correctamente");
|
||||
CargaDatos();
|
||||
UpDatos.Update();
|
||||
}
|
||||
ObjRH.Dispose();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user