153 lines
5.5 KiB
C#
153 lines
5.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Data;
|
|
using Extensiones;
|
|
|
|
public partial class Inventarios_CatAlmacenClasificacionSecciones : ClsPaginas
|
|
{
|
|
private int CveSeccionClasificacion
|
|
{
|
|
get
|
|
{
|
|
return ViewState["CveSeccionClasificacion"].ToString().ToEntero();
|
|
}
|
|
|
|
set
|
|
{
|
|
ViewState["CveSeccionClasificacion"] = value;
|
|
}
|
|
}
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
CargarDatos();
|
|
CargarDropDowns();
|
|
}
|
|
}
|
|
|
|
private void CargarDatos()
|
|
{
|
|
ClsInventarios Objinv = new ClsInventarios();
|
|
if (Objinv.GetAlmacenClasificacionSecciones(-1,UsuarioActual.CveEmpresa))
|
|
{
|
|
GvDatos.DataSource = Objinv.DtResultados;
|
|
}
|
|
Objinv.Dispose();
|
|
GvDatos.DataBind();
|
|
}
|
|
private void CargarDropDowns()
|
|
{
|
|
DdlAlmacen.DataSource = get_GlobalDTAlmacen(UsuarioActual.CveEmpresa);
|
|
DdlAlmacen.DataBind();
|
|
DdlAlmacen.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|
|
|
DdlClasificacion.DataSource = get_GlobalDTClasificaciones(CveEmpresa:UsuarioActual.CveEmpresa);
|
|
DdlClasificacion.DataBind();
|
|
DdlClasificacion.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|
|
|
DdlTipo.DataSource = get_GlobalDTClasificacionesDetalle(UsuarioActual.CveEmpresa);
|
|
DdlTipo.DataBind();
|
|
DdlTipo.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|
|
|
ClsProductosServicios ObjMarcas = new ClsProductosServicios();
|
|
ObjMarcas.GetMarcas(UsuarioActual.CveEmpresa);
|
|
DdlMarca.DataSource = ObjMarcas.DtResultados;
|
|
ObjMarcas.Dispose();
|
|
DdlMarca.DataBind();
|
|
DdlMarca.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|
|
|
}
|
|
|
|
protected void DdlAlmacen_Change(object sender, EventArgs e)
|
|
{
|
|
|
|
int CveAlmacen = ((DropDownList)sender).SelectedValue.ToEntero();
|
|
CargarSeccionAlmacen(CveAlmacen);
|
|
|
|
}
|
|
private void CargarSeccionAlmacen(int CveAlmacen)
|
|
{
|
|
DdlSeccionAlmacen.DataSource = get_GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, CveAlmacen);
|
|
DdlSeccionAlmacen.DataBind();
|
|
DdlSeccionAlmacen.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|
}
|
|
|
|
protected void BtnAgregarAlmacenClasificacionSeccion_Click(object sender, EventArgs e)
|
|
{
|
|
DdlAlmacen.SelectedValue = "-1";
|
|
DdlClasificacion.SelectedValue = "-1";
|
|
DdlTipo.SelectedValue = "-1";
|
|
DdlMarca.SelectedValue = "-1";
|
|
DdlSeccionAlmacen.Items.Clear();
|
|
UpModalTiposD.Update();
|
|
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposD"));
|
|
}
|
|
|
|
protected void BtnAgregarACS_Click(object sender, EventArgs e)
|
|
{
|
|
ClsInventarios ObjInv = new ClsInventarios();
|
|
|
|
if (BtnAgregarACS.Text == "Agregar")
|
|
{
|
|
if (ObjInv.AddAlmacenClasificacionSecciones(DdlAlmacen.SelectedValue.ToEntero(),DdlClasificacion.SelectedValue.ToEntero(),DdlTipo.SelectedValue.ToEntero(),
|
|
DdlMarca.SelectedValue.ToEntero(),DdlSeccionAlmacen.SelectedValue.ToEntero()))
|
|
{
|
|
Alert("Se agregó correctamente Almacén Clasificación Sección");
|
|
}
|
|
}else
|
|
{
|
|
if (ObjInv.UpdateAlmacenClasificacionSecciones(CveSeccionClasificacion,DdlAlmacen.SelectedValue.ToEntero(), DdlClasificacion.SelectedValue.ToEntero(), DdlTipo.SelectedValue.ToEntero(),
|
|
DdlMarca.SelectedValue.ToEntero(), DdlSeccionAlmacen.SelectedValue.ToEntero()))
|
|
{
|
|
Alert("Se actualizó correctamente Almacén Clasificación Sección");
|
|
}
|
|
}
|
|
|
|
CargarDatos();
|
|
UpDatos.Update();
|
|
|
|
ObjInv.Dispose();
|
|
}
|
|
|
|
protected void LnkEditar_Click(object sender, EventArgs e)
|
|
{
|
|
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
|
string CveAlmacen = GvRow.DataKey("CveAlmacen");
|
|
string CveClasificacion = GvRow.DataKey("CveClasificacion");
|
|
string CveClasificacionDetalle = GvRow.DataKey("CveClasificacionDetalle");
|
|
string CveMarca = GvRow.DataKey("CveMarca");
|
|
string CveSeccionAlmacen = GvRow.DataKey("CveSeccionAlmacen");
|
|
BtnAgregarACS.Text = "Actualizar";
|
|
|
|
CveSeccionClasificacion = GvRow.DataKey("CveSeccionClasificacion").ToEntero();
|
|
|
|
DdlAlmacen.SelectedValueExist(CveAlmacen);
|
|
CargarSeccionAlmacen(CveAlmacen.ToEntero());
|
|
DdlClasificacion.SelectedValueExist(CveClasificacion);
|
|
DdlTipo.SelectedValueExist(CveClasificacionDetalle);
|
|
DdlMarca.SelectedValueExist(CveMarca);
|
|
DdlSeccionAlmacen.SelectedValueExist(CveSeccionAlmacen);
|
|
UpModalTiposD.Update();
|
|
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarTiposD"));
|
|
}
|
|
|
|
protected void LnkEliminar_Click(object sender,EventArgs e)
|
|
{
|
|
GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
|
|
int CveSeccionClasificacion = GvRow.DataKey("CveSeccionClasificacion").ToEntero();
|
|
ClsInventarios ObjInv = new ClsInventarios();
|
|
if (ObjInv.RemoveAlmacenClasificacionSecciones(CveSeccionClasificacion))
|
|
{
|
|
CargarDatos();
|
|
UpDatos.Update();
|
|
Alert("Se eliminó correctamente Almacén Clasificación Sección");
|
|
}
|
|
ObjInv.Dispose();
|
|
}
|
|
} |