예제 #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
        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;
                            }
                        }
                    }
                }
            }
        }