Example #1
0
 public User(int ID_, string nickname_, string password_, Birth birth_, Location place_, Email email_)
 {
     ID          = ID_;
     nickname    = nickname_;
     passwordMD5 = SHA512(password_);
     birth       = birth_;
     location    = place_;
     email       = email_;
 }
Example #2
0
 public User(string line)
 {
     string[] parts = line.Split(',');
     ID          = int.Parse(parts[0]);
     nickname    = parts[1];
     passwordMD5 = parts[2];
     birth       = new Birth(parts[3]);
     location    = new Location(parts[4]);
     email       = new Email(parts[5]);
 }
Example #3
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (Textbox_Email.Text == "" || Textbox_Email.Text == "EMAIL" || Textbox_Username.Text == "" || Textbox_Username.Text == "USERNAME" ||
                Passwordbox_First.ToString() == "" || Passwordbox_confirm.ToString() == "" || Combobox_country.Text == "" ||
                Textbox_State.Text == "" || Textbox_State.Text == "STATE" || Textbox_City.Text == "" ||
                Textbox_City.Text == "CITY" || Combobox_Day.Text == "" || Combobox_Month.Text == "" || Textbox_Year.Text == "")
            {
                Label_Incorrect.Content = "-Please, fill in the blanks";
            }
            else
            {
                if (Textbox_Email.Text.Contains("@") & Textbox_Email.Text.Contains("."))
                {
                    if (Passwordbox_First.Password.Length < 8 || Passwordbox_First.Password.Length > 15)
                    {
                        Label_Incorrect.Content = "-Your password is either short or too large!";
                    }
                    else
                    {
                        if (Textbox_Year.Text.Length < 4)
                        {
                            Label_Incorrect.Content = "-The year of your birthday is incorrect!";
                        }
                        else
                        {
                            if (Passwordbox_First.Password != Passwordbox_confirm.Password)
                            {
                                Label_Incorrect.Content = "-Password doesn't match!";
                            }
                            else
                            {
                                bool validNickname = Login.validateJustUser(Textbox_Username.Text);
                                bool validEmail    = Login.validateEmail(Textbox_Email.Text);
                                if (validNickname)
                                {
                                    Label_Incorrect.Content = "This username is already in use!";
                                }
                                else
                                {
                                    if (validEmail)
                                    {
                                        Label_Incorrect.Content = "This email is already in use!";
                                    }
                                    else
                                    {
                                        Birth    birthie = new Birth(Combobox_Day.Text, Combobox_Month.Text, Textbox_Year.Text);
                                        Location loc     = new Location(Combobox_country.Text, Textbox_State.Text, Textbox_City.Text);
                                        Email    email   = new Email(Textbox_Email.Text);
                                        User     user    = new User(Data.getNextID(), Textbox_Username.Text, Passwordbox_First.ToString(), birthie, loc, email);
                                        Data.addUser(user);

                                        this.Hide();
                                        Window1 sistema = new Window1();
                                        sistema.ShowDialog();
                                        this.Close();
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    Label_Incorrect.Content = "-Your email is incomplete!";
                }
            }
        }