Esempio n. 1
0
    public void signInClicked()
    {
        // checking login for customers
        if (dictionaryCustomer.ContainsKey(email.text))
        {
            //correct email, now checking password
            if (dictionaryCustomer [email.text].getPassword() == password.text)
            {
                //correct password
                SSTools.ShowMessage("login successful", SSTools.Position.bottom, SSTools.Time.twoSecond);
                // login customer
                activitymanager.setCustomerLoggedIn(dictionaryCustomer [email.text]);

                changeActivityToHomeMenuCustomer();
                errorMessage = "login successful";
            }
            else
            {
                //correct email, incorrect password

                errorMessage = "Incorrect Password";
            }
        }
        else
        {
            //incorrect email
            errorMessage = "Incorrect UserName";
        }

        // checking login for mechanics
        if (errorMessage != "login successful")
        {
            if (dictionaryMechanic.ContainsKey(email.text))
            {
                //correct email, now checking password
                if (dictionaryMechanic [email.text].getPassword() == password.text)
                {
                    //correct password
                    SSTools.ShowMessage("login successful", SSTools.Position.bottom, SSTools.Time.twoSecond);
                    // login customer
                    activitymanager.setMechanicLoggedIn(dictionaryMechanic [email.text]);
                    changeActivityToHomeMenuMechanic();
                    errorMessage = "login successful";
                }
                else
                {
                    //correct email, incorrect password

                    errorMessage = "Incorrect Password";
                }
            }
            else
            {
                //incorrect email
                errorMessage = "Incorrect UserName";
            }
        }

        SSTools.ShowMessage(errorMessage, SSTools.Position.bottom, SSTools.Time.twoSecond);
        errorMessage = "";
    }
Esempio n. 2
0
    public void signInClicked()
    {
        // checking login for customers
        errorMessage = "";
        if (dictionaryContainsCustomerEmail(email.text))
        {
            //dictionary does contain customer with email

            //correct email, now checking password
            if (getCustomerByEmail(email.text).getPassword() == password.text)
            {
                //correct password
                errorMessage = "login successful";
                // login customer
                activitymanager.setCustomerLoggedIn(getCustomerByEmail(email.text));

                changeActivityToHomeMenuCustomer();
            }
            else
            {
                //correct email, incorrect password

                errorMessage = "Incorrect Password";
            }
            // checking login for mechanics
        }
        else if (dictionaryContainsMechanicEmail(email.text))
        {
            print("contains mechanic");
            //dictionary does contain mechanic with email

            //correct email, now checking password
            if (getMechanicByEmail(email.text).getPassword() == password.text)
            {
                //correct password
                errorMessage = "login successful";
                // login customer
                activitymanager.setMechanicLoggedIn(getMechanicByEmail(email.text));

                changeActivityToHomeMenuMechanic();
            }
            else
            {
                //correct email, incorrect password

                errorMessage = "Incorrect Password";
            }
        }
        else if (dictionaryContainsStaffEmail(email.text))
        {
            print("contains user");

            //correct email, now checking password
            if (getStaffByEmail(email.text).getPassword() == password.text)
            {
                //correct password
                errorMessage = "login successful";
                // login customer
                activitymanager.setStaffLoggedIn(getStaffByEmail(email.text));

                changeActivityToHomeMenuStaff();
            }
            else
            {
                //correct email, incorrect password

                errorMessage = "Incorrect Password-staff";
            }
        }
        if (errorMessage == "")
        {
            errorMessage = "Incorrect username";
        }
        SSTools.ShowMessage(errorMessage, SSTools.Position.bottom, SSTools.Time.twoSecond);
        errorMessage = "";
    }