-
This commit is contained in:
120
AF/CatTiposServiciosMateriales.aspx.cs
Normal file
120
AF/CatTiposServiciosMateriales.aspx.cs
Normal file
@@ -0,0 +1,120 @@
|
||||
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_CatTiposServiciosMateriales : ClsPaginas
|
||||
{
|
||||
private int CveTipoServicioMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
return ViewState["CveTipoServicioMaterial"].ToString().ToEntero();
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
ViewState["CveTipoServicioMaterial"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
CargaDatos();
|
||||
}
|
||||
}
|
||||
|
||||
private void CargaDatos()
|
||||
{
|
||||
ClsAF ObjAF = new ClsAF();
|
||||
if (ObjAF.GetTiposServiciosMaterial(-1, -1))
|
||||
{
|
||||
GvDatos.DataSource = ObjAF.DtResultados;
|
||||
GvDatos.DataBind();
|
||||
}
|
||||
|
||||
if (ObjAF.GetTiposServicios(-1, -1,-1,UsuarioActual.CveEmpresa))
|
||||
{
|
||||
DdlTipoServicio.DataSource = ObjAF.DtResultados;
|
||||
DdlTipoServicio.DataBind();
|
||||
}
|
||||
|
||||
DdlUM.DataSource = get_GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa);
|
||||
DdlUM.DataBind();
|
||||
|
||||
DdlPS.DataSource = get_GlobalDTPS(UsuarioActual.CveEmpresa);
|
||||
DdlPS.DataBind();
|
||||
|
||||
ObjAF.Dispose();
|
||||
}
|
||||
|
||||
protected void BtnAgregarTipoServicioD_Click(object sender, EventArgs e)
|
||||
{
|
||||
BtnAgregarTipoServicio.Text = "Agregar";
|
||||
TxtCantidad.Text = "";
|
||||
TxtTipo.Text = "";
|
||||
DdlTipoServicio.SelectedValueExist(-1);
|
||||
DdlUM.SelectedValueExist(-1);
|
||||
DdlPS.SelectedValueExist(-1);
|
||||
UpModalTiposD.Update();
|
||||
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposServiciosMaterialD"));
|
||||
}
|
||||
|
||||
protected void LnkEditar_Click(object sender, EventArgs e)
|
||||
{
|
||||
BtnAgregarTipoServicio.Text = "Actualizar";
|
||||
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
||||
CveTipoServicioMaterial = GvRow.DataKey("CveTipoServicioMaterial").ToEntero();
|
||||
TxtCantidad.Text = GvRow.DataKey("Cantidad");
|
||||
TxtTipo.Text = GvRow.DataKey("Tipo");
|
||||
DdlTipoServicio.SelectedValueExist(GvRow.DataKey("CveTipoServicio"));
|
||||
DdlPS.SelectedValueExist(GvRow.DataKey("CvePS"));
|
||||
DdlUM.SelectedValueExist(GvRow.DataKey("CveUM"));
|
||||
UpModalTiposD.Update();
|
||||
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposServiciosMaterialD"));
|
||||
}
|
||||
|
||||
protected void LnkEliminar_Click(object sender, EventArgs e)
|
||||
{
|
||||
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
||||
CveTipoServicioMaterial = GvRow.DataKey("CveTipoServicioMaterial").ToEntero();
|
||||
ClsAF ObjAF = new ClsAF();
|
||||
if (ObjAF.DeleteTiposServiciosMaterial(CveTipoServicioMaterial))
|
||||
{
|
||||
CargaDatos();
|
||||
UpDatos.Update();
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposServiciosMaterialD"));
|
||||
Alert("Se eliminó el Material 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.AddTiposServiciosMaterial(DdlTipoServicio.SelectedValue.ToEntero(),TxtCantidad.Text.ToDecimal(),DdlUM.SelectedValue.ToEntero(),DdlPS.SelectedValue.ToEntero(),TxtTipo.Text.ToEntero()))
|
||||
{
|
||||
Alert("Se agregó el Material del Tipo de servicio correctamente");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ObjAF.UpdateTiposServiciosMaterial(CveTipoServicioMaterial, DdlTipoServicio.SelectedValue.ToEntero(), TxtCantidad.Text.ToDecimal(), DdlUM.SelectedValue.ToEntero(), DdlPS.SelectedValue.ToEntero(), TxtTipo.Text.ToEntero()))
|
||||
{
|
||||
Alert("Se actualizó el Material del Tipo de servicio correctamente");
|
||||
}
|
||||
}
|
||||
ObjAF.Dispose();
|
||||
CargaDatos();
|
||||
UpDatos.Update();
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarTiposServiciosMaterialD"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user