Exemple #1
0
        private void OnAddItem(object sender, EventArgs e)
        {
            AllProductForm ItemsForm = new AllProductForm();

            ItemsForm.Owner = this;
            ItemsForm.Show();
        }
        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");
            }
        }