コード例 #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();
        }
コード例 #2
0
        private void ListaAnime_SelectedIndexChanged(object sender, EventArgs e)
        {
            ResetareControale();
            Anime a = adminAnime.GetAnime(ListaAnime.SelectedIndex);

            txtNume1.Text    = a.NumeAnime;
            txtSezoane.Text  = a.SezoaneAnime.ToString();
            txtEpisoade.Text = a.EpisoadeAnime.ToString();
            txtRecenzie.Text = a.NotaAnime.ToString();

            foreach (Control c in groupBoxStatus.Controls)
            {
                if (c.GetType() == typeof(RadioButton))
                {
                    if (a.OngoingAnime.ToString() == c.Text)
                    {
                        ((RadioButton)c).Checked = true;
                    }
                }
            }

            foreach (Control c in groupBoxType.Controls)
            {
                if (c.GetType() == typeof(RadioButton))
                {
                    if (a.TipulAnime.ToString() == c.Text)
                    {
                        ((RadioButton)c).Checked = true;
                    }
                }
            }

            foreach (Control c in groupBoxGenuri.Controls)
            {
                if (c.GetType() == typeof(CheckBox))
                {
                    foreach (var gen in a.GenAnime)
                    {
                        if (((CheckBox)c).Text == gen)
                        {
                            ((CheckBox)c).Checked = true;
                        }
                    }
                }
            }
        }
コード例 #3
0
        private void buttonStergere_Click(object sender, EventArgs e)
        {
            if (ListaAnime.SelectedIndex == 0 || ListaAnime.SelectedIndex == -1)
            {
                return;
            }

            Anime a = adminAnime.GetAnime(ListaAnime.SelectedIndex);

            if (adminAnime.DeleteAnime(a) == false)
            {
                label2.Visible   = true;
                label2.ForeColor = Color.DeepSkyBlue;
                label2.Text      = "Nici un anime nu a fost sters";
            }
            else
            {
                label2.Visible   = true;
                label2.ForeColor = Color.DeepSkyBlue;
                label2.Text      = "Animeul selectat a fost sters";
            }

            show();
        }
コード例 #4
0
        private void buttonAdaugare_Click(object sender, EventArgs e)
        {
            if (DateValide() == false)
            {
                label2.Visible   = true;
                label2.ForeColor = Color.DeepSkyBlue;
                label2.Text      = "Animeul nu a putut fi adaugat";
                return;
            }

            Anime anime1 = new Anime(txtNume1.Text, txtSezoane.Text, txtEpisoade.Text, txtRecenzie.Text);

            TypeAnime?typeAnime = GetTypeAnime();

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

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

            anime1.GenAnime = new List <string>();
            anime1.GenAnime.AddRange(genurileBifate);
            adminAnime.AddAnime(anime1);
            if (adminAnime.GetAnime(anime1.NumeAnime) == null)
            {
                label2.Visible   = true;
                label2.ForeColor = Color.DeepSkyBlue;
                label2.Text      = "Animeul nu a putut fi adaugat";
            }
            else
            {
                label2.Visible   = true;
                label2.ForeColor = Color.DeepSkyBlue;
                label2.Text      = "Animeul a fost adaugat";
            }
            ResetareControale();
            show();
        }
コード例 #5
0
        private void buttonCauta_Click(object sender, EventArgs e)
        {
            dataGridAnime.DataSource = null;
            dataGridAnime.DataSource = adminAnime.GetAnimeuri();
            lblMesaj.Text            = "Introduceti numele animeului cautat:";
            lblMesaj.ForeColor       = Color.Black;
            Anime a = adminAnime.GetAnime(txtNume2.Text);

            if (a == null)
            {
                dataGridAnime.DataSource = null;
                lblMesaj.Text            = "Animeul nu a fost gasit. Introduceti altul?";
                lblMesaj.ForeColor       = Color.Red;
            }
            else
            {
                dataGridAnime.DataSource = null;
                lblMesaj.Text            = "Animeul a fost gasit. Introduceti altul?";
                lblMesaj.ForeColor       = Color.Green;
                dataGridAnime.DataSource = adminAnime.GetAnimeL(txtNume2.Text);
            }

            txtNume2.Text = String.Empty;
        }