-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)
73 lines
4.1 KiB
C#
73 lines
4.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI.WebControls;
|
|
using Extensiones;
|
|
|
|
public partial class CGame_CatConceptoGastoCorte : ClsPaginas
|
|
{
|
|
|
|
|
|
|
|
#region Propiedades
|
|
|
|
private int CveConceptoGastoCorte
|
|
{
|
|
get { return (ViewState["CveConceptoGastoCorte"] == null) ? 0 : Convert.ToInt32(ViewState["CveConceptoGastoCorte"]); }
|
|
set { ViewState["CveConceptoGastoCorte"] = value; }
|
|
}
|
|
|
|
|
|
#endregion
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
CargaConcepto();
|
|
}
|
|
}
|
|
protected void CargaConcepto()
|
|
{
|
|
ClsCGame ObjCGame = new ClsCGame();
|
|
if (ObjCGame.GetConceptoGastoCorte(UsuarioActual.CveEmpresa))
|
|
{
|
|
GvConcepto.DataSource = ObjCGame.DtResultados;
|
|
}
|
|
ObjCGame.Dispose();
|
|
GvConcepto.DataBind();
|
|
UpDatos.Update();
|
|
}
|
|
|
|
protected void LimpiaConcepto()
|
|
{
|
|
TxtConcepto.Text = "";
|
|
UpModal.Update();
|
|
}
|
|
|
|
protected void LnkAgregarConcepto_Click(object sender, EventArgs e)
|
|
{
|
|
RegistraScript("$('#DModalConcepto').modal();");
|
|
LimpiaConcepto();
|
|
BtnConceptoAdd.Visible = true;
|
|
BtnConceptoEdit.Visible = false;
|
|
DivEstatus.Visible = false;
|
|
UpModal.Update();
|
|
}
|
|
|
|
protected void GvConcepto_RowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
if (e.Row.RowType == DataControlRowType.DataRow)
|
|
{
|
|
|
|
if (Convert.ToBoolean(e.Row.DBCampo("Estatus")) == true)
|
|
{
|
|
e.Row.FCLabel("lblestatus").Text = "Activo";
|
|
e.Row.FCLabel("lblestatus").ForeColor = System.Drawing.Color.Green;
|
|
}
|
|
else
|
|
{
|
|
e.Row.FCLabel("lblestatus").Text = "Inactivo";
|
|
e.Row.FCLabel("lblestatus").ForeColor = System.Drawing.Color.Red;
|
|
}
|
|
}
|
|
}
|
|
|
|
protected void LnkDelete_Click(object sender, EventArgs e)
|
|
{
|
|
GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
|
ClsCGame ObjCGame = new ClsCGame();
|
|
bool Continuar = ObjCGame.RemoveConceptoGastoCorte(gvRow.DataKey("CveConceptoGastoCorte").ToEntero());
|
|
ObjCGame.Dispose();
|
|
if (Continuar)
|
|
{
|
|
CargaConcepto();
|
|
Alert("El concepto se ha eliminado");
|
|
}
|
|
}
|
|
|
|
protected void LnkEditar_Click(object sender, EventArgs e)
|
|
{
|
|
LimpiaConcepto();
|
|
GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
|
CveConceptoGastoCorte = gvRow.DataKey("CveConceptoGastoCorte").ToEntero();
|
|
TxtConcepto.Text = gvRow.DataKey("ConceptoGastoCorte");
|
|
ChkEstatus.Checked = Convert.ToBoolean(gvRow.DataKey("Estatus"));
|
|
RegistraScript("$('#DModalConcepto').modal();");
|
|
BtnConceptoAdd.Visible = false;
|
|
BtnConceptoEdit.Visible = true;
|
|
DivEstatus.Visible = true;
|
|
UpModal.Update();
|
|
}
|
|
|
|
protected void BtnConceptoAdd_Click(object sender, EventArgs e)
|
|
{
|
|
ClsCGame ObjCgame = new ClsCGame();
|
|
bool Continuar = ObjCgame.AddConceptoGastoCorte(TxtConcepto.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa);
|
|
ObjCgame.Dispose();
|
|
if (Continuar)
|
|
{
|
|
RegistraScript("$('#DModalConcepto').modal('hide');");
|
|
LimpiaConcepto();
|
|
UpModal.Update();
|
|
Alert("El cocnepto se ha agregado");
|
|
CargaConcepto();
|
|
}
|
|
}
|
|
|
|
protected void BtnConceptoEdit_Click(object sender, EventArgs e)
|
|
{
|
|
ClsCGame ObjCGame = new ClsCGame();
|
|
bool Continuar = ObjCGame.UpdateConceptoGastoCorte(CveConceptoGastoCorte, TxtConcepto.Text, ChkEstatus.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa);
|
|
ObjCGame.Dispose();
|
|
if (Continuar)
|
|
{
|
|
RegistraScript("$('#DModalConcepto').modal('hide');");
|
|
LimpiaConcepto();
|
|
UpModal.Update();
|
|
Alert("El concepto se ha actualizado");
|
|
CargaConcepto();
|
|
}
|
|
}
|
|
} |