Example #1
0
        private void backButton_Click(object sender, EventArgs e)
        {
            MainFormAdmin admin = new MainFormAdmin(klientas);

            this.Hide();
            admin.ShowDialog();
            this.Close();
        }
Example #2
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            if (loginEmail.Text != null && loginEmail.Text != "" && loginPassword.Text != null && loginPassword.Text != "")
            {
                Klientas loggedKlientas = usersRepository.LoginKlientas(loginEmail.Text, loginPassword.Text);

                if (loggedKlientas.email != null && loggedKlientas.email != "")
                {
                    Console.WriteLine(loggedKlientas.email);
                    if (loggedKlientas.isAdmin == 1)
                    {
                        MainFormAdmin mainFormAdmin = new MainFormAdmin(loggedKlientas);
                        this.Hide();
                        mainFormAdmin.ShowDialog();
                        this.Close();
                    }
                    else if (loggedKlientas.isAdmin == 2)
                    {
                        MainFormWorker mainFormWorker = new MainFormWorker(loggedKlientas);
                        this.Hide();
                        mainFormWorker.ShowDialog();
                        this.Close();
                    }
                    else
                    {
                        MainForm mainForm = new MainForm(loggedKlientas);
                        this.Hide();
                        mainForm.ShowDialog();
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("Incorrect email or password");
                    //could redirect to register page or forget email/pass page
                }
            }
        }