示例#1
0
        private void Loginbutton_Click(object sender, RoutedEventArgs e)
        {
            Client c = new Client();
            if (c.CheckOnRegister(textBoxEmail.Text))
                {
                //MessageBox.Show("welcome");
                    Journal j = new Journal();
                    j.Show();
                this.Close();
            }
            else
            {
                errormessage.Text = "Email is not found.To Register please Click on Register Button.";

            }
        }
示例#2
0
        private void submit_click(object sender, RoutedEventArgs e)
        {
            if (textBoxEmail.Text==null)
            {
                errormessage.Text = "Enter an email!";
                textBoxEmail.Focus();
            }
            else if (!Regex.IsMatch
                (textBoxEmail.Text, @"^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"))
            {
                errormessage.Text = "Enter a valid email.";
                textBoxEmail.Select(0, textBoxEmail.Text.Length);
                textBoxEmail.Focus();
            }
            else
            {
                string username = textBoxUsername.Text;
                string email = textBoxEmail.Text;
                int age = Convert.ToInt32(textBoxAge.Text);
                string password = passwordBox1.Password;

                if (passwordBox1.Password.Length == 0)
                {
                    errormessage.Text = "Enter password.";
                    passwordBox1.Focus();
                }
                else if (passwordBoxConfirm.Password.Length == 0)
                {
                    errormessage.Text = "Enter confirm password";
                    passwordBoxConfirm.Focus();
                }
                else if (passwordBox1.Password != passwordBoxConfirm.Password)
                {
                    errormessage.Text = "Confirm password must be same as password";
                    passwordBoxConfirm.Focus();
                }
                else if (!c.CheckOnRegister(textBoxEmail.Text))
                {
                    DoctorEntities db = new DoctorEntities();

                    User u = new User();
                    u.UserName = username;
                    u.Email = email;
                    u.Age = age;
                    u.Password = password;
                    db.User.Add(u);
                    db.SaveChanges();

                }
                else
                {

                }
                Journal j = new Journal();
                j.Show();
                this.Close();//ít will close registering page
            }
        }