private void button3_Click(object sender, EventArgs e)
 {
     if (this.FriedChicken.Checked)
     {
         bindingSourceFC[selectindex] = new FriedChicken(cbFC.Text, Convert.ToBoolean(cbSpacy.Checked), int.Parse(kaloriFC.Text));
     }
     else if (this.Pizza.Checked)
     {
         bindingSourcePizza[selectindex] = new Pizza(this.pizzanama.Text, this.Pizzatoping.Text, this.cbPizzaCrust.Text,
                                                     this.cbPizzaSize.Text, Convert.ToInt32(this.pizzakalori.Text));
     }
     else
     {
         if (!this.Hamburger.Checked)
         {
             return;
         }
         bindingSourceHamburger[selectindex] = new Hamburger(Convert.ToInt32(this.HPatty.Text), this.HpattyType.Text,
                                                             this.HExtraFiller.Text, Convert.ToInt32(this.Hcalory.Text));
     }
     selectindex = -1;
 }
        private void calculate_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.FriedChicken.Checked)
                {
                    if (this.kaloriFC.Text == string.Empty)
                    {
                        int num1 = (int)MessageBox.Show("Please fill all fields!!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        if (int.Parse(this.kaloriFC.Text) < 50)
                        {
                            Exception ex = new Exception("Kalori Kurang dari 50");
                            MessageBox.Show(ex.Message);
                        }
                        else
                        {
                            FriedChicken friedChicken = new FriedChicken(this.cbFC.Text, this.cbSpacy.Checked, Convert.ToInt32(this.kaloriFC.Text));
                            this.menuFC.Text  = friedChicken.MenuName;
                            this.hargaFC.Text = friedChicken.Price.ToString();
                        }
                    }
                }
                else if (this.Pizza.Checked)
                {
                    if (this.pizzakalori.Text == string.Empty)
                    {
                        int num2 = (int)MessageBox.Show("Please fill all fields!!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        if (int.Parse(this.pizzakalori.Text) < 50)
                        {
                            Exception ex = new Exception("Kalori Kurang dari 50");
                            MessageBox.Show(ex.Message);
                        }
                        else
                        {
                            Pizza pizza = new Pizza(this.pizzanama.Text, this.Pizzatoping.Text, this.cbPizzaCrust.Text, this.cbPizzaSize.Text, Convert.ToInt32(this.pizzakalori.Text));
                            this.PizzaMenuName.Text = pizza.MenuName;
                            this.PizzaHarga.Text    = pizza.Price.ToString();
                        }
                    }
                }

                else
                {
                    if (!this.Hamburger.Checked)
                    {
                        return;
                    }
                    if (this.Hcalory.Text == string.Empty)
                    {
                        int num3 = (int)MessageBox.Show("Please fill all fields!!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        if (int.Parse(this.Hcalory.Text) < 50)
                        {
                            Exception ex = new Exception("Kalori Kurang dari 50");
                            MessageBox.Show(ex.Message);
                        }
                        else
                        {
                            Hamburger hamburger = new Hamburger(Convert.ToInt32(this.HPatty.Text), this.HpattyType.Text, this.HExtraFiller.Text, Convert.ToInt32(this.Hcalory.Text));
                            this.HMenuName.Text = hamburger.MenuName;
                            this.Hprice.Text    = hamburger.Price.ToString();
                        }
                    }
                }
            }
            catch (FormatException)
            {
                MessageBox.Show("Field Harus string");
            }
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            dataGridView1.AutoGenerateColumns = true;
            dataGridView1.DataSource          = bindingSourceFC;
            dataGridView1.ReadOnly            = true;
            dataGridView1.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;
            dataGridView2.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;
            dataGridView3.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;
            dataGridView1.MultiSelect         = false;

            DataGridViewColumn dataGridViewColumn1 = (DataGridViewColumn) new DataGridViewTextBoxColumn();

            dataGridViewColumn1.DataPropertyName = "PartOfChicken";
            dataGridViewColumn1.Name             = "Chicken Part";
            this.dataGridView1.Columns.Add(dataGridViewColumn1);
            DataGridViewColumn dataGridViewColumn2 = (DataGridViewColumn) new DataGridViewTextBoxColumn();

            dataGridViewColumn2.DataPropertyName = "Calory";
            dataGridViewColumn2.Name             = "Calory";
            this.dataGridView1.Columns.Add(dataGridViewColumn2);
            DataGridViewColumn dataGridViewColumn3 = (DataGridViewColumn) new DataGridViewTextBoxColumn();

            dataGridViewColumn3.DataPropertyName = "MenuName";
            dataGridViewColumn3.Name             = "Menu Name";
            this.dataGridView1.Columns.Add(dataGridViewColumn3);
            DataGridViewColumn dataGridViewColumn4 = (DataGridViewColumn) new DataGridViewTextBoxColumn();

            dataGridViewColumn4.DataPropertyName = "Price";
            dataGridViewColumn4.Name             = "Price (Rp)";
            this.dataGridView1.Columns.Add(dataGridViewColumn4);
            DataGridViewColumn dataGridViewColumn5 = (DataGridViewColumn) new DataGridViewCheckBoxColumn();

            dataGridViewColumn5.DataPropertyName = "IsSpicy";
            dataGridViewColumn5.Name             = "Spicy";
            this.dataGridView1.Columns.Add(dataGridViewColumn5);
            this.dataGridView2.AutoGenerateColumns = false;
            this.dataGridView2.DataSource          = (object)this.bindingSourcePizza;
            DataGridViewColumn dataGridViewColumn6 = (DataGridViewColumn) new DataGridViewTextBoxColumn();

            dataGridViewColumn6.DataPropertyName = "PizzaName";
            dataGridViewColumn6.Name             = "Pizza Name";
            this.dataGridView2.Columns.Add(dataGridViewColumn6);
            DataGridViewColumn dataGridViewColumn7 = (DataGridViewColumn) new DataGridViewTextBoxColumn();

            dataGridViewColumn7.DataPropertyName = "Calory";
            dataGridViewColumn7.Name             = "Calory";
            this.dataGridView2.Columns.Add(dataGridViewColumn7);
            DataGridViewColumn dataGridViewColumn8 = (DataGridViewColumn) new DataGridViewTextBoxColumn();

            dataGridViewColumn8.DataPropertyName = "MenuName";
            dataGridViewColumn8.Name             = "Menu Name";
            this.dataGridView2.Columns.Add(dataGridViewColumn8);
            DataGridViewColumn dataGridViewColumn9 = (DataGridViewColumn) new DataGridViewTextBoxColumn();

            dataGridViewColumn9.DataPropertyName = "Size";
            dataGridViewColumn9.Name             = "Pizza Size";
            this.dataGridView2.Columns.Add(dataGridViewColumn9);
            DataGridViewColumn dataGridViewColumn10 = (DataGridViewColumn) new DataGridViewTextBoxColumn();

            dataGridViewColumn10.DataPropertyName = "Crust";
            dataGridViewColumn10.Name             = "Crust Type";
            this.dataGridView2.Columns.Add(dataGridViewColumn10);
            DataGridViewColumn dataGridViewColumn11 = (DataGridViewColumn) new DataGridViewTextBoxColumn();

            dataGridViewColumn11.DataPropertyName = "Topping";
            dataGridViewColumn11.Name             = "Topping Items";
            this.dataGridView2.Columns.Add(dataGridViewColumn11);
            DataGridViewColumn dataGridViewColumn12 = (DataGridViewColumn) new DataGridViewTextBoxColumn();

            dataGridViewColumn12.DataPropertyName = "Price";
            dataGridViewColumn12.Name             = "Price (Rp)";
            this.dataGridView2.Columns.Add(dataGridViewColumn12);
            this.dataGridView3.AutoGenerateColumns = false;
            this.dataGridView3.DataSource          = (object)this.bindingSourceHamburger;
            this.dataGridView3.ReadOnly            = true;
            DataGridViewColumn dataGridViewColumn13 = (DataGridViewColumn) new DataGridViewTextBoxColumn();

            dataGridViewColumn13.DataPropertyName = "MeatType";
            dataGridViewColumn13.Name             = "Patty Type";
            this.dataGridView3.Columns.Add(dataGridViewColumn13);
            DataGridViewColumn dataGridViewColumn14 = (DataGridViewColumn) new DataGridViewTextBoxColumn();

            dataGridViewColumn14.DataPropertyName = "NMeat";
            dataGridViewColumn14.Name             = "Number of Patty (pcs)";
            this.dataGridView3.Columns.Add(dataGridViewColumn14);
            DataGridViewColumn dataGridViewColumn15 = (DataGridViewColumn) new DataGridViewTextBoxColumn();

            dataGridViewColumn15.DataPropertyName = "Calory";
            dataGridViewColumn15.Name             = "Calory";
            this.dataGridView3.Columns.Add(dataGridViewColumn15);
            DataGridViewColumn dataGridViewColumn16 = (DataGridViewColumn) new DataGridViewTextBoxColumn();

            dataGridViewColumn16.DataPropertyName = "MenuName";
            dataGridViewColumn16.Name             = "Menu Name";
            this.dataGridView3.Columns.Add(dataGridViewColumn16);
            DataGridViewColumn dataGridViewColumn17 = (DataGridViewColumn) new DataGridViewTextBoxColumn();

            dataGridViewColumn17.DataPropertyName = "ExtraFiller";
            dataGridViewColumn17.Name             = "Extra Filler";
            this.dataGridView3.Columns.Add(dataGridViewColumn17);
            DataGridViewColumn dataGridViewColumn18 = (DataGridViewColumn) new DataGridViewTextBoxColumn();

            dataGridViewColumn18.DataPropertyName = "Price";
            dataGridViewColumn18.Name             = "Price (Rp)";
            this.dataGridView3.Columns.Add(dataGridViewColumn18);

            dataGridView1.Rows.Clear();
            System.IO.StreamReader file = new System.IO.StreamReader("fileFC.txt");
            string newline;

            while ((newline = file.ReadLine()) != null)
            {
                string[] values = newline.Split(';');

                FriedChicken dgv1 = new FriedChicken(
                    values[1], Convert.ToBoolean(values[0]), int.Parse(values[3]));
                bindingSourceFC.Add(dgv1);
            }
            file.Close();

            System.IO.StreamReader dg2 = new System.IO.StreamReader("filePizza.txt");

            while ((newline = dg2.ReadLine()) != null)
            {
                string[] data = newline.Split(';');

                Pizza dgv2 = new Pizza(data[0], data[5], data[4], data[3], int.Parse(data[1]));
                bindingSourcePizza.Add(dgv2);
            }
            dg2.Close();

            System.IO.StreamReader dg3 = new System.IO.StreamReader("fileHamburger.txt");

            while ((newline = dg3.ReadLine()) != null)
            {
                string[]  data2 = newline.Split(';');
                Hamburger dgv3  = new Hamburger(int.Parse(data2[1]), data2[0], data2[4], int.Parse(data2[2]));
                bindingSourceHamburger.Add(dgv3);
            }
            dg3.Close();
        }