/// <summary> /// Default values /// </summary> public FeederConfig() { Application = new ApplicationDB(); Hardware = new HardwareDB(); AllControlSets = new ControlSetsDB(); }
private void subButt_Click(object sender, EventArgs e) { HardwareProduct p = new HardwareProduct { Manufacturer = manufacturerTxt.Text, Title = titleTxt.Text, Description = descriptionTxt.Text }; if (priceTxt.Text == "") { p.Price = -1; } else { p.Price = Convert.ToDecimal(priceTxt.Text.Replace("$", "")); } if (!editForm) { HardwareDB.Insert(p); } else { p.ProductId = editProd.ProductId; HardwareDB.Update(p); } var form1 = (Form1)Tag; // set form1 to the Form1 class we tagged earlier form1.Form1_Load(); //refresh products list form1.Show(); Close(); }
private void Form1_Load(object sender, EventArgs e) { List <HardwareProduct> prod = HardwareDB.GetHardwareProducts(); for (int i = 0; i < prod.Count(); i++) { checkedListBox1.Items.Add(prod[i]); } }
private void deletebutt_Click(object sender, EventArgs e) { for (int i = 0; i < checkedListBox1.CheckedItems.Count; i++) { HardwareProduct h = (HardwareProduct)checkedListBox1.CheckedItems[i]; HardwareDB.Delete(h.ProductId); } Form1_Load(); }
public void Form1_Load() { checkedListBox1.Items.Clear(); List <HardwareProduct> prod = HardwareDB.GetHardwareProducts(); for (int i = 0; i < prod.Count(); i++) { checkedListBox1.Items.Add(prod[i]); } }