Imports System.Drawing.Drawing2D
Imports System.Globalization

Public Class Portada
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Portada))
        '
        'Portada
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image)
        Me.ClientSize = New System.Drawing.Size(400, 300)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
        Me.Name = "Portada"
        Me.Opacity = 0.7
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "Portada"

    End Sub

#End Region

    Private Sub Portada_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim Ciclo As Int32
        ' Declaración para form ovalado
        Dim objDraw As System.Drawing.Drawing2D.GraphicsPath = New System.Drawing.Drawing2D.GraphicsPath
        ' Generación de form ovalado
        objDraw.AddEllipse(0, 0, Me.Width, Me.Height)
        Me.Region = New Region(objDraw)

        ' Mostrar formulario
        Show()

        ' Abrir base de datos general
        SubAbrirTablaBDGral("SELECT * FROM Configuracion WHERE Usuario = '" & UsuarioActual & "'")
        SubAbrirTablaBDGral2("SELECT * FROM Empleador")
        Dim FTablaGral As DataRow = TTablaGral.Rows(0)
        Dim FTablaGral2 As DataRow = TTablaGral2.Rows(0)
        If Not FnErrorADONET(Me) Then
            ' Saber si ya tiene ClaveVersion
            If CDbl(FTablaGral2("DocEmpleado").ToString) = 0 Then
                ' El codigo versión no fue realizado con anterioridad
                ' Calcularlo con números aleatorios
                Randomize(CDbl(DateTimeFormatInfo.CurrentInfo.LongTimePattern))
                ' ATENCION: VERIFICAR SI HAY QUE MODIFICAR ECUACION
                FTablaGral2("DocEmpleado") = ((CInt(Rnd() * 10000)) ^ 2) + 315
                BDTablaGral2.Update(TTablaGral2)
                TTablaGral2.AcceptChanges()
            End If
            ' Determinar estado

            ' Configuración de preguntar antes de modificar o crear
            If CBool(FTablaGral("PreguntarCrearModificar").ToString) Then
                PreguntarCrearModificar = True
            Else
                PreguntarCrearModificar = False
            End If

        Else
            ' Se generó error
            ' ATENCION: 08/03/2008 SI DA ERROR NO DETERMINA ESTADO

        End If

        ' ATENCION: 22/03/2008 LO DAMOS POR ANULADO
        '' ATENCION: TEMPORARIO HASTA QUE HAYA TAREAS
        'For Ciclo = 0 To 10000000 : Next

        ' Cerrar ventana Portada
        Me.Close()
    End Sub
End Class
