Commit inicial Ventas Productivo
This commit is contained in:
185
Flotillas/CatTalleres.aspx.vb
Normal file
185
Flotillas/CatTalleres.aspx.vb
Normal file
@@ -0,0 +1,185 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports System.Data
|
||||
Imports System.Linq
|
||||
Imports Extensiones
|
||||
|
||||
Partial Class Flotillas_CatTalleres
|
||||
Inherits ClsPaginas
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
ViewState("Orden") = ""
|
||||
CargaDatos()
|
||||
|
||||
'Permiso de Agregar Taller
|
||||
If UsuarioActual.TienePermisoProceso(105) Then LbAgregarTaller.Enabled = True Else LbAgregarTaller.Enabled = False
|
||||
|
||||
'Permiso de Editar Taller
|
||||
If UsuarioActual.TienePermisoProceso(106) Then GvDatosTalleres.Columns(4).Visible = True Else GvDatosTalleres.Columns(4).Visible = False
|
||||
|
||||
'Permiso de Eliminar Taller
|
||||
If UsuarioActual.TienePermisoProceso(107) Then GvDatosTalleres.Columns(5).Visible = True Else GvDatosTalleres.Columns(5).Visible = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub CargaDatos()
|
||||
Dim ObjFlotilla As New ClsFlotillas
|
||||
|
||||
If ObjFlotilla.GetTalleres() Then
|
||||
ViewState("DTTaller") = ObjFlotilla.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
||||
GlobalDTTalleres = ObjFlotilla.DtResultados
|
||||
Else
|
||||
Me.GvDatosTalleres.DataSource = Nothing
|
||||
End If
|
||||
|
||||
ObjFlotilla.Dispose()
|
||||
|
||||
|
||||
If ViewState("Orden").ToString() <> String.Empty Then
|
||||
CargaGrid(ViewState("Orden").ToString())
|
||||
Else
|
||||
CargaGrid("")
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub LbAgregarTaller_Click(sender As Object, e As EventArgs) Handles LbAgregarTaller.Click
|
||||
Dim ObjFlotilla As New ClsFlotillas
|
||||
If ObjFlotilla.AddTalleres(TxtTaller.Text.Trim, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
TxtTaller.Text = ""
|
||||
Alert("El nuevo Taller se guardó correctamente.", TipoMensaje.MsgInformacion)
|
||||
UpTitulosTalleres.Update()
|
||||
ViewState("DTTaller") = ObjFlotilla.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
||||
GlobalDTMantenimientos = ObjFlotilla.DtResultados
|
||||
|
||||
If ViewState("Orden").ToString() <> String.Empty Then
|
||||
CargaGrid(ViewState("Orden").ToString())
|
||||
Else
|
||||
CargaGrid("")
|
||||
End If
|
||||
End If
|
||||
ObjFlotilla.Dispose()
|
||||
End Sub
|
||||
|
||||
#Region "G V D A T O S"
|
||||
Protected Sub GvDatosTalleres_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatosTalleres.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.RowIndex = 0 Then
|
||||
e.Row.Cells(0).Width = Unit.Pixel(136) 'TALLER
|
||||
e.Row.Cells(1).Width = Unit.Pixel(95) 'ESTATUS
|
||||
e.Row.Cells(2).Width = Unit.Pixel(95) 'FECHA
|
||||
e.Row.Cells(3).Width = Unit.Pixel(95) 'USUARIO
|
||||
e.Row.Cells(4).Width = Unit.Pixel(100) 'EDITAR
|
||||
e.Row.Cells(5).Width = Unit.Pixel(65) 'ELIMINAR
|
||||
End If
|
||||
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
|
||||
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Center
|
||||
e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Center
|
||||
e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Center
|
||||
e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Center
|
||||
e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Center
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatosTalleres_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatosTalleres.RowDeleting
|
||||
Dim ObjFlotilla As New ClsFlotillas
|
||||
If ObjFlotilla.RemoveTalleres(GvDatosTalleres.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then
|
||||
GvDatosTalleres.EditIndex = -1
|
||||
ViewState("DTTaller") = ObjFlotilla.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
||||
GlobalDTTalleres = ObjFlotilla.DtResultados
|
||||
Alert("El Taller se eliminó correctamente.", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
|
||||
ObjFlotilla.Dispose()
|
||||
|
||||
If ViewState("Orden").ToString() <> String.Empty Then
|
||||
CargaGrid(ViewState("Orden").ToString())
|
||||
Else
|
||||
CargaGrid("")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatosTalleres_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvDatosTalleres.RowCancelingEdit
|
||||
GvDatosTalleres.EditIndex = -1
|
||||
If ViewState("Orden").ToString() <> String.Empty Then
|
||||
CargaGrid(ViewState("Orden").ToString())
|
||||
Else
|
||||
CargaGrid("")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatosTalleres_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvDatosTalleres.RowUpdating
|
||||
|
||||
Dim ObjFlotilla As New ClsFlotillas
|
||||
|
||||
Dim Taller As String = DirectCast(GvDatosTalleres.Rows(e.RowIndex).FindControl("TxtTaller"), TextBox).Text.Trim
|
||||
Dim EstatusTaller As Boolean = GvDatosTalleres.Rows(e.RowIndex).FCCheckBox("ChkEstatus").Checked
|
||||
Dim CveTaller As Integer = GvDatosTalleres.DataKeys(e.RowIndex).Value.ToString.ToEntero
|
||||
|
||||
|
||||
If ObjFlotilla.UpdateTalleres(Taller, EstatusTaller, CveTaller) Then
|
||||
GvDatosTalleres.EditIndex = -1
|
||||
ViewState("DTTaller") = ObjFlotilla.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
||||
GlobalDTTalleres = ObjFlotilla.DtResultados
|
||||
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
|
||||
ObjFlotilla.Dispose()
|
||||
|
||||
If ViewState("Orden").ToString() <> String.Empty Then
|
||||
CargaGrid(ViewState("Orden").ToString())
|
||||
Else
|
||||
CargaGrid("")
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Protected Sub GvDatosTalleres_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvDatosTalleres.RowEditing
|
||||
GvDatosTalleres.EditIndex = e.NewEditIndex
|
||||
|
||||
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(Orden As String)
|
||||
If Orden <> String.Empty Then
|
||||
Dim DV As New DataView(CType(ViewState("DTTaller"), DataTable), "", Orden, DataViewRowState.CurrentRows)
|
||||
GvDatosTalleres.DataSource = DV.ToTable()
|
||||
DV.Dispose()
|
||||
Else
|
||||
GvDatosTalleres.DataSource = CType(ViewState("DTTaller"), DataTable)
|
||||
End If
|
||||
GvDatosTalleres.DataBind()
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
#End Region
|
||||
End Class
|
||||
Reference in New Issue
Block a user