Exemple #1
0
        private void toolStripButtonAddProducer_Click(object sender, EventArgs e)
        {
            FormProducer formProducer = new FormProducer()
            {
                Producer = new Producer()
            };

            if (formProducer.ShowDialog() == DialogResult.OK)
            {
                Producer.Insert(_connection, formProducer.Producer);
            }
        }
Exemple #2
0
 private void toolStripButtonUpdateProducer_Click(object sender, EventArgs e)
 {
     try
     {
         FormProducer formProducer = new FormProducer
         {
             Producer = (Producer)listViewProducers.SelectedItems[0].Tag
         };
         if (formProducer.ShowDialog() == DialogResult.OK)
         {
             listViewProducers.SelectedItems[0].SubItems[1].Text = formProducer.Producer.FirstName;
             listViewProducers.SelectedItems[0].SubItems[2].Text = formProducer.Producer.LastName;
             Producer.Update(_connection, formProducer.Producer);
         }
     }
     catch (System.ArgumentOutOfRangeException ex)
     {
         MessageBox.Show("Аргумент не выбран", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }