Example #1
0
        private void buttonModificare_Click(object sender, EventArgs e)
        {
            Anime a = adminAnime.GetAnime(ListaAnime.SelectedIndex);

            if (DateValide() == false)
            {
                return;
            }

            a.NumeAnime = txtNume1.Text;

            a.NotaAnime     = Convert.ToDouble(txtRecenzie.Text);
            a.SezoaneAnime  = Convert.ToInt32(txtSezoane.Text);
            a.EpisoadeAnime = Convert.ToInt32(txtEpisoade.Text);

            TypeAnime?typeAnime = GetTypeAnime();

            if (typeAnime.HasValue)
            {
                a.TipulAnime = typeAnime.Value;
            }
            Status?status = GetStatus();

            if (status.HasValue)
            {
                a.OngoingAnime = status.Value;
            }

            a.GenAnime = new List <string>();
            a.GenAnime.AddRange(genurileBifate);
            adminAnime.RewriteAnime(a);

            show();
            ResetareControale();
        }
        private void buttonModificare_Click(object sender, EventArgs e)
        {
            if (ListaAnime.SelectedIndex == -1)
            {
                return;
            }
            Anime a = adminAnime.GetAnime(ListaAnime.SelectedIndex);

            if (DateValide() == false)
            {
                label2.Visible   = true;
                label2.ForeColor = Color.DeepSkyBlue;
                label2.Text      = "Animeul nu a putut fi modificat";
                return;
            }

            a.NumeAnime = txtNume1.Text;

            a.NotaAnime     = Convert.ToDouble(txtRecenzie.Text);
            a.SezoaneAnime  = Convert.ToInt32(txtSezoane.Text);
            a.EpisoadeAnime = Convert.ToInt32(txtEpisoade.Text);

            TypeAnime?typeAnime = GetTypeAnime();

            if (typeAnime.HasValue)
            {
                a.TipulAnime = typeAnime.Value;
            }
            Status?status = GetStatus();

            if (status.HasValue)
            {
                a.OngoingAnime = status.Value;
            }

            a.GenAnime = new List <string>();
            a.GenAnime.AddRange(genurileBifate);
            if (adminAnime.RewriteAnime(a) == false)
            {
                label2.Visible   = true;
                label2.ForeColor = Color.DeepSkyBlue;
                label2.Text      = "Animeul nu a putut fi modificat";
            }
            else
            {
                label2.Visible   = true;
                label2.ForeColor = Color.DeepSkyBlue;
                label2.Text      = "Animeul selectat a fost modificat";
            }

            show();
            ResetareControale();
        }