108 lines
3.6 KiB
C#
108 lines
3.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;
|
|
using System.Data;
|
|
|
|
public partial class AF_CatCheckListActividades : ClsPaginas
|
|
{
|
|
private int CveCheckListActividad
|
|
{
|
|
get
|
|
{
|
|
return ViewState["CveCheckListActividad"].ToString().ToEntero();
|
|
}
|
|
|
|
set
|
|
{
|
|
ViewState["CveCheckListActividad"] = value;
|
|
}
|
|
}
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
CargaDatos();
|
|
}
|
|
}
|
|
|
|
private void CargaDatos()
|
|
{
|
|
ClsAF ObjAF = new ClsAF();
|
|
if (ObjAF.GetCheckListActividad(-1, -1))
|
|
{
|
|
GvDatos.DataSource = ObjAF.DtResultados;
|
|
GvDatos.DataBind();
|
|
}
|
|
|
|
if (ObjAF.GetCheckListActividadGrupo(-1))
|
|
{
|
|
DdlCheckListActividadGrupo.DataSource = ObjAF.DtResultados;
|
|
DdlCheckListActividadGrupo.DataBind();
|
|
DdlCheckListActividadGrupo.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|
}
|
|
ObjAF.Dispose();
|
|
}
|
|
|
|
protected void BtnAgregarActividadCheckListD_Click(object sender, EventArgs e)
|
|
{
|
|
BtnAgregarActividadCheckList.Text = "Agregar";
|
|
TxtCheckListActividad.Text = "";
|
|
DdlCheckListActividadGrupo.SelectedValueExist(-1);
|
|
UpModalTiposD.Update();
|
|
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposServiciosD"));
|
|
}
|
|
|
|
protected void LnkEditar_Click(object sender, EventArgs e)
|
|
{
|
|
BtnAgregarActividadCheckList.Text = "Actualizar";
|
|
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
|
CveCheckListActividad = GvRow.DataKey("CveCheckListActividad").ToEntero();
|
|
TxtCheckListActividad.Text = GvRow.DataKey("CheckListActividad");
|
|
DdlCheckListActividadGrupo.SelectedValueExist(GvRow.DataKey("CveCheckListActividadGrupo"));
|
|
UpModalTiposD.Update();
|
|
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposServiciosD"));
|
|
}
|
|
|
|
protected void LnkEliminar_Click(object sender, EventArgs e)
|
|
{
|
|
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
|
CveCheckListActividad = GvRow.DataKey("CveCheckListActividad").ToEntero();
|
|
ClsAF ObjAF = new ClsAF();
|
|
if (ObjAF.DeleteCheckListActividad(CveCheckListActividad))
|
|
{
|
|
CargaDatos();
|
|
UpDatos.Update();
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposServiciosD"));
|
|
Alert("Se eliminó la Actividad de CheckList correctamente");
|
|
}
|
|
ObjAF.Dispose();
|
|
}
|
|
|
|
protected void BtnAgregarActividadCheckList_Click(object sender, EventArgs e)
|
|
{
|
|
ClsAF ObjAF = new ClsAF();
|
|
if (BtnAgregarActividadCheckList.Text == "Agregar")
|
|
{
|
|
if (ObjAF.AddCheckListActividad(TxtCheckListActividad.Text, DdlCheckListActividadGrupo.SelectedValue.ToEntero()))
|
|
{
|
|
Alert("Se agregó la Actividad de CheckList correctamente");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (ObjAF.UpdateCheckListActividad(CveCheckListActividad, TxtCheckListActividad.Text, DdlCheckListActividadGrupo.SelectedValue.ToEntero()))
|
|
{
|
|
Alert("Se actualizó la Actividad de CheckList correctamente");
|
|
}
|
|
}
|
|
ObjAF.Dispose();
|
|
CargaDatos();
|
|
UpDatos.Update();
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposServiciosD"));
|
|
}
|
|
} |