Exemplo n.º 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(textBox1.Text) && !String.IsNullOrEmpty(textBox2.Text))
     {
         DbEditor.AddCurrency(new Currency {
             Name = textBox1.Text, Code = textBox2.Text
         });
         Form1 MainForm = (Form1)this.Owner;
         MainForm.comboBox3.Items.Clear();
         MainForm.comboBox3.Items.AddRange(DbEditor.GetAllCurrency());
         this.Hide();
     }
     else
     {
         MessageBox.Show("Поля ввода не могут быть пустыми", "Внимание",
                         MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
     }
 }
Exemplo n.º 2
0
        public Form1()
        {
            InitializeComponent();



            AddToolStripMenuItem.Click    += new EventHandler(OnAddItem);
            RemoveToolStripMenuItem.Click += new EventHandler(RemoveItem);

            // Подгрузка из БД продавцов
            comboBox1.Items.Clear();
            comboBox1.Items.AddRange(DbEditor.GetAllSellers());

            // Подгрузка из БД покупателей
            comboBox2.Items.Clear();
            comboBox2.Items.AddRange(DbEditor.GetAllCustomers());

            // Подгрузка из БД валюты
            comboBox3.Items.Clear();
            comboBox3.Items.AddRange(DbEditor.GetAllCurrency());
            //contextMenu.Click += new EventHandler(OnAddItem);
        }