apertura de registro de conexión

This commit is contained in:
Rene Molina
2019-08-30 16:31:51 -07:00
parent 2f2b9d81d7
commit ebb6f15df4
5 changed files with 81 additions and 5 deletions

20
.gitignore vendored
View File

@@ -6,3 +6,23 @@
/Menu /Menu
/Web.config /Web.config
/Log.txt /Log.txt
/LogTimbrado.txt
/LogMail.txt
/Bin/Microsoft.ReportViewer.WebForms.dll.refresh
/Bin/Microsoft.ReportViewer.WebForms.dll
/Bin/Microsoft.ReportViewer.WebDesign.dll.refresh
/Bin/Microsoft.ReportViewer.WebDesign.dll
/Bin/Microsoft.ReportViewer.ProcessingObjectModel.dll.refresh
/Bin/Microsoft.ReportViewer.ProcessingObjectModel.dll
/Bin/Microsoft.ReportViewer.Design.dll.refresh
/Bin/Microsoft.ReportViewer.Design.dll
/Bin/Microsoft.ReportViewer.DataVisualization.dll.refresh
/Bin/Microsoft.ReportViewer.DataVisualization.dll
/Bin/Microsoft.ReportViewer.Common.dll.refresh
/Bin/Microsoft.ReportViewer.Common.dll
/.vs
/Temp/637022536882545607-PLANTILLA CFE 2019 DISTRIBUCION.xlsx
/Temp/637020871040720361-FormatoAlmacen (1).xlsx
/Temp/637020865803848374-FormatoAlmacen (1).xlsx
/Temp/637020863973072383-FormatoAlmacen (1).xlsx
/Temp/637020854397859419-FormatoAlmacen (1).xlsx

View File

