diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index bde4f584f..a704afaf3 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -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 diff --git a/App_Code/ClsRH.vb b/App_Code/ClsRH.vb index 5508900fd..b7729c3f2 100644 --- a/App_Code/ClsRH.vb +++ b/App_Code/ClsRH.vb @@ -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 = "") diff --git a/RH/CatChecadores.aspx b/RH/CatChecadores.aspx new file mode 100644 index 000000000..0e7b07707 --- /dev/null +++ b/RH/CatChecadores.aspx @@ -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" %> + + + + + + + + Catálogo de Checadores + + + + +
  • + +
  • + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RH/CatChecadores.aspx.cs b/RH/CatChecadores.aspx.cs new file mode 100644 index 000000000..c05160605 --- /dev/null +++ b/RH/CatChecadores.aspx.cs @@ -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(); + } +} \ No newline at end of file