示例#1
0
 private void loginbutton_Click(object sender, EventArgs e)
 {
     if (validate_login() == true)
     {
         bool login = User.Login(username_login.Text.Trim(), password_login.Text.Trim());
         if (login == true)
         {
             Admin_Client admin = new Admin_Client();
             admin.Show();
             this.Hide();
         }
         else
         {
             load_login_error();
         }
     }
 }
示例#2
0
        private void registerbutton_Click(object sender, EventArgs e)
        {
            if (validate_register() == true)
            {
                User user = new User();
                user.first_name  = fn_register.Text.Trim();
                user.last_name   = ln_register.Text.Trim();
                user.middle_name = mn_register.Text.Trim();
                user.username    = username_register.Text.Trim();
                user.password    = password_register.Text.Trim();

                if (User.Register(user) == false)
                {
                    register_error.Text    = "Username already Taken! Choose another one";
                    register_error.Visible = true;
                }
                else
                {
                    Admin_Client admin = new Admin_Client();
                    admin.Show();
                    this.Hide();
                }
            }
        }