Files
SIG/OI/Tablero.aspx.cs

137 lines
4.7 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 OI_Tablero : ClsPaginas
{
#region Propiedades
private int RcveTablero
{
get { return (ViewState["RcveTablero"] == null) ? 0 : Convert.ToInt32(ViewState["RcveTablero"]); }
set { ViewState["RcveTablero"] = value; }
}
private int CcveTablero
{
get { return (ViewState["CcveTablero"] == null) ? 0 : Convert.ToInt32(ViewState["CcveTablero"]); }
set { ViewState["CcveTablero"] = value; }
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//RcveTablero = Request["cveTablero"] == null ? 0 : Request["cveTablero"].ToString().ToEntero();
CargaDDl();
CargaTablero();
}
}
protected void CargaTablero()
{
using (ClsOIEventos ObjTabl = new ClsOIEventos())
{
ObjTabl.GetTablero(-1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa);
GVTablero.DataSource = ObjTabl.DtResultados;
}
GVTablero.DataBind();
UpContenido.Update();
}
protected void CargaDDl()
{
DdlTablusuario.DataSource = get_GlobalDTUsuarios(CveEmpresa: UsuarioActual.CveEmpresa).FiltraParametros("Estatus =1 ", "Rol ASC");
DdlTablusuario.DataBind();
UPModalTabl.Update();
}
protected void LimpiaTablero()
{
TxtTabltablero.Text = "";
DdlTablusuario.SelectedValueExist( UsuarioActual.CveUsuario) ;
UPModalTabl.Update();
}
protected void LnkEditarTabl_Click(object sender, EventArgs e)
{
LimpiaTablero();
GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
CcveTablero = gvRow.DataKey("CveTablero").ToEntero();
string tablero = gvRow.DataKey("Tablero");
int cveUsuario = gvRow.DataKey("CveUsuario").ToEntero();
DateTime fechaIng = gvRow.DataKey("FechaIng").ToDateTime();
int cveUsuarioIng = gvRow.DataKey("CveUsuarioIng").ToEntero();
int cveEmpresa = gvRow.DataKey("CveEmpresa").ToEntero();
TxtTabltablero.Text = tablero.ToString();
DdlTablusuario.SelectedValueExist(cveUsuario.ToString());
this.RegistraScript("$('#DModalTablero').modal();");
BtnTablADD.Visible = false;
BtnTablEdit.Visible = true;
UPModalTabl.Update();
}
protected void BtnTablADD_Click(object sender, EventArgs e)
{
string tablero = TxtTabltablero.Text;
int cveUsuario = DdlTablusuario.SelectedValue.ToEntero();
ClsOIEventos ObjTabl = new ClsOIEventos();
bool Continuar = ObjTabl.AddTablero(tablero, cveUsuario, UsuarioActual.CveUsuario , UsuarioActual.CveEmpresa);
ObjTabl.Dispose();
if (Continuar)
{
this.RegistraScript("$('#DModalTablero').modal('hide');");
LimpiaTablero();
CargaTablero();
UPModalTabl.Update();
this.Alert("El Tablero Se ha agregado");
}
}
protected void BtnTablEdit_Click(object sender, EventArgs e)
{
string tablero = TxtTabltablero.Text;
int cveUsuario = DdlTablusuario.SelectedValue.ToEntero();
ClsOIEventos ObjTabl = new ClsOIEventos();
bool Continuar = ObjTabl.UpTablero(CcveTablero, tablero, cveUsuario, UsuarioActual.CveEmpresa);
ObjTabl.Dispose();
if (Continuar)
{
this.RegistraScript("$('#DModalTablero').modal('hide');");
LimpiaTablero();
UPModalTabl.Update();
CargaTablero();
this.Alert("El Tablero Se ha actualizado");
}
}
protected void LnkEliminarTabl_Click(object sender, EventArgs e)
{
GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
CcveTablero = gvRow.DataKey("CveTablero").ToEntero();
int cveUsuario = gvRow.DataKey("cveUsuario").ToEntero();
ClsOIEventos ObjTabl = new ClsOIEventos();
bool Continuar = ObjTabl.RemoveTablero(CcveTablero, cveUsuario, UsuarioActual.CveEmpresa);
ObjTabl.Dispose();
if (Continuar)
{
CargaTablero();
this.Alert("El Tablero Se ha Eliminado");
}else
{
this.Alert("El Tablero Se ha Eliminado", ModExtensiones.TipoMensaje.MsgAdvertencia);
}
}
protected void LnkTableros_Click(object sender, EventArgs e)
{
this.RegistraScript("$('#DModalTablero').modal();");
LimpiaTablero();
BtnTablADD.Visible = true;
BtnTablEdit.Visible = false;
UPModalTabl.Update();
}
}