private void button1_Click(object sender, EventArgs e)
        {
            if (createMode)
            {
                Phone phone = new Phone();
                phone.ManufacturerId = (int)comboBoxManuf.SelectedValue;
                phone.Name           = textBox1.Text;
                phone.Cost           = numericUpDown1.Value;


                dal.CreatePhone(phone);
            }
            else
            {
                ph.Cost           = numericUpDown1.Value;
                ph.Name           = textBox1.Text;
                ph.ManufacturerId = (int)comboBoxManuf.SelectedValue;

                dal.UpdatePhone(ph);
            }
        }
Beispiel #2
0
        private void btnNewPhone_Click(object sender, EventArgs e)
        {
            AddPhoneForm f      = new AddPhoneForm(allManufacturers);
            DialogResult result = f.ShowDialog(this);

            if (result == DialogResult.Cancel)
            {
                return;
            }

            Phone phone = new Phone();

            phone.ManufacturerId = (int)f.comboBoxManuf.SelectedValue;
            phone.Name           = f.textBox1.Text;
            phone.Cost           = f.numericUpDown1.Value;


            dal.CreatePhone(phone);

            this.gvPhonesList.Refresh();

            //MessageBox.Show("Новый объект добавлен");
        }