Example #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || textBox4.Text == "" || textBox3.Text == "")
            {
                MessageBox.Show("All fields must be filled");
            }
            else
            {
                string s1 = Convert.ToString(textBox1.Text);
                bool   ok = true;

                for (int i = 0; i < s1.Length && ok; i++)
                {
                    if (s1[i] == '\'' || s1[i] == '.')
                    {
                        ok = false;
                    }
                }

                if (ok)
                {
                    bool      existentAlbum = false;
                    ArrayList list          = new ArrayList();
                    int       id            = connect.GetArtistId(this.artistName);
                    list = connect.ReadAlbumsForArtist("Select Name from Albums where [Artist.Id]=" + Convert.ToString(id));

                    foreach (string slist in list)
                    {
                        if (slist == textBox1.Text)
                        {
                            existentAlbum = true;
                        }
                    }

                    if (existentAlbum)
                    {
                        MessageBox.Show("The album already exists in the database.");
                    }
                    else
                    {
                        int artistId = connect.GetArtistId(this.artistName);

                        connect.AddAlbum(textBox1.Text, Convert.ToDateTime(textBox3.Text), textBox4.Text, artistId);

                        Add_Song newForm = new Add_Song(this.artistName, textBox1.Text, this.loggedArtist);
                        newForm.FormClosed += new FormClosedEventHandler(closeForm);
                        this.Hide();
                        newForm.Show();
                        newForm.Left = this.Left;
                        newForm.Top  = this.Top;
                    }
                }
                else
                {
                    MessageBox.Show("You cannot use the characters \' or .");
                }
            }
        }
Example #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            Add_Song newForm = new Add_Song(this.numeArtist, this.numeAlbum, this.loggedArtist);

            newForm.FormClosed += new FormClosedEventHandler(closeForm);
            this.Hide();
            newForm.Show();
            newForm.Left = this.Left;
            newForm.Top  = this.Top;
        }