예제 #1
0
    /// <summary>
    /// Store Google details into database through business logic if it is not in database
    /// </summary>
    private void InsertGoogle()
    {
        string email      = googleScript.Get("email").ToString();
        string googleId   = googleScript.Get("id").ToString();
        string googleName = googleScript.Get("google_name").ToString();
        bool   exist      = studentBL.CheckGoogleExist(googleId);

        if (exist)
        {
            GD.Print("gdsgsd");
            Global.StudentId      = studentBL.GetGoogleStudentId(googleId);
            Global.StudentName    = googleName;
            Global.GoogleLoggedIn = true;

            if (studentBL.CheckGoogleExist(googleId))
            {
                GetTree().ChangeScene("res://Presentation/MainMenu/MainMenu.tscn");
            }
            else
            {
                GetTree().ChangeScene("res://Presentation/CharSelect/CharSelect.tscn");
            }
        }
        else
        {
            GD.Print("dqweeq");
            studentBL.InsertGoogleStudent(googleName, email, googleId);
            Global.StudentId      = studentBL.GetGoogleStudentId(googleId);
            Global.StudentName    = googleName;
            Global.GoogleLoggedIn = true;
            GetTree().ChangeScene("res://Presentation/CharSelect/CharSelect.tscn");
        }
    }