Example #1
0
        //
        //Редактирование экспозиций
        //
        private void bEditExp_Click(object sender, EventArgs e)
        {
            int id = IdConverter(dGVExpositionList);

            if (id > 0)
            {
                Expositions    exposition = db.Expositions.Find(id);
                FormExposition editForm   = new FormExposition(exposition);

                DialogResult result = editForm.ShowDialog(this);

                switch (result)
                {
                case DialogResult.Cancel:
                    return;

                case DialogResult.Abort:
                    dbDelete.ExpositionDel(editForm.exposition, db);
                    cbExposition_SelectionChangeCommitted(null, null);
                    CbExposition_Refresh();
                    dGVExpositionList.Refresh();
                    break;

                case DialogResult.OK:
                    dbEdit.ExpositionEdit(exposition, editForm.exposition, db);
                    CbExposition_Refresh();
                    dGVExpositionList.Refresh();
                    break;

                default:
                    Console.WriteLine("Ой-ой");
                    break;
                }
            }
        }
Example #2
0
        //
        //Добавление экспозиций
        //
        private void bAddExp_Click(object sender, EventArgs e)
        {
            FormExposition addForm = new FormExposition(null);
            DialogResult   result  = addForm.ShowDialog(this);

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

            if (dbAdd.ExpositionAdd(addForm.exposition, db))
            {
                dGVExpositionList.Refresh();
                CbExposition_Refresh();
                MessageBox.Show("Новый объект добавлен");
            }
            else
            {
                MessageBox.Show("Ай-ай");
            }
        }