This commit is contained in:
2026-03-06 12:01:12 +01:00
15 changed files with 1109 additions and 22 deletions

View File

@@ -1,17 +1,15 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 18
VisualStudioVersion = 17.14.36414.22 VisualStudioVersion = 18.3.11505.172 d18.3
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WSAsegasa", "WSAsegasa\WSAsegasa.csproj", "{C891F2E3-60D2-449F-962A-BF78F58C67D6}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WSAsegasa", "WSAsegasa\WSAsegasa.csproj", "{C891F2E3-60D2-449F-962A-BF78F58C67D6}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bdAsegasa", "bdAsegasa\bdAsegasa.csproj", "{E42D668E-CB26-498B-89AF-8A205528C4EF}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bdAsegasa", "bdAsegasa\bdAsegasa.csproj", "{E42D668E-CB26-498B-89AF-8A205528C4EF}"
EndProject 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}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "APIFicheros", "APIFicheros\APIFicheros.csproj", "{729F814F-BBAF-A079-B0A1-D5890DA11543}"
EndProject 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 EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution 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}.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.ActiveCfg = Release|Any CPU
{E42D668E-CB26-498B-89AF-8A205528C4EF}.Release|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
{729F814F-BBAF-A079-B0A1-D5890DA11543}.Debug|Any CPU.Build.0 = 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.ActiveCfg = Release|Any CPU
{729F814F-BBAF-A079-B0A1-D5890DA11543}.Release|Any CPU.Build.0 = 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 {6995E4A5-BC07-42C2-8E8C-C09839886B7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DDFE8F31-9ED8-5C11-4E72-6CE96526C459}.Debug|Any CPU.Build.0 = Debug|Any CPU {6995E4A5-BC07-42C2-8E8C-C09839886B7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DDFE8F31-9ED8-5C11-4E72-6CE96526C459}.Release|Any CPU.ActiveCfg = Release|Any CPU {6995E4A5-BC07-42C2-8E8C-C09839886B7F}.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}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@@ -0,0 +1,9 @@
<Application x:Class="Application"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:GestionAsegasa"
StartupUri="dxwInicio.xaml">
<Application.Resources>
</Application.Resources>
</Application>

View File

@@ -0,0 +1,6 @@
Class Application
' Application-level events, such as Startup, Exit, and DispatcherUnhandledException
' can be handled in this file.
End Class

View File

@@ -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)
<Assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)>

412
GestionAsegasa/Comun.vb Normal file
View File

@@ -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

View File

@@ -0,0 +1,54 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows7.0</TargetFramework>
<RootNamespace>GestionAsegasa</RootNamespace>
<UseWPF>true</UseWPF>
<UseWindowsForms>False</UseWindowsForms>
</PropertyGroup>
<ItemGroup>
<Import Include="System.Windows" />
<Import Include="System.Windows.Controls" />
<Import Include="System.Windows.Data" />
<Import Include="System.Windows.Documents" />
<Import Include="System.Windows.Input" />
<Import Include="System.Windows.Media" />
<Import Include="System.Windows.Media.Imaging" />
<Import Include="System.Windows.Navigation" />
<Import Include="System.Windows.Shapes" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Autoupdater.NET.Official" Version="1.9.2" />
<PackageReference Include="DevExpress.Document.Processor" Version="23.2.3" />
<PackageReference Include="DevExpress.Document.Processor.es" Version="23.2.3" />
<PackageReference Include="DevExpress.Printing.Core" Version="23.2.3" />
<PackageReference Include="DevExpress.Printing.Core.es" Version="23.2.3" />
<PackageReference Include="DevExpress.Reporting.Core" Version="23.2.3" />
<PackageReference Include="DevExpress.Reporting.Core.es" Version="23.2.3" />
<PackageReference Include="DevExpress.Utils.UI" Version="23.2.3" />
<PackageReference Include="DevExpress.Utils.UI.es" Version="23.2.3" />
<PackageReference Include="DevExpress.Wpf.Accordion" Version="23.2.3" />
<PackageReference Include="DevExpress.Wpf.Accordion.es" Version="23.2.3" />
<PackageReference Include="DevExpress.Wpf.Printing" Version="23.2.3" />
<PackageReference Include="DevExpress.Wpf.Printing.es" Version="23.2.3" />
<PackageReference Include="DevExpress.Wpf.Reporting" Version="23.2.3" />
<PackageReference Include="DevExpress.Wpf.Reporting.es" Version="23.2.3" />
<PackageReference Include="DevExpress.Wpf.Spreadsheet" Version="23.2.3" />
<PackageReference Include="DevExpress.Wpf.Spreadsheet.es" Version="23.2.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.DynamicLinq" Version="8.7.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.7.1" />
<PackageReference Include="System.ServiceModel.Federation" Version="10.0.652802" />
<PackageReference Include="TSpdf.commons" Version="1.0.1" />
<PackageReference Include="TSpdfUtils" Version="1.0.15" />
<PackageReference Include="tsWPFCore" Version="1.3.9" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\bdAsegasa\bdAsegasa.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>true</MySubMain>
<MainForm>Form1</MainForm>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData>

View File

@@ -0,0 +1,44 @@
<dx:DXWindow x:Name="text" ShowIcon="False" ResizeMode="NoResize" WindowStyle="SingleBorderWindow"
x:Class="dxwIdentificacion"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:tsWPF="clr-namespace:tsWPFCore;assembly=tsWPFCore"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol"
Title="Identificación" Height="Auto" Width="390" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" WindowStartupLocation="CenterScreen" Topmost="True" >
<Grid x:Name="gc" Height="Auto" >
<dxlc:LayoutControl Header="Header" Orientation="Vertical" View="GroupBox" >
<dxlc:LayoutGroup Orientation="Vertical" Height="Auto" >
<tsWPF:tsLayoutItem Label="Usuario:" FontWeight="Bold" HorizontalAlignment="Stretch" TabIndex="1" Margin="0,10" >
<dxe:TextEdit Name="teUsuario" VerticalAlignment="Top" TabIndex="0" x:FieldModifier="Public" />
</tsWPF:tsLayoutItem>
<tsWPF:tsLayoutItem Label="Contraseña:" FontWeight="Bold" HorizontalAlignment="Stretch" TabIndex="1" Margin="0,10" >
<dxe:PasswordBoxEdit Name="pbeContrasenna" VerticalAlignment="Top" TabIndex="1" x:FieldModifier="Public"/>
</tsWPF:tsLayoutItem>
<!--<tsWPF:tsLayoutItem Label="Empresa:" FontWeight="Bold" HorizontalAlignment="Stretch" TabIndex="1" Margin="0,10" x:Name="liEmpresa" Visibility="Collapsed" >
<dxe:ComboBoxEdit TabIndex="1" x:Name="cbEmpresa" IsEnabled="True" ValueMember="idEmpresa" DisplayMember="RazonSocial" AutoComplete="True" />
</tsWPF:tsLayoutItem>-->
</dxlc:LayoutGroup>
<dxlc:LayoutGroup Orientation="Vertical" Margin="0,10" >
<dxlc:LayoutGroup >
<Button Content="Aceptar" Height="23" HorizontalAlignment="Left" Name="Button1" VerticalAlignment="Top" Width="121" />
<Button Content="Cancelar" Height="23" HorizontalAlignment="Right" Name="Button2" VerticalAlignment="Top" Width="121" />
</dxlc:LayoutGroup>
<Label x:Name="lVersion" Content="Versión:" FontSize="9" Height="23" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="200" />
</dxlc:LayoutGroup>
</dxlc:LayoutControl>
</Grid>
<!--<Grid x:Name="gc" >
<dxe:TextEdit HorizontalAlignment="Left" Margin="99,14,0,0" Name="teUsuario" VerticalAlignment="Top" Width="212" TabIndex="0" x:FieldModifier="Public" />
<Label Content="Usuario:" Height="28" HorizontalAlignment="Left" Margin="12,12,0,0" Name="Label1" VerticalAlignment="Top" Width="88" />
<Label Content="Contraseña:" Height="23" HorizontalAlignment="Left" Margin="12,55,0,0" Name="Label2" VerticalAlignment="Top" Width="79" />
<dxe:PasswordBoxEdit HorizontalAlignment="Left" Margin="97,56,0,0" Name="pbeContrasenna" VerticalAlignment="Top" Width="215" TabIndex="1" x:FieldModifier="Public"/>
<dxe:ComboBoxEdit TabIndex="1" x:Name="cbMunicipio" IsEnabled="True" ValueMember="CodigoMunicipio" DisplayMember="Nombre" AutoComplete="True" />
<Button Content="Aceptar" Height="23" HorizontalAlignment="Left" Margin="21,95,0,0" Name="Button1" VerticalAlignment="Top" Width="121" />
<Button Content="Cancelar" Height="23" HorizontalAlignment="Right" Margin="0,95,22,0" Name="Button2" VerticalAlignment="Top" Width="121" />
<Label x:Name="lVersion" Content="Versión:" FontSize="9" Height="23" HorizontalAlignment="Left" Margin="11,139,0,0" VerticalAlignment="Top" Width="200" />
</Grid>-->
</dx:DXWindow>

View File

@@ -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

View File

@@ -0,0 +1,43 @@
<dx:DXWindow
x:Class="dxwInicio"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxa="http://schemas.devexpress.com/winfx/2008/xaml/accordion"
Title="GrupoSanchoToro" Height="356" Width="570" xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" WindowState="Maximized" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" >
<dxdo:DockLayoutManager Name="DockLayoutManager1" MDIMergeStyle="Never" >
<dxdo:DockLayoutManager.LayoutRoot>
<dxdo:LayoutGroup Caption="LayoutRoot">
<dxdo:LayoutPanel Caption="Navegación" ItemWidth="220" MaxWidth="300" AllowClose="False" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="260"/>
</Grid.RowDefinitions>
<dxa:AccordionControl ShowSearchControl="True" x:Name="PanelNavegacion" CustomItemFilter="PanelNavegacion_CustomItemFilter" >
</dxa:AccordionControl>
<StackPanel Grid.Row="1" VerticalAlignment="Bottom" >
<Image Stretch="UniformToFill" x:Name="imgLogo" Source="/Resources/LogoTcsColor.png" />
<TextBlock x:Name="tbVersion" Margin="10">Versión:</TextBlock>
</StackPanel>
</Grid>
</dxdo:LayoutPanel>
<dxdo:DocumentGroup x:Name="grupodoc" SelectedTabIndex="0" MDIStyle="Default" AllowClose="False" DestroyOnClosingChildren="False" >
<!--<dxdo:DocumentGroup.Background>
<ImageBrush Stretch="Uniform" x:Name="imgFondo" />
</dxdo:DocumentGroup.Background>-->
<dxdo:DocumentGroup.Appearance>
<dxdo:Appearance>
<dxdo:Appearance.Active>
<dxdo:AppearanceObject></dxdo:AppearanceObject>
</dxdo:Appearance.Active>
</dxdo:Appearance>
</dxdo:DocumentGroup.Appearance>
</dxdo:DocumentGroup>
</dxdo:LayoutGroup>
</dxdo:DockLayoutManager.LayoutRoot>
</dxdo:DockLayoutManager>
</dx:DXWindow>

View File

@@ -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
<Serializable()> Public Class ConfiguracionAplicacion
Property RutaAplicacion As String
Property RutaActualizador As String
Property RutaPublicado As String
End Class

View File

@@ -21,14 +21,11 @@ using System.Xml;
using tsUtilidades; using tsUtilidades;
using tsUtilidades.Enumeraciones; using tsUtilidades.Enumeraciones;
using tsUtilidades.Extensiones; using tsUtilidades.Extensiones;
using tsVeriFactu;
using tsVeriFactu.tsClases;
using wsVerifactu;
using static bdAsegasa.db.registrosverifactu; using static bdAsegasa.db.registrosverifactu;
using static Org.BouncyCastle.Math.EC.ECCurve; using static Org.BouncyCastle.Math.EC.ECCurve;
using static Quartz.Logging.OperationName; using static Quartz.Logging.OperationName;
using static tsVeriFactu.Enums;
using static tsVeriFactu.tsDetalle;
namespace WSAsegasa namespace WSAsegasa
{ {

View File

@@ -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;
}
}
}
}

View File

@@ -7,8 +7,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.DynamicLinq" Version="8.6.7" /> <PackageReference Include="Microsoft.EntityFrameworkCore.DynamicLinq" Version="8.7.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.20" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.24" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.3" /> <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.3" />
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" /> <PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
<PackageReference Include="tsEFCore8" Version="1.0.1" /> <PackageReference Include="tsEFCore8" Version="1.0.1" />

View File

@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using static System.Runtime.InteropServices.JavaScript.JSType; using static System.Runtime.InteropServices.JavaScript.JSType;
using tsUtilidades.Enumeraciones; using tsUtilidades.Enumeraciones;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO;
namespace bdAsegasa.dbcontext namespace bdAsegasa.dbcontext
{ {
@@ -40,8 +41,12 @@ namespace bdAsegasa.dbcontext
var cn = lc.First(x => x.Nombre == NombreConexion); var cn = lc.First(x => x.Nombre == NombreConexion);
string servidor = ""; 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 else
{ {
servidor = cn.Servidor; servidor = cn.Servidor;