Imports System.Windows.Forms
Imports System.Data.SqlClient
Public Class MDIParent1
    Private m_ChildFormNumber As Integer
    Dim screenWidth = Screen.PrimaryScreen.Bounds.Width
    Dim screenHeight = Screen.PrimaryScreen.Bounds.Height
    Dim conn As New SqlConnection
    Dim cmd As New SqlCommand
    Dim dr As SqlDataReader
    Dim da As New SqlDataAdapter
    Dim ds As New DataSet : Dim ds1 As New DataSet : Dim ds2 As New DataSet : Dim ds3 As New DataSet
    Private Sub MDIParent1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        ConString = "Data Source=192.168.0.43;Initial Catalog=雪怡MES資料庫;Persist Security Info=True;User ID=b70340;Password=0911274990;Max pool size = 200;Connection Timeout=0"

        Label1.Text = "執行檔版本號 : " & 版本
        If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
        SQL1 = "SELECT 系統認證版本號 FROM 版本號管理01 "
        cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader
        If dr.Read() Then
            Label2.Text = "資料庫版本號 : " & dr("系統認證版本號")
        End If : conn.Close()
    End Sub
    Private Sub MDIParent1_SizeChanged(sender As Object, e As EventArgs) Handles Me.SizeChanged
        Me.BackgroundImage = My.Resources._1980X1010 : Me.BackgroundImageLayout = 3
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If Strings.Right(Label1.Text, 10) <> Strings.Right(Label2.Text, 10) Then
            MsgBox("系統版本號 與 資料庫版本號 對應不上，請W通知主管下載最新的執行檔。")
        Else
            MsgBox("待開發。")
        End If
    End Sub
    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        If Strings.Right(Label1.Text, 10) <> Strings.Right(Label2.Text, 10) Then
            MsgBox("系統版本號 與 資料庫版本號 對應不上，請W通知主管下載最新的執行檔。")
        Else
            薪資確認系統.Show()
        End If
    End Sub
    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        PA = InputBox("請刷卡登入") : 登入人職稱 = ""

        If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
        SQL1 = "SELECT 職稱 FROM 使用者權限管理表 WHERE ID卡號 LIKE '" & PA & "'"
        cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
        If dr.Read() Then : 登入人職稱 = dr("職稱").ToString : Else : 登入人職稱 = "" : End If
        conn.Close()
        If 登入人職稱 = "" Then
        Else
            If Val(Strings.Left(登入人職稱, 2)) <= 8 Then
                系統更新.Show()
            Else
                MsgBox("該卡片持有人無權限操作，如有需求請通知主管。")
            End If
        End If
    End Sub
End Class
