public ChatBanMessage(string channel, string messageId, PublicUserData bannedUser, RoomRole bannedRoomRole, PublicUserData admin, RoomRole adminRoomRole) : base(ChatEventType.BAN, channel, messageId) { BannedUser = bannedUser; BannedRoomRole = bannedRoomRole; Admin = admin; AdminRoomRole = adminRoomRole; }
public ChatGiftSubscriptionMessage(string channel, string messageId, int months, PublicUserData giftingUser, PublicUserData receiveingUser, RoomRole receiverRoomRole) : base(ChatEventType.GIFTSUB, channel, messageId) { Months = months; GiftingUser = giftingUser; ReceivingUser = receiveingUser; ReceiverRoomRole = receiverRoomRole; }
static void Main() { PrintStatus("Loading config..", ConsoleColor.Green); try { Config = JsonConvert.DeserializeObject <Config>(File.ReadAllText(Path.Combine(Environment.CurrentDirectory, "config.json"))); } catch (JsonReaderException e) { SetError(e.Message); } catch (FileNotFoundException ex) { SetError(ex.Message); } if (string.IsNullOrWhiteSpace(Config.DisplayName)) { SetError("No display name specified!"); } if (string.IsNullOrWhiteSpace(Config.AuthToken)) { SetError("No authentication token provided!"); } PrintStatus("Setting up account..", ConsoleColor.Green); Account = new DliveAccount(Config.AuthToken); try { Account.Query.GetMyInfo(); } catch (JsonSerializationException) { SetError("Invalid authentication token provided!"); } catch (Exception e) { SetError(e.Message); } PublicUserData usr = PublicQuery.GetPublicInfoByDisplayName(Config.DisplayName); if (usr.Username == "invalid user") { SetError("Invalid display name provided!"); } PrintStatus("Connecting to event stream..", ConsoleColor.Green); Subscription subscription = Subscription.SubscriptionByDisplayName(Config.DisplayName); subscription.OnChatEvent += OnChat; subscription.OnConnected += () => PrintStatus($"Connected to {Config.DisplayName}!", ConsoleColor.Green); subscription.OnError += (err) => SetError(err); subscription.Connect(); Console.WriteLine("Press enter to stop the program"); Console.ReadLine(); }
public ChatTimeoutMessage(string channel, string messageId, int duration, PublicUserData timedoutUser, RoomRole timedoutRoomRole, PublicUserData admin, RoomRole adminRoomRole) : base(ChatEventType.TIMEOUT, channel, messageId) { TimeoutMinutes = duration; TimedoutUser = timedoutUser; TimedoutRoomRole = timedoutRoomRole; Admin = admin; AdminRoomRole = adminRoomRole; }
private async Task <bool> LogIn() { try { await ParseUser.LogInAsync(tbLoginEmail.Text.ToLower(), tbLoginPassword.Text); ParseUser CurrentUser = ParseUser.CurrentUser; PublicUserData publicUserData = await CurrentUser.Get <PublicUserData>("publicUserData").FetchAsync(); // Email not verified if (!CurrentUser.Get <bool>("emailVerified")) { Session["LoginError"] = "Please check your email to verify your account."; return(false); } // Not tutor else if (!Constants.UserType.IsTutor(publicUserData.UserType)) { Session["LoginError"] = "Only tutors may use the website. If you are a student, then you can open CogniStudy through your mobile device."; return(false); } // Didn't pass registration test else if (CurrentUser.Get <int>("registrationTestScore") < 7) { Session["LoginError"] = "You failed to acheive a sufficient score on the registration test."; return(false); } // Login was successful. else { mPage.PublicUserData = publicUserData; //await mPage.PublicUserData.FetchAsync(); //mPage.Tutor = mPage.PublicUserData.Tutor; //await mPage.Tutor.FetchAsync(); //mPage.PrivateTutorData = mPage.Tutor.PrivateTutorData; //await mPage.PrivateTutorData.FetchAsync(); return(true); } } catch (Exception ex) { // The login failed. Check the error to see why. string s = ex.ToString(); Console.WriteLine(s); if (ex.Message.Contains("invalid login parameters")) { Session["LoginError"] = "Username and/or password is incorrect."; return(false); } else { Session["LoginError"] = "There was an unexpected problem with your login. Please try again."; return(false); } } }
public async Task UpdateUser(PublicUserData publicUser) { var user = await _userManager.FindByIdAsync(publicUser.Id); user.NickName = publicUser.NickName; user.PreferredLanguage = publicUser.PreferredLanguage; user.PreferredEditorTheme = publicUser.PreferredEditorTheme; await _userManager.UpdateAsync(user); await _context.SaveChangesAsync(); }
public UserData ToUserData() { List <AboutPanel> actualPanels = new List <AboutPanel>(); foreach (RawPanelData panel in panels) { actualPanels.Add(panel.ToAboutPanel()); } PublicUserData publicData = new PublicUserData(username, displayname, partnerStatus, livestream != null, effect, badges, deactivated, actualPanels.ToArray(), avatar, (long)followers["totalCount"], (long)treasureChest["value"], (long)wallet["balance"], (long)wallet["totalEarning"]); PrivateUserData privateData = new PrivateUserData((long)@private.subscribers["totalCount"], @private.email, @private.filterWords, @private.streamKey["key"].ToString()); return(new UserData(publicData, privateData)); }
public static async Task <PublicUserData[]> GetFollowersForUser(string username) { int cursor = -1; List <PublicUserData> followers = new List <PublicUserData>(); PublicUserData userData = GetPublicInfo(username); if (userData.NumFollowers == 0) { return(followers.ToArray()); } do { if (!Dlive.CanExecuteQuery()) { await Task.Delay((Dlive.NextIntervalReset - DateTime.Now).Milliseconds); } Dlive.IncreaseQueryCounter(); GraphQLResponse response = _publicClient.SendQueryAsync(GraphqlHelper.GetQueryString(QueryType.FOLLOWERS, new string[] { userData.Username, "50", cursor.ToString() })).Result; JArray followerList = response.Data.user.followers.list; foreach (JObject follower in followerList) { RawUserData followerData = new RawUserData(follower); followers.Add(followerData.ToPublicUserData()); } cursor += 50; if (userData.NumFollowers > 50) { await Task.Delay(200); } }while (cursor < userData.NumFollowers); return(followers.ToArray()); }
void reset() { StopAllCoroutines(); firebaseManager.setErrorMessage(""); loginPage.SetActive(true); foreach (TMP_InputField input in loginPage.gameObject.GetComponentsInChildren <TMP_InputField>()) { input.text = ""; } loginPage.SetActive(false); memberInfoPage.SetActive(true); email.text = "Email: "; phoneNumber.text = "(000) 000-0000"; memberName.text = "Name"; classification.text = "Member"; daysAttended.text = "Days Attended: "; totalHours.text = "Total Hours: "; averageAttendance.text = "Average Attendance: "; foreach (Transform program in programsContent.transform) { Destroy(program.gameObject); } memberInfoPage.SetActive(false); messageScreen.SetActive(true); messageScreen.gameObject.GetComponentInChildren <TextMeshProUGUI>().text = "MESSAGE"; messageScreen.SetActive(false); loginPage.SetActive(true); editProfilePage.SetActive(false); unverfiedPage.SetActive(false); memberInfoPage.SetActive(false); gameObject.SetActive(false); firebaseManager.auth.SignOut(); firebaseManager.disableLoadingScreen(); mainScreen.SetActive(true); mainScreen.GetComponent <MainScreenManager>().Start(); publicData = null; privateData = null; attendanceData = null; }
public ChatGiftMessage(string channel, string messageId, PublicUserData user, RoomRole roomRole, bool subscribing, GiftType type, int amount, string message) : base(ChatEventType.GIFT, channel, messageId, user, roomRole, subscribing) { GiftType = type; GiftMessage = message; AmountGifts = amount; switch (type) { case GiftType.LEMON: GiftValue = 1m; break; case GiftType.ICE_CREAM: GiftValue = 10m; break; case GiftType.DIAMOND: GiftValue = 100m; break; case GiftType.NINJAGHINI: GiftValue = 1000m; break; case GiftType.NINJET: GiftValue = 10000m; break; case GiftType.BTT: case GiftType.TRX: GiftValue = (decimal)amount / 1000000; break; default: break; } GiftLinoValue = GiftLemonValue = (int)GiftValue; }
public static PublicUserData GetPublicInfo(string username) { if (!Dlive.CanExecuteQuery()) { Task.Delay((Dlive.NextIntervalReset - DateTime.Now).Milliseconds).Wait(); } Dlive.IncreaseQueryCounter(); GraphQLResponse response = _publicClient.SendQueryAsync(GraphqlHelper.GetQueryString(QueryType.USER, new string[] { username })).Result; PublicUserData userData; if (response.Data.user != null) { userData = response.GetDataFieldAs <RawUserData>("user").ToPublicUserData(); } else { userData = new PublicUserData("invalid user", "Invalid User", PartnerStatus.NONE, false, "", null, true, null, null, 0, 0, 0, 0); } return(userData); }
void reset() { firebaseManager.setErrorMessage(""); StopAllCoroutines(); screenID = 0; firstTimeEntry = true; foreach (GameObject page in pages) { page.SetActive(true); foreach (TMP_InputField input in page.GetComponentsInChildren <TMP_InputField>()) { input.text = ""; } page.SetActive(false); } pages[0].SetActive(true); update = false; firstTimeEntry = true; inputFields = null; currentPage = null; publicUserData = null; privateUserData = null; programs = new List <string>(); pages[5].SetActive(true); foreach (Transform child in programsContent.transform) { Destroy(child.gameObject); } pages[5].SetActive(false); firebaseManager.disableLoadingScreen(); firebaseManager.auth.SignOut(); gameObject.SetActive(false); mainScreen.SetActive(true); mainScreen.GetComponent <MainScreenManager>().Start(); homeButton.SetActive(true); }
IEnumerator openUser(string memberName, string userID) { firebaseManager.enableLoadingScreen(); PublicUserData userData = null; Attendance attendanceData = null; firebaseManager.getFirebaseReference("Users/Public Data").Child(memberName).Child(userID).Child("attendance").GetValueAsync().ContinueWith(task => { if (task.IsCanceled || task.IsFaulted) { print("retrieve data encountered an error: " + task.Exception); return; } if (task.IsCompleted) { attendanceData = JsonUtility.FromJson <Attendance>(task.Result.GetRawJsonValue()); } }); yield return(new WaitUntil(() => attendanceData != null)); firebaseManager.getFirebaseReference("Users/Public Data").Child(memberName).Child(userID).Child("profile").GetValueAsync().ContinueWith(task => { if (task.IsCanceled || task.IsFaulted) { print("retrieve data encountered an error: " + task.Exception); return; } if (task.IsCompleted) { userData = JsonUtility.FromJson <PublicUserData>(task.Result.GetRawJsonValue()); } }); yield return(new WaitUntil(() => userData != null)); mainScreen.SetActive(false); memberInfoScreen.SetActive(true); memberInfoObject.SetName(userData.name); memberInfoObject.SetClassification(userData.classification); memberInfoObject.memberName = userData.name; memberInfoObject.userID = userID; inspirencEmailText.text = "Email: " + userData.inspirencEmail; gradeText.text = "Grade: " + userData.grade.ToString(); schoolText.text = "School: " + userData.school; GameObject recyclableGameObject = null; foreach (string program in userData.programs) { recyclableGameObject = Instantiate(programTextPrefab, programContentGameObject.transform, false); recyclableGameObject.GetComponent <TextMeshProUGUI>().text = program; } if (attendanceData.signedIn == true) { signInOutButton.GetComponentInChildren <TextMeshProUGUI>().text = "Sign Out"; } else { signInOutButton.GetComponentInChildren <TextMeshProUGUI>().text = "Sign In"; } firebaseManager.disableLoadingScreen(); }
IEnumerator login(bool isItLoginPage) { bool done = false; bool ableToSignIn = true; string errorMessage = ""; firebaseManager.enableLoadingScreen(); firebaseManager.setErrorMessage(""); firebaseManager.auth.SignOut(); firebaseManager.auth.SignInWithEmailAndPasswordAsync(emailInput.text, passwordInput.text).ContinueWith(task => { if (task.IsFaulted) { errorMessage = (task.Exception.ToString().Substring(task.Exception.ToString().IndexOf("FirebaseException: ") + 19, task.Exception.ToString().Substring(task.Exception.ToString().IndexOf("FirebaseException: ") + 19).IndexOf(".") + 1)); ableToSignIn = false; done = true; return; } if (task.IsCompleted) { done = true; } }); yield return(new WaitUntil(() => done == true)); done = false; firebaseManager.setErrorMessage(errorMessage); if (ableToSignIn == false) { firebaseManager.disableLoadingScreen(); yield break; } loginPage.SetActive(false); if (firebaseManager.auth.CurrentUser.IsEmailVerified == false) { unverfiedPage.SetActive(true); firebaseManager.disableLoadingScreen(); yield break; } memberInfoPage.SetActive(true); if (isItLoginPage == true) { messageScreen.SetActive(true); messageScreen.GetComponentInChildren <TextMeshProUGUI>().text = "Welcome " + firebaseManager.auth.CurrentUser.DisplayName + "!"; yield return(new WaitForSeconds(1)); messageScreen.SetActive(false); } publicData = null; firebaseManager.getFirebaseReference("Users").Child("Public Data").Child(firebaseManager.auth.CurrentUser.DisplayName).Child(firebaseManager.auth.CurrentUser.UserId).Child("profile").GetValueAsync().ContinueWith(task => { if (task.IsCanceled) { return; } if (task.IsFaulted) { print(task.Exception); return; } if (task.IsCompleted) { publicData = JsonUtility.FromJson <PublicUserData>(task.Result.GetRawJsonValue()); } }); yield return(new WaitUntil(() => publicData != null)); done = false; firebaseManager.getFirebaseReference("Users").Child("Private Data").Child(firebaseManager.auth.CurrentUser.DisplayName).Child(firebaseManager.auth.CurrentUser.UserId).Child("profile").GetValueAsync().ContinueWith(task => { if (task.IsCanceled) { return; } if (task.IsFaulted) { return; } if (task.IsCompleted) { privateData = JsonUtility.FromJson <PrivateUserData>(task.Result.GetRawJsonValue()); } }); yield return(new WaitUntil(() => privateData != null)); done = false; firebaseManager.getFirebaseReference("Users").Child("Public Data").Child(firebaseManager.auth.CurrentUser.DisplayName).Child(firebaseManager.auth.CurrentUser.UserId).Child("attendance").GetValueAsync().ContinueWith(task => { if (task.IsCanceled) { return; } if (task.IsFaulted) { return; } if (task.IsCompleted) { attendanceData = JsonUtility.FromJson <Attendance>(task.Result.GetRawJsonValue()); } }); yield return(new WaitUntil(() => attendanceData != null)); done = false; GameObject recyclableGameObject = null; foreach (Transform program in programsContent.transform) { Destroy(program.gameObject); } foreach (string program in publicData.programs) { recyclableGameObject = Instantiate(programTextPrefab, programsContent.transform, false); recyclableGameObject.GetComponent <TextMeshProUGUI>().text = program; } recyclableGameObject = null; email.text = "Email: " + publicData.inspirencEmail + ", " + privateData.personalEmail; phoneNumber.text = "Phone Number: (" + privateData.phoneNumber.Substring(0, 3) + ") " + privateData.phoneNumber.Substring(3, 3) + "-" + privateData.phoneNumber.Substring(6, 4); memberName.text = publicData.name; classification.text = publicData.classification; daysAttended.text = "Days Attended: " + attendanceData.daysAttended.ToString(); totalHours.text = "Total Hours: " + attendanceData.totalHours.ToString(); averageAttendance.text = "Average Hours: " + attendanceData.averageHours.ToString(); firebaseManager.disableLoadingScreen(); yield break; }
public UserChatMessage(ChatEventType eventType, string channel, string messageId, PublicUserData user, RoomRole roomRole, bool subscribing) : base(eventType, channel, messageId) { User = user; RoomRole = roomRole; Subscribing = subscribing; }
public ChatHostMessage(string channel, string messageId, PublicUserData user, RoomRole roomRole, bool subscribing, int viewers) : base(ChatEventType.HOST, channel, messageId, user, roomRole, subscribing) { Viewers = viewers; }
private async Task BuildCharts() { ClearCharts(); int updatePanelCounter = 0; int catUpdatePanelCounter = 0; if (ddlFilterStudent.Text == "All Students") { // ALL STUDENTS/SUBJECTS if (ddlFilterSubject.Text == "All Subjects") { int totalResponses = 0; int correctResponses = 0; IList <ParseObject> subjectStats = await ParseCloud.CallFunctionAsync <IList <ParseObject> >("getAllSubStats", null); foreach (ParseObject stat in subjectStats) { totalResponses += stat.Get <int>("totalResponses"); correctResponses += stat.Get <int>("correctResponses"); } DoughnutChart subjectChart = (DoughnutChart)LoadControl("~/UserControls/DoughnutChart.ascx"); subjectChart.NumCorrect = correctResponses; subjectChart.NumIncorrect = totalResponses - correctResponses; subjectChart.Title = ddlFilterSubject.Text; subjectChart.Chart.DataBind(); updatePanels[updatePanelCounter++].ContentTemplateContainer.Controls.Add(subjectChart); } // ALL STUDENTS, one subject else { DoughnutChart subjectChart = (DoughnutChart)LoadControl("~/UserControls/DoughnutChart.ascx"); IDictionary <string, object> parameters = new Dictionary <string, object> { { "subjectName", ddlFilterSubject.Text } }; ParseObject subjectStats = await ParseCloud.CallFunctionAsync <ParseObject>("getSubStats", parameters); subjectChart.NumCorrect = subjectStats.Get <int>("correctResponses"); subjectChart.NumIncorrect = subjectStats.Get <int>("totalResponses") - subjectStats.Get <int>("correctResponses"); subjectChart.Title = subjectStats.Get <string>("subject"); subjectChart.Chart.DataBind(); updatePanels[updatePanelCounter++].ContentTemplateContainer.Controls.Add(subjectChart); string[] categories = Constants.SubjectToCategory[ddlFilterSubject.Text]; IDictionary <string, object> catParams = new Dictionary <string, object> { { "catNames", categories } }; IList <ParseObject> categoryStats = await ParseCloud.CallFunctionAsync <IList <ParseObject> >("getSomeCatStats", catParams); foreach (ParseObject category in categoryStats) { SingleBarChart catChart = (SingleBarChart)LoadControl("~/UserControls/SingleBarChart.ascx"); catChart.SetCorrectIncorrect(category.Get <int>("correctResponses"), category.Get <int>("totalResponses") - category.Get <int>("correctResponses")); catChart.Title = category.Get <string>("category"); catChart.Chart.DataBind(); catUpdatePanels[catUpdatePanelCounter++].ContentTemplateContainer.Controls.Add(catChart); } } } // one student else { PublicUserData publicUserData = await PublicUserData.GetById(ddlFilterStudent.SelectedValue); Student student = await publicUserData.Student.FetchIfNeededAsync(); //PrivateStudentData privateStudentData = await student.PrivateStudentData.FetchIfNeededAsync(); // one student, ALL SUBJECTS if (ddlFilterSubject.Text == "All Subjects") { StudentTotalRollingStats studentTotalRollingStats = await student.StudentTotalRollingStats.FetchIfNeededAsync(); int totalResponses = 0; int correctResponses = 0; if (ddlFilterTime.SelectedValue == "PastWeek") { totalResponses = studentTotalRollingStats.TotalPastWeek; correctResponses = studentTotalRollingStats.CorrectPastWeek; } else if (ddlFilterTime.SelectedValue == "PastMonth") { totalResponses = studentTotalRollingStats.TotalPastMonth; correctResponses = studentTotalRollingStats.CorrectPastMonth; } else { totalResponses = studentTotalRollingStats.TotalAllTime; correctResponses = studentTotalRollingStats.CorrectAllTime; } Debug.WriteLine(totalResponses + " " + correctResponses); DoughnutChart subjectChart = (DoughnutChart)LoadControl("~/UserControls/DoughnutChart.ascx"); subjectChart.NumCorrect = correctResponses; subjectChart.NumIncorrect = totalResponses - correctResponses; subjectChart.Title = ddlFilterSubject.Text; subjectChart.Chart.DataBind(); updatePanels[updatePanelCounter++].ContentTemplateContainer.Controls.Add(subjectChart); } // one student, one subject else { // ALL CATEGORIES if (ddlFilterCategory.Text == "All Categories") { DoughnutChart subjectChart = (DoughnutChart)LoadControl("~/UserControls/DoughnutChart.ascx"); string subjectName = ddlFilterSubject.Text; IEnumerable <StudentSubjectRollingStats> studentAllSubjectRollingStats = await student.StudentSubjectRollingStats.FetchAllIfNeededAsync(); StudentSubjectRollingStats studentSubjectRollingStats = studentAllSubjectRollingStats.Single(x => x.Subject == subjectName); int totalResponses = 0; int correctResponses = 0; if (ddlFilterTime.SelectedValue == "PastWeek") { totalResponses = studentSubjectRollingStats.TotalPastWeek; correctResponses = studentSubjectRollingStats.CorrectPastWeek; } else if (ddlFilterTime.SelectedValue == "PastMonth") { totalResponses = studentSubjectRollingStats.TotalPastMonth; correctResponses = studentSubjectRollingStats.CorrectPastMonth; } else { totalResponses = studentSubjectRollingStats.TotalAllTime; correctResponses = studentSubjectRollingStats.CorrectAllTime; } subjectChart.NumCorrect = correctResponses; subjectChart.NumIncorrect = totalResponses - correctResponses; subjectChart.Title = subjectName; subjectChart.Chart.DataBind(); updatePanels[updatePanelCounter++].ContentTemplateContainer.Controls.Add(subjectChart); string[] categories = Constants.SubjectToCategory[ddlFilterSubject.Text]; IEnumerable <StudentCategoryRollingStats> studentAllCategoryRollingStats = await student.StudentCategoryRollingStats.FetchAllIfNeededAsync(); //int i = 1; foreach (string catName in categories) { SingleBarChart catChart = (SingleBarChart)LoadControl("~/UserControls/SingleBarChart.ascx"); StudentCategoryRollingStats categoryStats = studentAllCategoryRollingStats.First(x => x.Category == catName); if (ddlFilterTime.SelectedValue == "PastWeek") { totalResponses = categoryStats.TotalPastWeek; correctResponses = categoryStats.CorrectPastWeek; } else if (ddlFilterTime.SelectedValue == "PastMonth") { totalResponses = categoryStats.TotalPastMonth; correctResponses = categoryStats.CorrectPastMonth; } else { totalResponses = categoryStats.TotalAllTime; correctResponses = categoryStats.CorrectAllTime; } catChart.SetCorrectIncorrect(correctResponses, totalResponses - correctResponses); catChart.Title = catName; catChart.Chart.DataBind(); catUpdatePanels[catUpdatePanelCounter++].ContentTemplateContainer.Controls.Add(catChart); } } // one category else { DoughnutChart categoryChart = (DoughnutChart)LoadControl("~/UserControls/DoughnutChart.ascx"); string categoryName = ddlFilterCategory.Text; IEnumerable <StudentCategoryRollingStats> studentAllCategoryRollingStats = await student.StudentCategoryRollingStats.FetchAllIfNeededAsync(); StudentCategoryRollingStats studentCategoryRollingStats = studentAllCategoryRollingStats.Single(x => x.Category == categoryName); int totalResponses = 0; int correctResponses = 0; if (ddlFilterTime.SelectedValue == "PastWeek") { totalResponses = studentCategoryRollingStats.TotalPastWeek; correctResponses = studentCategoryRollingStats.CorrectPastWeek; } else if (ddlFilterTime.SelectedValue == "PastMonth") { totalResponses = studentCategoryRollingStats.TotalPastMonth; correctResponses = studentCategoryRollingStats.CorrectPastMonth; } else { totalResponses = studentCategoryRollingStats.TotalAllTime; correctResponses = studentCategoryRollingStats.CorrectAllTime; } categoryChart.NumCorrect = correctResponses; categoryChart.NumIncorrect = totalResponses - correctResponses; categoryChart.Title = categoryName; categoryChart.Chart.DataBind(); updatePanels[updatePanelCounter++].ContentTemplateContainer.Controls.Add(categoryChart); } } ProgressBarChart progressChart = (ProgressBarChart)LoadControl("~/UserControls/ProgressBarChart.ascx"); DateTime curDate; int startBlockNum; int endBlockNum; ParseRelation <ParseObject> rel; List <DataPoint> correctDataPoints = new List <DataPoint>(); List <DataPoint> incorrectDataPoints = new List <DataPoint>(); string blockStatsType = FigureBlockStatsType(); string blockStatsSelection = FigureBlockStatsSelection(); if (ddlFilterTime.SelectedValue == "PastWeek") { rel = student.GetRelation <ParseObject>("student" + blockStatsType + "DayStats"); endBlockNum = DateUtils.getCurrentDayBlockNum(); startBlockNum = endBlockNum - 6; curDate = DateTime.Today.AddDays(-6); for (int i = startBlockNum; i <= endBlockNum; i++, curDate = curDate.AddDays(1)) { var query = from s in rel.Query where s.Get <int>("blockNum") == i select s; if (blockStatsType != "Total") { query = from s in rel.Query where s.Get <int>("blockNum") == i where s.Get <string>(blockStatsType.ToLower()) == blockStatsSelection select s; } ParseObject stat = await query.FirstOrDefaultAsync(); DataPoint correct = new DataPoint(); DataPoint incorrect = new DataPoint(); correct.YValues = new double[] { stat == null ? 0 : stat.Get <int>("correct") }; incorrect.YValues = new double[] { stat == null ? 0 : stat.Get <int>("total") - stat.Get <int>("correct") }; correct.AxisLabel = curDate.ToShortDateString(); incorrect.AxisLabel = curDate.ToShortDateString(); correctDataPoints.Add(correct); incorrectDataPoints.Add(incorrect); } } else if (ddlFilterTime.SelectedValue == "PastMonth") { rel = student.GetRelation <ParseObject>("student" + blockStatsType + "DayStats"); endBlockNum = DateUtils.getCurrentDayBlockNum(); startBlockNum = endBlockNum - 29; curDate = DateTime.Today.AddDays(-29); for (int i = startBlockNum; i <= endBlockNum; i += 3, curDate = curDate.AddDays(3)) { var query = from s in rel.Query where s.Get <int>("blockNum") >= i where s.Get <int>("blockNum") <= i + 2 select s; if (blockStatsType != "Total") { query = from s in rel.Query where s.Get <int>("blockNum") == i where s.Get <string>(blockStatsType.ToLower()) == blockStatsSelection select s; } IEnumerable <ParseObject> stats = await query.FindAsync(); int totalCorrect = 0, totalIncorrect = 0; foreach (ParseObject stat in stats) { totalCorrect += stat.Get <int>("correct"); totalIncorrect += stat.Get <int>("total") - stat.Get <int>("correct"); } DataPoint correct = new DataPoint(); DataPoint incorrect = new DataPoint(); correct.YValues = new double[] { totalCorrect }; incorrect.YValues = new double[] { totalIncorrect }; correct.AxisLabel = curDate.ToShortDateString(); incorrect.AxisLabel = curDate.ToShortDateString(); correctDataPoints.Add(correct); incorrectDataPoints.Add(incorrect); } } else { rel = student.GetRelation <ParseObject>("student" + blockStatsType + "MonthStats"); endBlockNum = DateUtils.getCurrentMonthBlockNum(); startBlockNum = endBlockNum - 11; curDate = DateTime.Today.AddMonths(-11); for (int i = startBlockNum; i <= endBlockNum; i++, curDate = curDate.AddMonths(1)) { var query = from s in rel.Query where s.Get <int>("blockNum") == i select s; if (blockStatsType != "Total") { query = from s in rel.Query where s.Get <int>("blockNum") == i where s.Get <string>(blockStatsType.ToLower()) == blockStatsSelection select s; } ParseObject stat = await query.FirstOrDefaultAsync(); DataPoint correct = new DataPoint(); DataPoint incorrect = new DataPoint(); correct.YValues = new double[] { stat == null ? 0 : stat.Get <int>("correct") }; incorrect.YValues = new double[] { stat == null ? 0 : stat.Get <int>("total") - stat.Get <int>("correct") }; correct.AxisLabel = curDate.ToShortDateString(); incorrect.AxisLabel = curDate.ToShortDateString(); correctDataPoints.Add(correct); incorrectDataPoints.Add(incorrect); } } progressChart.SetUp(correctDataPoints, incorrectDataPoints); progressChart.Title = publicUserData.DisplayName + "'s Progress in " + FigureMostSpecificType(); if (blockStatsType == "Subject") { updatePanels[updatePanelCounter++].ContentTemplateContainer.Controls.Add(progressChart); } else { catUpdatePanels[catUpdatePanelCounter++].ContentTemplateContainer.Controls.Add(progressChart); } } DoughnutChart chart1 = UpdatePanel1.ContentTemplateContainer.Controls[0] as DoughnutChart; if (chart1.NumCorrect + chart1.NumIncorrect == 0) { ClearCharts(); lbNoResults.Visible = true; } else { lbNoResults.Visible = false; } }
public async Task <IActionResult> UpdateUser(PublicUserData publicUser) { await _accountManager.UpdateUser(publicUser); return(Ok()); }
public IEnumerator PushUserToFirebase() { firebaseManager.enableLoadingScreen(); Firebase.Auth.FirebaseUser newUser = null; bool done = false; string errorMessage = ""; publicUserData = new PublicUserData(programs, inspirencEmail.text, school.text, memberName.text, "Member", Int32.Parse(grade.text)); privateUserData = new PrivateUserData(personalEmail.text, address.text, parent1name.text, parent1email.text, parent1number.text, parent2name.text, parent2email.text, parent2number.text, phoneNumber.text, getCheckedGender(), Int32.Parse(age.text)); firebaseManager.auth.CreateUserWithEmailAndPasswordAsync(publicUserData.inspirencEmail, passwordInput.text.ToString()).ContinueWith(task => { if (task.IsCanceled || task.IsFaulted) { errorMessage = errorMessage = (task.Exception.ToString().Substring(task.Exception.ToString().IndexOf("FirebaseException: ") + 19, task.Exception.ToString().Substring(task.Exception.ToString().IndexOf("FirebaseException: ") + 19).IndexOf(".") + 1));; done = true; return; } else if (task.IsCompleted) { newUser = task.Result; done = true; } }); yield return(new WaitUntil(() => done == true)); done = false; if (errorMessage.Equals("The email address is already in use by another account.")) { firebaseManager.setErrorMessage("The email address is already in use by another account."); yield return(new WaitForSeconds(4)); reset(); yield break; } Firebase.Auth.FirebaseUser user = firebaseManager.auth.CurrentUser; if (user != null) { Firebase.Auth.UserProfile profile = new Firebase.Auth.UserProfile { DisplayName = publicUserData.name }; user.UpdateUserProfileAsync(profile).ContinueWith(task => { if (task.IsCanceled || task.IsFaulted) { return; } done = true; }); } yield return(new WaitUntil(() => done == true)); done = false; Firebase.Auth.FirebaseUser currentUser = firebaseManager.auth.CurrentUser; currentUser.SendEmailVerificationAsync().ContinueWith(task => { done = true; }); yield return(new WaitUntil(() => done == true)); done = false; firebaseManager.reference.Child("Users").Child("Public Data").Child(publicUserData.name).Child(currentUser.UserId).Child("profile").SetRawJsonValueAsync(JsonUtility.ToJson(publicUserData)).ContinueWith(task => { if (task.IsCanceled || task.IsFaulted) { return; } if (task.IsCompleted) { done = true; } }); yield return(new WaitUntil(() => done == true)); done = false; firebaseManager.reference.Child("Users").Child("Private Data").Child(publicUserData.name).Child(currentUser.UserId).Child("profile").SetRawJsonValueAsync(JsonUtility.ToJson(privateUserData)).ContinueWith(task => { if (task.IsCanceled || task.IsFaulted) { return; } if (task.IsCompleted) { done = true; } }); yield return(new WaitUntil(() => done == true)); done = false; firebaseManager.reference.Child("Users").Child("Public Data").Child(publicUserData.name).Child(currentUser.UserId).Child("attendance").SetRawJsonValueAsync(JsonUtility.ToJson(new Attendance())).ContinueWith(task => { if (task.IsCanceled || task.IsFaulted) { return; } if (task.IsCompleted) { done = true; } }); yield return(new WaitUntil(() => done == true)); done = false; firebaseManager.reference.Child("Email List").Child(inspirencEmail.text.Substring(0, inspirencEmail.text.IndexOf("@"))).SetValueAsync(inspirencEmail.text).ContinueWith(task => { if (task.IsCanceled || task.IsFaulted) { return; } if (task.IsCompleted) { done = true; } }); yield return(new WaitUntil(() => done == true)); done = false; firebaseManager.disableLoadingScreen(); }
public ChatClipMessage(string channel, string messageId, PublicUserData user, RoomRole roomRole, bool subscribing, Uri link) : base(ChatEventType.CLIP, channel, messageId, user, roomRole, subscribing) { ClipUri = link; }
public ChatModStatusChangeMessage(string channel, string messageId, PublicUserData user, RoomRole roomRole, bool subscribing, ModeratorStatusChange change) : base(ChatEventType.MOD, channel, messageId, user, roomRole, subscribing) { StatusChange = change; }
public ChatTextMessage(string channel, string messageId, PublicUserData user, RoomRole roomRole, bool subscribing, string content, long subStreak) : base(ChatEventType.MESSAGE, channel, messageId, user, roomRole, subscribing) { Content = content; SubStreak = subStreak; }
public ChatSubscriptionMessage(string channel, string messageId, PublicUserData user, RoomRole roomRole, bool subscription, int months) : base(ChatEventType.SUBSCRIPTION, channel, messageId, user, roomRole, subscription) { Months = months; }
public ChatEmoteMessage(string channel, string messageId, PublicUserData user, RoomRole roomRole, bool subscribing, string emote) : base(ChatEventType.EMOTE, channel, messageId, user, roomRole, subscribing) { Emote = emote; }
public ChatModeChangeMessage(string channel, string messageId, PublicUserData user, RoomRole roomRole, bool subscribing, ChatMode mode) : base(ChatEventType.CHAT_MODE, channel, messageId, user, roomRole, subscribing) { NewMode = mode; }
IEnumerator PopulateMemberListing() { firebaseManager.enableLoadingScreen(); bool done = false; if (firebaseManager.auth.CurrentUser == null) { firebaseManager.auth.SignInWithEmailAndPasswordAsync("*****@*****.**", "bUfFoONeRy").ContinueWith(task => { if (task.IsFaulted || task.IsCanceled) { return; } else if (task.IsCompleted) { done = true; } }); yield return(new WaitUntil(() => done == true)); done = false; } DataSnapshot users = null; firebaseManager.getFirebaseReference("Users/Public Data").GetValueAsync().ContinueWith(task => { if (task.IsCanceled || task.IsFaulted) { return; } else if (task.IsCompleted) { users = task.Result; } }); yield return(new WaitUntil(() => users != null)); done = false; if (users.HasChildren == false) { noMemberText.SetActive(true); noMemberText.GetComponentInChildren <TextMeshProUGUI>().text = "No Registered Members"; firebaseManager.disableLoadingScreen(); yield break; } noMemberText.SetActive(false); GameObject recyclableGameObject = null; foreach (DataSnapshot memberName in users.Children) { foreach (DataSnapshot userID in memberName.Children) { PublicUserData userData = JsonUtility.FromJson <PublicUserData>(userID.Child("profile").GetRawJsonValue()); recyclableGameObject = Instantiate(memberPrefab, memberContentGameObject.transform, false); recyclableGameObject.GetComponent <User>().SetName(userData.name); recyclableGameObject.GetComponent <User>().SetClassification(userData.classification); recyclableGameObject.GetComponent <User>().memberName = userData.name; recyclableGameObject.GetComponent <User>().userID = userID.Key; userList.Add(recyclableGameObject); } } firebaseManager.disableLoadingScreen(); }