Ejemplo n.º 1
0
        private void buttonAddBook_Click(object sender, EventArgs e)
        {
            if (GetSelectedType() == typeof(Book))
            {
                DesignBookForm form         = new DesignBookForm();
                DialogResult   dialogResult = form.ShowDialog(this);
                if (dialogResult == DialogResult.OK)
                {
                    OnCreatedEntity(form.ResultBook);
                }
                form.Dispose();
            }

            if (GetSelectedType() == typeof(Journal))
            {
                DesignJournalForm form         = new DesignJournalForm();
                DialogResult      dialogResult = form.ShowDialog(this);
                if (dialogResult == DialogResult.OK)
                {
                    OnCreatedEntity(form.ResultJournal);
                }
                form.Dispose();
            }

            if (GetSelectedType() == typeof(Newspaper))
            {
                DesignNewspaperForm form         = new DesignNewspaperForm();
                DialogResult        dialogResult = form.ShowDialog(this);
                if (dialogResult == DialogResult.OK)
                {
                    OnCreatedEntity(form.ResultNewspaper);
                }
                form.Dispose();
            }
        }
Ejemplo n.º 2
0
        private void buttonUpdateSelected_Click(object sender, EventArgs e)
        {
            if (GetSelectedType() == typeof(Book))
            {
                List <Book> selectedBooks = GetSelectedBooks();
                foreach (Book selectedBook in selectedBooks)
                {
                    DesignBookForm form         = new DesignBookForm(selectedBook);
                    DialogResult   dialogResult = form.ShowDialog(this);
                    if (dialogResult == DialogResult.OK)
                    {
                        OnUpdatedEntity(form.ResultBook);
                    }
                    form.Dispose();
                }
            }

            if (GetSelectedType() == typeof(Journal))
            {
                List <Journal> selectedJournals = GetSelectedJournals();
                foreach (Journal selectedJournal in selectedJournals)
                {
                    DesignJournalForm form         = new DesignJournalForm(selectedJournal);
                    DialogResult      dialogResult = form.ShowDialog(this);
                    if (dialogResult == DialogResult.OK)
                    {
                        OnUpdatedEntity(form.ResultJournal);
                    }
                    form.Dispose();
                }
            }

            if (GetSelectedType() == typeof(Newspaper))
            {
                List <Newspaper> selectedNewspapers = GetSelectedNewspapers();
                foreach (Newspaper selectedNewspaper in selectedNewspapers)
                {
                    DesignNewspaperForm form         = new DesignNewspaperForm(selectedNewspaper);
                    DialogResult        dialogResult = form.ShowDialog(this);
                    if (dialogResult == DialogResult.OK)
                    {
                        OnUpdatedEntity(form.ResultNewspaper);
                    }
                    form.Dispose();
                }
            }
        }