Exemplo n.º 1
0
        private void Backbutton_Click(object sender, EventArgs e)
        {
            AdminHome home = new AdminHome();

            home.Show();
            this.Hide();
        }
Exemplo n.º 2
0
        private void AddDriverbutton_Click(object sender, EventArgs e)
        {
            Program.admin.AddNewCar(textBoxcarnumber.Text, textBoxcarcolor.Text, textBoxcaryear.Text, textBoxcarmodel.Text);
            MessageBox.Show("The car has been added successfully.");
            AdminHome admin_home = new AdminHome();

            admin_home.Show();
            this.Hide();
        }
Exemplo n.º 3
0
        private void AddDriverbutton_Click(object sender, EventArgs e)
        {
            int    lastdriverid = DriverGlobals.DriverMap.Count();
            int    currentid    = lastdriverid + 1;
            string driver_id    = Convert.ToString(currentid);

            Program.admin.AddNewDriver(textBoxusername.Text, textBoxpassword.Text, textBoxname.Text, driver_id, textBoxcarnumber.Text, textBoxsalary.Text, textBoxstatus.Text);
            MessageBox.Show("The Driver has been added successfully");
            AdminHome admin_homr = new AdminHome();

            admin_homr.Show();
            this.Hide();
        }
Exemplo n.º 4
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");
            }
        }