96 lines
2.9 KiB
C#
96 lines
2.9 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 General_CatMotivoRechazoGuias : ClsPaginas
|
|
{
|
|
private int CveMotivoRechazoPaqueteria
|
|
{
|
|
get
|
|
{
|
|
return ViewState["CveMotivoRechazoPaqueteria"].ToString().ToEntero();
|
|
}
|
|
|
|
set
|
|
{
|
|
ViewState["CveMotivoRechazoPaqueteria"] = value;
|
|
}
|
|
}
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
CargaDatos();
|
|
UpDatos.Update();
|
|
}
|
|
}
|
|
|
|
private void CargaDatos()
|
|
{
|
|
ClsGenerales ObjGeneral = new ClsGenerales();
|
|
if (ObjGeneral.GetMotivoRechazoPaqueteria(-1,UsuarioActual.CveEmpresa))
|
|
{
|
|
GvDatos.DataSource = ObjGeneral.DtResultados;
|
|
GvDatos.DataBind();
|
|
}
|
|
ObjGeneral.Dispose();
|
|
}
|
|
|
|
protected void BtnAgregarMotivoD_Click(object sender, EventArgs e)
|
|
{
|
|
BtnAgregarTiposDModal.Text = "Agregar";
|
|
UpModalTiposD.Update();
|
|
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposD"));
|
|
}
|
|
|
|
protected void LnkEditar_Click(object sender, EventArgs e)
|
|
{
|
|
BtnAgregarTiposDModal.Text = "Actualizar";
|
|
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
|
CveMotivoRechazoPaqueteria = GvRow.DataKey("CveMotivoRechazoPaqueteria").ToEntero();
|
|
DescripcionTxt.Text = GvRow.DataKey("Descripcion");
|
|
UpModalTiposD.Update();
|
|
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposD"));
|
|
}
|
|
|
|
protected void BtnAgregarTiposDModal_Click(object sender, EventArgs e)
|
|
{
|
|
ClsGenerales ObjGeneral = new ClsGenerales();
|
|
if (BtnAgregarTiposDModal.Text == "Agregar")
|
|
{
|
|
if (ObjGeneral.AddMotivoRechazoPaqueteria(DescripcionTxt.Text,UsuarioActual.CveEmpresa))
|
|
{
|
|
Alert("Motivo Agregado Correctamente");
|
|
}
|
|
}else
|
|
{
|
|
if (ObjGeneral.UpdateMotivoRechazoPaqueteria(CveMotivoRechazoPaqueteria, DescripcionTxt.Text))
|
|
{
|
|
Alert("Motivo Actualizado Correctamente");
|
|
}
|
|
}
|
|
ObjGeneral.Dispose();
|
|
CargaDatos();
|
|
UpDatos.Update();
|
|
}
|
|
|
|
protected void LnkEliminar_Click(object sender, EventArgs e)
|
|
{
|
|
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
|
int CveMotivoRechazoPaqueteriaAux = GvRow.DataKey("CveMotivoRechazoPaqueteria").ToEntero();
|
|
ClsGenerales ObjGeneral = new ClsGenerales();
|
|
if (ObjGeneral.RemoveMotivoRechazoPaqueteria(CveMotivoRechazoPaqueteriaAux))
|
|
{
|
|
Alert("Motivo Eliminado con Correctamente");
|
|
}
|
|
ObjGeneral.Dispose();
|
|
CargaDatos();
|
|
UpDatos.Update();
|
|
}
|
|
} |