private void cbProductName_Update_SelectedIndexChanged(object sender, EventArgs e)
 {
     BusinessLayer.Component comp = (BusinessLayer.Component)cbProductName_Update.SelectedItem;
     if (comp != null)
     {
         txtComponentName_Update.Text          = comp.Name;
         txtCost_Update.Text                   = $"{comp.Cost.ToString("C", CultureInfo.GetCultureInfo("en-ZA"))}";
         cb_ComponentType_Update.SelectedIndex = (comp.Type - 1);
     }
 }
        //Deletes component from database
        private void btnDeleteProduct_Click(object sender, EventArgs e)
        {
            BusinessLayer.Component comp = (BusinessLayer.Component)cbProductName_Delete.SelectedItem;
            //WATCH STORED PROCEDURE RELATIONSHIP ORDER!!!
            management.Delete(comp.ID);

            RefreshAll();

            MessageBox.Show($"{comp.Name} successfully deleted", "Success", MessageBoxButtons.OK, MessageBoxIcon.None);
        }
        //TODO Correct multi-product group updates and move index increment to business layer Implement exception handling
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            List <MaterialSingleLineTextField> allFields = UpdateProductDetails();
            List <MaterialSingleLineTextField> numeric   = new List <MaterialSingleLineTextField>();

            if (!IsNullOrWhiteSpace(allFields) && IsNumeric(numeric) && IsInRange(cb_ComponentType_Update) &&
                IsInRange(cbProductName_Update) && IsInRange(cbProductGroup_Update))
            {
                BusinessLayer.Component comp = (BusinessLayer.Component)cbProductName_Update.SelectedItem;
                if (comp != null)
                {
                    management.Update(comp.ID, txtComponentName_Update.Text, (cb_ComponentType_Update.SelectedIndex + 1), double.Parse(txtCost_Update.Text), (cbProductGroup_Update.SelectedIndex + 1));
                    RefreshAll();
                    MessageBox.Show($"Updated {comp.Name} To {txtComponentName_Update.Text} {txtCost_Update.Text} {cb_ComponentType_Update.SelectedItem.ToString()}");
                }
            }
        }
        //Refreshes comboboxes datasource
        public void RefreshComponents()
        {
            bsComponents.Clear();


            if (product != null)
            {
                List <BusinessLayer.Component> components = new List <BusinessLayer.Component>();
                components.Clear();

                components = new BusinessLayer.Component().GetComponents();

                bsComponents.DataSource = components;

                cbProductName_Update.DataSource    = bsComponents;
                cbProductName_Update.DisplayMember = "Name";

                cbProductName_Delete.DataSource    = bsComponents;
                cbProductName_Delete.DisplayMember = "Name";
            }
        }