private void button1_Click(object sender, EventArgs e) { button1.Enabled = false; comboBox1.Enabled = false; comboBox2.Enabled = false; comboBox3.Enabled = false; comboBox4.Enabled = false; bool choice_fill = false; if (comboBox1.SelectedItem != null && comboBox2.SelectedItem != null && comboBox3.SelectedItem != null && comboBox4.SelectedItem != null) { ComponentColor color1 = EnumParse.parseColorStrToEnum(comboBox4.SelectedItem.ToString()); int numberOfLockers = Int32.Parse(comboBox1.SelectedItem.ToString()); int width = Int32.Parse(comboBox2.SelectedItem.ToString()); int depth = Int32.Parse(comboBox3.SelectedItem.ToString()); ShoppingCart.addCupboardUserChoices(width, depth, numberOfLockers, color1); choice_fill = true; } else { MessageBox.Show("Fill every choices"); button1.Enabled = true; comboBox1.Enabled = true; comboBox2.Enabled = true; comboBox3.Enabled = true; comboBox4.Enabled = true; } if (choice_fill) { int widthChosen = ShoppingCart.widthChosen; if (widthChosen < 62) { comboBox6.Items.Clear(); comboBox6.Items.Add("none"); } comboBox5.Enabled = true; comboBox6.Enabled = true; comboBox7.Enabled = true; comboBox8.Enabled = true; comboBox9.Enabled = true; button2.Enabled = true; } }
public CatalogueComponents createComponents(int height, int width, int depth, ComponentColor color, PanelsType panelsType, string typeObj) { conn = new MySqlConnection(MyConString); conn.Open(); // 0 = code, 1 = in stock, 2 = price typeObj = typeObj + " " + EnumParse.parseTypeEnumToStr(panelsType); string price = DbUtils.BigMoney(conn, "CustPrice", typeObj, height.ToString(), depth.ToString(), width.ToString(), EnumParse.parseColorEnumToStr(color))[0]; conn.Close(); conn.Open(); string code = DbUtils.BigMoney(conn, "Code", typeObj, height.ToString(), depth.ToString(), width.ToString(), EnumParse.parseColorEnumToStr(color))[0]; conn.Close(); conn.Open(); bool inStock = int.Parse(DbUtils.BigMoney(conn, "Instock", typeObj, height.ToString(), depth.ToString(), width.ToString(), EnumParse.parseColorEnumToStr(color))[0]) > 0; ComponentSize size = new ComponentSize(height, width, depth); conn.Close(); return(new Panels(double.Parse(price), typeof(Panels).ToString().Split('.')[1], code, size, inStock, color, panelsType)); }