-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)
138 lines
4.6 KiB
C#
138 lines
4.6 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 Nomina_Acumulados : ClsPaginas
|
|
{
|
|
|
|
#region Propiedades
|
|
private int RcveAcumulado
|
|
{
|
|
get { return (ViewState["RcveAcumulado"] == null) ? 0 : Convert.ToInt32(ViewState["RcveAcumulado"]); }
|
|
set { ViewState["RcveAcumulado"] = value; }
|
|
}
|
|
private int CcveAcumulado
|
|
{
|
|
get { return (ViewState["CcveAcumulado"] == null) ? 0: Convert.ToInt32(ViewState["CcveAcumulado"]); }
|
|
set { ViewState["CcveAcumulado"] = value; }
|
|
}
|
|
|
|
#endregion
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
RcveAcumulado = Request["cveAcumulado"] == null ? -1: Request["cveAcumulado"].ToString().ToEntero();
|
|
|
|
using (ClsNominas ObjAcum = new ClsNominas())
|
|
{
|
|
|
|
ObjAcum.GetAcumuladosTipos();
|
|
DdlTipoAcumulado.DataSource = ObjAcum.DtResultados;
|
|
}
|
|
DdlTipoAcumulado.DataBind();
|
|
CargaAcumulados();
|
|
}
|
|
}
|
|
protected void CargaAcumulados()
|
|
{
|
|
using (ClsNominas ObjAcum = new ClsNominas())
|
|
{
|
|
|
|
ObjAcum.GetAcumulados(RcveAcumulado,UsuarioActual.CveEmpresa );
|
|
GVAcumulados.DataSource = ObjAcum.DtResultados;
|
|
}
|
|
GVAcumulados.DataBind();
|
|
upDatosAcum.Update();
|
|
}
|
|
protected void LimpiaAcumulados()
|
|
{
|
|
DdlTipoAcumulado.SelectedValue = "1";
|
|
TxtAcumacumulado.Text = "";
|
|
UPModalAcum.Update();
|
|
}
|
|
protected void LnkEditarAcum_Click(object sender, EventArgs e)
|
|
{
|
|
LimpiaAcumulados();
|
|
GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
|
CcveAcumulado = gvRow.DataKey("CveAcumulado").ToEntero();
|
|
int cveTipoAcumulado = gvRow.DataKey("CveTipoAcumulado").ToEntero();
|
|
string acumulado = gvRow.DataKey("Acumulado");
|
|
|
|
DdlTipoAcumulado .SelectedValueExist(cveTipoAcumulado.ToString());
|
|
TxtAcumacumulado.Text = acumulado.ToString();
|
|
RegistraScript("$('#DModalAcumulados').modal();");
|
|
BtnAcumADD.Visible = false;
|
|
BtnAcumEdit.Visible = true;
|
|
UPModalAcum.Update();
|
|
}
|
|
protected void LnkAgregarAcum_Click(object sender, EventArgs e)
|
|
{
|
|
RegistraScript("$('#DModalAcumulados').modal();");
|
|
LimpiaAcumulados();
|
|
BtnAcumADD.Visible = true;
|
|
BtnAcumEdit.Visible = false;
|
|
UPModalAcum.Update();
|
|
}
|
|
protected void BtnAcumADD_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
int cveTipoAcumulado = DdlTipoAcumulado.SelectedValue.ToEntero();
|
|
string acumulado = TxtAcumacumulado.Text;
|
|
int cveEmpresa = UsuarioActual.CveEmpresa;
|
|
bool Continuar = false;
|
|
using (ClsNominas ObjAcum = new ClsNominas())
|
|
{
|
|
|
|
Continuar = ObjAcum.AcumuladosAdd(cveTipoAcumulado, acumulado, cveEmpresa);
|
|
ObjAcum.Dispose();
|
|
}
|
|
if (Continuar)
|
|
{
|
|
RegistraScript("$('#DModalAcumulados').modal('hide');");
|
|
LimpiaAcumulados();
|
|
CargaAcumulados();
|
|
UPModalAcum.Update();
|
|
Alert("El Acumulados Se ha agregado");
|
|
}
|
|
}
|
|
protected void BtnAcumEdit_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
int cveTipoAcumulado = DdlTipoAcumulado.SelectedValue.ToEntero();
|
|
string acumulado = TxtAcumacumulado.Text;
|
|
int cveEmpresa = UsuarioActual.CveEmpresa;
|
|
bool Continuar = false;
|
|
using (ClsNominas ObjAcum = new ClsNominas())
|
|
{
|
|
Continuar = ObjAcum.AcumuladosUp(CcveAcumulado, cveTipoAcumulado, acumulado, cveEmpresa);
|
|
}
|
|
if (Continuar)
|
|
{
|
|
RegistraScript("$('#DModalAcumulados').modal('hide');");
|
|
LimpiaAcumulados();
|
|
UPModalAcum.Update();
|
|
CargaAcumulados();
|
|
Alert("El Acumulados Se ha actualizado");
|
|
}
|
|
}
|
|
protected void LnkEliminarAcum_Click(object sender, EventArgs e)
|
|
{
|
|
GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
|
CcveAcumulado = gvRow.DataKey("CveAcumulado").ToEntero();
|
|
int cveEmpresa = UsuarioActual.CveEmpresa;
|
|
bool Continuar = false;
|
|
using (ClsNominas ObjAcum = new ClsNominas())
|
|
{
|
|
Continuar = ObjAcum.AcumuladosRemove(CcveAcumulado, cveEmpresa);
|
|
}
|
|
if (Continuar)
|
|
{
|
|
CargaAcumulados();
|
|
Alert("El Acumulados Se ha Eliminado");
|
|
}
|
|
}
|
|
} |