예제 #1
0
 //public List<Product> ProductList;
 public AllProductForm()
 {
     InitializeComponent();
     comboBoxItems.Items.Clear();
     comboBoxItems.Items.AddRange(DbEditor.GetAllItems());
     comboBox2.SelectedIndex = 1;
 }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            AllProductForm AllProductFrm = (AllProductForm)this.Owner;

            if (File.Exists(DbPath))
            {
                Unit Unit = DbEditor.GetUnitById(comboBoxUnit.SelectedIndex + 1);
                DbEditor.AddItem(textBoxStuffName.Text, Convert.ToDouble(textBoxPrice.Text), Convert.ToDouble(textBoxVAT.Text), Unit.Name, Unit.Code);
                AllProductFrm.comboBoxItems.Items.Clear();
                AllProductFrm.comboBoxItems.Items.AddRange(DbEditor.GetAllItems());
                this.Hide();
            }
            else
            {
                throw new Exception("Database \"BH.db\" not found");
            }
        }