コード例 #1
0
ファイル: Login.cs プロジェクト: Cosmin3/DiscHouse
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || textBox2.Text == "")
            {
                MessageBox.Show("All fields must be filled");
            }
            else
            {
                int log;
                log = connect.CheckLogIn(textBox1.Text, textBox2.Text);

                if (log == -1)
                {
                    Artists_admin newForm = new Artists_admin();
                    newForm.FormClosed += new FormClosedEventHandler(closeForm);
                    this.Hide();
                    newForm.Show();
                    newForm.Left = this.Left;
                    newForm.Top  = this.Top;
                }
                else if (log == 1)
                {
                    Artists_user newForm = new Artists_user(connect.ArtistForUser(textBox1.Text));
                    newForm.FormClosed += new FormClosedEventHandler(closeForm);
                    this.Hide();
                    newForm.Show();
                    newForm.Left = this.Left;
                    newForm.Top  = this.Top;
                }
                else
                {
                    MessageBox.Show("User/Password incorrect");
                }
            }
        }
コード例 #2
0
ファイル: Albums_user.cs プロジェクト: Cosmin3/DiscHouse
        private void button5_Click(object sender, EventArgs e)
        {
            Artists_user newForm = new Artists_user(this.loggedArtist);

            newForm.FormClosed += new FormClosedEventHandler(closeForm);
            this.Hide();
            newForm.Show();
            newForm.Left = this.Left;
            newForm.Top  = this.Top;
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool      uniqueUser   = true;
            bool      hasArtist    = false;
            bool      userCreated  = false;
            bool      artistLinked = false;
            ArrayList list         = new ArrayList();

            list = connect.ReadUsers();
            foreach (string slist in list)
            {
                if (slist == textBox1.Text)
                {
                    uniqueUser = false;
                }
            }
            if (!uniqueUser)
            {
                MessageBox.Show("User taken");
            }
            else
            {
                if (textBox2.Text != textBox3.Text)
                {
                    MessageBox.Show("Passwords do not match");
                }
                else
                {
                    if (textBox4.Text != "45682")
                    {
                        MessageBox.Show("Wrong Registration Code");
                    }
                    else
                    {
                        if (comboBox1.SelectedItem.ToString() == "")
                        {
                            MessageBox.Show("Please choose an artist!");
                        }
                        else
                        {
                            userCreated = connect.AddUser(textBox1.Text, textBox2.Text);
                            if (!userCreated)
                            {
                                MessageBox.Show("Error at user");
                            }
                            int       idUser     = connect.GetUserId(textBox1.Text);
                            ArrayList artistList = connect.ReadArtists();
                            artistLinked = connect.UpdateArtist(idUser, artistList, comboBox1.SelectedItem.ToString());
                            if (!artistLinked)
                            {
                                MessageBox.Show("Error at link");
                            }
                            if (artistLinked && userCreated)
                            {
                                MessageBox.Show("User created");
                                Artists_user newForm = new Artists_user(comboBox1.SelectedItem.ToString());
                                newForm.FormClosed += new FormClosedEventHandler(closeForm);
                                this.Hide();
                                newForm.Show();
                                newForm.Left = this.Left;
                                newForm.Top  = this.Top;
                            }
                        }
                    }
                }
            }
        }