-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)
205 lines
6.7 KiB
C#
205 lines
6.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_TableroDetalle : ClsPaginas
|
|
{
|
|
|
|
#region Propiedades
|
|
private int RcveTablero
|
|
{
|
|
get { return (ViewState["RcveTablero"] == null) ? 0 : Convert.ToInt32(ViewState["RcveTablero"]); }
|
|
set { ViewState["RcveTablero"] = value; }
|
|
}
|
|
|
|
private System.Data.DataTable DtDatos
|
|
{
|
|
get { return (ViewState["DtDatos"] == null) ? null : (System.Data.DataTable)ViewState["DtDatos"]; }
|
|
set { ViewState["DtDatos"] = value; }
|
|
}
|
|
private int CcveTableroLista
|
|
{
|
|
get { return (ViewState["CcveTableroLista"] == null) ? 0 : Convert.ToInt32(ViewState["CcveTableroLista"]); }
|
|
set { ViewState["CcveTableroLista"] = value; }
|
|
}
|
|
|
|
#endregion
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
if (!IsPostBack)
|
|
{
|
|
RcveTablero = Request["cveTablero"] == null ? 0 : Request["cveTablero"].ToString().ToEntero();
|
|
|
|
|
|
if (RcveTablero > 0)
|
|
{
|
|
|
|
using (ClsOIEventos ObjTabl = new ClsOIEventos())
|
|
{
|
|
if (ObjTabl.GetTablero(RcveTablero, -1, UsuarioActual.CveEmpresa) && ObjTabl.DtResultados.Rows.Count > 0)
|
|
{
|
|
LtlTituloTablero.Text = string.Format("Tablero : {0}", ObjTabl.DtResultados.Rows[0]["Tablero"]);
|
|
}
|
|
else
|
|
{
|
|
RcveTablero = 0;
|
|
}
|
|
|
|
}
|
|
CargaTableroLista();
|
|
}
|
|
}
|
|
}
|
|
protected void CargaTableroLista()
|
|
{
|
|
using (ClsOIEventos ObjTabl = new ClsOIEventos())
|
|
{
|
|
if (ObjTabl.GetTableroListaTrello(RcveTablero))
|
|
{
|
|
DtDatos = ObjTabl.DtResultados;
|
|
RptrListas.DataSource = DtDatos.FiltraParametros("", "", new string[] { "CveTableroLista", "Lista" });
|
|
RptrListas.DataBind();
|
|
}
|
|
//GVTableroLista.DataSource = ObjTabl.DtResultados;
|
|
|
|
}
|
|
//GVTableroLista.DataBind();
|
|
UpContenido.Update();
|
|
}
|
|
|
|
protected void LimpiaTableroLista()
|
|
{
|
|
TxtTabllista.Text = "";
|
|
UPModalTabl.Update();
|
|
}
|
|
protected void LnkEditarTabl_Click(object sender, EventArgs e)
|
|
{
|
|
LimpiaTableroLista();
|
|
GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
|
CcveTableroLista = gvRow.DataKey("CveTableroLista").ToEntero();
|
|
int cveTablero = gvRow.DataKey("CveTablero").ToEntero();
|
|
string lista = gvRow.DataKey("Lista");
|
|
|
|
TxtTabllista.Text = lista.ToString();
|
|
RegistraScript("$('#DModalTableroLista').modal();");
|
|
BtnTablADD.Visible = false;
|
|
BtnTablEdit.Visible = true;
|
|
UPModalTabl.Update();
|
|
}
|
|
protected void LnkAgregarTabl_Click(object sender, EventArgs e)
|
|
{
|
|
RegistraScript("$('#DModalTableroLista').modal();");
|
|
LimpiaTableroLista();
|
|
BtnTablADD.Visible = true;
|
|
BtnTablEdit.Visible = false;
|
|
UPModalTabl.Update();
|
|
}
|
|
protected void BtnTablADD_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
string lista = TxtTabllista.Text;
|
|
ClsOIEventos ObjTabl = new ClsOIEventos();
|
|
bool Continuar = ObjTabl.AddTableroLista(RcveTablero, lista, UsuarioActual.CveUsuario);
|
|
ObjTabl.Dispose();
|
|
if (Continuar)
|
|
{
|
|
RegistraScript("$('#DModalTableroLista').modal('hide');");
|
|
LimpiaTableroLista();
|
|
CargaTableroLista();
|
|
UPModalTabl.Update();
|
|
Alert("La Lista se ha agregadó",ModExtensiones.TipoMensaje.ToastInformacion);
|
|
}
|
|
}
|
|
protected void BtnTablEdit_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
string lista = TxtTabllista.Text;
|
|
ClsOIEventos ObjTabl = new ClsOIEventos();
|
|
bool Continuar = ObjTabl.UpTableroLista(CcveTableroLista, lista);
|
|
ObjTabl.Dispose();
|
|
if (Continuar)
|
|
{
|
|
RegistraScript("$('#DModalTableroLista').modal('hide');");
|
|
LimpiaTableroLista();
|
|
UPModalTabl.Update();
|
|
CargaTableroLista();
|
|
Alert("La Lista Se ha actualizado");
|
|
}
|
|
}
|
|
protected void LnkEliminarTabl_Click(object sender, EventArgs e)
|
|
{
|
|
GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
|
CcveTableroLista = gvRow.DataKey("CveTableroLista").ToEntero();
|
|
ClsOIEventos ObjTabl = new ClsOIEventos();
|
|
bool Continuar = ObjTabl.RemoveTableroLista(CcveTableroLista);
|
|
ObjTabl.Dispose();
|
|
if (Continuar)
|
|
{
|
|
CargaTableroLista();
|
|
Alert("El Tablero_Lista Se ha Eliminado");
|
|
}
|
|
}
|
|
//Dim item As DataRowView = DirectCast(e.Item.DataItem, DataRowView)
|
|
|
|
protected void RptrListas_ItemDataBound(object sender, RepeaterItemEventArgs e)
|
|
{
|
|
System.Data.DataRowView item = (System.Data.DataRowView)e.Item.DataItem;
|
|
string Lista = item["Lista"].ToString();
|
|
int CveTableroLista = item["CveTableroLista"].ToString().ToEntero();
|
|
|
|
Repeater RptTareas = (Repeater)e.Item.FindControl("RptTareas");
|
|
RptTareas.DataSource =DtDatos.FiltraParametros(string.Format("CveTableroLista={0} AND CveEvento>0", CveTableroLista));
|
|
RptTareas.DataBind();
|
|
}
|
|
|
|
protected void BtnCargarDatos_Click(object sender, EventArgs e)
|
|
{
|
|
CargaTableroLista();
|
|
}
|
|
|
|
protected void BtnUpPosition_Click(object sender, EventArgs e)
|
|
{
|
|
bool continuar = false;
|
|
using (ClsOIEventos eveobj = new ClsOIEventos())
|
|
{
|
|
eveobj.IniciaTransacSQL();
|
|
continuar =eveobj.UpEventoLista(Txtcvetablerolista.Text.ToEntero(), txtCveEvento.Text.ToEntero());
|
|
if (continuar)
|
|
{
|
|
List<string> orderlist = TxtCveOrdeList.Text.Split(',').ToList<string>();
|
|
continuar = eveobj.OrdenaTareas(orderlist, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario);
|
|
}
|
|
|
|
if (continuar)
|
|
{
|
|
eveobj.Commit();
|
|
}
|
|
else
|
|
{
|
|
eveobj.RollBack();
|
|
}
|
|
}
|
|
}
|
|
|
|
protected void BtnOrderList_Click(object sender, EventArgs e)
|
|
{
|
|
List<string> orderlist = TxtCveOrdeList.Text.Split(',').ToList<string>();
|
|
using (ClsOIEventos eveobj = new ClsOIEventos())
|
|
{
|
|
eveobj.IniciaTransacSQL();
|
|
if(eveobj.OrdenaListas(orderlist,UsuarioActual.CveEmpresa,UsuarioActual.CveUsuario))
|
|
{
|
|
eveobj.Commit();
|
|
}
|
|
else
|
|
{
|
|
eveobj.RollBack();
|
|
}
|
|
}
|
|
}
|
|
} |