Ejemplo n.º 1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            RadioButton radioBtn = this.Controls.OfType <RadioButton>()
                                   .Where(x => x.Checked).FirstOrDefault();

            if (radioBtn != null)
            {
                switch (radioBtn.Name)
                {
                case "rbNewspaper":
                    AddNewspaperForm addNewspaperForm = new AddNewspaperForm();
                    addNewspaperForm.Show();
                    // this.Close();
                    break;

                case "rbMagazine":
                    AddMagazineForm addMagazineForm = new AddMagazineForm();
                    addMagazineForm.Show();
                    // this.Close();
                    break;

                case "rbScienceArticle":
                    AddScientificArticleForm addScientificArticle = new AddScientificArticleForm();
                    addScientificArticle.Show();
                    // this.Close();
                    break;

                case "rbFiction":
                    AddFictionForm addFiction = new AddFictionForm();
                    addFiction.Show();
                    // this.Close();
                    break;

                case "rbTechnicalLiterature":
                    AddTechnicalLiteratureForm addTechnicalLiterature = new AddTechnicalLiteratureForm();
                    addTechnicalLiterature.Show();
                    // this.Close();
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        private void listBoxShowLibrary_MouseDoubleClick(object sender, EventArgs e)
        {
            if (listBoxShowLibrary.SelectedItem is Fiction)
            {
                Fiction        fiction = (Fiction)listBoxShowLibrary.SelectedItem;
                AddFictionForm aff     = new AddFictionForm()
                {
                    ISBNValue            = fiction.ISBN,
                    TitleValue           = fiction.Title,
                    LanguageValue        = fiction.Language,
                    PublisherValue       = fiction.Publishers,
                    ReleaseDateValue     = fiction.ReleaseDate.ToString(),
                    AuthorValue          = fiction.Authors,
                    PageCountValue       = fiction.PageCount.ToString(),
                    EditionNumberValue   = fiction.EditionNumber.ToString(),
                    CoverTypeValue       = fiction.CoverType,
                    GenreValue           = fiction.Genre,
                    AudienceValue        = fiction.Audience,
                    CopiesAvailableValue = fiction.CopiesAvailable.ToString()
                };
                aff.btnAddArticle.Hide();
                aff.Show();
            }
            else if (listBoxShowLibrary.SelectedItem is Newspaper)
            {
                Newspaper        newspaper = (Newspaper)listBoxShowLibrary.SelectedItem;
                AddNewspaperForm anf       = new AddNewspaperForm()
                {
                    ISBNValue            = newspaper.ISBN,
                    TitleValue           = newspaper.Title,
                    LanguageValue        = newspaper.Language,
                    PublisherValue       = newspaper.Publishers,
                    YearPublishedValue   = newspaper.Year.ToString(),
                    EditionNumberValue   = newspaper.EditionNumber.ToString(),
                    TypeValue            = newspaper.Type,
                    EditorValue          = newspaper.Editor,
                    TopicValue           = newspaper.MainTopicForTheEdition,
                    CopiesAvailableValue = newspaper.CopiesAvailable.ToString()
                };
                anf.btnAddNewspaper.Hide();
                anf.Show();
            }
            else if (listBoxShowLibrary.SelectedItem is Magazine)
            {
                Magazine magazine = (Magazine)listBoxShowLibrary.SelectedItem;

                AddMagazineForm amf = new AddMagazineForm()
                {
                    ISBNValue             = magazine.ISBN,
                    TitleValue            = magazine.Title,
                    LanguageValue         = magazine.Language,
                    PublisherValue        = magazine.Publishers,
                    YearPublishedValue    = magazine.Year.ToString(),
                    EditionNumberValue    = magazine.EditionNumber.ToString(),
                    TopicValue            = magazine.Topic,
                    AuthorValue           = magazine.Authors,
                    CoverDescriptionValue = magazine.FrontCoverDescription,
                    CopiesAvailableValue  = magazine.CopiesAvailable.ToString()
                };
                amf.btnAddMagazine.Hide();
                amf.Show();
            }
            else if (listBoxShowLibrary.SelectedItem is ScientificArticle)
            {
                ScientificArticle article = (ScientificArticle)listBoxShowLibrary.SelectedItem;

                AddScientificArticleForm asaf = new AddScientificArticleForm()
                {
                    ISBNValue                 = article.ISBN,
                    TitleValue                = article.Title,
                    LanguageValue             = article.Language,
                    PublisherValue            = article.Publishers,
                    ReleaseDateValue          = article.ReleaseDate.ToString(),
                    AuthorValue               = article.Authors,
                    PageCountValue            = article.PageCount.ToString(),
                    ScientificFieldValue      = article.ScientificFiled,
                    RecomendedLiteratureValue = article.RecomendedLiterature,
                    CopiesAvailableValue      = article.CopiesAvailable.ToString()
                };
                asaf.btnAddArticle.Hide();
                asaf.Show();
            }
            else if (listBoxShowLibrary.SelectedItem is TechnicalLiterature)
            {
                TechnicalLiterature techLit = (TechnicalLiterature)listBoxShowLibrary.SelectedItem;

                AddTechnicalLiteratureForm atlf = new AddTechnicalLiteratureForm()
                {
                    ISBNValue            = techLit.ISBN,
                    TitleValue           = techLit.Title,
                    LanguageValue        = techLit.Language,
                    PublisherValue       = techLit.Publishers,
                    ReleaseDateValue     = techLit.ReleaseDate.ToString(),
                    AuthorValue          = techLit.Authors,
                    PageCountValue       = techLit.PageCount.ToString(),
                    EditionNumberValue   = techLit.EditionNumber.ToString(),
                    CoverTypeValue       = techLit.CoverType,
                    ScientificFieldValue = techLit.ScientificField,
                    AudienceLevelValue   = techLit.AudienceLevel,
                    CopiesAvailableValue = techLit.CopiesAvailable.ToString()
                };
                atlf.btnAddTechLit.Hide();
                atlf.Show();
            }
        }