@@ -75,6 +75,7 @@ Public Class ClsVentas
Public Sub RollBack() Public Sub RollBack()
SqlTransacc.Rollback() SqlTransacc.Rollback()
End Sub End Sub
Private CveConexion As Integer = 0
Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing) Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing)
If TransaccionCompartida Is Nothing Then If TransaccionCompartida Is Nothing Then
@@ -82,6 +83,7 @@ Public Class ClsVentas
SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString
Try Try
SqlConexion.Open() SqlConexion.Open()
AddConexion()
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
@@ -93,6 +95,8 @@ Public Class ClsVentas
SqlAdapter = New SqlDataAdapter("", SqlConexion) SqlAdapter = New SqlDataAdapter("", SqlConexion)
End Sub End Sub
Private Sub DataAdapter(ByVal pStrSQL As String, Optional ByVal TipoComando As CommandType = CommandType.StoredProcedure) Private Sub DataAdapter(ByVal pStrSQL As String, Optional ByVal TipoComando As CommandType = CommandType.StoredProcedure)
With SqlAdapter.SelectCommand With SqlAdapter.SelectCommand
.Parameters.Clear() .Parameters.Clear()
@@ -102,6 +106,48 @@ Public Class ClsVentas
If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc
Data = New DataTable Data = New DataTable
End Sub End Sub
#Region "Conexiones"
Private Sub ConexionAdd()
If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
DataAdapter(String.Format("INSERT INTO Sis_Conexiones (Clase,Modulo) VALUES ('ClsVentas',{0})", HttpContext.Current.Request.Url.Authority), CommandType.Text) ' pendiente de terminar parra registrar el cveconexion, falta el rarámetro de módulo
With SqlAdapter.SelectCommand.Parameters
.Add("@CveConexion", SqlDbType.Int).Direction = ParameterDirection.Output
End With
Try
SqlAdapter.Fill(Data)
CveConexion = SqlAdapter.SelectCommand.Parameters("@Opcion").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 ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
DataAdapter(String.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE WHERE CveConexion = ", 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
End If
End Sub
#End Region
Public Function GetVenta(CveVenta As Integer, CveEmpresa As Integer) As Boolean Public Function GetVenta(CveVenta As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_VentasGet") DataAdapter("PA_VentasGet")
@@ -3879,6 +3925,7 @@ Public Class ClsVentas
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
AddConexion()
' 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 Dataset Is Nothing Then Dataset.Dispose() If Not Dataset Is Nothing Then Dataset.Dispose()

View File

@@ -1089,7 +1089,7 @@ Partial Class Inventarios_EntradasSalidas
If ObjConta IsNot Nothing Then ObjConta.RollBack() If ObjConta IsNot Nothing Then ObjConta.RollBack()
Inv.RollBack() Inv.RollBack()
Alert("Ocurrió un error al eliminar el movimiento. Por favor vuelva a intetar.", TipoMensaje.MsgError) Alert("Ocurrió un error al eliminar el movimiento. Por favor vuelva a intentar.", TipoMensaje.MsgError)
End If End If
CveMovimiento = 0 CveMovimiento = 0

View File

@@ -209,7 +209,15 @@
<ajax:ValidatorCalloutExtender ID="VCClasificacion" runat="server" HighlightCssClass="vco" TargetControlID="RFVClasificacion" Width="300px"></ajax:ValidatorCalloutExtender> <ajax:ValidatorCalloutExtender ID="VCClasificacion" runat="server" HighlightCssClass="vco" TargetControlID="RFVClasificacion" Width="300px"></ajax:ValidatorCalloutExtender>
<i></i> <i></i>
</div> </div>
<div class="form-group form-md-line-input input-iconright" id="DivClasificacionDetalle" runat="server" visible="false">
<asp:DropDownList ID="DropDownList1" CssClass="form-control input-sm select2me " Width="70%" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="ClasificacionDetalle" DataValueField="CveClasificacionDetalle" Enabled="true">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
<label for="<%= DdlTipoPSDes.ClientID.ToString()%>">Tipo:</label>
<asp:LinkButton ID="LinkButton1" runat="server" OnClick="BtnAddClasificacionDetalle_Click" CssClass="btn btn-default btn-circle btn-xs " data-toggle="tooltip" title="Registrar un Tipo"><i class='fa fa-plus' style="color:black" ></i></asp:LinkButton>
</div>
<div class="form-group form-md-line-input input-iconright" id="DvTamanio" runat="server" visible="false"> <div class="form-group form-md-line-input input-iconright" id="DvTamanio" runat="server" visible="false">
<asp:DropDownList ID="DdlTamanio" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="Tamaño" DataValueField="CveTamaño" Width="350px"> <asp:DropDownList ID="DdlTamanio" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="Tamaño" DataValueField="CveTamaño" Width="350px">
<asp:ListItem Value="-1">Seleccione</asp:ListItem> <asp:ListItem Value="-1">Seleccione</asp:ListItem>

View File

@@ -15750,12 +15750,13 @@ Partial Class Ventas
Next Next
End If End If
Dim ErrorLista As New StringBuilder
'Orden Produccion' 'Orden Produccion'
If Not OcurrioError Then If Not OcurrioError Then
If UsuarioActual.CveEmpresa.Contiene(126) Then If UsuarioActual.CveEmpresa.Contiene(126) Then
If CveVenta > 0 And DdlOrdenProduccion.SelectedValue.ToEntero > 0 Then If CveVenta > 0 And DdlOrdenProduccion.SelectedValue.ToEntero > 0 Then
If Not ObjCGame.UpdateOrdenProduccionVenta(DdlOrdenProduccion.SelectedValue.ToEntero(), CveVenta) Then If Not ObjCGame.UpdateOrdenProduccionVenta(DdlOrdenProduccion.SelectedValue.ToEntero(), CveVenta) Then
ErrorList.Add("Ocurrió un error al actualizar la orden de producción") ErrorLista.Append("Ocurrió un error al actualizar la orden de producción")
End If End If
End If End If
End If End If
@@ -15765,7 +15766,7 @@ Partial Class Ventas
If ObjConta.ValorPolizaDescuadre > 0 Then If ObjConta.ValorPolizaDescuadre > 0 Then
If ObjConta.ValorPolizaDescuadre = 2 Then If ObjConta.ValorPolizaDescuadre = 2 Then
OcurrioError = True OcurrioError = True
ErrorList.Add(ObjConta.MensajePolizaDescuadre) ErrorLista.Append(ObjConta.MensajePolizaDescuadre)
End If End If
End If End If
End If End If
@@ -15778,7 +15779,7 @@ Partial Class Ventas
If OcurrioError Then If OcurrioError Then
ObjVentas.RollBack() ObjVentas.RollBack()
Alert("Ocurrió un error al guardar los cambios. Por favor intente de nuevo.", TipoMensaje.MsgError) Alert("Ocurrió un error al guardar los cambios. Por favor intente de nuevo." & ErrorLista.ToString, TipoMensaje.MsgError)
Else Else
ObjVentas.Commit() ObjVentas.Commit()
If ObjAC IsNot Nothing Then ObjAC.Commit() If ObjAC IsNot Nothing Then ObjAC.Commit()