Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -7405,6 +7405,26 @@ Public Class ClsVentas
|
||||
|
||||
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"
|
||||
|
||||
|
||||
|
||||
@@ -77,18 +77,22 @@
|
||||
<asp:UpdatePanel ID="UPPMov" runat="server" RenderMode="Inline" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
|
||||
<asp:GridView ID="GvT" Width="1000px" runat="server" GridLines="None" BorderWidth="0" data-heighterror="330" data-freezecols="0" CssClass="table table-striped table-advance table-hover mysmallbtn ScrollAD Widthall"
|
||||
<asp:GridView ID="GvT" Width="1000px" runat="server" GridLines="None" BorderWidth="0" data-heighterror="330" data-freezecols="0" CssClass="table table-advance table-hover mysmallbtn ScrollAD Widthall"
|
||||
ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true" AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False" OnRowDataBound="GvT_RowDataBound"
|
||||
DataKeyNames="CveTraspasoSolicitud,Folio,Fecha,CveUsuario,CveAlmacenOrigen,CveAlmacenDestino,CveTrasladoEstatus,PermisoOrigen,TraspasoEstatus,AlmacenOrigen,AlmacenDestino,Nombre" >
|
||||
<Columns>
|
||||
|
||||
|
||||
<Columns>
|
||||
<asp:BoundField DataField="Folio" HeaderText="Folio" ItemStyle-Width="10%" />
|
||||
<asp:BoundField DataField="AlmacenOrigen" HeaderText="Origen" />
|
||||
<asp:BoundField DataField="AlmacenDestino" HeaderText="Destino" />
|
||||
<asp:BoundField DataField="Fecha" HeaderText="Fecha" ItemStyle-Width="10%" DataFormatString="{0:d}" />
|
||||
<asp:BoundField DataField="Nombre" HeaderText="Solicitante" ItemStyle-Width="200px" />
|
||||
<asp:BoundField DataField="TraspasoEstatus" HeaderText="Estatus" ItemStyle-Width="10%" />
|
||||
<%--<asp:BoundField DataField="TraspasoEstatus" HeaderText="Estatus" ItemStyle-Width="10%" />--%>
|
||||
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Left" HeaderText="Estatus" ItemStyle-Width="70px" >
|
||||
<ItemTemplate>
|
||||
<asp:Label runat="server" ID="LblTraspasoEstatus" Width="70px" Height="15px" Text='<%# Eval("TraspasoEstatus") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:HyperLinkField DataNavigateUrlFields="CveMovimientoAlmacen" DataNavigateUrlFormatString="~/Inventarios/EntradasSalidas.aspx?CveMovimiento={0} "
|
||||
Target="_blank" ItemStyle-Width="5%" HeaderText="Movimiento" ControlStyle-CssClass="Texto" ItemStyle-HorizontalAlign="Left" DataTextField="FolioMovimiento" />
|
||||
@@ -128,12 +132,17 @@
|
||||
|
||||
<div class="row marginRowLeft">
|
||||
<div class="col-md-6 form-group form-md-line-input input-iconright" id="Div1" runat="server">
|
||||
<asp:DropDownList ID="DdlAlmacenOrigen" Width="100%" DataTextField="Almacen" DataValueField="CveAlmacen" CssClass="form-control select2me" runat="server"></asp:DropDownList>
|
||||
<asp:DropDownList ID="DdlAlmacenOrigen" Width="100%" DataTextField="Almacen" DataValueField="CveAlmacen" CssClass="form-control select2me" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DdlAlmacenOrigen_SelectedIndexChanged"></asp:DropDownList>
|
||||
<label for="<%= DdlAlmacenOrigen.ClientID.ToString()%>">Almacén Origen:</label>
|
||||
<asp:RequiredFieldValidator ID="RfvDdlAlmacenOrigen" runat="server" InitialValue="-1" ControlToValidate="DdlAlmacenOrigen" CssClass="help-block errorimput"
|
||||
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Almacén Origen''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGeneraSolictud"></asp:RequiredFieldValidator>
|
||||
|
||||
</div>
|
||||
<div class="col-md-6 form-group form-md-line-input input-iconright" id="Div2" runat="server">
|
||||
<asp:DropDownList ID="DdlAlmacenDestino" DataTextField="Almacen" DataValueField="CveAlmacen" Width="100%" CssClass="form-control select2me" runat="server" ></asp:DropDownList>
|
||||
<label for="<%= DdlAlmacenDestino.ClientID.ToString()%>">Almacén Destino:</label>
|
||||
<asp:RequiredFieldValidator ID="RfvDdlAlmacenDestino" runat="server" InitialValue="-1" ControlToValidate="DdlAlmacenDestino" CssClass="help-block errorimput"
|
||||
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Almacén Destino''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGeneraSolictud"></asp:RequiredFieldValidator>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -156,7 +165,9 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12" style="text-align:right!important">
|
||||
<asp:Button ID="BtnAgregarPS" runat="server" class="btn btn-success" Text="Agregar Producto" Style="margin-left: -100px;" ValidationGroup="AgregarPS"/>
|
||||
<%--<asp:Button ID="BtnAgregarPS" runat="server" class="btn btn-success" Text="Agregar" Style="margin-left: -100px;" ValidationGroup="AgregarPS"/>--%>
|
||||
<asp:LinkButton ID="BtnAgregarPS" runat="server" CssClass="btn btn-success btn-sm" Text='<i class="fa fa-plus"></i> Agregar' Style="margin-left: -100px;" ValidationGroup="AgregarPS"/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -182,7 +193,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<asp:Button runat="server" ID="BtnGuardar" align="center" Text="Guardar Solicitud" CssClass="btn btn-success" />
|
||||
<asp:Button runat="server" ID="BtnGuardar" align="center" Text="Guardar Solicitud" CssClass="btn btn-success" ValidationGroup="GrpGeneraSolictud" />
|
||||
<button id="LbCancelar" runat="server" type="button" class="btn default" data-dismiss="modal">Cerrar</button>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
|
||||
@@ -84,9 +84,10 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
Private Sub CargaAlmacenes()
|
||||
'Cargo los almacenes
|
||||
DdlAlmacenOrigen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros("CveTipoAlmacen <> 9") 'Excluir almacenes de Apartado
|
||||
DdlAlmacenDestino.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros("CveTipoAlmacen <> 9") 'Excluir almacenes de Apartado
|
||||
'DdlAlmacenDestino.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros("CveTipoAlmacen <> 9") 'Excluir almacenes de Apartado
|
||||
DdlAlmacenOrigen.DataBind()
|
||||
DdlAlmacenDestino.DataBind()
|
||||
DdlAlmacenOrigen.Items.Insert(0, New ListItem("Seleccione Uno", "-1"))
|
||||
'DdlAlmacenDestino.DataBind()
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -493,7 +494,7 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
Dim FolioEntrada As Integer = 0
|
||||
|
||||
Dim TextoError As String = ""
|
||||
Dim CveConceptoEntrada As Integer = 27
|
||||
Dim CveConceptoEntrada As Integer = 9
|
||||
|
||||
|
||||
'AGREGAMOS LA SALIDA DEL ALMACEN ORIGEN
|
||||
@@ -527,7 +528,7 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
End If
|
||||
Next
|
||||
|
||||
'For Each Dr As DataRow In DtMovimientos.Rows
|
||||
'For Each Dr As DataRow In DtMovimientos.RowsF
|
||||
|
||||
'Next
|
||||
End If
|
||||
@@ -550,7 +551,7 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
|
||||
Dim CostoEntrada As Decimal = If(TipoAlmacenDestino = 26, 0, Dr("PU").ToString.ToDecimal())
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, CostoEntrada, CveAF:=-1,
|
||||
CveSeccionAlmacen:=-1, Serie:="-1", Lote:="-1", FechaCaducidad:=MinFecha, CveMovimientoDetalleEntrada:=-1, Observaciones:="") Then
|
||||
CveSeccionAlmacen:=-1, Serie:="-1", Lote:="-1", FechaCaducidad:=MinFecha, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, Observaciones:="") Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al guardar los movimientos de entrada"
|
||||
Exit For
|
||||
@@ -621,7 +622,12 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
ObjInventario.Commit()
|
||||
MensajeAlert.Append("Se realizó con éxito el traspaso.")
|
||||
MensajeAlert.AppendFormat("<br/> Folio de Salida: <b><a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={1}"" target=""_blank"">{0}</a></b>", FolioSalida, CveMovimientoSalida)
|
||||
MensajeAlert.AppendFormat("<br/><a target='_blank' class='Texto' href='/Compras/PopUpVerFactura.aspx?P={0}'> Imprimir </a>", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoSalida)))
|
||||
MensajeAlert.AppendFormat("<br/><a target='_blank' class='Texto' href='/Compras/PopUpVerFactura.aspx?P={0}'> Imprimir Salida </a>", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoSalida)))
|
||||
|
||||
MensajeAlert.AppendFormat("<br/> Folio de Transitorio: <b><a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={1}"" target=""_blank"">{0}</a></b>", FolioEntrada, CveMovimientoEntrada)
|
||||
MensajeAlert.AppendFormat("<br/><a target='_blank' class='Texto' href='/Compras/PopUpVerFactura.aspx?P={0}'> Imprimir Transitorio </a>", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoEntrada)))
|
||||
|
||||
|
||||
Alert(MensajeAlert.ToString, TipoMensaje.MsgInformacion, "")
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "DVModalSolicitud"))
|
||||
Else
|
||||
@@ -672,10 +678,13 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
|
||||
If e.Row.DataKey("CveTrasladoEstatus").ToEntero = 1 Then
|
||||
e.Row.FCLinkButton("LnkMostrarTraspaso").CssClass = "btn btn-circle btn-sm blue"
|
||||
e.Row.FCLabel("LblTraspasoEstatus").CssClass = "label label-sm label-info"
|
||||
Else
|
||||
If e.Row.DataKey("CveTrasladoEstatus").ToEntero = 2 Then
|
||||
e.Row.FCLabel("LblTraspasoEstatus").CssClass = "label label-sm label-success"
|
||||
e.Row.FCLinkButton("LnkMostrarTraspaso").CssClass = "btn btn-circle btn-sm green"
|
||||
Else
|
||||
e.Row.FCLabel("LblTraspasoEstatus").CssClass = "label label-sm label-danger"
|
||||
e.Row.FCLinkButton("LnkMostrarTraspaso").CssClass = "btn btn-circle btn-sm red"
|
||||
End If
|
||||
|
||||
@@ -686,4 +695,16 @@ Partial Class Inventarios_TrasladoSolicitud
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlAlmacenOrigen_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
|
||||
DdlAlmacenDestino.ClearSelection()
|
||||
DdlAlmacenDestino.SelectedValue = Nothing
|
||||
DdlAlmacenDestino.Items.Clear()
|
||||
|
||||
DdlAlmacenDestino.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros($"CveTipoAlmacen <> 9 AND CveAlmacen <> {DdlAlmacenOrigen.SelectedValue}")
|
||||
DdlAlmacenDestino.DataBind()
|
||||
DdlAlmacenDestino.Items.Insert(0, New ListItem("Seleccione Uno", "-1"))
|
||||
UpPS.Update()
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
@@ -4299,7 +4299,8 @@
|
||||
<br />
|
||||
<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="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>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -5023,7 +5023,7 @@ Partial Class Ventas
|
||||
If Adjunto <> "" Then
|
||||
BtnArchivoAdjunto.Text = Adjunto
|
||||
BtnArchivoAdjunto.Visible = True
|
||||
BtnEliminarAdjunto.Visible = False
|
||||
BtnEliminarAdjunto.Visible = True
|
||||
BtnAdjuntar.Visible = False
|
||||
BtnReemplazarAdjunto.Visible = True
|
||||
End If
|
||||
@@ -6007,7 +6007,7 @@ Partial Class Ventas
|
||||
|
||||
ObjUsados.Dispose()
|
||||
|
||||
BtnsFacturar.Visible = True
|
||||
BtnsFacturar.Visible = UsuarioActual.TienePermisoProceso(60)
|
||||
|
||||
'VERIFICA SI YA SE FACTURO COMPLETAMENTE
|
||||
If TmpDT.SUM("CantidadFacturadaRem") = TmpDT.SUM("Cantidad") Then
|
||||
@@ -6075,7 +6075,7 @@ Partial Class Ventas
|
||||
If DbRowVenta("TipoDocto").ToString().Contiene("Ped") Then
|
||||
'ACTIVA BOTONERA | DEBE TENER CONCEPTOS PENDIENTES DE FACTURAR
|
||||
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
|
||||
If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then
|
||||
@@ -15630,7 +15630,7 @@ Partial Class Ventas
|
||||
If DT.Rows.Count > 0 Then
|
||||
'Se agrega movimiento separado por la cuenta de ventas (ER)
|
||||
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
|
||||
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(UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString()}"), "Sin SubProyecto Asignado")}"
|
||||
@@ -36306,12 +36306,16 @@ Partial Class Ventas
|
||||
End If
|
||||
My.Computer.FileSystem.MoveFile(fileItem.FileUrl, Path)
|
||||
|
||||
If File.Exists(Path) AndAlso Me.CveVenta > 0 Then
|
||||
Using ObjVta As New ClsVentasTemp
|
||||
If ObjVta.UpdateVentaAdjunto(Me.CveVenta, Adjunto, UsuarioActual.CveEmpresa) Then
|
||||
Alert("Documento cargado", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
End Using
|
||||
If File.Exists(Path) Then
|
||||
If Me.CveVenta > 0 Then
|
||||
Using ObjVta As New ClsVentas
|
||||
If ObjVta.UpdateVentaAdjunto(Me.CveVenta, Adjunto, UsuarioActual.CveEmpresa) Then
|
||||
Alert("Documento cargado", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
End Using
|
||||
Else
|
||||
Alert("Documento cargado", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
End If
|
||||
|
||||
BtnAdjuntar.Visible = False
|
||||
@@ -36360,9 +36364,20 @@ Partial Class Ventas
|
||||
Dim objVentas As New ClsVentas
|
||||
Dim Path As String
|
||||
Path = String.Format("{0}Ventas/{1}", UsuarioActual.Empresa.Ruta, Adjunto)
|
||||
|
||||
If File.Exists(Path) Then
|
||||
File.Delete(Path)
|
||||
|
||||
If Me.CveVenta > 0 Then
|
||||
Using ObjVta As New ClsVentas
|
||||
If ObjVta.UpdateVentaAdjunto(Me.CveVenta, "", UsuarioActual.CveEmpresa) Then
|
||||
Alert("Documento eliminado", TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
End Using
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
BtnAdjuntar.Visible = True
|
||||
BtnArchivoAdjunto.Text = ""
|
||||
BtnArchivoAdjunto.Visible = False
|
||||
@@ -38927,181 +38942,161 @@ Partial Class Ventas
|
||||
End Sub
|
||||
|
||||
|
||||
Public Class ClsVentasTemp
|
||||
Implements IDisposable
|
||||
'Public Class ClsVentasTemp
|
||||
' 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
|
||||
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
|
||||
' 'Atributos de la clase
|
||||
' Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
|
||||
' Private CveConexion As Integer = 0
|
||||
' Private EsTransaccionCompartida As Boolean = False
|
||||
|
||||
'Atributos de la clase
|
||||
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
|
||||
Private CveConexion As Integer = 0
|
||||
Private EsTransaccionCompartida As Boolean = False
|
||||
|
||||
#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 ReadOnly Property DtResultados() As DataTable
|
||||
' Get
|
||||
' DtResultados = Data
|
||||
' End Get
|
||||
' End Property
|
||||
|
||||
|
||||
Public Function UpdateVentaAdjunto(CveVenta As Integer, Adjunto As String, CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Vta_VentaAdjuntoUpdate")
|
||||
' Public Function IniciaTransacSQL() As SqlClient.SqlTransaction
|
||||
' If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction()
|
||||
' Return SqlTransacc
|
||||
' End Function
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
|
||||
.Add("@Adjunto", SqlDbType.VarChar).Value = Adjunto
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
' Public Sub Commit()
|
||||
' SqlTransacc.Commit()
|
||||
' End Sub
|
||||
' Public Sub RollBack()
|
||||
' SqlTransacc.Rollback()
|
||||
' End Sub
|
||||
|
||||
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
|
||||
' Sub New(Optional TransaccionCompartida As SqlClient.SqlTransaction = Nothing, Optional UsuarioActual As Usuario = Nothing)
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
' 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
|
||||
|
||||
' 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
|
||||
Protected Overridable Sub Dispose(disposing As Boolean)
|
||||
If Not Me.disposedValue Then
|
||||
If disposing Then
|
||||
' TODO: dispose managed state (managed objects).
|
||||
' ' IDisposable
|
||||
' Protected Overridable Sub Dispose(disposing As Boolean)
|
||||
' If Not Me.disposedValue Then
|
||||
' If disposing Then
|
||||
' ' TODO: dispose managed state (managed objects).
|
||||
|
||||
|
||||
|
||||
If Not Data Is Nothing Then Data.Dispose() : Data = Nothing
|
||||
If Not Dataset Is Nothing Then Dataset.Dispose() : Dataset = Nothing
|
||||
If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing
|
||||
If Not SqlCommand Is Nothing Then SqlCommand.Dispose() : SqlCommand = Nothing
|
||||
If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing
|
||||
If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close()
|
||||
If Not SqlConexion Is Nothing Then SqlConexion.Dispose() : SqlConexion = Nothing
|
||||
' If Not Data Is Nothing Then Data.Dispose() : Data = Nothing
|
||||
' If Not Dataset Is Nothing Then Dataset.Dispose() : Dataset = Nothing
|
||||
' If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing
|
||||
' If Not SqlCommand Is Nothing Then SqlCommand.Dispose() : SqlCommand = Nothing
|
||||
' If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing
|
||||
' If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close()
|
||||
' 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: set large fields to null.
|
||||
End If
|
||||
Me.disposedValue = True
|
||||
End Sub
|
||||
' ' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
|
||||
' ' TODO: set large fields to null.
|
||||
' End If
|
||||
' Me.disposedValue = True
|
||||
' End Sub
|
||||
|
||||
' TODO: override Finalize() only if Dispose(disposing As Boolean) above has code to free unmanaged resources.
|
||||
'Protected Overrides Sub Finalize()
|
||||
' ' Do not change this code. Put cleanup code in Dispose(disposing As Boolean) above.
|
||||
' Dispose(False)
|
||||
' MyBase.Finalize()
|
||||
'End Sub
|
||||
|
||||
' This code added by Visual Basic to correctly implement the disposable pattern.
|
||||
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
|
||||
' ' This code added by Visual Basic to correctly implement the disposable pattern.
|
||||
' 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 Class
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user