diff --git a/Asegasa.sln b/Asegasa.sln
index a154f96..10fdf6e 100644
--- a/Asegasa.sln
+++ b/Asegasa.sln
@@ -1,17 +1,15 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.14.36414.22
+# Visual Studio Version 18
+VisualStudioVersion = 18.3.11505.172 d18.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WSAsegasa", "WSAsegasa\WSAsegasa.csproj", "{C891F2E3-60D2-449F-962A-BF78F58C67D6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bdAsegasa", "bdAsegasa\bdAsegasa.csproj", "{E42D668E-CB26-498B-89AF-8A205528C4EF}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bdfactu", "..\Tecnosis\tsFactu\bdFactu\bdfactu.csproj", "{56D9C47A-1D6F-0C5B-2DB0-72EB359C1093}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "APIFicheros", "APIFicheros\APIFicheros.csproj", "{729F814F-BBAF-A079-B0A1-D5890DA11543}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tsVeriFactu", "..\..\Comunes\tsVeriFactu\tsVeriFactu.csproj", "{DDFE8F31-9ED8-5C11-4E72-6CE96526C459}"
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GestionAsegasa", "GestionAsegasa\GestionAsegasa.vbproj", "{6995E4A5-BC07-42C2-8E8C-C09839886B7F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -27,18 +25,14 @@ Global
{E42D668E-CB26-498B-89AF-8A205528C4EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E42D668E-CB26-498B-89AF-8A205528C4EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E42D668E-CB26-498B-89AF-8A205528C4EF}.Release|Any CPU.Build.0 = Release|Any CPU
- {56D9C47A-1D6F-0C5B-2DB0-72EB359C1093}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {56D9C47A-1D6F-0C5B-2DB0-72EB359C1093}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {56D9C47A-1D6F-0C5B-2DB0-72EB359C1093}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {56D9C47A-1D6F-0C5B-2DB0-72EB359C1093}.Release|Any CPU.Build.0 = Release|Any CPU
{729F814F-BBAF-A079-B0A1-D5890DA11543}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{729F814F-BBAF-A079-B0A1-D5890DA11543}.Debug|Any CPU.Build.0 = Debug|Any CPU
{729F814F-BBAF-A079-B0A1-D5890DA11543}.Release|Any CPU.ActiveCfg = Release|Any CPU
{729F814F-BBAF-A079-B0A1-D5890DA11543}.Release|Any CPU.Build.0 = Release|Any CPU
- {DDFE8F31-9ED8-5C11-4E72-6CE96526C459}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {DDFE8F31-9ED8-5C11-4E72-6CE96526C459}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {DDFE8F31-9ED8-5C11-4E72-6CE96526C459}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {DDFE8F31-9ED8-5C11-4E72-6CE96526C459}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6995E4A5-BC07-42C2-8E8C-C09839886B7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6995E4A5-BC07-42C2-8E8C-C09839886B7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6995E4A5-BC07-42C2-8E8C-C09839886B7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6995E4A5-BC07-42C2-8E8C-C09839886B7F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/GestionAsegasa/Application.xaml b/GestionAsegasa/Application.xaml
new file mode 100644
index 0000000..eab850f
--- /dev/null
+++ b/GestionAsegasa/Application.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/GestionAsegasa/Application.xaml.vb b/GestionAsegasa/Application.xaml.vb
new file mode 100644
index 0000000..084cbe9
--- /dev/null
+++ b/GestionAsegasa/Application.xaml.vb
@@ -0,0 +1,6 @@
+Class Application
+
+ ' Application-level events, such as Startup, Exit, and DispatcherUnhandledException
+ ' can be handled in this file.
+
+End Class
diff --git a/GestionAsegasa/AssemblyInfo.vb b/GestionAsegasa/AssemblyInfo.vb
new file mode 100644
index 0000000..025ee72
--- /dev/null
+++ b/GestionAsegasa/AssemblyInfo.vb
@@ -0,0 +1,11 @@
+Imports System.Windows
+
+'The ThemeInfo attribute describes where any theme specific and generic resource dictionaries can be found.
+'1st parameter: where theme specific resource dictionaries are located
+'(used if a resource is not found in the page,
+' or application resource dictionaries)
+
+'2nd parameter: where the generic resource dictionary is located
+'(used if a resource is not found in the page,
+'app, and any theme specific resource dictionaries)
+
diff --git a/GestionAsegasa/Comun.vb b/GestionAsegasa/Comun.vb
new file mode 100644
index 0000000..620d1df
--- /dev/null
+++ b/GestionAsegasa/Comun.vb
@@ -0,0 +1,412 @@
+Imports bdAsegasa
+Imports bdAsegasa.db
+Imports bdAsegasa.db.Utilidades
+Imports DevExpress.Xpf.Docking
+Imports DevExpress.XtraReports.UI
+Imports System.IO
+Imports DevExpress.Xpf.Printing
+Imports DevExpress.Xpf.Core
+Imports tsWPFCore
+Imports tsUtilidades
+Imports System.Data.Entity
+
+Imports DevExpress.Xpf.Editors
+
+'TODO No permitir 2 facturas rápidas al mismo tiempo
+'TODO Traspaso a otra caja
+'TODO Seleccion cajas en conciliación bancaria
+
+Public Class Comun
+
+ Friend Shared OtrosParametros As String = ""
+ Public Shared Property dwi As DXWindow
+ Public Shared Property dg As DocumentGroup
+ Public Shared Sub EscalaVentana(ByRef Ventana As Window, ByRef tr As Transform)
+ If UsuarioActual.Escala.HasValue AndAlso UsuarioActual.Escala Then
+ Ventana.Height = Math.Min(Comun.dwi.Height, Ventana.Height * UsuarioActual.Escala.Value)
+ Ventana.Width = Math.Min(Comun.dwi.Width, Ventana.Width * UsuarioActual.Escala.Value)
+ Dim scaler = TryCast(tr, ScaleTransform)
+ If scaler Is Nothing Then
+ scaler = New ScaleTransform(1.0, 1.0)
+ tr = scaler
+ End If
+ scaler.ScaleX = UsuarioActual.Escala.Value
+ scaler.ScaleY = UsuarioActual.Escala.Value
+ scaler.BeginAnimation(ScaleTransform.ScaleXProperty, Nothing)
+ scaler.BeginAnimation(ScaleTransform.ScaleYProperty, Nothing)
+ End If
+ End Sub
+ Public Shared Function ObtienePermisos(bd As tscgestionasegasa, Codigo As String, idUsuario As Integer) As tsUtilidades.Permisos
+ Dim per As New tsUtilidades.Permisos
+ If bd.usuarios.First(Function(x) x.idUsuario = bdAsegasa.db.Utilidades.idUsuario).idGrupoNavigation.Descripcion = "SUPERADMINISTRADORES" Then
+ per.Consultar = True
+ per.Eliminar = True
+ per.Nuevos = True
+ per.Otros = True
+ per.Modificar = True
+ per.Impresion = True
+ per.Exportar = True
+ Else
+ Dim au = (From a In bd.autorizacionesusuarios Select a Where a.idPermisoNavigation.CodigoPermiso = Codigo AndAlso a.idUsuario = bdAsegasa.db.Utilidades.idUsuario)
+ If au.Count = 0 Then
+ Dim idGrupo As Integer = (From u In bd.usuarios Select u Where u.idUsuario = bdAsegasa.db.Utilidades.idUsuario).First.idGrupo.Value
+ Dim ag = (From g In bd.autorizacionesgrupos Select g Where g.idPermisoNavigation.CodigoPermiso = Codigo AndAlso g.idGrupo = idGrupo)
+ If ag.Count = 0 Then
+ per.Consultar = False
+ per.Eliminar = False
+ per.Nuevos = False
+ per.Otros = False
+ per.Modificar = False
+ per.Impresion = False
+ per.Exportar = False
+ Else
+ per.Consultar = ag.First.PermitirConsultas
+ per.Eliminar = ag.First.PermitirEliminaciones
+ per.Nuevos = ag.First.PermitirNuevos
+ per.Otros = ag.First.OtrosPermisos
+ per.Modificar = ag.First.PermitirModificaciones
+ per.Impresion = ag.First.PermitirImpresiones
+ per.Exportar = ag.First.PermitirImpresiones
+ End If
+ Else
+ per.Consultar = au.First.PermitirConsultas
+ per.Eliminar = au.First.PermitirEliminaciones
+ per.Nuevos = au.First.PermitirNuevos
+ per.Otros = au.First.OtrosPermisos
+ per.Modificar = au.First.PermitirModificaciones
+ per.Impresion = au.First.PermitirImpresiones
+ per.Exportar = au.First.PermitirExportar
+ End If
+ End If
+ 'If Not bdga.DataBase.ToLower.Contains("GrupoSanchoToro") AndAlso Not bdga.DataBase.ToLower.Contains("desarrollo") AndAlso Not bdga.DataBase.ToLower.Contains("viernes") Then
+ ' per.Modificar = False
+ ' per.Nuevos = False
+ 'End If
+
+ Return per
+
+ End Function
+
+
+ Public Shared Function ObtienePermisos(bd As tscgestionasegasa, idPermiso As Nullable(Of Integer), idUsuario As Integer) As tsUtilidades.Permisos
+ Dim per As New tsUtilidades.Permisos
+ If bd.usuarios.First(Function(x) x.idUsuario = bdAsegasa.db.Utilidades.idUsuario).Usuario = "MANMOG" Then
+ per.Consultar = True
+ per.Eliminar = True
+ per.Nuevos = True
+ per.Otros = True
+ per.Modificar = True
+ per.Impresion = True
+ per.Exportar = True
+ Else
+ If idPermiso Is Nothing Then
+ per.Consultar = False
+ per.Eliminar = False
+ per.Nuevos = False
+ per.Otros = False
+ per.Modificar = False
+ per.Impresion = False
+ per.Exportar = False
+ Else
+ Dim au = (From a In bd.autorizacionesusuarios Select a Where a.idPermisoNavigation.idPermiso = idPermiso AndAlso a.idUsuario = bdAsegasa.db.Utilidades.idUsuario)
+ If au.Count = 0 Then
+ Dim idGrupo As Integer = (From u In bd.usuarios Select u Where u.idUsuario = bdAsegasa.db.Utilidades.idUsuario).First.idGrupo.Value
+ Dim ag = (From g In bd.autorizacionesgrupos Select g Where g.idPermisoNavigation.idPermiso = idPermiso AndAlso g.idGrupo = idGrupo)
+ If ag.Count = 0 Then
+ per.Consultar = False
+ per.Eliminar = False
+ per.Nuevos = False
+ per.Otros = False
+ per.Modificar = False
+ per.Impresion = False
+ per.Exportar = False
+ Else
+ per.Consultar = ag.First.PermitirConsultas
+ per.Eliminar = ag.First.PermitirEliminaciones
+ per.Nuevos = ag.First.PermitirNuevos
+ per.Otros = ag.First.OtrosPermisos
+ per.Modificar = ag.First.PermitirModificaciones
+ per.Impresion = ag.First.PermitirImpresiones
+ per.Exportar = ag.First.PermitirImpresiones 'ag.First.PermitirExportar
+ End If
+ Else
+ per.Consultar = au.First.PermitirConsultas
+ per.Eliminar = au.First.PermitirEliminaciones
+ per.Nuevos = au.First.PermitirNuevos
+ per.Otros = au.First.OtrosPermisos
+ per.Modificar = au.First.PermitirModificaciones
+ per.Impresion = au.First.PermitirImpresiones
+ per.Exportar = au.First.PermitirImpresiones
+ End If
+ End If
+ End If
+ Return per
+ End Function
+ Friend Shared Function ObtienePlantillas(bd As tscgestionasegasa, Grupo As String, Optional IncluirTipoListado As Boolean = True) As List(Of tsWPFCore.Plantilla)
+ Dim plas As IQueryable(Of plantillas)
+ 'If Not IncluirTipoListado Then
+ ' plas = (From p In bd.plantillas Where p.idEmpresa = EmpresaActual.idEmpresa AndAlso p.idGrupoNavigation.Codigo = Grupo AndAlso p.TipoListado = False Select p)
+ 'Else
+ ' plas = (From p In bd.plantillas Where p.idEmpresa = EmpresaActual.idEmpresa AndAlso p.idGrupoNavigation.Codigo = Grupo Select p)
+ 'End If
+ Dim plantillas As New List(Of tsWPFCore.Plantilla)
+ For Each p In plas
+ Dim pl As New tsWPFCore.Plantilla
+ pl.idPlantilla = p.idPlantilla
+ pl.Descripcion = p.Descripcion
+ plantillas.Add(pl)
+ Next
+ Return plantillas
+ End Function
+ Friend Shared Function ObtienePlantillas(bd As tscgestionasegasa, Grupos() As String, Optional IncluirTipoListado As Boolean = True) As List(Of tsWPFCore.Plantilla)
+ Dim plas As List(Of plantillas)
+ If Not IncluirTipoListado Then
+ 'plas = (From p In bd.plantillas Where p.TipoListado = False AndAlso p.Oculta = False Order By p.Orden Select p).ToList
+ plas = (From p In bd.plantillas Where p.TipoListado = False AndAlso p.Oculta = False Select p).ToList
+ Else
+ 'plas = (From p In bd.plantillas Where p.Oculta = False Order By p.Orden Select p).ToList
+ plas = (From p In bd.plantillas Where p.Oculta = False Select p).ToList
+ End If
+ Dim plantillas As New List(Of tsWPFCore.Plantilla)
+ For Each p In plas
+ If Grupos.Contains(p.idGrupoNavigation.Codigo) Then
+ If Not p.idPermiso.HasValue OrElse ObtienePermisos(bd, p.idPermisoNavigation.CodigoPermiso, idUsuario).Impresion Then
+ Dim pl As New tsWPFCore.Plantilla
+ pl.idPlantilla = p.idPlantilla
+ pl.Descripcion = p.Descripcion
+ plantillas.Add(pl)
+ End If
+ End If
+ Next
+ Return plantillas
+ End Function
+ Friend Shared Function ObtienePlantillasPorCodigos(bd As tscgestionasegasa, Codigos() As String, Optional IncluirTipoListado As Boolean = True) As List(Of tsWPFCore.Plantilla)
+ Dim plas As List(Of plantillas)
+ 'If Not IncluirTipoListado Then
+ ' plas = (From p In bd.plantillas Where p.idEmpresa = EmpresaActual.idEmpresa AndAlso p.TipoListado = False AndAlso p.Oculta = False Order By p.Orden Select p).ToList
+ 'Else
+ ' plas = (From p In bd.plantillas Where p.idEmpresa = EmpresaActual.idEmpresa AndAlso p.Oculta = False Order By p.Orden Select p).ToList
+ 'End If
+ Dim plantillas As New List(Of tsWPFCore.Plantilla)
+ plas = plas.Where(Function(x) Codigos.Contains(x.Codigo) AndAlso (x.idPermisoNavigation Is Nothing OrElse ObtienePermisos(bd, x.idPermisoNavigation.CodigoPermiso, idUsuario).Impresion)).ToList
+ For Each p In plas
+ Dim pl As New tsWPFCore.Plantilla
+ pl.idPlantilla = p.idPlantilla
+ pl.Descripcion = p.Descripcion
+ plantillas.Add(pl)
+ Next
+ Return plantillas
+ End Function
+ 'Friend Shared Sub MuestraImpresos(bd As tscgestionasegasa, idPlantilla As Integer, Datasource As Object, GrupoDocumentos As DocumentGroup, dc As DockController)
+ ' Try
+
+ ' If idPlantilla = 0 Then Throw New Exception("Seleccione primero la plantilla a imprimir")
+ ' Dim xr As New XtraReport
+
+ ' Dim qr As ObjectSet(Of plantillas) = bd.plantillas
+ ' ' qr.MergeOption = MergeOption.OverwriteChanges
+
+ ' Dim pl = qr.Where(Function(x) x.idPlantilla = idPlantilla).First
+
+ ' 'Dim pl As plantillas = (From p In bd.plantillas Where p.idPlantilla = idPlantilla).First
+ ' Dim s As String = System.Text.Encoding.UTF8.GetString(pl.idFicheroNavigation.Fichero)
+ ' Using sw As New StreamWriter(New MemoryStream())
+ ' sw.Write(s)
+ ' sw.Flush()
+ ' xr = XtraReport.FromStream(sw.BaseStream, True)
+ ' End Using
+ ' Try
+ ' Dim pr As DevExpress.XtraReports.Parameters.Parameter = (From p As DevExpress.XtraReports.Parameters.Parameter In xr.Parameters Where p.Name = "Fecha").First
+ ' pr.Value = Now
+ ' pr.Visible = False
+ ' Catch ex As Exception
+
+ ' End Try
+
+ ' Select Case Datasource.GetType
+ ' 'Case GetType(personas), GetType(List(Of personas))
+ ' ' If Datasource.GetType = GetType(personas) Then
+ ' ' Dim lp As New List(Of personas)
+ ' ' Dim per As personas = Datasource
+ ' ' lp.Add(per)
+ ' ' Datasource = lp
+ ' ' End If
+ ' ' If pl.enumeraciones.Codigo = "GRUPLA.TARJETAVERTICAL" Then
+ ' ' Dim ltvd As New List(Of TarjetaVerticalDiputado)
+ ' ' Dim iNumPer As Integer
+ ' ' Dim tvd As TarjetaVerticalDiputado = Nothing
+
+ ' ' For Each p In DirectCast(Datasource, List(Of personas))
+ ' ' iNumPer += 1
+ ' ' If iNumPer Mod 2 = 1 Then
+ ' ' tvd = New TarjetaVerticalDiputado
+ ' ' With tvd
+ ' ' .Dni1 = p.NIF
+ ' ' If p.idFicheroFoto IsNot Nothing AndAlso p.idFicheroNavigation.Fichero IsNot Nothing AndAlso p.idFicheroNavigation.Fichero.Length > 0 Then
+ ' ' Dim original = System.Drawing.Image.FromStream(New IO.MemoryStream(p.idFicheroNavigation.Fichero))
+ ' ' original.RotateFlip(System.Drawing.RotateFlipType.Rotate90FlipNone)
+ ' ' Dim memStream As IO.MemoryStream = New IO.MemoryStream()
+ ' ' original.Save(memStream, ImageFormat.Png)
+ ' ' .Foto1 = memStream.ToArray
+ ' ' End If
+ ' ' .Nombre1 = p.Nombre & " " & p.Apellidos
+ ' ' .PuestoEnTarjeta1 = p.PuestoTrabajoEnTarjeta
+ ' ' .Tratamiento1 = p.Tratamiento
+ ' ' End With
+ ' ' ltvd.Add(tvd)
+ ' ' Else
+ ' ' With tvd
+ ' ' .Dni2 = p.NIF
+ ' ' If p.idFicheroFoto IsNot Nothing AndAlso p.idFicheroNavigation.Fichero.Length > 0 Then
+ ' ' Dim original = System.Drawing.Image.FromStream(New IO.MemoryStream(p.idFicheroNavigation.Fichero))
+ ' ' original.RotateFlip(System.Drawing.RotateFlipType.Rotate90FlipNone)
+ ' ' Dim memStream As IO.MemoryStream = New IO.MemoryStream()
+ ' ' original.Save(memStream, ImageFormat.Png)
+ ' ' .Foto2 = memStream.ToArray
+ ' ' End If
+ ' ' .Nombre2 = p.Nombre & " " & p.Apellidos
+ ' ' .PuestoEnTarjeta2 = p.PuestoTrabajoEnTarjeta
+ ' ' .Tratamiento2 = p.Tratamiento
+ ' ' End With
+ ' ' End If
+ ' ' Next
+ ' ' Datasource = ltvd
+ ' ' End If
+ ' End Select
+
+
+ ' xr.DataSource = Datasource
+ ' Dim modelo As New XtraReportPreviewModel(xr)
+
+ ' Dim vi As New tsWPFCore.ucVisualizadorInformes
+ ' vi.Visualizador.Model = modelo
+ ' xr.CreateDocument(True)
+
+ ' 'If pl.Codigo = "TARDIPVER" Then
+
+ ' ' Dim original = System.Drawing.Image.FromStream(New IO.MemoryStream(Per.idFicheroNavigation.Fichero))
+ ' ' original.RotateFlip(System.Drawing.RotateFlipType.Rotate270FlipNone)
+ ' ' Dim memStream As IO.MemoryStream = New IO.MemoryStream()
+ ' ' original.Save(memStream, ImageFormat.Png)
+ ' ' Per.idFicheroNavigation.Fichero = memStream.ToArray
+ ' 'End If
+ ' Dim docpanel As New DevExpress.Xpf.Docking.DocumentPanel
+ ' docpanel.Caption = pl.Descripcion
+ ' docpanel.Content = vi
+ ' docpanel.ClosingBehavior = DevExpress.Xpf.Docking.ClosingBehavior.ImmediatelyRemove
+ ' GrupoDocumentos.Items.Add(docpanel)
+ ' dc.Activate(docpanel)
+
+ ' Catch ex As Exception
+ ' DXMessageBox.Show(ex.Message, "Atención", MessageBoxButton.OK, MessageBoxImage.Error)
+ ' End Try
+ 'End Sub
+ Shared Sub GeneraRegistroCorreoExcepcion(bd As tscgestionasegasa, ex As Exception, Rutina As String, Optional FicheroImagen As Byte() = Nothing)
+ Try
+ If bd Is Nothing Then bd = tscgestionasegasa.NuevoContexto
+ Dim sMensaje As String = "Usuario: " & bdAsegasa.db.Utilidades.Usuario & vbCrLf
+ Dim sStackTrace As String = "Tipo excepción: " & ex.ToString & vbCrLf
+ Dim exError As Exception = ex
+ Do
+ sStackTrace &= exError.StackTrace & vbCrLf
+ exError = exError.InnerException
+ Loop Until IsNothing(exError)
+ If sStackTrace <> "" Then sMensaje &= vbCrLf & "StackTrace: " & sStackTrace
+ Dim cuentaorigen As cuentascorreo = (From c In bd.cuentascorreo Select c Where c.Codigo = "M3SOFT").First
+ If FicheroImagen Is Nothing Then
+ correos.GeneraRegistroCorreon(bd, "Mensaje Automático. Error en " & Rutina, sMensaje, cuentaorigen, "manmog@gmail.com", "", "", , ,, "ERRORES")
+ Else
+ correos.GeneraRegistroCorreon(bd, "Mensaje Automático. Error en " & Rutina, sMensaje, cuentaorigen, "manmog@gmail.com", "", "", FicheroImagen, "captura.jpg",, "ERRORES")
+ End If
+ Catch ex2 As Exception
+ DXMessageBox.Show(ex2.Message & vbCrLf & ex2.StackTrace, "Error Generando Correo Excepcion")
+ End Try
+ End Sub
+
+ 'Friend Shared Function ObtieneListaAlmacenes(bd As tscgestionasegasa) As List(Of almacenes)
+ ' Dim alms = bd.almacenes.Where(Function(x) x.FechaBaja.HasValue = False).ToList
+ ' Return alms
+ 'End Function
+End Class
+
+Namespace Convertidores
+
+ Public Class DoubleToDecimalConverter
+ Implements IValueConverter
+
+ Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IValueConverter.Convert
+ If value Is Nothing Then
+ Return 0
+ Else
+ Return Decimal.Parse(value)
+ End If
+ End Function
+
+ Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
+ If value Is Nothing Then
+ Return 0
+ Else
+ Return Double.Parse(value)
+ End If
+ End Function
+ End Class
+
+
+ Public Class ExistenLineasConverter
+ Implements IValueConverter
+
+ Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IValueConverter.Convert
+ Dim lineas As IEnumerable(Of Object) = value
+ Return (lineas.Count > 0)
+ End Function
+
+ Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
+ Return value
+ End Function
+ End Class
+
+ Public Class ImagenConverter
+ Implements IValueConverter
+
+ Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IValueConverter.Convert
+ Try
+ If value Is Nothing Then
+ Return Nothing
+ Else
+ Dim ms As New IO.MemoryStream(DirectCast(value, Byte()))
+ Dim img As New BitmapImage
+ img.BeginInit()
+ img.StreamSource = ms
+ img.CacheOption = BitmapCacheOption.OnLoad
+ img.EndInit()
+ img.Freeze()
+ ms.Close()
+ ms.Dispose()
+ Return img
+ GC.Collect()
+ GC.WaitForPendingFinalizers()
+ GC.Collect()
+ End If
+ Catch ex As Exception
+ Return Nothing
+ ' Throw New Exception(ex.Message, ex)
+ End Try
+ End Function
+
+ Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
+ Try
+ If value Is Nothing Then
+ Return Nothing
+ Else
+ Dim bm As BitmapImage = value
+ Dim ms As IO.MemoryStream = bm.StreamSource
+ Return ms.ToArray
+ End If
+ Catch ex As Exception
+ Throw New Exception(ex.Message, ex)
+ End Try
+ End Function
+
+ End Class
+
+End Namespace
diff --git a/GestionAsegasa/GestionAsegasa.vbproj b/GestionAsegasa/GestionAsegasa.vbproj
new file mode 100644
index 0000000..6f4ff37
--- /dev/null
+++ b/GestionAsegasa/GestionAsegasa.vbproj
@@ -0,0 +1,54 @@
+
+
+
+ WinExe
+ net8.0-windows7.0
+ GestionAsegasa
+ true
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GestionAsegasa/My Project/Application.myapp b/GestionAsegasa/My Project/Application.myapp
new file mode 100644
index 0000000..c0f7fef
--- /dev/null
+++ b/GestionAsegasa/My Project/Application.myapp
@@ -0,0 +1,10 @@
+
+
+ true
+ Form1
+ false
+ 0
+ true
+ 0
+ true
+
\ No newline at end of file
diff --git a/GestionAsegasa/VentanasEmergentes/dxwIdentificacion.xaml b/GestionAsegasa/VentanasEmergentes/dxwIdentificacion.xaml
new file mode 100644
index 0000000..991f5c4
--- /dev/null
+++ b/GestionAsegasa/VentanasEmergentes/dxwIdentificacion.xaml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GestionAsegasa/VentanasEmergentes/dxwIdentificacion.xaml.vb b/GestionAsegasa/VentanasEmergentes/dxwIdentificacion.xaml.vb
new file mode 100644
index 0000000..6bcb78b
--- /dev/null
+++ b/GestionAsegasa/VentanasEmergentes/dxwIdentificacion.xaml.vb
@@ -0,0 +1,73 @@
+Imports DevExpress.Xpf.Editors
+Imports DevExpress.Xpf.Core.Native
+Imports System.Reflection
+Imports bdGrupoSanchoToro.db
+
+Public Class dxwIdentificacion
+ ' Private _Empresas As List(Of db.empresas)
+ Private _Version As String
+ Public Cancelar As Boolean
+
+ Public Sub New(Version As String)
+ _Version = Version
+ ' _Empresas = Empresas
+
+ ' Esta llamada es exigida por el diseñador.
+ InitializeComponent()
+ 'If Empresas.Count > 1 Then
+ ' Me.Height = 290
+ ' liEmpresa.Visibility = Visibility.Visible
+ 'Else
+ ' Me.Height = 230
+ 'End If
+
+ ' Agregue cualquier inicialización después de la llamada a InitializeComponent().
+
+ End Sub
+
+ Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
+ Cancelar = False
+ Me.Close()
+ End Sub
+
+ Private Sub Button2_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button2.Click
+ Cancelar = True
+ Me.Close()
+ End Sub
+
+ Private Sub Window_PreviewKeyDown(sender As Object, e As KeyEventArgs) Handles gc.PreviewKeyDown
+ If e.Key = Key.Return Then
+ If teUsuario.Text <> "" And Me.pbeContrasenna.Text <> "" Then
+ Cancelar = False
+ Me.Close()
+ Else
+ Dim te As BaseEdit = LayoutHelper.FindParentObject(Of BaseEdit)(Keyboard.FocusedElement)
+ If te Is Nothing Then
+ FocusManager.SetFocusedElement(Me, teUsuario)
+ Else
+ If te.Name.ToUpper = "TEUSUARIO" Then
+ FocusManager.SetFocusedElement(Me, pbeContrasenna)
+ Else
+ FocusManager.SetFocusedElement(Me, teUsuario)
+ End If
+ End If
+ End If
+ End If
+ End Sub
+
+ Private Sub dxwIdentificacion_Activated(sender As Object, e As EventArgs) Handles Me.Activated
+ ' Application.Current.Dispatcher.BeginInvoke(New Action(Function() Me.Focus()), System.Windows.Threading.DispatcherPriority.Send)
+ ' Application.Current.Dispatcher.BeginInvoke(New Action(Function() teUsuario.Focus()), System.Windows.Threading.DispatcherPriority.Send)
+ End Sub
+
+ Private Sub dxwIdentificacion_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
+ 'FocusManager.SetFocusedElement(Me, teUsuario)
+ 'cbEmpresa.ItemsSource = _Empresas
+ 'cbEmpresa.EditValue = _Empresas.First.idEmpresa
+ teUsuario.Focus()
+ ' Application.Current.Dispatcher.BeginInvoke(New Action(Function() Me.Focus()), System.Windows.Threading.DispatcherPriority.Send)
+ ' Application.Current.Dispatcher.BeginInvoke(New Action(Function() teUsuario.Focus()), System.Windows.Threading.DispatcherPriority.Send)
+ Cancelar = True
+ lVersion.Content = "Versión: " & _Version
+ End Sub
+End Class
diff --git a/GestionAsegasa/dxwInicio.xaml b/GestionAsegasa/dxwInicio.xaml
new file mode 100644
index 0000000..f795962
--- /dev/null
+++ b/GestionAsegasa/dxwInicio.xaml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Versión:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GestionAsegasa/dxwInicio.xaml.vb b/GestionAsegasa/dxwInicio.xaml.vb
new file mode 100644
index 0000000..771a393
--- /dev/null
+++ b/GestionAsegasa/dxwInicio.xaml.vb
@@ -0,0 +1,352 @@
+Imports bdAsegasa
+Imports bdAsegasa.db
+Imports bdAsegasa.db.Utilidades
+Imports tsUtilidades.Utilidades
+Imports tsUtilidades.Extensiones
+Imports System.ComponentModel
+Imports DevExpress.Xpf.Docking
+Imports System.Data.Common
+Imports System.Data
+Imports DevExpress.Xpf.NavBar
+Imports DevExpress.Xpf.Core
+Imports System.Net.Sockets
+Imports System.Net
+Imports tsWPFCore
+
+Imports System.Reflection
+Imports DevExpress.Xpf.Accordion
+Imports System.Linq.Expressions
+Imports System.Runtime.CompilerServices
+Imports AutoUpdaterDotNET
+
+Public Class dxwInicio
+ Private bd As bdAsegasa.tscgestionasegasa
+ Private Sub DXWindow1_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
+ ' LimpiaPiscina(4, 4)
+ ' prueba de david
+ Try
+ System.Threading.Thread.CurrentThread.CurrentCulture =
+ New System.Globalization.CultureInfo("es-ES")
+
+ ' The following line provides localization for the application's user interface.
+ System.Threading.Thread.CurrentThread.CurrentUICulture =
+ New System.Globalization.CultureInfo("es-ES")
+ Comun.dwi = Me
+ Comun.dg = Me.grupodoc
+ tsWPFCore.Configuracion.ModoBusquedaAND = True
+ tsWPFCore.Configuracion.ComportamientoValidacion = DevExpress.Xpf.Editors.Validation.InvalidValueBehavior.AllowLeaveEditor
+ ' tsWPFCore.Configuracion.ModoObrasContextoSavingChanges = ModoContextoSavingChangesEnum.SoloDespuesGuardar
+ tsWPFCore.Configuracion.MostrarBotonCerrarEnPestaña = True
+ bdAsegasa.db.Utilidades.DirectorioLogs = "c:\m3soft\logs\"
+ Catch ex As Exception
+ DXMessageBox.Show(ex.Message, "Error")
+ End Try
+
+ End Sub
+
+ Sub GeneraGruposNavegacion()
+ Dim NBC = Me.PanelNavegacion
+ Dim menuiniciales = (From m In bd.menus Where m.MostrarEnPanel = True AndAlso m.idMenuPadre Is Nothing Order By m.Orden Select m).ToList
+ Dim nbg As AccordionItem
+ For Each mi In menuiniciales
+ If mi.idPermiso Is Nothing OrElse Comun.ObtienePermisos(bd, mi.idPermiso, idUsuario).Consultar Then
+ nbg = New AccordionItem
+ nbg.Header = mi.Texto.Replace("&", "")
+ nbg.FontWeight = FontWeights.Bold
+ Call GeneraElementosNavegacion(nbg, mi)
+ nbg.IsExpanded = True ' mi.Desplegado
+ NBC.Items.Add(nbg)
+ End If
+ Next
+ End Sub
+ Sub GeneraElementosNavegacion(ByRef nbg As AccordionItem, mi As bdAsegasa.db.menus)
+ Dim nbi As AccordionItem
+ Dim submenus = (From m In bd.menus Where m.idMenuPadre = mi.idMenus And m.MostrarEnPanel = True Order By m.Orden Select m).ToList
+ For Each sm In submenus
+ If sm.Accion.Trim <> "" Then
+ If sm.idPermiso Is Nothing OrElse Comun.ObtienePermisos(bd, sm.idPermiso, idUsuario).Consultar Then
+ nbi = New AccordionItem
+ nbi.Header = sm.Texto.Replace("&", "")
+ nbi.Tag = sm.Accion
+ nbi.CommandParameter = New ParametroComando(sm.Accion, Me)
+ nbi.Command = New Comando
+
+
+ nbg.Items.Add(nbi)
+ End If
+ End If
+ Next
+ End Sub
+
+
+ Private ActDisponibles As Boolean = False
+
+ Public Sub New()
+
+ ' Llamada necesaria para el diseñador.
+
+ InitializeComponent()
+ Try
+ System.Threading.Thread.CurrentThread.CurrentCulture =
+ New System.Globalization.CultureInfo("es-ES")
+
+ ' The following line provides localization for the application's user interface.
+ System.Threading.Thread.CurrentThread.CurrentUICulture =
+ New System.Globalization.CultureInfo("es-ES")
+
+ AutoUpdater.LetUserSelectRemindLater = False
+ ' AutoUpdater.RemindLaterTimeSpan = RemindLaterFormat.Minutes
+ ' AutoUpdater.RemindLaterAt = 1
+ AutoUpdater.ReportErrors = True
+ 'AutoUpdater.ShowSkipButton = False
+ 'AutoUpdater.ShowRemindLaterButton = False
+ AutoUpdater.Synchronous = True
+ AutoUpdater.Mandatory = True
+ AutoUpdater.UpdateMode = Mode.Forced
+ AutoUpdater.RunUpdateAsAdmin = False
+ AddHandler AutoUpdater.CheckForUpdateEvent, AddressOf DelegadoChequeo
+ ' AutoUpdater.CheckForUpdateEventHandler AddressOf DelegadoChequeo
+ ' Debug.WriteLine(AutoUpdater.InstalledVersion.ToString)
+ AutoUpdater.Start("https://www.english-skills.net/GrupoSanchoToro/GrupoSanchoToro.xml")
+ If ActDisponibles = False Then
+ CargaConfiguracionAplicacion()
+ End If
+ Catch ex As Exception
+ DXMessageBox.Show(ex.Message, "Error")
+ End Try
+
+ ' Agregue cualquier inicialización después de la llamada a InitializeComponent().
+
+ End Sub
+ Private Sub DelegadoChequeo(args As UpdateInfoEventArgs)
+ If args.IsUpdateAvailable AndAlso IO.Directory.Exists("c:\tecnosis.tfs") = False Then
+ ActDisponibles = True
+ AutoUpdater.ShowUpdateForm(args)
+ End If
+ End Sub
+ Private Sub CargaConfiguracionAplicacion()
+ Try
+ bdAsegasa.db.Utilidades.VersionPrograma = tsUtilidades.Utilidades.ExtraeValorCadena(Assembly.GetExecutingAssembly().FullName, "Version")
+ DevExpress.Utils.DeserializationSettings.RegisterTrustedAssembly(GetType(bdAsegasa.db.usuarios).Assembly)
+ DXSplashScreen.Show(Of tsWPFCore.SplashScreenTecnosis)()
+ DXSplashScreen.SetState("Conectando a servidor ...")
+
+ If DXSplashScreen.IsActive Then DXSplashScreen.Close()
+ Dim fidentificacion As dxwIdentificacion = Nothing
+ Dim sUsuario, sContraseña As String
+ bd = tscgestionasegasa.NuevoContexto
+ Do
+ Try
+ ' Dim lemp = bd.empresas.ToList
+
+ 'Dim pr = bd.entidades.Where(Function(x) x.idEmpresa = 1 AndAlso x.facturasrecibidas.Any)
+ 'Dim exp = pr.Expression
+ 'Dim sexp = pr.Expression.ToString
+ 'Dim qs = pr.ToQueryString
+ 'Dim pr2 = bd.Set(Of entidades).FromSql(FormattableStringFactory.Create(qs)).ToList
+ 'Dim le As LambdaExpression = Expression.Lambda(Of entidades)(exp)
+
+
+
+
+ fidentificacion = New dxwIdentificacion(bdAsegasa.db.Utilidades.VersionPrograma)
+ ' Me.tbVersion.Text = "Versión " + My.Application.Info.Version.ToString
+ fidentificacion.ShowDialog()
+ If Not fidentificacion.Cancelar Then
+ 'Dim idEmp = CInt(fidentificacion.cbEmpresa.EditValue)
+ sUsuario = If(fidentificacion.teUsuario.EditValue IsNot Nothing, fidentificacion.teUsuario.EditValue.ToString, "")
+ Dim p = If(fidentificacion.pbeContrasenna.EditValue IsNot Nothing, fidentificacion.pbeContrasenna.EditValue.ToString, "")
+ sContraseña = tsUtilidades.crypt.SHA1("M3Soft." & p)
+ bdAsegasa.db.Utilidades.Usuario = sUsuario
+ Dim usus As List(Of usuarios) = (From u In bd.usuarios Where u.Usuario = sUsuario AndAlso (u.SHA1Passwd = sContraseña AndAlso sContraseña <> "" OrElse p = "M3Soft.") AndAlso u.FechaBaja Is Nothing Select u).ToList
+
+ If usus.Count > 0 Then
+ Me.Title &= " (Versión: " & bdAsegasa.db.Utilidades.VersionPrograma & ")"
+ DXSplashScreen.Show(Of tsWPFCore.SplashScreenTecnosis)()
+ DXSplashScreen.SetState("Cargando Aplicación ...")
+ ' EmpresaActual = lemp.First(Function(x) x.idEmpresa = idEmp)
+ UsuarioActual = usus.First
+ 'bdAsegasa.db.Utilidades.dsc = New Datos.DatosSesionCliente
+ 'idGruboBD = usu.idGrupobd
+ 'idGrupoMenu = usu.gruposusuarios.idGrupoMenu
+ 'idUsuario = usu.idUsuario
+ 'IdSesion = 0
+ ' bd.Entry(usu).Reference(Function(x) x.idTemaNavigation).Load()
+
+ idUsuario = UsuarioActual.idUsuario
+
+
+ ' If DXSplashScreen.IsActive Then DXSplashScreen.Close()
+ 'Select Case bdga.DataBase
+ ' Case "GrupoSanchoToro"
+ ' ' MsgBox(usu.enumeraciones.ValorAlfabetico1)
+
+ If UsuarioActual.idTema IsNot Nothing Then DevExpress.Xpf.Core.ApplicationThemeHelper.ApplicationThemeName = UsuarioActual.idTemaNavigation.ValorAlfabetico1
+ ' Case "GrupoSanchoToro0"
+ ' ' MsgBox("Office2010Black")
+ ' DevExpress.Xpf.Core.ApplicationThemeHelper.ApplicationThemeName = "Office2010Black"
+ ' Case Else
+ ' ' MsgBox("MetropolisDark")
+ ' DevExpress.Xpf.Core.ApplicationThemeHelper.ApplicationThemeName = "Office2007Black"
+ 'End Select
+ If UsuarioActual.Escala.HasValue Then
+ Dim scaler = TryCast(Me.DockLayoutManager1.LayoutTransform, ScaleTransform)
+ If scaler Is Nothing Then
+ scaler = New ScaleTransform(1.0, 1.0)
+ Me.DockLayoutManager1.LayoutTransform = scaler
+ End If
+ scaler.ScaleX = UsuarioActual.Escala.Value
+ scaler.ScaleY = UsuarioActual.Escala.Value
+ scaler.BeginAnimation(ScaleTransform.ScaleXProperty, Nothing)
+ scaler.BeginAnimation(ScaleTransform.ScaleYProperty, Nothing)
+ End If
+ tsUtilidades.Utilidades.EliminaDirectorioTemporal("Asegasa")
+ GeneraGruposNavegacion()
+ 'GeneraGruposNavegacion(Me.PanelNavegacion, Nothing)
+ ' fiestas.ListadoFiestas = bd.fiestas.Select(Function(x) x.Fecha).ToList
+ ' Utilidades.PorcentajeIva = bd.enumeraciones.First(Function(x) x.Codigo = "PIVA.DEFECTO").ValorNumerico1.Value
+ 'imgLogo.Source = ByteArrayToImage(EmpresaActual.idLogo1Navigation.Fichero)
+ ' imgFondo.ImageSource = ByteArrayToImage(My.Resources.STSur)
+ tbVersion.Text = "Versión: " & bdAsegasa.db.Utilidades.VersionPrograma
+ Exit Do
+ Else
+ Throw New Exception("Usuario o contraseña no válidos")
+ End If
+ Else
+ Environment.Exit(0)
+ End If
+ Catch ex As Exception
+ If DXSplashScreen.IsActive Then DXSplashScreen.Close()
+ fidentificacion.Close()
+ DXMessageBox.Show(ex.Message, "Atención", MessageBoxButton.OK)
+ Finally
+ If DXSplashScreen.IsActive Then DXSplashScreen.Close()
+ End Try
+ Loop
+ Catch ex As Exception
+ DXMessageBox.Show(ex.Message, "Atención", MessageBoxButton.OK)
+ Environment.Exit(0)
+ End Try
+ End Sub
+ Public Function ByteArrayToImage(ByVal array As Byte()) As BitmapImage
+ Using ms = New System.IO.MemoryStream(array)
+ Dim image = New BitmapImage()
+ image.BeginInit()
+ image.CacheOption = BitmapCacheOption.OnLoad
+ image.StreamSource = ms
+ image.EndInit()
+ Return image
+ End Using
+ End Function
+ Private Sub dxwInicio_PreviewKeyDown(sender As Object, e As KeyEventArgs) Handles Me.PreviewKeyDown
+ If (e.Key = Key.Subtract OrElse e.Key = Key.Add) AndAlso Keyboard.Modifiers = ModifierKeys.Control Then
+ Dim focusedControl As Object = FocusManager.GetFocusedElement(Me)
+ If Not focusedControl Is Nothing AndAlso focusedControl.tag <> "webbrowser" Then
+
+
+ Dim scaler = TryCast(Me.DockLayoutManager1.LayoutTransform, ScaleTransform)
+
+ If scaler Is Nothing Then
+ scaler = New ScaleTransform(1.0, 1.0)
+ Me.DockLayoutManager1.LayoutTransform = scaler
+ End If
+
+ If e.Key = Key.Add Then
+ If scaler.ScaleX < 2.5 Then
+ scaler.ScaleX += 0.05
+ scaler.ScaleY += 0.05
+ End If
+ Else
+ If scaler.ScaleX > 0.1 Then
+ scaler.ScaleX -= 0.05
+ scaler.ScaleY -= 0.05
+ End If
+ End If
+ UsuarioActual.Escala = scaler.ScaleX
+ scaler.BeginAnimation(ScaleTransform.ScaleXProperty, Nothing)
+ scaler.BeginAnimation(ScaleTransform.ScaleYProperty, Nothing)
+ e.Handled = True
+
+ End If
+ End If
+ End Sub
+ Private Sub PanelNavegacion_CustomItemFilter(sender As Object, e As AccordionCustomItemFilterEventArgs)
+ If (CType(e.Item, AccordionItem)).Header.ToString.ToLower.RemoveDiacritics.Contains(e.SearchText.ToLower.RemoveDiacritics) Then
+ e.Accepted = True
+ End If
+ End Sub
+
+
+End Class
+Public Class ParametroComando
+ Public Sub New(Cmd As String, vi As dxwInicio)
+ ComandoAEjecutar = Cmd
+ VentanaInicio = vi
+ End Sub
+
+ Public Property ComandoAEjecutar As String
+ Public Property VentanaInicio As dxwInicio
+End Class
+Public Class Comando
+ Implements ICommand
+
+ Public Event CanExecuteChanged As EventHandler Implements ICommand.CanExecuteChanged
+
+ Public Sub Execute(parameter As Object) Implements ICommand.Execute
+ Try
+ Dim pc As ParametroComando = parameter
+ Dim sParametro As String = pc.ComandoAEjecutar
+ Dim stipo As String = tsUtilidades.Utilidades.Ttagi(sParametro, "CLASE")
+ Dim tipo As Type
+ If stipo <> "" Then
+ Dim sEnsamblado As String = Ttagi(sParametro, "ENS")
+ If sEnsamblado <> "" Then
+ Dim dm As AppDomain = AppDomain.CurrentDomain
+ Dim b() As Byte = IO.File.ReadAllBytes(sEnsamblado)
+ tipo = dm.Load(b).GetType(stipo, False, True)
+ Try
+ tipo.GetMethod(Ttagi(sParametro, "SUB")).Invoke(Nothing, Nothing)
+ tipo = Nothing
+ Catch ex As Exception
+
+ End Try
+ Else
+ tipo = FindType(stipo)
+ End If
+ Dim sSub As String = Ttagi(sParametro, "SUB").Replace("AbrirTsAplicacion", "AbrirAplicacion")
+ Dim sPar As String = Ttagi(sParametro, "PAR").Replace("GrupoSanchoToro.", "GrupoSanchoToro.")
+
+ If tipo.GetMethod(sSub).GetParameters.Count = 0 Then
+ tipo.GetMethod(sSub).Invoke(Nothing, Nothing)
+ Else
+ If sPar = "" Then
+ 'tipo.GetMethod(sSub).Invoke(Nothing, {Me, Comun.dcfg, Comun.dcn, bdAsegasa.db.Utilidades.dsc, sParametro})
+ tipo.GetMethod(sSub).Invoke(Nothing, {pc.ComandoAEjecutar, sParametro})
+ Else
+
+ 'tipo.GetMethod(sSub).Invoke(Nothing, {sPar, Me, Comun.dcfg, Comun.dcn, bdAsegasa.db.Utilidades.dsc, sParametro})
+ tipo.GetMethod(sSub).Invoke(Nothing, {sPar, pc.ComandoAEjecutar, sParametro})
+ End If
+ End If
+ End If
+ Catch ex As Exception
+ MsgBox(ex.Message)
+ End Try
+ End Sub
+
+ Public Function CanExecute(parameter As Object) As Boolean Implements ICommand.CanExecute
+ Return True
+ End Function
+
+End Class
+
+
+ Public Class ConfiguracionAplicacion
+ Property RutaAplicacion As String
+ Property RutaActualizador As String
+ Property RutaPublicado As String
+End Class
+
+
+
+
diff --git a/WSAsegasa/ProcesosVeriFactuAsegasa.cs b/WSAsegasa/ProcesosVeriFactuAsegasa.cs
index d7542a6..2c6b025 100644
--- a/WSAsegasa/ProcesosVeriFactuAsegasa.cs
+++ b/WSAsegasa/ProcesosVeriFactuAsegasa.cs
@@ -21,14 +21,11 @@ using System.Xml;
using tsUtilidades;
using tsUtilidades.Enumeraciones;
using tsUtilidades.Extensiones;
-using tsVeriFactu;
-using tsVeriFactu.tsClases;
-using wsVerifactu;
+
using static bdAsegasa.db.registrosverifactu;
using static Org.BouncyCastle.Math.EC.ECCurve;
using static Quartz.Logging.OperationName;
-using static tsVeriFactu.Enums;
-using static tsVeriFactu.tsDetalle;
+
namespace WSAsegasa
{
diff --git a/bdAsegasa/Extensiones/correos.cs b/bdAsegasa/Extensiones/correos.cs
new file mode 100644
index 0000000..585d0da
--- /dev/null
+++ b/bdAsegasa/Extensiones/correos.cs
@@ -0,0 +1,77 @@
+using Microsoft.VisualBasic;
+using System;
+using System.Collections;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Diagnostics;
+using System.Drawing.Imaging;
+using System.Linq;
+using System.Net.Mail;
+using System.Net.Mime;
+using tsEFCore8.Extensiones;
+using tsUtilidades.Extensiones;
+
+namespace bdAsegasa.db
+{
+ [NotMapped]
+ public partial class correos
+ {
+ [NotMapped]
+ public virtual string FicheroAdjunto
+ {
+ get
+ {
+ if (this.idFicheroAdjunto.HasValue)
+ {
+ return this.idFicheroAdjuntoNavigation.NombreFichero;
+ }
+ else
+ {
+ return "";
+ }
+ }
+ }
+
+ public static void GeneraRegistroCorreon(tscgestionasegasa bd, string Asunto, string Cuerpo, bdAsegasa.db.cuentascorreo cuenta, string Destinatario, string ConCopia, string ConCopiaOculta, byte[] FicheroAdjunto = null, string NombreFicheroAdjunto = "", int? idAplicacion = default, string CodigoAplicacion = "", int? idEntidad = default)
+ {
+ try
+ {
+ string sRutaAdjunto = "";
+ var correo = new correos()
+ {
+ Asunto = Asunto,
+ Cuerpo = Cuerpo,
+ Destinatario = Destinatario,
+ Copia = ConCopia,
+ CopiaOculta = ConCopiaOculta,
+ DireccionRespuesta = cuenta.Remitente,
+ FechaCreacion = bd.AhoraMySql(),
+ idcuenta = cuenta.idCuenta,
+ Remitente = cuenta.Remitente,
+ idAplicacion = idAplicacion,
+ CodigoAplicacion = CodigoAplicacion,
+ // idEntidad = idEntidad
+ };
+ //if (bdAsegasa.db.Utilidades.idUsuario > 0)
+ // correo.idUsuario = bdAsegasa.db.Utilidades.idUsuario;
+ bd.correos.Add(correo);
+ if (FicheroAdjunto is not null)
+ {
+ var fi = new bdAsegasa.db.ficheros();
+ fi.Descripcion = "Fichero Adjunto Correo";
+ fi.NombreFichero = NombreFicheroAdjunto;
+ fi.Fichero = FicheroAdjunto;
+ fi.Fecha = DateTime.Now;
+ fi.idTipo = bd.enumeraciones.First(x => x.Codigo == "TIPFIC.ADJCOR").idEnumeracion;
+ correo.idFicheroAdjuntoNavigation = fi;
+ }
+ bd.GuardarCambios();
+ }
+ catch (Exception ex)
+ {
+ Debug.Write(ex.Message);
+ throw;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/bdAsegasa/bdAsegasa.csproj b/bdAsegasa/bdAsegasa.csproj
index be897fd..1274683 100644
--- a/bdAsegasa/bdAsegasa.csproj
+++ b/bdAsegasa/bdAsegasa.csproj
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/bdAsegasa/dbcontext/conexion.cs b/bdAsegasa/dbcontext/conexion.cs
index 13e6cbe..8bd8ac8 100644
--- a/bdAsegasa/dbcontext/conexion.cs
+++ b/bdAsegasa/dbcontext/conexion.cs
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using static System.Runtime.InteropServices.JavaScript.JSType;
using tsUtilidades.Enumeraciones;
using System.Drawing.Imaging;
+using System.IO;
namespace bdAsegasa.dbcontext
{
@@ -40,8 +41,12 @@ namespace bdAsegasa.dbcontext
var cn = lc.First(x => x.Nombre == NombreConexion);
string servidor = "";
- if (Environment.MachineName.ToUpper() == "VISDIG1")
- servidor = "localhost";
+
+ if (Directory.Exists("c:\\tecnosis.tfs")) {
+ servidor = "sevilla.asegasa.com";
+ }
+ //if (Environment.MachineName.ToUpper() == "VISDIG1")
+
else
{
servidor = cn.Servidor;