109 lines
3.6 KiB
C#
109 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_CatTiposServiciosActividades : ClsPaginas
|
|
{
|
|
private int CveTipoServicioActividad
|
|
{
|
|
get
|
|
{
|
|
return ViewState["CveTipoServicioActividad"].ToString().ToEntero();
|
|
}
|
|
|
|
set
|
|
{
|
|
ViewState["CveTipoServicioActividad"] = value;
|
|
}
|
|
}
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
CargaDatos();
|
|
}
|
|
}
|
|
|
|
private void CargaDatos()
|
|
{
|
|
ClsAF ObjAF = new ClsAF();
|
|
if (ObjAF.GetTiposServiciosActividades(-1, -1,-1))
|
|
{
|
|
GvDatos.DataSource = ObjAF.DtResultados;
|
|
GvDatos.DataBind();
|
|
}
|
|
|
|
if (ObjAF.GetActividades(-1,-1,-1,UsuarioActual.CveEmpresa))
|
|
{
|
|
DdlActividades.DataSource = ObjAF.DtResultados;
|
|
DdlActividades.DataBind();
|
|
}
|
|
ObjAF.Dispose();
|
|
}
|
|
|
|
protected void BtnAgregarTipoServicioD_Click(object sender, EventArgs e)
|
|
{
|
|
BtnAgregarTipoServicio.Text = "Agregar";
|
|
TxtDuracion.Text = "";
|
|
TxtObservaciones.Text = "";
|
|
DdlActividades.SelectedValueExist(-1);
|
|
UpModalTiposD.Update();
|
|
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposServiciosActividadesD"));
|
|
}
|
|
|
|
protected void LnkEditar_Click(object sender, EventArgs e)
|
|
{
|
|
BtnAgregarTipoServicio.Text = "Actualizar";
|
|
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
|
CveTipoServicioActividad = GvRow.DataKey("CveTipoServicioActividad").ToEntero();
|
|
TxtDuracion.Text = GvRow.DataKey("Duracion");
|
|
TxtObservaciones.Text = GvRow.DataKey("Observaciones");
|
|
DdlActividades.SelectedValueExist(GvRow.DataKey("CveActividad"));
|
|
UpModalTiposD.Update();
|
|
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposServiciosActividadesD"));
|
|
}
|
|
|
|
protected void LnkEliminar_Click(object sender, EventArgs e)
|
|
{
|
|
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
|
CveTipoServicioActividad = GvRow.DataKey("CveTipoServicioActividad").ToEntero();
|
|
ClsAF ObjAF = new ClsAF();
|
|
if (ObjAF.DeleteTiposServiciosActividades(CveTipoServicioActividad, UsuarioActual.CveEmpresa))
|
|
{
|
|
CargaDatos();
|
|
UpDatos.Update();
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposServiciosActividadesD"));
|
|
Alert("Se eliminó la Actividad del Tipo de Servicio correctamente");
|
|
}
|
|
ObjAF.Dispose();
|
|
}
|
|
|
|
protected void BtnAgregarTipoServicio_Click(object sender, EventArgs e)
|
|
{
|
|
ClsAF ObjAF = new ClsAF();
|
|
if (BtnAgregarTipoServicio.Text == "Agregar")
|
|
{
|
|
if (ObjAF.AddTiposServiciosActividades(DdlActividades.SelectedValue.ToEntero(),-1,TxtDuracion.Text.ToDecimal(),TxtObservaciones.Text))
|
|
{
|
|
Alert("Se agregó la Actividad del Tipo de Servicio correctamente");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//if (ObjAF.UpdateActividades(DdlActividades.SelectedValue.ToEntero(),TxtDuracion.Text.ToEntero(),TxtObservaciones.Text,))
|
|
//{
|
|
// Alert("Se actualizó la Actividad del Tipo de Servicio correctamente");
|
|
//}
|
|
}
|
|
ObjAF.Dispose();
|
|
CargaDatos();
|
|
UpDatos.Update();
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposServiciosActividadesD"));
|
|
}
|
|
} |