private void backbutton_Click(object sender, EventArgs e)
        {
            this.Hide();
            Admin_Panel back = new Admin_Panel();

            back.Show();
        }
Exemplo n.º 2
0
        private void loginbutton_Click(object sender, EventArgs e)
        {
            bool flag = false;
            DataClasses1DataContext context = new DataClasses1DataContext();

            foreach (ADMIN a in context.ADMINs)
            {
                if (a.Admin_Name == usernamebox.Text && a.Admin_Password == passwordbox.Text)
                {
                    flag = true;
                    this.Hide();
                    Admin_Panel ap = new Admin_Panel(usernamebox.Text, passwordbox.Text, remember);
                    ap.Show();
                }
            }

            foreach (USER a in context.USERs)
            {
                if (a.User_Name == usernamebox.Text && a.User_Password == passwordbox.Text)
                {
                    flag = true;
                    this.Hide();
                    User_Panel up = new User_Panel(usernamebox.Text, passwordbox.Text, remember);
                    up.Show();
                }
            }

            if (flag == false)
            {
                MessageBox.Show("Incorrect Username/Pass.");
            }
        }