Пример #1
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            int    flag = 0;
            string email = "", passwd = "";

            if (!string.IsNullOrEmpty(txtEmail.Text.Trim()))
            {
                email = txtEmail.Text;
            }
            else
            {
                flag             = 1;
                errEmail.Visible = true;
            }

            if (!string.IsNullOrEmpty(txtPassword.Text.Trim()))
            {
                passwd = txtPassword.Text;
            }
            else
            {
                flag = 1;
                errPassword.Visible = true;
            }

            if (flag == 0)
            {
                if (!chkArtist.Checked)
                {
                    if (user.loginListener(email, passwd) == 0)
                    {
                        errEmail.Visible    = false;
                        errPassword.Visible = false;
                        Ui_ListenerHome home = new Ui_ListenerHome();
                        home.populateHome(email, passwd);
                        home.Show();
                        this.Hide();
                    }
                    else
                    {
                        errEmail.Visible    = true;
                        errPassword.Visible = true;
                    }
                }
                else
                {
                    if (creator.loginArtist(email, passwd) == 0)
                    {
                        errEmail.Visible    = false;
                        errPassword.Visible = false;
                        Ui_ArtistHome home = new Ui_ArtistHome();
                        home.populateHome(email, passwd);
                        home.Show();
                        this.Hide();
                    }
                    else
                    {
                        errEmail.Visible    = true;
                        errPassword.Visible = true;
                    }
                }
            }
        }
Пример #2
0
        private void BtnUpdate_Click(object sender, EventArgs e)
        {
            if (list != null)
            {
                int flag = 0;

                Listener user = new Listener();

                MemoryStream ms = new MemoryStream();
                picUser.Image.Save(ms, picUser.Image.RawFormat);
                user.picture = ms.ToArray();


                user.fName = txtFname.Text;
                user.lName = txtLname.Text;
                user.email = userEmail;

                if (rbMale.Checked)
                {
                    user.gender = "M";
                }
                else if (rbFemale.Checked)
                {
                    user.gender = "F";
                }
                else
                {
                    errGender.Visible = true;
                    flag = 1;
                }

                if (flag == 0)
                {
                    user.updateListener();
                    list.populateHome(userEmail, userPasswd);
                    this.Close();
                }
            }
            else if (arts != null)
            {
                int flag = 0;

                Artist user = new Artist();

                MemoryStream ms = new MemoryStream();
                picUser.Image.Save(ms, picUser.Image.RawFormat);
                user.picture = ms.ToArray();


                user.fName = txtFname.Text;
                user.lName = txtLname.Text;
                user.email = userEmail;

                if (rbMale.Checked)
                {
                    user.gender = "M";
                }
                else if (rbFemale.Checked)
                {
                    user.gender = "F";
                }
                else
                {
                    errGender.Visible = true;
                    flag = 1;
                }

                if (flag == 0)
                {
                    user.updateArtist();
                    arts.populateHome(userEmail, userPasswd);
                    this.Close();
                }
            }
        }