Пример #1
0
    public void AlreadyLoggedIn()
    {
        if (!String.IsNullOrEmpty(PlayerPrefs.GetString("email")) && !String.IsNullOrEmpty(PlayerPrefs.GetString("password")))
        {
            GUser.GetUserByConnexion(PlayerPrefs.GetString("email"), PlayerPrefs.GetString("password"));
            User user = GUser.user;

            if (user != null)
            {
                Debug.Log("not null");


                if (user.IsStudent())
                {
                    string spe = ((Student)user).Promo.Specialty;
                    GApp.SetPrefUser(user.Firstname, user.Lastname, user.Email, user.Password, "Elève", spe, "TD1", "TP1", "2019-02-14"); // as IARISS didn't give us the schedule data for the current month, but for a more "full" month
                }
                else
                {
                    GApp.SetPrefUser(user.Firstname, user.Lastname, user.Email, user.Password, "Prof.", "", "", "", "2019-02-14"); // as IARISS didn't give us the schedule data for the current month, but for a more "full" month
                }

                GApp.ChangeScene("DetectSalle");
            }
            else
            {
                Debug.Log("user Null");
                PlayerPrefs.DeleteAll();
            }
        }
        else
        {
            GApp.ChangeScene("ConnexionScene");
        }
    }
Пример #2
0
    // Check si modification ou nouvel utilisateur
    public void CreateUser()
    {
        if (!String.IsNullOrEmpty(firstname.text) && !String.IsNullOrEmpty(lastname.text) && !String.IsNullOrEmpty(email.text) && !String.IsNullOrEmpty(password.text))
        {
            User currentUser;

            // Prof
            if (String.Equals(status.captionText.text, "Prof."))
            {
                int id = DBCommands.InsertTeacher(lastname.text, firstname.text, email.text, password.text);
                currentUser = GUser.CreateTeacher(id, firstname.text, lastname.text, email.text, password.text);
                GApp.SetPrefUser(firstname.text, lastname.text, email.text, password.text, "Prof.", "", "", "", "2019-02-11");
            }
            // Student
            else
            {
                Promo p  = GPromo.GetPromo(1, promo.captionText.text);
                int   id = DBCommands.InsertStudent(firstname.text, lastname.text, p.Id, email.text, password.text);
                currentUser = GUser.CreateStudent(id, firstname.text, lastname.text, email.text, password.text, p);
                GApp.SetPrefUser(firstname.text, lastname.text, email.text, password.text, "Elève", p.Specialty, td.captionText.text, tp.captionText.text, "2019-02-11");
            }

            GApp.ChangeScene(nextScene);
        }
    }
Пример #3
0
    public void Login()
    {
        if (!String.IsNullOrEmpty(mailAddressIT.text) && !String.IsNullOrEmpty(passwordIT.text))
        {
            GUser.GetUserByConnexion(mailAddressIT.text, passwordIT.text);
            User user = GUser.user;

            if (user != null)
            {
                Debug.Log("not null");
                if (user.IsStudent())
                {
                    GApp.SetPrefUser(user.Firstname, user.Lastname, mailAddressIT.text, passwordIT.text, "Elève", ((Student)user).Promo.Specialty, "TD1", "TP1", "2019-02-14"); // as IARISS didn't give us the schedule data for the current month, but for a more "full" month
                }
                else
                {
                    GApp.SetPrefUser(user.Firstname, user.Lastname, mailAddressIT.text, passwordIT.text, "Prof.", "", "", "", "2019-02-14"); // as IARISS didn't give us the schedule data for the current month, but for a more "full" month
                }

                GApp.ChangeScene("DetectSalle");
            }

            else
            {
                Debug.Log("user Null");
            }
        }
    }
Пример #4
0
    public void UpdateUser()
    {
        if (!String.IsNullOrEmpty(firstname.text) && !String.IsNullOrEmpty(lastname.text) && !String.IsNullOrEmpty(email.text) && !String.IsNullOrEmpty(password.text))
        {
            User currentUser = GUser.GetUserByConnexion(email.text, password.text);

            // Prof
            if (String.Equals(status.captionText.text, "Prof."))
            {
                GUser.UpdateTeacher((Teacher)currentUser, firstname.text, lastname.text, email.text, password.text);
                GApp.SetPrefUser(firstname.text, lastname.text, email.text, password.text, "Prof.", "", "", "", "2019-02-11");
            }
            // Student
            else
            {
                GUser.UpdateStudent((Student)currentUser, firstname.text, lastname.text, email.text, password.text, ((Student)currentUser).Promo);
                GApp.SetPrefUser(firstname.text, lastname.text, email.text, password.text, "Elève", promo.captionText.text, td.captionText.text, tp.captionText.text, "2019-02-11");
            }

            GApp.ChangeScene(nextScene);
        }
    }