Imports System.data
Imports System.Data.OleDb
Imports System.io
Imports System.Drawing.Image
Public Class manager
    Dim dataadapter1 As New OleDbDataAdapter(" select * from cake ", conn)
    Dim dataadapter2 As New OleDbDataAdapter(" select * from coffee ", conn)
    Dim dataadapter3 As New OleDbDataAdapter(" select * from cupcake ", conn)
    Private Sub manager_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Label1.Text = Now

        PictureBox1.ImageLocation = Directory.GetCurrentDirectory & "\jan.jpg"
        GroupBox1.Visible = False
        GroupBox2.Visible = False
        GroupBox3.Visible = False


    End Sub

    Private Sub TabPage2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage2.Click

    End Sub

    Private Sub btmp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btmp.Click
        PictureBox1.ImageLocation = Directory.GetCurrentDirectory & "\feb.jpg"
    End Sub

    Private Sub btmn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btmn.Click
        PictureBox1.ImageLocation = Directory.GetCurrentDirectory & "\jan.jpg"
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        PictureBox1.ImageLocation = Directory.GetCurrentDirectory & "\mar.jpg"
    End Sub

 
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        PictureBox1.ImageLocation = Directory.GetCurrentDirectory & "\ap.jpg"
    End Sub

    Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Radcupcake.CheckedChanged
        'txtprice.Visible = False
        'Label5.Visible = True
        'Label6.Visible = True
        'Label7.Visible = True
        'txtsmall.Visible = True
        'txtmedium.Visible = True
        'txtlarge.Visible = True

        GroupBox1.Hide()
        GroupBox2.Hide()
        GroupBox3.Show()




        conn.Open()

        dataadapter3.Fill(dataset1, "cupcake1")

        tname.DataBindings.Clear()
        tname.DataBindings.Add("text", dataset1, "cupcake1.cupname")

        tsmall.DataBindings.Clear()
        tsmall.DataBindings.Add("text", dataset1, "cupcake1.small")

        tmedium.DataBindings.Clear()
        tmedium.DataBindings.Add("text", dataset1, "cupcake1.medium")

        tlarge.DataBindings.Clear()
        tlarge.DataBindings.Add("text", dataset1, "cupcake1.large")
        conn.Close()

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

     

        If Radcake.Checked = True Then
            conn.Open()
            Dim mycom As New OleDbCommand
            mycom.Connection = conn
            mycom.CommandType = CommandType.Text
            mycom.CommandText = "INSERT INTO cake(name,price)" & "values ('" & txtname.Text & "','" & txtprice.Text & "') "
            mycom.ExecuteNonQuery()
            dataset1.Clear()

            dataadapter1 = New OleDbDataAdapter("select * from cake", conn)
            dataadapter1.Fill(dataset1, "cake1")

            conn.Close()



        ElseIf Radcoffee.Checked = True Then
            conn.Open()
            Dim mycom As New OleDbCommand
            mycom.Connection = conn
            mycom.CommandType = CommandType.Text
            mycom.CommandText = "INSERT INTO coffee(coffeename ,small , medium , large)" & "values ('" & txtname2.Text & "','" & txtsmall2.Text & "','" & txtmedium2.Text & "','" & txtlarge2.Text & "') "
            mycom.ExecuteNonQuery()
            dataset1.Clear()

            dataadapter2 = New OleDbDataAdapter("select * from coffee", conn)
            dataadapter2.Fill(dataset1, "coffee1")
            conn.Close()
            MsgBox("suc")


        ElseIf Radcupcake.Checked = True Then
            conn.Open()
            Dim mycom As New OleDbCommand
            mycom.Connection = conn
            mycom.CommandType = CommandType.Text
            mycom.CommandText = "INSERT INTO cupcake(cupname ,small , medium , large)" & "values ('" & tname.Text & "','" & tsmall.Text & "','" & tmedium.Text & "','" & tlarge.Text & "') "
            mycom.ExecuteNonQuery()
            dataset1.Clear()

            dataadapter3 = New OleDbDataAdapter("select * from cupcake", conn)
            dataadapter3.Fill(dataset1, "cupcake1")
            conn.Close()
            MsgBox("suc")

        End If
       





    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        txtname.Text = ""
        txtprice.Text = ""
        txtsmall.Text = ""
        txtlarge.Text = ""
        txtmedium.Text = ""
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

    End Sub

    Private Sub TabPage1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Click

    End Sub

    Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Radcoffee.CheckedChanged
        ' txtprice.Visible = False
        'Label5.Visible = True
        'Label6.Visible = True
        'Label7.Visible = True
        'txtsmall.Visible = True
        'txtmedium.Visible = True
        'txtlarge.Visible = True
        GroupBox1.Hide()
        GroupBox3.Hide()

        GroupBox2.Show()




        conn.Open()

        dataadapter2.Fill(dataset1, "coffee1")
        txtname2.DataBindings.Clear()
        txtname2.DataBindings.Add("text", dataset1, "coffee1.coffeename")
        txtsmall2.DataBindings.Clear()
        txtsmall2.DataBindings.Add("text", dataset1, "coffee1.small")

        txtmedium2.DataBindings.Clear()
        txtmedium2.DataBindings.Add("text", dataset1, "coffee1.medium")

        txtlarge2.DataBindings.Clear()
        txtlarge2.DataBindings.Add("text", dataset1, "coffee1.large")
        conn.Close()

    End Sub

    Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Radcake.CheckedChanged
        ' txtprice.Visible = True
        'Label5.Visible = False
        'Label6.Visible = False
        'Label7.Visible = False
        'txtsmall.Visible = False
        'txtmedium.Visible = False
        'txtlarge.Visible = False
        GroupBox3.Hide()
        GroupBox2.Hide()

        GroupBox1.Show()




        conn.Open()

        dataadapter1.Fill(dataset1, "cake1")

        txtname.DataBindings.Clear()
        txtname.DataBindings.Add("text", dataset1, "cake1.name")

        txtprice.DataBindings.Clear()
        txtprice.DataBindings.Add("text", dataset1, "cake1.price")

        conn.Close()


    End Sub

    Private Sub GroupBox3_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox3.Enter

    End Sub
End Class