private void guna2ButtonRegister_Click(object sender, EventArgs e)
        {
            try
            {
                Login.AdminLogin();

                Student student = new Student(
                    "",
                    guna2TextBoxAddNameStudent.Text,
                    guna2TextBoxAddUsernameStudent.Text,
                    guna2TextBoxAddPasswordStudent.Text);

                string id = student.GeneratePrimaryKey();

                student.Id = id;

                student.Insert();

                Login.CloseConnection();

                MessageBox.Show("Berhasil Registrasi", "Info");

                this.Close();
            }
            catch (Exception error)
            {
                MessageBox.Show($"Gagal Regsitrasi, Error : {error.Message}", "Error");
            }
        }
示例#2
0
 public ActionResult Login(Account account)
 {
     if (ModelState.IsValid)
     {
         if (login.AdminLogin(account.AdminUsername, account.AdminPassword))
         {
             FormsAuthentication.SetAuthCookie(account.AdminUsername, true);
             Session["AdminID"]       = account.AdminID;
             Session["AdminUsername"] = account.AdminUsername;
             return(RedirectToAction("Home", "Action"));
         }
         else
         {
             ModelState.AddModelError("", "username and/or password is incorrect");
         }
     }
     return(View(account));
 }
示例#3
0
 private void guna2ButtonLogin_Click(object sender, EventArgs e)
 {
     try
     {
         if (guna2TextBoxUsername.Text != "" || guna2TextBoxPassword.Text != "")
         {
             Login.AdminLogin(guna2TextBoxUsername.Text, guna2TextBoxPassword.Text);
             session.SessionClear();
             session.Name = "Admin";
             session.Id   = "Admin";
             session.User = "******";
             MessageBox.Show("Koneksi Berhasil", "Info");
             this.Close();
         }
         else
         {
             MessageBox.Show("Username atau Password Tidak Boleh Kosong", "Info");
         }
     }
     catch (Exception error)
     {
         MessageBox.Show($"Gagal Login, Error : {error.Message}", "Error");
     }
 }
示例#4
0
 public string LoginPost([FromBody] LoginModel LoginDetails)
 {
     return(Login.AdminLogin(LoginDetails));
 }