199 lines
7.3 KiB
VB.net
199 lines
7.3 KiB
VB.net
Imports System.Data
|
|
Imports Extensiones
|
|
|
|
|
|
Partial Class CatEstatusPedido
|
|
Inherits ClsPaginas
|
|
|
|
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
ViewState("Orden") = ""
|
|
|
|
'Permisos
|
|
If UsuarioActual.TienePermisoProceso(30) Then LbAgregar.Enabled = True Else LbAgregar.Enabled = False
|
|
|
|
'Permiso Modificar
|
|
If UsuarioActual.TienePermisoProceso(31) Then GvDatos.Columns(4).Visible = True Else GvDatos.Columns(4).Visible = False
|
|
|
|
'Permiso Eliminar
|
|
If UsuarioActual.TienePermisoProceso(32) Then GvDatos.Columns(5).Visible = True Else GvDatos.Columns(5).Visible = False
|
|
|
|
CargaDatos()
|
|
End If
|
|
End Sub
|
|
|
|
Public Sub CargaDatos()
|
|
|
|
'Dim EstatusPedido As New ClsEstatusPedido
|
|
'If EstatusPedido.GetEstatusPedido(-1, "-1") Then
|
|
' Cache("DTEstatusPedido" & UsuarioActual.CveUsuario.ToString()) = EstatusPedido.DtResultados
|
|
'Else
|
|
' GvDatos.DataSource = Nothing
|
|
'End If
|
|
|
|
'EstatusPedido.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 EstatusPedido As New ClsEstatusPedido
|
|
'If EstatusPedido.AddEstatusPedido(TxtEstatusPedido.Text.Trim, True, UsuarioActual.CveUsuario) Then
|
|
' TxtEstatusPedido.Text = ""
|
|
|
|
' Alert("El nuevo Estatus de pedido se guardó correctamente.", TipoMensaje.MsgInformacion)
|
|
|
|
' UpTitulos.Update()
|
|
|
|
' Cache("DTEstatusPedido" & UsuarioActual.CveUsuario.ToString()) = EstatusPedido.DtResultados
|
|
' If ViewState("Orden").ToString() <> String.Empty Then
|
|
' CargaGrid(ViewState("Orden").ToString())
|
|
' Else
|
|
' CargaGrid("")
|
|
' End If
|
|
|
|
'End If
|
|
'EstatusPedido.Dispose()
|
|
|
|
End Sub
|
|
|
|
#Region "G V D A T O S"
|
|
Protected Sub GvDatos_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
|
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
If e.Row.RowState = DataControlRowState.Alternate OrElse e.Row.RowState = DataControlRowState.Normal Then
|
|
If e.Row.RowIndex <= 1 Then
|
|
e.Row.Cells(0).Width = Unit.Pixel(206)
|
|
e.Row.Cells(1).Width = Unit.Pixel(75)
|
|
e.Row.Cells(2).Width = Unit.Pixel(75)
|
|
e.Row.Cells(3).Width = Unit.Pixel(200)
|
|
e.Row.Cells(4).Width = Unit.Pixel(100)
|
|
e.Row.Cells(5).Width = Unit.Pixel(65)
|
|
|
|
End If
|
|
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Center
|
|
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Center
|
|
e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Center
|
|
e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Left
|
|
e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Center
|
|
e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Center
|
|
End If
|
|
End If
|
|
|
|
End Sub
|
|
|
|
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 EstatusPedidos As New ClsEstatusPedido
|
|
|
|
'Dim EstatusPedido As String
|
|
'Dim CveEstatusPedido As Integer
|
|
'Dim Estatus As Boolean
|
|
'EstatusPedido = GvDatos.Rows(e.RowIndex).FCTextBox("TxtA").Text.Trim
|
|
'Estatus = GvDatos.Rows(e.RowIndex).FCCheckBox("ChkA").Checked
|
|
'CveEstatusPedido = GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero
|
|
|
|
'If EstatusPedidos.UpdateEstatusPedido(EstatusPedido, Estatus, CveEstatusPedido, UsuarioActual.CveUsuario) Then
|
|
|
|
' GvDatos.EditIndex = -1
|
|
' Cache("DTEstatusPedido" & UsuarioActual.CveUsuario.ToString()) = EstatusPedidos.DtResultados
|
|
'End If
|
|
|
|
'EstatusPedidos.Dispose()
|
|
|
|
'If ViewState("Orden").ToString() <> String.Empty Then
|
|
' CargaGrid(ViewState("Orden").ToString())
|
|
'Else
|
|
' CargaGrid("")
|
|
'End If
|
|
|
|
End Sub
|
|
|
|
Protected Sub GvDatos_RowDeleting(ByVal sender As Object, ByVal e As GridViewDeleteEventArgs) Handles GvDatos.RowDeleting
|
|
|
|
'Dim EstatusPedido As New ClsEstatusPedido
|
|
'If EstatusPedido.RemoveEstatusPedido(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then
|
|
' GvDatos.EditIndex = -1
|
|
' Cache("DTEstatusPedido" & UsuarioActual.CveUsuario.ToString) = EstatusPedido.DtResultados
|
|
'End If
|
|
|
|
'EstatusPedido.Dispose()
|
|
|
|
'If ViewState("Orden").ToString() <> String.Empty Then
|
|
' CargaGrid(ViewState("Orden").ToString())
|
|
'Else
|
|
' CargaGrid("")
|
|
'End If
|
|
|
|
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
|
|
#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(Cache("DTEstatusPedido" & UsuarioActual.CveUsuario.ToString()), DataTable), "", Orden, DataViewRowState.CurrentRows)
|
|
GvDatos.DataSource = DV.ToTable()
|
|
DV.Dispose()
|
|
Else
|
|
GvDatos.DataSource = CType(Cache("DTEstatusPedido" & UsuarioActual.CveUsuario.ToString()), DataTable)
|
|
End If
|
|
|
|
GvDatos.DataBind()
|
|
UpDatos.Update()
|
|
End Sub
|
|
#End Region
|
|
End Class
|