예제 #1
0
        private void LabelSignIN_Click(object sender, EventArgs e)
        {
            this.Hide();
            SIGNin sIGNin = new SIGNin();

            sIGNin.Show();
        }
예제 #2
0
        private void btnSignUP_Click(object sender, EventArgs e)
        {
            try
            {
                Match matchPhone = Regex.Match(TextBoxPhone.Text, @"((\(\d{3}\) ?)|(\d{3}-))?\d{2}-\d{3}-\d{2}-\d{2}");
                Match matchMail  = Regex.Match(TextBoxEmail.Text, @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z");
                if (matchMail.Success && matchPhone.Success)
                {
                    if (TextBoxPassword.Text != TextBoxPass2.Text)
                    {
                        panelInfo.Visible       = true;
                        labelMessenge.ForeColor = Color.Red;
                        labelMessenge.Text      = "Password не совпадает";
                    }
                    else if (TextBoxName.Text != "Name" && TextBoxSurname.Text != "Surname" && TextBoxUsername.Text != "Username" && TextBoxPassword.Text != "Password" && TextBoxEmail.Text != "Email" && TextBoxPhone.Text != "(375)29-943-28-53" && TextBoxPass2.Text != "Password")
                    {
                        OleDbCommand command = new OleDbCommand("INSERT INTO Users (uName, uSurname, uEmail, uPhone, uUsername, uPassword, uPassword2) VALUES ('" + TextBoxName.Text + "', '" + TextBoxSurname.Text + "', '" + TextBoxEmail.Text + "', '" + TextBoxPhone.Text + "', '" + TextBoxUsername.Text + "', '" + TextBoxPassword.Text + "', '" + TextBoxPass2.Text + "')", myConnection);

                        myConnection.Open();
                        command.ExecuteNonQuery();
                        myConnection.Close();

                        this.Hide();
                        SIGNin sIGNin = new SIGNin();
                        sIGNin.Show();
                    }
                    else
                    {
                        if (TextBoxName.Text == "Name")
                        {
                            TextBoxName.BorderColor = Color.Red;
                        }
                        if (TextBoxSurname.Text == "Surname")
                        {
                            TextBoxSurname.BorderColor = Color.Red;
                        }
                        if (TextBoxEmail.Text == "Email")
                        {
                            TextBoxEmail.BorderColor = Color.Red;
                        }
                        if (TextBoxPhone.Text == "Phone")
                        {
                            TextBoxPhone.BorderColor = Color.Red;
                        }
                        if (TextBoxUsername.Text == "Username")
                        {
                            TextBoxUsername.BorderColor = Color.Red;
                        }
                        if (TextBoxPassword.Text == "Password")
                        {
                            TextBoxPassword.BorderColor = Color.Red;
                        }
                        if (TextBoxPass2.Text == "Password")
                        {
                            TextBoxPass2.BorderColor = Color.Red;
                        }
                        panelInfo.Visible       = true;
                        labelMessenge.ForeColor = Color.Red;
                        labelMessenge.Text      = "Есть пустые поля";
                    }
                }
                else
                {
                    panelInfo.Visible       = true;
                    labelMessenge.ForeColor = Color.Red;
                    labelMessenge.Text      = "Проверьте E-mail, Phone";
                }
            }
            catch
            {
                panelInfo.Visible       = true;
                labelMessenge.ForeColor = Color.Red;
                labelMessenge.Text      = "Пользователь с таким UserName уже зарегестрирован";
            }
        }