예제 #1
0
        private void Backbutton_Click(object sender, EventArgs e)
        {
            Driver_Home home = new Driver_Home();

            home.Show();
            this.Hide();
        }
예제 #2
0
        private void LogInButton_Click(object sender, EventArgs e)
        {
            //foreach(KeyValuePair<string,Driver> kvp in DriverGlobals.DriverMap)
            //{
            //    MessageBox.Show(kvp.Value.DriverPassword.ToString());
            //}

            bool isClient = false, isDriver = false, isAdmin = false, correctPassword = false;

            if (ClientGlobals.ClientMap.ContainsKey(usernametextbox.Text))
            {
                isClient = true;
            }
            else if (DriverGlobals.DriverMap.ContainsKey(usernametextbox.Text))
            {
                isDriver = true;
            }
            else if (AdminGlobals.AdminMap.ContainsKey(usernametextbox.Text))
            {
                isAdmin = true;
            }

            if (!isClient && !isDriver && !isAdmin)
            {
                MessageBox.Show("Not found. Please retry or register.", "Invalid Data");
            }

            else if (isClient)
            {
                if (ClientGlobals.ClientMap[usernametextbox.Text].ClientPassword == loginpasswordtext.Text)
                {
                    correctPassword = true;
                }
            }
            else if (isDriver)
            {
                if (DriverGlobals.DriverMap[usernametextbox.Text].DriverPassword == loginpasswordtext.Text)
                {
                    correctPassword = true;
                }
            }
            else if (isAdmin)
            {
                if (AdminGlobals.AdminMap[usernametextbox.Text].AdminPassword == loginpasswordtext.Text)
                {
                    correctPassword = true;
                }
            }


            if (isClient && correctPassword)
            {
                clientHome ClientHome = new clientHome();
                ClientHome.Show();
                this.Hide();
                currentUsername = usernametextbox.Text;
            }

            else if (isDriver && correctPassword)
            {
                Driver_Home DriverHome = new Driver_Home();
                DriverHome.Show();
                this.Hide();
                currentUsername = usernametextbox.Text;
            }

            else if (isAdmin && correctPassword)
            {
                AdminHome adminHome = new AdminHome();
                adminHome.Show();
                this.Hide();
                currentUsername = usernametextbox.Text;
            }

            else
            {
                MessageBox.Show("Please retry or register.", "Invalid Data");
            }
        }