nuevo catálogo de checadores
This commit is contained in:
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