Imports System.Windows.Forms

Public Class MDICadastro

    Private Sub ShowNewForm(ByVal sender As Object, ByVal e As EventArgs) Handles NewWindowToolStripMenuItem.Click
        ' Create a new instance of the child form.
        Dim ChildForm As New System.Windows.Forms.Form
        ' Make it a child of this MDI form before showing it.
        ChildForm.MdiParent = Me

        m_ChildFormNumber += 1
        ChildForm.Text = "Window " & m_ChildFormNumber

        ChildForm.Show()
    End Sub

    Private Sub OpenFile(ByVal sender As Object, ByVal e As EventArgs)
        Dim OpenFileDialog As New OpenFileDialog
        OpenFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
        OpenFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
        If (OpenFileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then
            Dim FileName As String = OpenFileDialog.FileName
            ' TODO: Add code here to open the file.
        End If
    End Sub

    Private Sub SaveAsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim SaveFileDialog As New SaveFileDialog
        SaveFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
        SaveFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"

        If (SaveFileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then
            Dim FileName As String = SaveFileDialog.FileName
            ' TODO: Add code here to save the current contents of the form to a file.
        End If
    End Sub


    Private Sub ExitToolsStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        Me.Close()
    End Sub

    Private Sub CutToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles CutToolStripMenuItem.Click
        ' Use My.Computer.Clipboard to insert the selected text or images into the clipboard
    End Sub

    Private Sub CopyToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles CopyToolStripMenuItem.Click
        ' Use My.Computer.Clipboard to insert the selected text or images into the clipboard
    End Sub

    Private Sub PasteToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles PasteToolStripMenuItem.Click
        'Use My.Computer.Clipboard.GetText() or My.Computer.Clipboard.GetData to retrieve information from the clipboard.
    End Sub

    Private Sub ToolBarToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ToolBarToolStripMenuItem.Click

    End Sub

    Private Sub StatusBarToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles StatusBarToolStripMenuItem.Click
        Me.StatusStrip.Visible = Me.StatusBarToolStripMenuItem.Checked
    End Sub

    Private Sub CascadeToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles CascadeToolStripMenuItem.Click
        Me.LayoutMdi(MdiLayout.Cascade)
    End Sub

    Private Sub TileVerticalToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles TileVerticalToolStripMenuItem.Click
        Me.LayoutMdi(MdiLayout.TileVertical)
    End Sub

    Private Sub TileHorizontalToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles TileHorizontalToolStripMenuItem.Click
        Me.LayoutMdi(MdiLayout.TileHorizontal)
    End Sub

    Private Sub ArrangeIconsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ArrangeIconsToolStripMenuItem.Click
        Me.LayoutMdi(MdiLayout.ArrangeIcons)
    End Sub

    Private Sub CloseAllToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles CloseAllToolStripMenuItem.Click
        ' Close all child forms of the parent.
        For Each ChildForm As Form In Me.MdiChildren
            ChildForm.Close()
        Next
    End Sub

    Private m_ChildFormNumber As Integer

    Private Sub MDICadastro_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Text = "SSM Setri Sales Management - " & CStr(strRole) & ": " & CStr(strNomeUser)
        Call ArrumaTela()
    End Sub

    Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
        Dim frmCadastroRegiao As New frmCadastroRegiao
        With frmCadastroRegiao
            .MdiParent = Me
            .Show()
        End With
    End Sub

    Private Sub RegiãoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RegiãoToolStripMenuItem.Click
        Dim frmCadastroRegiao As New frmCadastroRegiao
        With frmCadastroRegiao
            .MdiParent = Me
            .Show()
        End With
    End Sub

    Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click
        Dim frmCadastroDivisao As New frmCadastroDivisao
        With frmCadastroDivisao
            .MdiParent = Me
            .Show()
        End With
    End Sub

    Private Sub DivisãoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DivisãoToolStripMenuItem.Click
        Dim frmCadastroDivisao As New frmCadastroDivisao
        With frmCadastroDivisao
            .MdiParent = Me
            .Show()
        End With
    End Sub

    Private Sub ToolStripButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton3.Click
        Dim frmConsultaFuncionario As New frmConsultaFuncionario
        With frmConsultaFuncionario
            .MdiParent = Me
            .Show()
        End With
    End Sub

    Private Sub FuncionáriosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FuncionáriosToolStripMenuItem.Click
        Dim frmConsultaFuncionario As New frmConsultaFuncionario
        With frmConsultaFuncionario
            .MdiParent = Me
            .Show()
        End With
    End Sub

    Private Sub ToolStripButton4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton4.Click
        Dim frmConsultaEmpresa As New frmConsultaEmpresa
        With frmConsultaEmpresa
            .MdiParent = Me
            .Show()
        End With
    End Sub

    Private Sub EmpresaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EmpresaToolStripMenuItem.Click
        Dim frmConsultaEmpresa As New frmConsultaEmpresa
        With frmConsultaEmpresa
            .MdiParent = Me
            .Show()
        End With

    End Sub

    Private Sub ToolStripButton6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton6.Click
        Dim frmConsultaVendas As New frmConsultaVendas
        With frmConsultaVendas
            .MdiParent = Me
            .Show()
        End With
    End Sub

    Private Sub VendasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VendasToolStripMenuItem.Click
        Dim frmConsultaVendas As New frmConsultaVendas
        With frmConsultaVendas
            .MdiParent = Me
            .Show()
        End With
    End Sub
    Private Sub ArrumaTela()
        'Verifica se o  Login é de Usuário ou Não
        If strRole = ("Usuário") Then
            ToolStripButton1.Visible = False
            ToolStripButton2.Visible = False
            ToolStripButton3.Visible = False
            ToolStripButton7.Visible = False
            RegiãoToolStripMenuItem.Visible = False
            DivisãoToolStripMenuItem.Visible = False
            FuncionáriosToolStripMenuItem.Visible = False
            ProdutosToolStripMenuItem.Visible = False
        Else
            ToolStripButton1.Visible = True
            ToolStripButton2.Visible = True
            ToolStripButton3.Visible = True
            ToolStripButton7.Visible = True
            RegiãoToolStripMenuItem.Visible = True
            DivisãoToolStripMenuItem.Visible = True
            FuncionáriosToolStripMenuItem.Visible = True
            ProdutosToolStripMenuItem.Visible = True
        End If

    End Sub

    Private Sub ToolStripButton8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton8.Click
        Dim frmRelatorio As New frmRelatorio
        With frmRelatorio
            .MdiParent = Me
            .WindowState = FormWindowState.Maximized
            .Show()
        End With
    End Sub
End Class
