Merge branch 'master' of http://jperez@192.168.10.111:8383/SIG.git
This commit is contained in:
@@ -1,306 +1,306 @@
|
|||||||
Option Explicit On
|
Option Explicit On
|
||||||
Option Strict On
|
Option Strict On
|
||||||
|
|
||||||
Imports System.Data
|
Imports System.Data
|
||||||
Imports System.Data.SqlClient
|
Imports System.Data.SqlClient
|
||||||
Imports Extensiones
|
Imports Extensiones
|
||||||
Imports System
|
Imports System
|
||||||
Imports System.Configuration
|
Imports System.Configuration
|
||||||
|
|
||||||
Public Class ClsGralFolios
|
Public Class ClsGralFolios
|
||||||
Implements IDisposable
|
Implements IDisposable
|
||||||
|
|
||||||
#Region "Campos"
|
#Region "Campos"
|
||||||
|
|
||||||
'SQL
|
'SQL
|
||||||
Private SqlConexion As SqlConnection
|
Private SqlConexion As SqlConnection
|
||||||
Private SqlAdapter As SqlDataAdapter
|
Private SqlAdapter As SqlDataAdapter
|
||||||
Private SqlCommand As SqlCommand
|
Private SqlCommand As SqlCommand
|
||||||
Private SqlTransacc As SqlTransaction
|
Private SqlTransacc As SqlTransaction
|
||||||
Private Data As DataTable
|
Private Data As DataTable
|
||||||
|
|
||||||
'Atributos de la clase
|
'Atributos de la clase
|
||||||
|
|
||||||
Private _CveFolio As Integer
|
Private _CveFolio As Integer
|
||||||
Private _CveEmpresa As Integer
|
Private _CveEmpresa As Integer
|
||||||
Private _CveUsuario As Integer
|
Private _CveUsuario As Integer
|
||||||
Private _Aprobacion As String
|
Private _Aprobacion As String
|
||||||
Private _CBB As String
|
Private _CBB As String
|
||||||
Private _FInicial As Integer
|
Private _FInicial As Integer
|
||||||
Private _FFinal As Integer
|
Private _FFinal As Integer
|
||||||
Private _FActual As Integer
|
Private _FActual As Integer
|
||||||
Private _FechaIng As Date
|
Private _FechaIng As Date
|
||||||
|
|
||||||
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
|
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
|
||||||
'REGISTRAR CONEXIONES ABIERTAS
|
'REGISTRAR CONEXIONES ABIERTAS
|
||||||
Private CveConexion As Integer = 0
|
Private CveConexion As Integer = 0
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region "Propiedades"
|
#Region "Propiedades"
|
||||||
|
|
||||||
Public ReadOnly Property DtResultados() As DataTable
|
Public ReadOnly Property DtResultados() As DataTable
|
||||||
Get
|
Get
|
||||||
DtResultados = Data
|
DtResultados = Data
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
Public Function IniciaTransacSQL() As SqlTransaction
|
Public Function IniciaTransacSQL() As SqlTransaction
|
||||||
If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction()
|
If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction()
|
||||||
Return SqlTransacc
|
Return SqlTransacc
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Sub RollBack()
|
Public Sub RollBack()
|
||||||
SqlTransacc.Rollback()
|
SqlTransacc.Rollback()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Sub Commit()
|
Public Sub Commit()
|
||||||
SqlTransacc.Commit()
|
SqlTransacc.Commit()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing)
|
Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing)
|
||||||
|
|
||||||
If TransaccionCompartida Is Nothing Then
|
If TransaccionCompartida Is Nothing Then
|
||||||
SqlConexion = New SqlConnection
|
SqlConexion = New SqlConnection
|
||||||
SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString
|
SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString
|
||||||
Try
|
Try
|
||||||
SqlConexion.Open()
|
SqlConexion.Open()
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex)
|
OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex)
|
||||||
End Try
|
End Try
|
||||||
Else
|
Else
|
||||||
SqlConexion = TransaccionCompartida.Connection
|
SqlConexion = TransaccionCompartida.Connection
|
||||||
SqlTransacc = TransaccionCompartida
|
SqlTransacc = TransaccionCompartida
|
||||||
End If
|
End If
|
||||||
|
|
||||||
SqlAdapter = New SqlDataAdapter("", SqlConexion)
|
SqlAdapter = New SqlDataAdapter("", SqlConexion)
|
||||||
ConexionAdd()
|
ConexionAdd()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub DataAdapter(pStrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure)
|
Private Sub DataAdapter(pStrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure)
|
||||||
With SqlAdapter.SelectCommand
|
With SqlAdapter.SelectCommand
|
||||||
.Parameters.Clear()
|
.Parameters.Clear()
|
||||||
.CommandText = pStrSQL
|
.CommandText = pStrSQL
|
||||||
.CommandType = TipoComando
|
.CommandType = TipoComando
|
||||||
End With
|
End With
|
||||||
Data = New DataTable
|
Data = New DataTable
|
||||||
If SqlTransacc IsNot Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc
|
If SqlTransacc IsNot Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc
|
||||||
End Sub
|
End Sub
|
||||||
#Region "Conexiones"
|
#Region "Conexiones"
|
||||||
|
|
||||||
Private Sub ConexionAdd()
|
Private Sub ConexionAdd()
|
||||||
If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
|
If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
|
||||||
Try
|
Try
|
||||||
DataAdapter("PA_Sis_RegistrarConexion")
|
DataAdapter("PA_Sis_RegistrarConexion")
|
||||||
With SqlAdapter.SelectCommand.Parameters
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
.Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name
|
.Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name
|
||||||
.Add("@Modulo", SqlDbType.VarChar).Value = String.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString, HttpContext.Current.Request.QueryString.ToString)
|
.Add("@Modulo", SqlDbType.VarChar).Value = String.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString, HttpContext.Current.Request.QueryString.ToString)
|
||||||
.Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output
|
.Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output
|
||||||
End With
|
End With
|
||||||
SqlAdapter.Fill(Data)
|
SqlAdapter.Fill(Data)
|
||||||
CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero
|
CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub ConexionClose()
|
Private Sub ConexionClose()
|
||||||
If CveConexion > 0 AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
|
If CveConexion > 0 AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
|
||||||
|
|
||||||
DataAdapter(String.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE() WHERE CveConexion = {0}", CveConexion), CommandType.Text)
|
DataAdapter(String.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE() WHERE CveConexion = {0}", CveConexion), CommandType.Text)
|
||||||
|
|
||||||
Try
|
Try
|
||||||
SqlAdapter.Fill(Data)
|
SqlAdapter.Fill(Data)
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
End Try
|
End Try
|
||||||
CveConexion = 0
|
CveConexion = 0
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
Public Function GetFolios(Optional TipoDocto As String = "-1", Optional CveEmpresa As Integer = -1) As Boolean
|
Public Function GetFolios(Optional TipoDocto As String = "-1", Optional CveEmpresa As Integer = -1) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
DataAdapter("PA_Gral_FoliosGet")
|
DataAdapter("PA_Gral_FoliosGet")
|
||||||
|
|
||||||
With SqlAdapter.SelectCommand.Parameters
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
.Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto
|
.Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto
|
||||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||||
.Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue
|
.Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue
|
||||||
End With
|
End With
|
||||||
|
|
||||||
Try
|
Try
|
||||||
SqlAdapter.Fill(Data)
|
SqlAdapter.Fill(Data)
|
||||||
Retorno = True
|
Retorno = True
|
||||||
Catch ex As SqlException
|
Catch ex As SqlException
|
||||||
OnError("Ocurrió un error al consultar los Folios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
OnError("Ocurrió un error al consultar los Folios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
Public Function AddFolios(CveSubProyecto As Integer, TipoDocto As String, Serie As String, FInicial As Integer, FActual As Integer, FFinal As Integer, CBB As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean
|
Public Function AddFolios(CveSubProyecto As Integer, TipoDocto As String, Serie As String, FInicial As Integer, FActual As Integer, FFinal As Integer, CBB As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
DataAdapter("PA_Gral_FoliosAdd")
|
DataAdapter("PA_Gral_FoliosAdd")
|
||||||
|
|
||||||
With SqlAdapter.SelectCommand.Parameters
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
|
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
|
||||||
.Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto
|
.Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto
|
||||||
.Add("@Serie", SqlDbType.VarChar).Value = Serie
|
.Add("@Serie", SqlDbType.VarChar).Value = Serie
|
||||||
.Add("@FInicial", SqlDbType.Int).Value = FInicial
|
.Add("@FInicial", SqlDbType.Int).Value = FInicial
|
||||||
.Add("@FActual", SqlDbType.Int).Value = FActual
|
.Add("@FActual", SqlDbType.Int).Value = FActual
|
||||||
.Add("@FFinal", SqlDbType.Int).Value = FFinal
|
.Add("@FFinal", SqlDbType.Int).Value = FFinal
|
||||||
.Add("@CBB", SqlDbType.VarChar).Value = CBB
|
.Add("@CBB", SqlDbType.VarChar).Value = CBB
|
||||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||||
.Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue
|
.Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue
|
||||||
End With
|
End With
|
||||||
|
|
||||||
Try
|
Try
|
||||||
SqlAdapter.Fill(Data)
|
SqlAdapter.Fill(Data)
|
||||||
_CveFolio = SqlAdapter.SelectCommand.Parameters("@RETURN_VALUE").Value.ToString.ToEntero
|
_CveFolio = SqlAdapter.SelectCommand.Parameters("@RETURN_VALUE").Value.ToString.ToEntero
|
||||||
Retorno = True
|
Retorno = True
|
||||||
Catch Ex1 As SqlException
|
Catch Ex1 As SqlException
|
||||||
If Ex1.Message.Contains("Número: 2627;") Then
|
If Ex1.Message.Contains("Número: 2627;") Then
|
||||||
Me.OnError("Ocurrió un error al guardar el folio.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
Me.OnError("Ocurrió un error al guardar el folio.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||||
Else
|
Else
|
||||||
Me.OnError("Ocurrió un error al guardar la nueva Aprobación de Folios.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
Me.OnError("Ocurrió un error al guardar la nueva Aprobación de Folios.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
OnError("Ocurrió un error al guardar la nueva Aprobación de Folios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
OnError("Ocurrió un error al guardar la nueva Aprobación de Folios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function UpdateFolios(CveSubProyecto As Integer, TipoDocto As String, Serie As String, FInicial As Integer, FActual As Integer, FFinal As Integer, CBB As String, Estado As Boolean, CveUsuario As Integer, CveFolio As Integer) As Boolean
|
Public Function UpdateFolios(CveSubProyecto As Integer, TipoDocto As String, Serie As String, FInicial As Integer, FActual As Integer, FFinal As Integer, CBB As String, Estado As Boolean, CveUsuario As Integer, CveFolio As Integer) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
DataAdapter("PA_Gral_FoliosUpdate")
|
DataAdapter("PA_Gral_FoliosUpdate")
|
||||||
|
|
||||||
With SqlAdapter.SelectCommand.Parameters
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
|
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
|
||||||
.Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto
|
.Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto
|
||||||
.Add("@Serie", SqlDbType.VarChar).Value = Serie
|
.Add("@Serie", SqlDbType.VarChar).Value = Serie
|
||||||
.Add("@FInicial", SqlDbType.Int).Value = FInicial
|
.Add("@FInicial", SqlDbType.Int).Value = FInicial
|
||||||
.Add("@FActual", SqlDbType.Int).Value = FActual
|
.Add("@FActual", SqlDbType.Int).Value = FActual
|
||||||
.Add("@FFinal", SqlDbType.Int).Value = FFinal
|
.Add("@FFinal", SqlDbType.Int).Value = FFinal
|
||||||
.Add("@CBB", SqlDbType.VarChar).Value = CBB
|
.Add("@CBB", SqlDbType.VarChar).Value = CBB
|
||||||
.Add("@Estado", SqlDbType.Bit).Value = Estado
|
.Add("@Estado", SqlDbType.Bit).Value = Estado
|
||||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||||
.Add("@CveFolio", SqlDbType.Int).Value = CveFolio
|
.Add("@CveFolio", SqlDbType.Int).Value = CveFolio
|
||||||
End With
|
End With
|
||||||
|
|
||||||
Try
|
Try
|
||||||
SqlAdapter.Fill(Data)
|
SqlAdapter.Fill(Data)
|
||||||
Retorno = True
|
Retorno = True
|
||||||
Catch Ex1 As SqlException
|
Catch Ex1 As SqlException
|
||||||
If Ex1.Message.Contains("Número: 2627;") Then
|
If Ex1.Message.Contains("Número: 2627;") Then
|
||||||
Me.OnError("Ocurrió un error al actualizar los folios..", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
Me.OnError("Ocurrió un error al actualizar los folios..", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||||
Else
|
Else
|
||||||
Me.OnError("Ocurrió un error al actualizar los folios.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
Me.OnError("Ocurrió un error al actualizar los folios.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
OnError("Ocurrió un error al guardar los cambios en la Aprobación de Folios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
OnError("Ocurrió un error al guardar los cambios en la Aprobación de Folios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function RemoveFolios(CveFolio As Integer) As Boolean
|
Public Function RemoveFolios(CveFolio As Integer) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
DataAdapter("PA_Gral_FoliosRemove")
|
DataAdapter("PA_Gral_FoliosRemove")
|
||||||
|
|
||||||
With SqlAdapter.SelectCommand.Parameters
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
.Add("@CveFolio", SqlDbType.Int).Value = CveFolio
|
.Add("@CveFolio", SqlDbType.Int).Value = CveFolio
|
||||||
|
|
||||||
End With
|
End With
|
||||||
|
|
||||||
Try
|
Try
|
||||||
SqlAdapter.Fill(Data)
|
SqlAdapter.Fill(Data)
|
||||||
Retorno = True
|
Retorno = True
|
||||||
Catch Ex1 As SqlException
|
Catch Ex1 As SqlException
|
||||||
If Ex1.Message.Contains("Número: 547;") Then
|
If Ex1.Message.Contains("Número: 547;") Then
|
||||||
Alert("La aprobación de Folios no se pudo eliminar porque está siendo utilizado por otro registro.", TipoMensaje.MsgAdvertencia)
|
Alert("La aprobación de Folios no se pudo eliminar porque está siendo utilizado por otro registro.", TipoMensaje.MsgAdvertencia)
|
||||||
Else
|
Else
|
||||||
Me.OnError("Ocurrió un error al eliminar la Aprobación de Folios.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
Me.OnError("Ocurrió un error al eliminar la Aprobación de Folios.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Me.OnError("Ocurrió un error al eliminar la Aprobación de Folios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
Me.OnError("Ocurrió un error al eliminar la Aprobación de Folios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function UpdateFolioActual(CveSubProyecto As Integer, TipoDocto As String, Estatus As Boolean, CveEmpresa As Integer) As Boolean
|
Public Function UpdateFolioActual(CveSubProyecto As Integer, TipoDocto As String, Estatus As Boolean, CveEmpresa As Integer) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
DataAdapter("PA_Gral_FolioActualUpdate")
|
DataAdapter("PA_Gral_FolioActualUpdate")
|
||||||
|
|
||||||
With SqlAdapter.SelectCommand.Parameters
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
|
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
|
||||||
.Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto
|
.Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto
|
||||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||||
.Add("@Estado", SqlDbType.Bit).Value = Estatus
|
.Add("@Estado", SqlDbType.Bit).Value = Estatus
|
||||||
End With
|
End With
|
||||||
|
|
||||||
Try
|
Try
|
||||||
SqlAdapter.Fill(Data)
|
SqlAdapter.Fill(Data)
|
||||||
Retorno = True
|
Retorno = True
|
||||||
Catch Ex1 As SqlException
|
Catch Ex1 As SqlException
|
||||||
If Ex1.Message.Contains("Número: 547;") Then
|
If Ex1.Message.Contains("Número: 547;") Then
|
||||||
Alert("La aprobación de Folios no se pudo eliminar porque está siendo utilizado por otro registro.", TipoMensaje.MsgAdvertencia)
|
Alert("La aprobación de Folios no se pudo eliminar porque está siendo utilizado por otro registro.", TipoMensaje.MsgAdvertencia)
|
||||||
Else
|
Else
|
||||||
Me.OnError("Ocurrió un error al actualizar la Aprobación de Folios.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
Me.OnError("Ocurrió un error al actualizar la Aprobación de Folios.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Me.OnError("Ocurrió un error al actualizar la Aprobación de Folios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
Me.OnError("Ocurrió un error al actualizar la Aprobación de Folios.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
#Region "IDisposable Support"
|
#Region "IDisposable Support"
|
||||||
|
|
||||||
' IDisposable
|
' IDisposable
|
||||||
Protected Overridable Sub Dispose(disposing As Boolean)
|
Protected Overridable Sub Dispose(disposing As Boolean)
|
||||||
If Not Me.disposedValue Then
|
If Not Me.disposedValue Then
|
||||||
If disposing Then
|
If disposing Then
|
||||||
' TODO: dispose managed state (managed objects).
|
' TODO: dispose managed state (managed objects).
|
||||||
If Not Data Is Nothing Then Data.Dispose()
|
If Not Data Is Nothing Then Data.Dispose()
|
||||||
If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose()
|
If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose()
|
||||||
If Not SqlCommand Is Nothing Then SqlCommand.Dispose()
|
If Not SqlCommand Is Nothing Then SqlCommand.Dispose()
|
||||||
If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close()
|
If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close()
|
||||||
If Not SqlConexion Is Nothing Then SqlConexion.Dispose()
|
If Not SqlConexion Is Nothing Then SqlConexion.Dispose()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
|
' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
|
||||||
' TODO: set large fields to null.
|
' TODO: set large fields to null.
|
||||||
End If
|
End If
|
||||||
Me.disposedValue = True
|
Me.disposedValue = True
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
' TODO: override Finalize() only if Dispose(disposing As Boolean) above has code to free unmanaged resources.
|
' TODO: override Finalize() only if Dispose(disposing As Boolean) above has code to free unmanaged resources.
|
||||||
'Protected Overrides Sub Finalize()
|
'Protected Overrides Sub Finalize()
|
||||||
' ' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
|
' ' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
|
||||||
' Dispose(False)
|
' Dispose(False)
|
||||||
' MyBase.Finalize()
|
' MyBase.Finalize()
|
||||||
'End Sub
|
'End Sub
|
||||||
|
|
||||||
' This code added by Visual Basic to correctly implement the disposable pattern.
|
' This code added by Visual Basic to correctly implement the disposable pattern.
|
||||||
Public Sub Dispose() Implements IDisposable.Dispose
|
Public Sub Dispose() Implements IDisposable.Dispose
|
||||||
' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
|
' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
|
||||||
ConexionClose()
|
ConexionClose()
|
||||||
Dispose(True)
|
Dispose(True)
|
||||||
GC.SuppressFinalize(Me)
|
GC.SuppressFinalize(Me)
|
||||||
End Sub
|
End Sub
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,215 +1,215 @@
|
|||||||
Option Explicit On
|
Option Explicit On
|
||||||
Option Strict On
|
Option Strict On
|
||||||
|
|
||||||
Imports System.Data
|
Imports System.Data
|
||||||
Imports Extensiones
|
Imports Extensiones
|
||||||
Imports System.IO
|
Imports System.IO
|
||||||
|
|
||||||
Partial Class CatFolios
|
Partial Class CatFolios
|
||||||
Inherits ClsPaginas
|
Inherits ClsPaginas
|
||||||
|
|
||||||
#Region "P R O P I E D A D E S"
|
#Region "P R O P I E D A D E S"
|
||||||
Private Property CveFolio As Integer
|
Private Property CveFolio As Integer
|
||||||
Get
|
Get
|
||||||
Return ViewState("CveFolio").ToString.ToEntero
|
Return ViewState("CveFolio").ToString.ToEntero
|
||||||
End Get
|
End Get
|
||||||
Set(value As Integer)
|
Set(value As Integer)
|
||||||
ViewState("CveFolio") = value
|
ViewState("CveFolio") = value
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||||
If Not Page.IsPostBack Then
|
If Not Page.IsPostBack Then
|
||||||
ViewState("Orden") = ""
|
ViewState("Orden") = ""
|
||||||
Session("FileUpload") = ""
|
Session("FileUpload") = ""
|
||||||
CargaSubProyectos()
|
CargaSubProyectos()
|
||||||
CargaDdlTipoDocto()
|
CargaDdlTipoDocto()
|
||||||
CargaDatos()
|
CargaDatos()
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
#Region "C A R G A S"
|
#Region "C A R G A S"
|
||||||
|
|
||||||
Private Sub CargaDdlTipoDocto()
|
Private Sub CargaDdlTipoDocto()
|
||||||
DdlTipoDocto.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
DdlTipoDocto.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||||
If UsuarioActual.Empresa.CvePlataforma = 1 Then
|
If UsuarioActual.Empresa.CvePlataforma = 1 Then
|
||||||
DdlTipoDocto.Items.Insert(1, New ListItem("Facturas", "Ing"))
|
DdlTipoDocto.Items.Insert(1, New ListItem("Facturas", "Ing"))
|
||||||
DdlTipoDocto.Items.Insert(2, New ListItem("Remisión", "Rem"))
|
DdlTipoDocto.Items.Insert(2, New ListItem("Remisión", "Rem"))
|
||||||
DdlTipoDocto.Items.Insert(3, New ListItem("Notas de Crédito", "Egs"))
|
DdlTipoDocto.Items.Insert(3, New ListItem("Notas de Crédito", "Egs"))
|
||||||
DdlTipoDocto.Items.Insert(4, New ListItem("Devoluciones", "Dev"))
|
DdlTipoDocto.Items.Insert(4, New ListItem("Devoluciones", "Dev"))
|
||||||
DdlTipoDocto.Items.Insert(5, New ListItem("Cotización", "Cot"))
|
DdlTipoDocto.Items.Insert(5, New ListItem("Cotización", "Cot"))
|
||||||
DdlTipoDocto.Items.Insert(6, New ListItem("Requisiciones", "Req"))
|
DdlTipoDocto.Items.Insert(6, New ListItem("Requisiciones", "Req"))
|
||||||
DdlTipoDocto.Items.Insert(7, New ListItem("Orden de Compra", "OC"))
|
DdlTipoDocto.Items.Insert(7, New ListItem("Orden de Compra", "OC"))
|
||||||
DdlTipoDocto.Items.Insert(8, New ListItem("Orden de Servicio", "OS"))
|
DdlTipoDocto.Items.Insert(8, New ListItem("Orden de Servicio", "OS"))
|
||||||
DdlTipoDocto.Items.Insert(9, New ListItem("Nomina", "Nom"))
|
DdlTipoDocto.Items.Insert(9, New ListItem("Nomina", "Nom"))
|
||||||
DdlTipoDocto.Items.Insert(10, New ListItem("Organización Interna", "OI"))
|
DdlTipoDocto.Items.Insert(10, New ListItem("Organización Interna", "OI"))
|
||||||
DdlTipoDocto.Items.Insert(11, New ListItem("Vale Gasolina", "VaG"))
|
DdlTipoDocto.Items.Insert(11, New ListItem("Vale Gasolina", "VaG"))
|
||||||
DdlTipoDocto.Items.Insert(12, New ListItem("Resguardo AF", "AFR"))
|
DdlTipoDocto.Items.Insert(12, New ListItem("Resguardo AF", "AFR"))
|
||||||
DdlTipoDocto.Items.Insert(13, New ListItem("Traslado AF", "AFT"))
|
DdlTipoDocto.Items.Insert(13, New ListItem("Traslado AF", "AFT"))
|
||||||
DdlTipoDocto.Items.Insert(14, New ListItem("Acarreo", "Aca"))
|
DdlTipoDocto.Items.Insert(14, New ListItem("Acarreo", "Aca"))
|
||||||
DdlTipoDocto.Items.Insert(15, New ListItem("Contratos", "Con"))
|
DdlTipoDocto.Items.Insert(15, New ListItem("Contratos", "Con"))
|
||||||
DdlTipoDocto.Items.Insert(16, New ListItem("Pedido", "Ped"))
|
DdlTipoDocto.Items.Insert(16, New ListItem("Pedido", "Ped"))
|
||||||
DdlTipoDocto.Items.Insert(17, New ListItem("Devolución de Pedido", "DPe"))
|
DdlTipoDocto.Items.Insert(17, New ListItem("Devolución de Pedido", "DPe"))
|
||||||
DdlTipoDocto.Items.Insert(18, New ListItem("Pedido de Consignación", "PeC"))
|
DdlTipoDocto.Items.Insert(18, New ListItem("Pedido de Consignación", "PeC"))
|
||||||
DdlTipoDocto.Items.Insert(19, New ListItem("Órden de Producción", "OP"))
|
DdlTipoDocto.Items.Insert(19, New ListItem("Órden de Producción", "OP"))
|
||||||
DdlTipoDocto.Items.Insert(20, New ListItem("Órden de Corte", "OCO"))
|
DdlTipoDocto.Items.Insert(20, New ListItem("Órden de Corte", "OCO"))
|
||||||
DdlTipoDocto.Items.Insert(21, New ListItem("Entrada de Materia Prima a Empaque", "EME"))
|
DdlTipoDocto.Items.Insert(21, New ListItem("Entrada de Materia Prima a Empaque", "EME"))
|
||||||
DdlTipoDocto.Items.Insert(22, New ListItem("Empaque", "EMP"))
|
DdlTipoDocto.Items.Insert(22, New ListItem("Empaque", "EMP"))
|
||||||
DdlTipoDocto.Items.Insert(23, New ListItem("Solicitud de Traslado", "STr"))
|
DdlTipoDocto.Items.Insert(23, New ListItem("Solicitud de Traslado", "STr"))
|
||||||
DdlTipoDocto.Items.Insert(24, New ListItem("Complemento Pago", "CP"))
|
DdlTipoDocto.Items.Insert(24, New ListItem("Complemento Pago", "CP"))
|
||||||
DdlTipoDocto.Items.Insert(24, New ListItem("Fletes", "FLE"))
|
DdlTipoDocto.Items.Insert(24, New ListItem("Fletes", "FLE"))
|
||||||
DdlTipoDocto.Items.Insert(25, New ListItem("Activos Fijos", "AF"))
|
DdlTipoDocto.Items.Insert(25, New ListItem("Activos Fijos", "AF"))
|
||||||
DdlTipoDocto.Items.Insert(26, New ListItem("Viaticos", "VIA"))
|
DdlTipoDocto.Items.Insert(26, New ListItem("Viaticos", "VIA"))
|
||||||
DdlTipoDocto.Items.Insert(27, New ListItem("Remanufactura", "RMF"))
|
DdlTipoDocto.Items.Insert(27, New ListItem("Remanufactura", "RMF"))
|
||||||
DdlTipoDocto.Items.Insert(28, New ListItem("PedidoA", "PA"))
|
DdlTipoDocto.Items.Insert(28, New ListItem("PedidoA", "PA"))
|
||||||
DdlTipoDocto.Items.Insert(29, New ListItem("Pedido2", "Pd2"))
|
DdlTipoDocto.Items.Insert(29, New ListItem("Pedido2", "Pd2"))
|
||||||
DdlTipoDocto.Items.Insert(30, New ListItem("Proveedor/Acreedor", "Amb"))
|
DdlTipoDocto.Items.Insert(30, New ListItem("Proveedor/Acreedor", "Amb"))
|
||||||
DdlTipoDocto.Items.Insert(31, New ListItem("Proveedor", "Pro"))
|
DdlTipoDocto.Items.Insert(31, New ListItem("Proveedor", "Pro"))
|
||||||
DdlTipoDocto.Items.Insert(32, New ListItem("Acreedor", "Acr"))
|
DdlTipoDocto.Items.Insert(32, New ListItem("Acreedor", "Acr"))
|
||||||
DdlTipoDocto.Items.Insert(33, New ListItem("Productos/Servicios", "PS"))
|
DdlTipoDocto.Items.Insert(33, New ListItem("Productos/Servicios", "PS"))
|
||||||
DdlTipoDocto.Items.Insert(34, New ListItem("NC de Remisión", "RNC"))
|
DdlTipoDocto.Items.Insert(34, New ListItem("NC de Remisión", "RNC"))
|
||||||
ElseIf UsuarioActual.Empresa.CvePlataforma = 2 Then
|
ElseIf UsuarioActual.Empresa.CvePlataforma = 2 Then
|
||||||
DdlTipoDocto.Items.Insert(1, New ListItem("Facturas", "Ing"))
|
DdlTipoDocto.Items.Insert(1, New ListItem("Facturas", "Ing"))
|
||||||
DdlTipoDocto.Items.Insert(2, New ListItem("Notas de Crédito", "Egs"))
|
DdlTipoDocto.Items.Insert(2, New ListItem("Notas de Crédito", "Egs"))
|
||||||
DdlTipoDocto.Items.Insert(3, New ListItem("Cotización", "Cot"))
|
DdlTipoDocto.Items.Insert(3, New ListItem("Cotización", "Cot"))
|
||||||
DdlTipoDocto.Items.Insert(4, New ListItem("Remisión", "Rem"))
|
DdlTipoDocto.Items.Insert(4, New ListItem("Remisión", "Rem"))
|
||||||
DdlTipoDocto.Items.Insert(5, New ListItem("Orden de Compra", "OC"))
|
DdlTipoDocto.Items.Insert(5, New ListItem("Orden de Compra", "OC"))
|
||||||
End If
|
End If
|
||||||
DdlTipoDocto.DataBind()
|
DdlTipoDocto.DataBind()
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub CargaSubProyectos()
|
Private Sub CargaSubProyectos()
|
||||||
DdlSubProyecto.Items.Clear()
|
DdlSubProyecto.Items.Clear()
|
||||||
DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa)
|
DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa)
|
||||||
DdlSubProyecto.DataBind()
|
DdlSubProyecto.DataBind()
|
||||||
|
|
||||||
DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||||
End Sub
|
End Sub
|
||||||
Public Sub CargaDatos()
|
Public Sub CargaDatos()
|
||||||
Dim ObjFolios As New ClsGralFolios
|
Dim ObjFolios As New ClsGralFolios
|
||||||
If ObjFolios.GetFolios() Then
|
If ObjFolios.GetFolios() Then
|
||||||
ViewState("DTFolios") = ObjFolios.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
ViewState("DTFolios") = ObjFolios.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
||||||
GlobalDTFolios = ObjFolios.DtResultados
|
GlobalDTFolios = ObjFolios.DtResultados
|
||||||
GvDatos.DataSource = ObjFolios.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
GvDatos.DataSource = ObjFolios.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
||||||
GvDatos.DataBind()
|
GvDatos.DataBind()
|
||||||
Else
|
Else
|
||||||
Me.GvDatos.DataSource = Nothing
|
Me.GvDatos.DataSource = Nothing
|
||||||
End If
|
End If
|
||||||
|
|
||||||
ObjFolios.Dispose()
|
ObjFolios.Dispose()
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
Public Sub BtnAgregarFolio_Click(sender As Object, e As EventArgs)
|
Public Sub BtnAgregarFolio_Click(sender As Object, e As EventArgs)
|
||||||
CveFolio = -1
|
CveFolio = -1
|
||||||
HdnModalidad.Value = "I"
|
HdnModalidad.Value = "I"
|
||||||
ChkEstatus.Checked = True
|
ChkEstatus.Checked = True
|
||||||
TxtFolioInicial.Text = ""
|
TxtFolioInicial.Text = ""
|
||||||
TxtFolioFinal.Text = ""
|
TxtFolioFinal.Text = ""
|
||||||
TxtFolioActual.Text = ""
|
TxtFolioActual.Text = ""
|
||||||
txtserie.text = ""
|
txtserie.text = ""
|
||||||
DivFactual.Visible = False
|
DivFactual.Visible = False
|
||||||
CargaSubProyectos()
|
CargaSubProyectos()
|
||||||
|
|
||||||
BtnGuardar.Text = "Agregar"
|
BtnGuardar.Text = "Agregar"
|
||||||
UpAddFolio.Update()
|
UpAddFolio.Update()
|
||||||
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarFolio"))
|
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarFolio"))
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Sub Edit_Click(sender As Object, e As EventArgs)
|
Public Sub Edit_Click(sender As Object, e As EventArgs)
|
||||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||||
CveFolio = (GvRow.DataKey("CveFolio")).ToEntero
|
CveFolio = (GvRow.DataKey("CveFolio")).ToEntero
|
||||||
HdnModalidad.Value = "U"
|
HdnModalidad.Value = "U"
|
||||||
DdlSubProyecto.SelectedValueExist(GvRow.DataKey("CveSubProyecto"))
|
DdlSubProyecto.SelectedValueExist(GvRow.DataKey("CveSubProyecto"))
|
||||||
DdlTipoDocto.SelectedValueExist(GvRow.DataKey("TipoDocto"))
|
DdlTipoDocto.SelectedValueExist(GvRow.DataKey("TipoDocto"))
|
||||||
ChkEstatus.Checked = If(GvRow.DataKey("Estado").ToString = "Activo", True, False)
|
ChkEstatus.Checked = If(GvRow.DataKey("Estado").ToString = "Activo", True, False)
|
||||||
TxtFolioInicial.Text = (GvRow.DataKey("FInicial"))
|
TxtFolioInicial.Text = (GvRow.DataKey("FInicial"))
|
||||||
TxtFolioFinal.Text = (GvRow.DataKey("FFinal"))
|
TxtFolioFinal.Text = (GvRow.DataKey("FFinal"))
|
||||||
TxtFolioActual.Text = (GvRow.DataKey("FActual"))
|
TxtFolioActual.Text = (GvRow.DataKey("FActual"))
|
||||||
DivFactual.Visible = True
|
DivFactual.Visible = True
|
||||||
|
|
||||||
|
|
||||||
BtnGuardar.Text = "Actualizar"
|
BtnGuardar.Text = "Actualizar"
|
||||||
UpAddFolio.Update()
|
UpAddFolio.Update()
|
||||||
|
|
||||||
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarFolio"))
|
RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarFolio"))
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
#Region "GV"
|
#Region "GV"
|
||||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||||
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
|
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
|
||||||
e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Right
|
e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Right
|
||||||
e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Right
|
e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Right
|
||||||
e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right
|
e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting
|
Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting
|
||||||
Dim ObjFolios As New ClsGralFolios
|
Dim ObjFolios As New ClsGralFolios
|
||||||
If ObjFolios.RemoveFolios(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then
|
If ObjFolios.RemoveFolios(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then
|
||||||
GvDatos.EditIndex = -1
|
GvDatos.EditIndex = -1
|
||||||
ViewState("DTFolios") = ObjFolios.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
ViewState("DTFolios") = ObjFolios.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
||||||
GlobalDTFolios = ObjFolios.DtResultados
|
GlobalDTFolios = ObjFolios.DtResultados
|
||||||
Alert("La Aprobación de Folios se eliminó correctamente.", TipoMensaje.MsgInformacion)
|
Alert("La Aprobación de Folios se eliminó correctamente.", TipoMensaje.MsgInformacion)
|
||||||
End If
|
End If
|
||||||
ObjFolios.Dispose()
|
ObjFolios.Dispose()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
|
|
||||||
#Region "G U A R D A R "
|
#Region "G U A R D A R "
|
||||||
Private Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click
|
Private Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click
|
||||||
Dim ObjFolios As New ClsGralFolios
|
Dim ObjFolios As New ClsGralFolios
|
||||||
Dim TieneError = False
|
Dim TieneError = False
|
||||||
|
|
||||||
|
|
||||||
If HdnModalidad.Value = "I" Then
|
If HdnModalidad.Value = "I" Then
|
||||||
If Not ObjFolios.AddFolios(DdlSubProyecto.SelectedValue.ToEntero, DdlTipoDocto.SelectedValue, TxtFolioInicial.Text.Trim.ToEntero, TxtFolioInicial.Text.Trim.ToEntero,
|
If Not ObjFolios.AddFolios(DdlSubProyecto.SelectedValue.ToEntero, DdlTipoDocto.SelectedValue, TxtFolioInicial.Text.Trim.ToEntero, TxtFolioInicial.Text.Trim.ToEntero,
|
||||||
TxtFolioFinal.Text.Trim.Trim.ToEntero, Session("FileUpload").ToString, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
TxtFolioFinal.Text.Trim.Trim.ToEntero, Session("FileUpload").ToString, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||||
TieneError = True
|
TieneError = True
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
If Not ObjFolios.UpdateFolios(DdlSubProyecto.SelectedValue.ToEntero, DdlTipoDocto.SelectedValue, TxtFolioInicial.Text.Trim.ToEntero, TxtFolioActual.Text.Trim.ToEntero, TxtFolioFinal.Text.Trim.ToEntero,
|
If Not ObjFolios.UpdateFolios(DdlSubProyecto.SelectedValue.ToEntero, DdlTipoDocto.SelectedValue, TxtFolioInicial.Text.Trim.ToEntero, TxtFolioActual.Text.Trim.ToEntero, TxtFolioFinal.Text.Trim.ToEntero,
|
||||||
"", If(ChkEstatus.Checked, True, False), UsuarioActual.CveUsuario, CveFolio) Then
|
"", If(ChkEstatus.Checked, True, False), UsuarioActual.CveUsuario, CveFolio) Then
|
||||||
TieneError = True
|
TieneError = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
If TieneError Then
|
If TieneError Then
|
||||||
Alert("Ocurrio un error al guardar/editar la nueva aprobación de Folios", TipoMensaje.MsgError)
|
Alert("Ocurrio un error al guardar/editar la nueva aprobación de Folios", TipoMensaje.MsgError)
|
||||||
Else
|
Else
|
||||||
|
|
||||||
DdlTipoDocto.SelectedIndex = 0
|
DdlTipoDocto.SelectedIndex = 0
|
||||||
TxtFolioInicial.Text = ""
|
TxtFolioInicial.Text = ""
|
||||||
TxtFolioActual.Text = ""
|
TxtFolioActual.Text = ""
|
||||||
TxtFolioFinal.Text = ""
|
TxtFolioFinal.Text = ""
|
||||||
|
|
||||||
Session("FileUpload") = ""
|
Session("FileUpload") = ""
|
||||||
|
|
||||||
Alert("El nuevo Folio se guardó/editó correctamente.", TipoMensaje.MsgInformacion)
|
Alert("El nuevo Folio se guardó/editó correctamente.", TipoMensaje.MsgInformacion)
|
||||||
GlobalDTFolios = ObjFolios.DtResultados
|
GlobalDTFolios = ObjFolios.DtResultados
|
||||||
ViewState("DTFolios") = ObjFolios.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
ViewState("DTFolios") = ObjFolios.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
||||||
|
|
||||||
|
|
||||||
CargaDatos()
|
CargaDatos()
|
||||||
UpDatos.Update()
|
UpDatos.Update()
|
||||||
UpAddFolio.Update()
|
UpAddFolio.Update()
|
||||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarFolio"))
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarFolio"))
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
ObjFolios.Dispose()
|
ObjFolios.Dispose()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
Reference in New Issue
Block a user