136 lines
3.8 KiB
VB.net
136 lines
3.8 KiB
VB.net
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports System.Linq
|
|
Imports Extensiones
|
|
|
|
Partial Class AF_CatEstatusOT
|
|
Inherits ClsPaginas
|
|
|
|
Protected Property CveEstatusOT As Integer
|
|
Get
|
|
If ViewState("CveEstatusOT") Is Nothing Then
|
|
Return -1
|
|
Else
|
|
Return ViewState("CveEstatusOT").ToString.ToEntero
|
|
End If
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveEstatusOT") = value
|
|
End Set
|
|
End Property
|
|
|
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
|
|
If Not Page.IsPostBack Then
|
|
CargaDatos()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub CargaDatos()
|
|
|
|
Dim ObjAF As New ClsAF
|
|
|
|
If ObjAF.GetEstatusOT(-1, UsuarioActual.CveEmpresa, -1) Then
|
|
GvDatos.DataSource = ObjAF.DtResultados
|
|
Else
|
|
GvDatos.DataSource = Nothing
|
|
End If
|
|
|
|
ObjAF.Dispose()
|
|
|
|
GvDatos.DataBind()
|
|
UpDatos.Update()
|
|
|
|
End Sub
|
|
|
|
|
|
Protected Sub BtnAgregarOperador_Click(sender As Object, e As EventArgs) Handles LnkAgregarEstatusOT.Click
|
|
ResetModalEstatusOT()
|
|
RegistraScript(String.Format("$('#{0}').modal();", "DVModalEstatusOT"))
|
|
End Sub
|
|
|
|
Private Sub ResetModalEstatusOT()
|
|
CveEstatusOT = -1
|
|
TxtEstatusOT.Text = ""
|
|
ChkEstatus.Checked = True
|
|
LtlTituloModalOperdaor.Text = "Agregar Etapa"
|
|
CheckActiveSection.Visible = False
|
|
|
|
UpModalEstatusOT.Update()
|
|
End Sub
|
|
|
|
Protected Sub LnkGvActualizar_Click(sender As Object, e As EventArgs)
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
|
|
CveEstatusOT = GvRow.DataKey("CveEstatusOT").ToEntero
|
|
TxtEstatusOT.Text = GvRow.DataKey("EstatusOT")
|
|
'TxtFecha.Text = GvRow.DataKey("Fecha").ToDate.ToString("dd/MM/yyyy")
|
|
|
|
ChkEstatus.Checked = If(GvRow.DataKey("Estatus").ToString.ToEntero = 1, True, False)
|
|
LtlTituloModalOperdaor.Text = "Actualizar Etapa"
|
|
CheckActiveSection.Visible = True
|
|
|
|
UpModalEstatusOT.Update()
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal();", "DVModalEstatusOT"))
|
|
|
|
End Sub
|
|
|
|
Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles BtnModalAgregarEstatusOT.Click
|
|
|
|
Dim ObjAF As New ClsAF
|
|
Dim ErrorProceso As Boolean = False
|
|
|
|
If CveEstatusOT = -1 Then
|
|
If Not ObjAF.AddEstatusOT(TxtEstatusOT.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, If(ChkEstatus.Checked, 1, 0)) Then
|
|
ErrorProceso = True
|
|
End If
|
|
Else
|
|
|
|
If Not ObjAF.UpdateEstatusOT(CveEstatusOT, TxtEstatusOT.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, If(ChkEstatus.Checked, 1, 0)) Then
|
|
ErrorProceso = True
|
|
End If
|
|
|
|
End If
|
|
|
|
ObjAF.Dispose()
|
|
|
|
|
|
If Not ErrorProceso Then
|
|
Alert($"Etapa { If(CveEstatusOT > 0, "Actualizada", "Agregada") } correctamente.")
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "DVModalEstatusOT"))
|
|
CargaDatos()
|
|
End If
|
|
|
|
|
|
End Sub
|
|
|
|
Protected Sub LnkGvEliminar_Click(sender As Object, e As EventArgs)
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
Dim ErrorProceso As Boolean = False
|
|
Dim CveEstatusOTEliminar As Integer = GvRow.DataKey("CveEstatusOT").ToEntero
|
|
|
|
Dim ObjAF As New ClsAF
|
|
|
|
If ObjAF.DeletEstatusOT(CveEstatusOTEliminar, UsuarioActual.CveEmpresa) Then
|
|
Alert("Etapa eliminado correctamente")
|
|
Else
|
|
ErrorProceso = True
|
|
End If
|
|
|
|
ObjAF.Dispose()
|
|
|
|
|
|
If Not ErrorProceso Then
|
|
CargaDatos()
|
|
End If
|
|
|
|
|
|
End Sub
|
|
End Class
|