Exemple #1
0
 protected void grdTutors_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Message")
     {
         int    index         = Convert.ToInt32(e.CommandArgument);
         string TheirObjectId = (string)grdTutors.DataKeys[index]["ObjectId"];
         Session["ConversationUserId"] = TheirObjectId;
         Response.Redirect("Messages");
     }
     else if (e.CommandName == "SeeProfile")
     {
         int    index         = Convert.ToInt32(e.CommandArgument);
         string TheirObjectId = (string)grdTutors.DataKeys[index]["ObjectId"];
         Response.Redirect("Profile.aspx?tutorId=" + TheirObjectId);
     }
     else if (e.CommandName == "ToggleModerator")
     {
         string         TheirObjectId = e.CommandArgument.ToString();
         PublicUserData pud           = AsyncHelpers.RunSync(() => PublicUserData.GetById(TheirObjectId));
         if (pud.UserType == Constants.UserType.TUTOR)
         {
             pud.UserType = Constants.UserType.MODERATOR;
         }
         else if (pud.UserType == Constants.UserType.MODERATOR)
         {
             pud.UserType = Constants.UserType.TUTOR;
         }
         AsyncHelpers.RunSync(() => pud.SaveAsync());
     }
     AsyncHelpers.RunSync(LoadEverything);
 }
        protected override async Task OnStart()
        {
            if (!this.IsPostBack)
            {
                string studentID = Request.QueryString["StudentId"];
                StudentPublicData = await PublicUserData.GetById(studentID);

                Image1.ImageUrl = StudentPublicData.ProfilePic != null?StudentPublicData.ProfilePic.Url.ToString() : "Images/default_prof_pic.png";

                await PrivateTutorData.Students.FetchAllIfNeededAsync();
            }
            FixButtonVisibility();

            if (Common.ParseContains(PrivateTutorData.Students, StudentPublicData))
            {
                pnlAssignedQuestions.Visible    = true;
                pnlAnalyticsHolder.Visible      = true;
                grdAssignedQuestions.DataSource = await SuggestedQuestion.GetAssignedQuestionsBetweenStudentTutor(StudentPublicData, PublicUserData);

                grdAssignedQuestions.DataBind();
            }
            else
            {
                pnlAssignedQuestions.Visible = false;
                pnlAnalyticsHolder.Visible   = false;
            }
        }