catálogo de checklist listo
This commit is contained in:
@@ -4,11 +4,119 @@ using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Extensiones;
|
||||
using System.Data;
|
||||
|
||||
public partial class AF_CatCheckList : System.Web.UI.Page
|
||||
public partial class AF_CatCheckList : ClsPaginas
|
||||
{
|
||||
private int CveCheckList
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["CveCheckList"].ToString().ToEntero();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
ViewState["CveCheckList"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
CargaDatos();
|
||||
}
|
||||
}
|
||||
|
||||
private void CargaDatos()
|
||||
{
|
||||
ClsAF ObjAF = new ClsAF();
|
||||
if (ObjAF.GetCheckList(-1, -1, -1))
|
||||
{
|
||||
GvDatos.DataSource = ObjAF.DtResultados;
|
||||
GvDatos.DataBind();
|
||||
}
|
||||
|
||||
DdlTipoServicio.Items.Clear();
|
||||
if (ObjAF.GetTiposServicios(-1,-1,-1,UsuarioActual.CveEmpresa))
|
||||
{
|
||||
DdlTipoServicio.DataSource = ObjAF.DtResultados;
|
||||
DdlTipoServicio.DataBind();
|
||||
DdlTipoServicio.Items.Insert(0, new ListItem("Seleccione","-1"));
|
||||
}
|
||||
|
||||
DdlCheckListActividad.Items.Clear();
|
||||
if (ObjAF.GetCheckListActividad(-1, -1))
|
||||
{
|
||||
DdlCheckListActividad.DataSource = ObjAF.DtResultados;
|
||||
DdlCheckListActividad.DataBind();
|
||||
DdlCheckListActividad.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
||||
}
|
||||
|
||||
ObjAF.Dispose();
|
||||
}
|
||||
|
||||
protected void BtnAgregarCheckListD_Click(object sender, EventArgs e)
|
||||
{
|
||||
BtnAgregarCheckList.Text = "Agregar";
|
||||
DdlTipoServicio.SelectedValueExist(-1);
|
||||
DdlCheckListActividad.SelectedValueExist(-1);
|
||||
UpModalTiposD.Update();
|
||||
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposServiciosD"));
|
||||
}
|
||||
|
||||
protected void LnkEditar_Click(object sender, EventArgs e)
|
||||
{
|
||||
BtnAgregarCheckList.Text = "Actualizar";
|
||||
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
||||
CveCheckList = GvRow.DataKey("CveCheckList").ToEntero();
|
||||
DdlTipoServicio.SelectedValueExist(GvRow.DataKey("CveTipoServicio"));
|
||||
DdlCheckListActividad.SelectedValueExist(GvRow.DataKey("CveCheckListActividad"));
|
||||
UpModalTiposD.Update();
|
||||
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposServiciosD"));
|
||||
}
|
||||
|
||||
protected void LnkEliminar_Click(object sender, EventArgs e)
|
||||
{
|
||||
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
||||
CveCheckList = GvRow.DataKey("CveCheckList").ToEntero();
|
||||
ClsAF ObjAF = new ClsAF();
|
||||
if (ObjAF.DeleteCheckList(CveCheckList))
|
||||
{
|
||||
CargaDatos();
|
||||
UpDatos.Update();
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposServiciosD"));
|
||||
Alert("Se eliminó el CheckList correctamente");
|
||||
}
|
||||
ObjAF.Dispose();
|
||||
}
|
||||
|
||||
protected void BtnAgregarCheckList_Click(object sender, EventArgs e)
|
||||
{
|
||||
ClsAF ObjAF = new ClsAF();
|
||||
if (BtnAgregarCheckList.Text == "Agregar")
|
||||
{
|
||||
if (ObjAF.AddCheckList(DdlTipoServicio.SelectedValue.ToEntero(), DdlCheckListActividad.SelectedValue.ToEntero()))
|
||||
{
|
||||
CargaDatos();
|
||||
UpDatos.Update();
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposServiciosD"));
|
||||
Alert("Se agregó el CheckList correctamente");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ObjAF.UpdateCheckList(CveCheckList, DdlTipoServicio.SelectedValue.ToEntero(), DdlCheckListActividad.SelectedValue.ToEntero()))
|
||||
{
|
||||
CargaDatos();
|
||||
UpDatos.Update();
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposServiciosD"));
|
||||
Alert("Se actualizó el CheckList correctamente");
|
||||
}
|
||||
}
|
||||
ObjAF.Dispose();
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposServiciosD"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user