Exemplo n.º 1
0
        private void btn_next_Click(object sender, EventArgs e)
        {
            Empolyee_form f3 = new Empolyee_form();

            f3.Show();
            this.Hide();
        }
        private void btn_back_Click(object sender, EventArgs e)
        {
            Empolyee_form f4 = new Empolyee_form();

            f4.Show();
            this.Hide();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            if (Form1.role == "Admin")
            {
                Admin_form f2 = new Admin_form();
                f2.Show();
                this.Hide();
            }

            else if (Form1.role == "Manager")
            {
                Manager_Form f3 = new Manager_Form();
                f3.Show();
                this.Hide();
            }

            else if (Form1.role == "Employee")
            {
                Empolyee_form f4 = new Empolyee_form();
                f4.Show();
                this.Hide();
            }
        }
        private void btn_login_Click(object sender, EventArgs e)
        {
            var UserLogin = from usr in db.penggunas
                            where usr.username == txt_username.Text && usr.password == txt_password.Text
                            select usr;

            if (UserLogin.Count() == 1)
            {
                UserPosition = UserLogin.First();
                if (UserPosition.role == "Admin")
                {
                    idpengguna   = UserLogin.First().id_pengguna;
                    username     = UserLogin.First().username;
                    namapengguna = UserLogin.First().nama;
                    role         = UserLogin.First().role;
                    Admin_form f2 = new Admin_form();
                    f2.Show();
                    this.Hide();
                }

                else if (UserPosition.role == "Manager")
                {
                    idpengguna   = UserLogin.First().id_pengguna;
                    username     = UserLogin.First().username;
                    namapengguna = UserLogin.First().nama;
                    role         = UserLogin.First().role;
                    Manager_Form f3 = new Manager_Form();
                    f3.Show();
                    this.Hide();
                }

                else if (UserPosition.role == "Employee")
                {
                    idpengguna     = UserLogin.First().id_pengguna;
                    username       = UserLogin.First().username;
                    namapengguna   = UserLogin.First().nama;
                    statuspengguna = UserLogin.First().status_pengguna;
                    role           = UserLogin.First().role;
                    Empolyee_form f4 = new Empolyee_form();
                    f4.Show();
                    this.Hide();
                }
            }

            else if (txt_username.Text == "" && txt_password.Text == "")
            {
                MessageBox.Show("HARAP ISI DENGAN LENGKAP !!!");
            }

            else if (txt_username.Text == "" && txt_password.Text != "")
            {
                MessageBox.Show("HARAP ISI DENGAN LENGKAP !!!");
            }

            else if (txt_username.Text != "" && txt_password.Text == "")
            {
                MessageBox.Show("HARAP ISI DENGAN LENGKAP !!!");
            }

            else
            {
                MessageBox.Show("TIDAK ADA AKUN TERSEBUT !!!");
            }
        }