--Cambios en archivo adjunto
--fix permiso de facturar
This commit is contained in:
@@ -7405,6 +7405,26 @@ Public Class ClsVentas
|
|||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Public Function UpdateVentaAdjunto(CveVenta As Integer, Adjunto As String, CveEmpresa As Integer) As Boolean
|
||||||
|
Dim Retorno As Boolean = False
|
||||||
|
DataAdapter("PA_Vta_VentaAdjuntoUpdate")
|
||||||
|
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
|
||||||
|
.Add("@Adjunto", SqlDbType.VarChar).Value = Adjunto
|
||||||
|
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||||
|
End With
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al actualizar el adjunto de la venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
|
|
||||||
#Region "IDisposable Support"
|
#Region "IDisposable Support"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4299,7 +4299,8 @@
|
|||||||
<br />
|
<br />
|
||||||
<asp:LinkButton ID="BtnArchivoAdjunto" runat="server" Visible="false" Text="" Font-Size="14px" />
|
<asp:LinkButton ID="BtnArchivoAdjunto" runat="server" Visible="false" Text="" Font-Size="14px" />
|
||||||
<asp:LinkButton ID="BtnEliminarAdjunto" runat="server" Visible="false" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Desea eliminar el archivo?" data-btn-ok-label="si" />
|
<asp:LinkButton ID="BtnEliminarAdjunto" runat="server" Visible="false" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Desea eliminar el archivo?" data-btn-ok-label="si" />
|
||||||
<asp:LinkButton ID="BtnReemplazarAdjunto" runat="server" Visible="false" AlternateText="Reemplazar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm blue" Text="<i class='fa-upload fa' style=' color: white;'></i>" data-toggle="modal" data-target="#ModalAdjuntar" />
|
|
||||||
|
<asp:LinkButton ID="BtnReemplazarAdjunto" runat="server" Visible="false" AlternateText="Reemplazar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-sm blue" Text="<i class='fa-upload fa' style=' color: white;'></i>" data-toggle="modal" data-target="#ModalAdjuntar" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -5023,7 +5023,7 @@ Partial Class Ventas
|
|||||||
If Adjunto <> "" Then
|
If Adjunto <> "" Then
|
||||||
BtnArchivoAdjunto.Text = Adjunto
|
BtnArchivoAdjunto.Text = Adjunto
|
||||||
BtnArchivoAdjunto.Visible = True
|
BtnArchivoAdjunto.Visible = True
|
||||||
BtnEliminarAdjunto.Visible = False
|
BtnEliminarAdjunto.Visible = True
|
||||||
BtnAdjuntar.Visible = False
|
BtnAdjuntar.Visible = False
|
||||||
BtnReemplazarAdjunto.Visible = True
|
BtnReemplazarAdjunto.Visible = True
|
||||||
End If
|
End If
|
||||||
@@ -5956,10 +5956,7 @@ Partial Class Ventas
|
|||||||
|
|
||||||
'ACTIVA BOTONERA | DEBE TENER CONCEPTOS PENDIENTES DE FACTURAR
|
'ACTIVA BOTONERA | DEBE TENER CONCEPTOS PENDIENTES DE FACTURAR
|
||||||
If (TmpDT.SUM("CantidadFacturadaRem") < TmpDT.SUM("Cantidad")) AndAlso TieneBloqueoPorCreditoVencimiento = 0 Then
|
If (TmpDT.SUM("CantidadFacturadaRem") < TmpDT.SUM("Cantidad")) AndAlso TieneBloqueoPorCreditoVencimiento = 0 Then
|
||||||
BtnsFacturar.Visible = True
|
BtnsFacturar.Visible = UsuarioActual.TienePermisoProceso(60)
|
||||||
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
|
||||||
BtnsFacturar.Visible = UsuarioActual.TienePermisoProceso(60)
|
|
||||||
End If
|
|
||||||
|
|
||||||
'E119, bloquear la facturación de remisiones que no estén surtidas
|
'E119, bloquear la facturación de remisiones que no estén surtidas
|
||||||
If UsuarioActual.CveEmpresa = 119 Then
|
If UsuarioActual.CveEmpresa = 119 Then
|
||||||
@@ -6010,7 +6007,7 @@ Partial Class Ventas
|
|||||||
|
|
||||||
ObjUsados.Dispose()
|
ObjUsados.Dispose()
|
||||||
|
|
||||||
BtnsFacturar.Visible = True
|
BtnsFacturar.Visible = UsuarioActual.TienePermisoProceso(60)
|
||||||
|
|
||||||
'VERIFICA SI YA SE FACTURO COMPLETAMENTE
|
'VERIFICA SI YA SE FACTURO COMPLETAMENTE
|
||||||
If TmpDT.SUM("CantidadFacturadaRem") = TmpDT.SUM("Cantidad") Then
|
If TmpDT.SUM("CantidadFacturadaRem") = TmpDT.SUM("Cantidad") Then
|
||||||
@@ -6078,7 +6075,7 @@ Partial Class Ventas
|
|||||||
If DbRowVenta("TipoDocto").ToString().Contiene("Ped") Then
|
If DbRowVenta("TipoDocto").ToString().Contiene("Ped") Then
|
||||||
'ACTIVA BOTONERA | DEBE TENER CONCEPTOS PENDIENTES DE FACTURAR
|
'ACTIVA BOTONERA | DEBE TENER CONCEPTOS PENDIENTES DE FACTURAR
|
||||||
If TmpDT.SUM("CantidadFacturadaPed2") < TmpDT.SUM("Cantidad") Then
|
If TmpDT.SUM("CantidadFacturadaPed2") < TmpDT.SUM("Cantidad") Then
|
||||||
BtnsFacturar.Visible = True
|
BtnsFacturar.Visible = UsuarioActual.TienePermisoProceso(60)
|
||||||
|
|
||||||
'bloquear la facturación de remisiones que no estén surtidas
|
'bloquear la facturación de remisiones que no estén surtidas
|
||||||
If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then
|
If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then
|
||||||
@@ -6142,7 +6139,7 @@ Partial Class Ventas
|
|||||||
'Verifico si es su supervisor asignado
|
'Verifico si es su supervisor asignado
|
||||||
If DTVendedores.Rows.Count > 0 Then
|
If DTVendedores.Rows.Count > 0 Then
|
||||||
If GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {Me.CveEstatus}").ToEntero() = 2 Then
|
If GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {Me.CveEstatus}").ToEntero() = 2 Then
|
||||||
BtnsFacturar.Visible = True
|
BtnsFacturar.Visible = UsuarioActual.TienePermisoProceso(60)
|
||||||
BtnGenerarRemision.Visible = True
|
BtnGenerarRemision.Visible = True
|
||||||
Else
|
Else
|
||||||
BtnsFacturar.Visible = False
|
BtnsFacturar.Visible = False
|
||||||
@@ -6263,7 +6260,7 @@ Partial Class Ventas
|
|||||||
'Verifico si es su supervisor asignado
|
'Verifico si es su supervisor asignado
|
||||||
If DTVendedores.Rows.Count > 0 Then
|
If DTVendedores.Rows.Count > 0 Then
|
||||||
If GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {Me.CveEstatus}").ToEntero() = 2 Then
|
If GlobalDTEstatusFactura().FiltroPrimeroValor("TipoEstatus", $"CveEstatusFactura = {Me.CveEstatus}").ToEntero() = 2 Then
|
||||||
BtnsFacturar.Visible = True
|
BtnsFacturar.Visible = UsuarioActual.TienePermisoProceso(60)
|
||||||
|
|
||||||
If UsuarioActual.TienePermisoProceso(199) Then
|
If UsuarioActual.TienePermisoProceso(199) Then
|
||||||
BtnGenerarRemision.Visible = If(CveEstatus = 10, False, True)
|
BtnGenerarRemision.Visible = If(CveEstatus = 10, False, True)
|
||||||
@@ -7785,7 +7782,7 @@ Partial Class Ventas
|
|||||||
|
|
||||||
'SI NO TIENE AUTORIZACION, MANTIENE EL BLOQUEO POR CONDICIONES DE CREDITO
|
'SI NO TIENE AUTORIZACION, MANTIENE EL BLOQUEO POR CONDICIONES DE CREDITO
|
||||||
If Autorizacion > 0 Then
|
If Autorizacion > 0 Then
|
||||||
BtnsFacturar.Visible = True
|
BtnsFacturar.Visible = UsuarioActual.TienePermisoProceso(60)
|
||||||
TieneBloqueoPorCreditoVencimiento = 0
|
TieneBloqueoPorCreditoVencimiento = 0
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -15633,7 +15630,7 @@ Partial Class Ventas
|
|||||||
If DT.Rows.Count > 0 Then
|
If DT.Rows.Count > 0 Then
|
||||||
'Se agrega movimiento separado por la cuenta de ventas (ER)
|
'Se agrega movimiento separado por la cuenta de ventas (ER)
|
||||||
For Each Row2 As DataRow In DT.Rows
|
For Each Row2 As DataRow In DT.Rows
|
||||||
importeMovimiento = (TmpDTDetalle.SUM("Descuento", String.Format("CveClasificacion = {0} And CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString().ToDecimal) * ValorMultiplicador
|
importeMovimiento = (TmpDTDetalle.SUM("Descuento", String.Format("CveClasificacion = {0} And CveSubProyecto = {1} AND PorcentajeIVA = {2}", Row2("CveClasificacion"), Row2("CveSubProyecto"), Row2("PorcentajeIVA"))).ToString().ToDecimal) * ValorMultiplicador
|
||||||
importeMX = importeMovimiento * tipoCambio * Multiplicador
|
importeMX = importeMovimiento * tipoCambio * Multiplicador
|
||||||
FechaMovimiento = ObjFactura.FechaPago
|
FechaMovimiento = ObjFactura.FechaPago
|
||||||
Concepto = $"{ObjFactura.SerieFolio} {If(Row2("CveClasificacion").ToString().ToEntero() > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString()}"), "")} - {If(Row2("CveSubProyecto").ToString().ToEntero() > 0, GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString()}"), "Sin SubProyecto Asignado")}"
|
Concepto = $"{ObjFactura.SerieFolio} {If(Row2("CveClasificacion").ToString().ToEntero() > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString()}"), "")} - {If(Row2("CveSubProyecto").ToString().ToEntero() > 0, GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString()}"), "Sin SubProyecto Asignado")}"
|
||||||
@@ -36309,12 +36306,16 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
My.Computer.FileSystem.MoveFile(fileItem.FileUrl, Path)
|
My.Computer.FileSystem.MoveFile(fileItem.FileUrl, Path)
|
||||||
|
|
||||||
If File.Exists(Path) AndAlso Me.CveVenta > 0 Then
|
If File.Exists(Path) Then
|
||||||
Using ObjVta As New ClsVentasTemp
|
If Me.CveVenta > 0 Then
|
||||||
If ObjVta.UpdateVentaAdjunto(Me.CveVenta, Adjunto, UsuarioActual.CveEmpresa) Then
|
Using ObjVta As New ClsVentas
|
||||||
Alert("Documento cargado", TipoMensaje.MsgInformacion)
|
If ObjVta.UpdateVentaAdjunto(Me.CveVenta, Adjunto, UsuarioActual.CveEmpresa) Then
|
||||||
End If
|
Alert("Documento cargado", TipoMensaje.MsgInformacion)
|
||||||
End Using
|
End If
|
||||||
|
End Using
|
||||||
|
Else
|
||||||
|
Alert("Documento cargado", TipoMensaje.MsgInformacion)
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
BtnAdjuntar.Visible = False
|
BtnAdjuntar.Visible = False
|
||||||
@@ -36363,9 +36364,20 @@ Partial Class Ventas
|
|||||||
Dim objVentas As New ClsVentas
|
Dim objVentas As New ClsVentas
|
||||||
Dim Path As String
|
Dim Path As String
|
||||||
Path = String.Format("{0}Ventas/{1}", UsuarioActual.Empresa.Ruta, Adjunto)
|
Path = String.Format("{0}Ventas/{1}", UsuarioActual.Empresa.Ruta, Adjunto)
|
||||||
|
|
||||||
If File.Exists(Path) Then
|
If File.Exists(Path) Then
|
||||||
File.Delete(Path)
|
File.Delete(Path)
|
||||||
|
|
||||||
|
If Me.CveVenta > 0 Then
|
||||||
|
Using ObjVta As New ClsVentasTemp
|
||||||
|
If ObjVta.UpdateVentaAdjunto(Me.CveVenta, "", UsuarioActual.CveEmpresa) Then
|
||||||
|
Alert("Documento eliminado", TipoMensaje.MsgInformacion)
|
||||||
|
End If
|
||||||
|
End Using
|
||||||
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
BtnAdjuntar.Visible = True
|
BtnAdjuntar.Visible = True
|
||||||
BtnArchivoAdjunto.Text = ""
|
BtnArchivoAdjunto.Text = ""
|
||||||
BtnArchivoAdjunto.Visible = False
|
BtnArchivoAdjunto.Visible = False
|
||||||
@@ -38930,181 +38942,161 @@ Partial Class Ventas
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
Public Class ClsVentasTemp
|
'Public Class ClsVentasTemp
|
||||||
Implements IDisposable
|
' Implements IDisposable
|
||||||
|
|
||||||
#Region "Campos"
|
' 'SQL
|
||||||
|
' Private SqlConexion As SqlClient.SqlConnection
|
||||||
|
' Private SqlAdapter As SqlClient.SqlDataAdapter
|
||||||
|
' Private SqlCommand As SqlClient.SqlCommand
|
||||||
|
' Private SqlTransacc As SqlClient.SqlTransaction
|
||||||
|
' Private Data As DataTable
|
||||||
|
' Private Dataset As DataSet
|
||||||
|
|
||||||
'SQL
|
' 'Atributos de la clase
|
||||||
Private SqlConexion As SqlClient.SqlConnection
|
' Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
|
||||||
Private SqlAdapter As SqlClient.SqlDataAdapter
|
' Private CveConexion As Integer = 0
|
||||||
Private SqlCommand As SqlClient.SqlCommand
|
' Private EsTransaccionCompartida As Boolean = False
|
||||||
Private SqlTransacc As SqlClient.SqlTransaction
|
|
||||||
Private Data As DataTable
|
|
||||||
Private Dataset As DataSet
|
|
||||||
|
|
||||||
'Atributos de la clase
|
' Public ReadOnly Property DtResultados() As DataTable
|
||||||
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
|
' Get
|
||||||
Private CveConexion As Integer = 0
|
' DtResultados = Data
|
||||||
Private EsTransaccionCompartida As Boolean = False
|
' End Get
|
||||||
|
' End Property
|
||||||
#End Region
|
|
||||||
|
|
||||||
#Region "Propiedades"
|
|
||||||
Public ReadOnly Property DtResultados() As DataTable
|
|
||||||
Get
|
|
||||||
DtResultados = Data
|
|
||||||
End Get
|
|
||||||
End Property
|
|
||||||
|
|
||||||
#End Region
|
|
||||||
|
|
||||||
Public Function IniciaTransacSQL() As SqlClient.SqlTransaction
|
|
||||||
If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction()
|
|
||||||
Return SqlTransacc
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Public Sub Commit()
|
|
||||||
SqlTransacc.Commit()
|
|
||||||
End Sub
|
|
||||||
Public Sub RollBack()
|
|
||||||
SqlTransacc.Rollback()
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Sub New(Optional TransaccionCompartida As SqlClient.SqlTransaction = Nothing, Optional UsuarioActual As Usuario = Nothing)
|
|
||||||
|
|
||||||
If TransaccionCompartida Is Nothing Then
|
|
||||||
SqlConexion = New SqlClient.SqlConnection
|
|
||||||
SqlConexion.ConnectionString = If(UsuarioActual IsNot Nothing, UsuarioActual.RutaDB, ClsPaginas.UsuarioActualRutaDB)
|
|
||||||
|
|
||||||
Try
|
|
||||||
SqlConexion.Open()
|
|
||||||
Catch ex As Exception
|
|
||||||
OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex)
|
|
||||||
End Try
|
|
||||||
Else
|
|
||||||
SqlConexion = TransaccionCompartida.Connection
|
|
||||||
SqlTransacc = TransaccionCompartida
|
|
||||||
EsTransaccionCompartida = True
|
|
||||||
End If
|
|
||||||
SqlAdapter = New SqlClient.SqlDataAdapter("", SqlConexion)
|
|
||||||
ConexionAdd()
|
|
||||||
|
|
||||||
End Sub
|
|
||||||
Private Sub DataAdapter(ByVal pStrSQL As String, Optional ByVal TipoComando As CommandType = CommandType.StoredProcedure)
|
|
||||||
With SqlAdapter.SelectCommand
|
|
||||||
.Parameters.Clear()
|
|
||||||
.CommandText = pStrSQL
|
|
||||||
.CommandType = TipoComando
|
|
||||||
End With
|
|
||||||
If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc
|
|
||||||
Data = New DataTable
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
#Region "Conexiones"
|
|
||||||
|
|
||||||
Private Sub ConexionAdd()
|
|
||||||
If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
|
|
||||||
Try
|
|
||||||
DataAdapter("PA_Sis_RegistrarConexion")
|
|
||||||
With SqlAdapter.SelectCommand.Parameters
|
|
||||||
.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("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output
|
|
||||||
End With
|
|
||||||
SqlAdapter.Fill(Data)
|
|
||||||
CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero
|
|
||||||
Catch ex As Exception
|
|
||||||
OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
|
||||||
End Try
|
|
||||||
|
|
||||||
End If
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Private Sub ConexionClose()
|
|
||||||
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)
|
|
||||||
|
|
||||||
Try
|
|
||||||
SqlAdapter.Fill(Data)
|
|
||||||
|
|
||||||
Catch ex As Exception
|
|
||||||
OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
|
||||||
End Try
|
|
||||||
CveConexion = 0
|
|
||||||
End If
|
|
||||||
|
|
||||||
End Sub
|
|
||||||
#End Region
|
|
||||||
|
|
||||||
|
|
||||||
Public Function UpdateVentaAdjunto(CveVenta As Integer, Adjunto As String, CveEmpresa As Integer) As Boolean
|
' Public Function IniciaTransacSQL() As SqlClient.SqlTransaction
|
||||||
Dim Retorno As Boolean = False
|
' If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction()
|
||||||
DataAdapter("PA_Vta_VentaAdjuntoUpdate")
|
' Return SqlTransacc
|
||||||
|
' End Function
|
||||||
|
|
||||||
With SqlAdapter.SelectCommand.Parameters
|
' Public Sub Commit()
|
||||||
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
|
' SqlTransacc.Commit()
|
||||||
.Add("@Adjunto", SqlDbType.VarChar).Value = Adjunto
|
' End Sub
|
||||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
' Public Sub RollBack()
|
||||||
End With
|
' SqlTransacc.Rollback()
|
||||||
|
' End Sub
|
||||||
|
|
||||||
Try
|
' Sub New(Optional TransaccionCompartida As SqlClient.SqlTransaction = Nothing, Optional UsuarioActual As Usuario = Nothing)
|
||||||
SqlAdapter.Fill(Data)
|
|
||||||
Retorno = True
|
|
||||||
Catch ex As Exception
|
|
||||||
OnError("Ocurrió un error al actualizar el adjunto de la venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
|
||||||
End Try
|
|
||||||
|
|
||||||
Return Retorno
|
' If TransaccionCompartida Is Nothing Then
|
||||||
End Function
|
' SqlConexion = New SqlClient.SqlConnection
|
||||||
|
' SqlConexion.ConnectionString = If(UsuarioActual IsNot Nothing, UsuarioActual.RutaDB, ClsPaginas.UsuarioActualRutaDB)
|
||||||
|
|
||||||
|
' Try
|
||||||
|
' SqlConexion.Open()
|
||||||
|
' Catch ex As Exception
|
||||||
|
' OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex)
|
||||||
|
' End Try
|
||||||
|
' Else
|
||||||
|
' SqlConexion = TransaccionCompartida.Connection
|
||||||
|
' SqlTransacc = TransaccionCompartida
|
||||||
|
' EsTransaccionCompartida = True
|
||||||
|
' End If
|
||||||
|
' SqlAdapter = New SqlClient.SqlDataAdapter("", SqlConexion)
|
||||||
|
' ConexionAdd()
|
||||||
|
|
||||||
|
' End Sub
|
||||||
|
' Private Sub DataAdapter(ByVal pStrSQL As String, Optional ByVal TipoComando As CommandType = CommandType.StoredProcedure)
|
||||||
|
' With SqlAdapter.SelectCommand
|
||||||
|
' .Parameters.Clear()
|
||||||
|
' .CommandText = pStrSQL
|
||||||
|
' .CommandType = TipoComando
|
||||||
|
' End With
|
||||||
|
' If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc
|
||||||
|
' Data = New DataTable
|
||||||
|
' End Sub
|
||||||
|
|
||||||
|
' Private Sub ConexionAdd()
|
||||||
|
' If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
|
||||||
|
' Try
|
||||||
|
' DataAdapter("PA_Sis_RegistrarConexion")
|
||||||
|
' With SqlAdapter.SelectCommand.Parameters
|
||||||
|
' .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("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output
|
||||||
|
' End With
|
||||||
|
' SqlAdapter.Fill(Data)
|
||||||
|
' CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero
|
||||||
|
' Catch ex As Exception
|
||||||
|
' OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
' End Try
|
||||||
|
|
||||||
|
' End If
|
||||||
|
' End Sub
|
||||||
|
|
||||||
|
' Private Sub ConexionClose()
|
||||||
|
' 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)
|
||||||
|
|
||||||
|
' Try
|
||||||
|
' SqlAdapter.Fill(Data)
|
||||||
|
|
||||||
|
' Catch ex As Exception
|
||||||
|
' OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
' End Try
|
||||||
|
' CveConexion = 0
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' End Sub
|
||||||
|
|
||||||
|
|
||||||
#Region "IDisposable Support"
|
' Public Function UpdateVentaAdjunto(CveVenta As Integer, Adjunto As String, CveEmpresa As Integer) As Boolean
|
||||||
|
' Dim Retorno As Boolean = False
|
||||||
|
' DataAdapter("PA_Vta_VentaAdjuntoUpdate")
|
||||||
|
|
||||||
|
' With SqlAdapter.SelectCommand.Parameters
|
||||||
|
' .Add("@CveVenta", SqlDbType.Int).Value = CveVenta
|
||||||
|
' .Add("@Adjunto", SqlDbType.VarChar).Value = Adjunto
|
||||||
|
' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||||
|
' End With
|
||||||
|
|
||||||
|
' Try
|
||||||
|
' SqlAdapter.Fill(Data)
|
||||||
|
' Retorno = True
|
||||||
|
' Catch ex As Exception
|
||||||
|
' OnError("Ocurrió un error al actualizar el adjunto de la venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
' End Try
|
||||||
|
|
||||||
|
' Return Retorno
|
||||||
|
' End Function
|
||||||
|
|
||||||
|
|
||||||
' 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() : Data = Nothing
|
' If Not Data Is Nothing Then Data.Dispose() : Data = Nothing
|
||||||
If Not Dataset Is Nothing Then Dataset.Dispose() : Dataset = Nothing
|
' If Not Dataset Is Nothing Then Dataset.Dispose() : Dataset = Nothing
|
||||||
If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing
|
' If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing
|
||||||
If Not SqlCommand Is Nothing Then SqlCommand.Dispose() : SqlCommand = Nothing
|
' If Not SqlCommand Is Nothing Then SqlCommand.Dispose() : SqlCommand = Nothing
|
||||||
If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing
|
' If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing
|
||||||
If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close()
|
' If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close()
|
||||||
If Not SqlConexion Is Nothing Then SqlConexion.Dispose() : SqlConexion = Nothing
|
' If Not SqlConexion Is Nothing Then SqlConexion.Dispose() : SqlConexion = Nothing
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
' ' This code added by Visual Basic to correctly implement the disposable pattern.
|
||||||
'Protected Overrides Sub Finalize()
|
' 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.
|
||||||
' Dispose(False)
|
' ConexionClose()
|
||||||
' MyBase.Finalize()
|
' Dispose(True)
|
||||||
'End Sub
|
' GC.SuppressFinalize(Me)
|
||||||
|
' End Sub
|
||||||
' This code added by Visual Basic to correctly implement the disposable pattern.
|
'End Class
|
||||||
Public Sub Dispose() Implements IDisposable.Dispose
|
|
||||||
' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
|
|
||||||
ConexionClose()
|
|
||||||
Dispose(True)
|
|
||||||
GC.SuppressFinalize(Me)
|
|
||||||
End Sub
|
|
||||||
#End Region
|
|
||||||
End Class
|
|
||||||
|
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
Reference in New Issue
Block a user