Commit inicial Ventas Productivo
This commit is contained in:
159
Inventarios/CatTiposAlmacenes.aspx.vb
Normal file
159
Inventarios/CatTiposAlmacenes.aspx.vb
Normal file
@@ -0,0 +1,159 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
|
||||
|
||||
Partial Class Inventarios_CatTiposAlmacenes
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region "INICIALIZA VALORES"
|
||||
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
ViewState("Orden") = ""
|
||||
CargaDatos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub CargaDatos()
|
||||
Dim ObjTipoAlmacen As New ClsInventarios
|
||||
If ObjTipoAlmacen.GetTiposAlmacenes
|
||||
ViewState("DTTiposAlmacenes") = ObjTipoAlmacen.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
||||
GlobalDTTipoAlmacen(-1) = ObjTipoAlmacen.DtResultados
|
||||
Else
|
||||
GvDatos.DataSource = Nothing
|
||||
End If
|
||||
ObjTipoAlmacen.Dispose()
|
||||
If ViewState("Orden").ToString() <> String.Empty Then
|
||||
CargaGrid(ViewState("Orden").ToString())
|
||||
Else
|
||||
CargaGrid("")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub LbAgregar_Click(ByVal sender As Object, ByVal e As EventArgs) Handles LbAgregar.Click
|
||||
Dim ObjTipoAlmacen As New ClsInventarios
|
||||
If ObjTipoAlmacen.AddTipoAlmacen(TxtTipoAlmacen.Text.Trim, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
TxtTipoAlmacen.Text = ""
|
||||
Alert("El nuevo Tipo Almacén se guardó correctamente.", TipoMensaje.MsgInformacion)
|
||||
UpTitulos.Update()
|
||||
|
||||
CargaDatos()
|
||||
End If
|
||||
ObjTipoAlmacen.Dispose()
|
||||
CargaGlobal()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region "G V D A T O S"
|
||||
|
||||
Protected Sub GvDatos_RowEditing(ByVal sender As Object, ByVal e As GridViewEditEventArgs) Handles GvDatos.RowEditing
|
||||
GvDatos.EditIndex = e.NewEditIndex
|
||||
If ViewState("Orden").ToString() <> String.Empty Then
|
||||
CargaGrid(ViewState("Orden").ToString())
|
||||
Else
|
||||
CargaGrid("")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatos_RowUpdating(ByVal sender As Object, ByVal e As GridViewUpdateEventArgs) Handles GvDatos.RowUpdating
|
||||
Dim ObjTipoAlmacen As New ClsInventarios
|
||||
Dim TipoAlmacen As String
|
||||
Dim CveTipoAlmacen As Integer
|
||||
Dim Estatus As Boolean
|
||||
TipoAlmacen = GvDatos.Rows(e.RowIndex).FCTextBox("TxtTipoAlmacen").Text.Trim
|
||||
Estatus = GvDatos.Rows(e.RowIndex).FCCheckBox("ChkEstatus").Checked
|
||||
CveTipoAlmacen = GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero
|
||||
|
||||
If ObjTipoAlmacen.UpdateTipoAlmacen(TipoAlmacen, Estatus, CveTipoAlmacen) Then
|
||||
GvDatos.EditIndex = -1
|
||||
ViewState("DTTiposAlmacenes") = ObjTipoAlmacen.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
||||
GlobalDTTipoAlmacen(-1) = ObjTipoAlmacen.DtResultados
|
||||
End If
|
||||
|
||||
ObjTipoAlmacen.Dispose()
|
||||
|
||||
If ViewState("Orden").ToString() <> String.Empty Then
|
||||
CargaGrid(ViewState("Orden").ToString())
|
||||
Else
|
||||
CargaGrid("")
|
||||
End If
|
||||
|
||||
Cargaglobal()
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatos_RowDeleting(ByVal sender As Object, ByVal e As GridViewDeleteEventArgs) Handles GvDatos.RowDeleting
|
||||
Dim ObjTipoAlmacen As New ClsInventarios
|
||||
If ObjTipoAlmacen.RemoveTipoAlmacen(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then
|
||||
GvDatos.EditIndex = -1
|
||||
ViewState("DTTiposAlmacenes") = ObjTipoAlmacen.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
||||
GlobalDTTipoAlmacen(-1) = ObjTipoAlmacen.DtResultados
|
||||
End If
|
||||
ObjTipoAlmacen.Dispose()
|
||||
If ViewState("Orden").ToString() <> String.Empty Then
|
||||
CargaGrid(ViewState("Orden").ToString())
|
||||
Else
|
||||
CargaGrid("")
|
||||
End If
|
||||
CargaGlobal()
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatos_RowCancelingEdit(ByVal sender As Object, ByVal e As GridViewCancelEditEventArgs) Handles GvDatos.RowCancelingEdit
|
||||
GvDatos.EditIndex = -1
|
||||
If ViewState("Orden").ToString() <> String.Empty Then
|
||||
CargaGrid(ViewState("Orden").ToString())
|
||||
Else
|
||||
CargaGrid("")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaGlobal()
|
||||
Dim ObjTipoAlmacen As New ClsInventarios
|
||||
If ObjTipoAlmacen.GetTiposAlmacenes() Then
|
||||
GlobalDTTipoAlmacen(-1) = ObjTipoAlmacen.DtResultados
|
||||
End If
|
||||
ObjTipoAlmacen.Dispose()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region "O R D E N A M I E N T O"
|
||||
Protected Sub LbOrden_Click(ByVal sender As Object, ByVal e As EventArgs)
|
||||
Dim Orden As String = ""
|
||||
Dim Campo As String = ""
|
||||
Dim Literal As Literal = Nothing
|
||||
Const OrdenInicial As String = ""
|
||||
Dim Arg(2) As String
|
||||
|
||||
Arg = CType(sender, LinkButton).CommandArgument().ToString.Split(";"c)
|
||||
Campo = Arg(0)
|
||||
Literal = CType(CType(sender, LinkButton).NamingContainer.FindControl("Img" & Campo.Replace(",", "_")), Literal)
|
||||
|
||||
If ViewState(String.Format("O{0}", Campo)) IsNot Nothing AndAlso ViewState(String.Format("O{0}", Campo)).ToString = String.Format("{0} DESC", Campo) Then
|
||||
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} ASC", Campo)
|
||||
Literal.Text = String.Format("<i class='fa fa-sort-asc' style='color:#999' ></i>")
|
||||
Else
|
||||
ViewState(String.Format("O{0}", Campo)) = String.Format("{0} DESC", Campo)
|
||||
Literal.Text = String.Format("<i class='fa fa-sort-desc' style='color:#999' ></i>")
|
||||
End If
|
||||
Orden = OrdenInicial & ViewState(String.Format("O{0}", Campo)).ToString
|
||||
ViewState("Orden") = Orden
|
||||
CargaGrid(Orden)
|
||||
End Sub
|
||||
|
||||
Private Sub CargaGrid(ByVal Orden As String)
|
||||
If Orden <> String.Empty Then
|
||||
Dim DV As New DataView(CType(ViewState("DTTiposAlmacenes"), DataTable), "", Orden, DataViewRowState.CurrentRows)
|
||||
GvDatos.DataSource = DV.ToTable()
|
||||
DV.Dispose()
|
||||
Else
|
||||
GvDatos.DataSource = CType(ViewState("DTTiposAlmacenes"), DataTable)
|
||||
End If
|
||||
|
||||
GvDatos.DataBind()
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user