-RegistraScript se unifica en una sola clase static/shared y se simplica el código -Alert se vuelve estático -Random() no se manda a crear cada vez que se registra un script (esto tenía un costo alto) -Se corrigieron unos errores en los nombres de funciones -Las clases que ya heredan de Clspaginas, se les quita el this a RegistraScript y a Alert puesto que era innecesario (y además al haberlos vuelto métodos estáticos, NO pueden llamarse de un this)
74 lines
2.1 KiB
C#
74 lines
2.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using Extensiones;
|
|
|
|
public partial class RH_DiasFestivos : ClsPaginas
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
CargaDiasFestivos();
|
|
}
|
|
|
|
}
|
|
|
|
|
|
protected void CargaDiasFestivos()
|
|
{
|
|
ClsRH ObjDias = new ClsRH();
|
|
ObjDias.DiasFestivosGet(UsuarioActual.CveEmpresa );
|
|
GVDiasFestivos.DataSource = ObjDias.DtResultados;
|
|
ObjDias.Dispose();
|
|
GVDiasFestivos.DataBind();
|
|
upDatosDias.Update();
|
|
}
|
|
protected void LimpiaDiasFestivos()
|
|
{
|
|
TxtDiasfecha.Text = "";
|
|
UPModalDias.Update();
|
|
}
|
|
protected void LnkAgregarDias_Click(object sender, EventArgs e)
|
|
{
|
|
RegistraScript("$('#DModalDiasFestivos').modal();");
|
|
LimpiaDiasFestivos();
|
|
BtnDiasADD.Visible = true;
|
|
UPModalDias.Update();
|
|
}
|
|
protected void BtnDiasADD_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
DateTime fecha = TxtDiasfecha.Text.ToDate();
|
|
ClsRH ObjDias = new ClsRH();
|
|
bool Continuar = ObjDias.DiasFestivosAdd(fecha, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario);
|
|
ObjDias.Dispose();
|
|
if (Continuar)
|
|
{
|
|
RegistraScript("$('#DModalDiasFestivos').modal('hide');");
|
|
LimpiaDiasFestivos();
|
|
CargaDiasFestivos();
|
|
UPModalDias.Update();
|
|
Alert("El dìa festivos se ha agregado");
|
|
}
|
|
}
|
|
protected void LnkEliminarDias_Click(object sender, EventArgs e)
|
|
{
|
|
GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
|
DateTime fecha = gvRow.DataKey("CveDiainabil").ToDateTime();
|
|
ClsRH ObjDias = new ClsRH();
|
|
bool Continuar = ObjDias.DiasFestivosRemove(fecha, UsuarioActual.CveEmpresa);
|
|
ObjDias.Dispose();
|
|
if (Continuar)
|
|
{
|
|
CargaDiasFestivos();
|
|
Alert("El dìa festivos se ha Eliminado");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} |