protected void PC_GV_Comments_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        //Code to udpate the comments table with the changed comments.

        Label  commentID = (Label)PC_GV_Comments.Rows[e.RowIndex].FindControl("PC_LB_CommentID");
        string Role      = utiliFuntions.checkIFStudentorProfessor(User.Identity.Name);
        string UserID    = CourseConnectAccess.getUserID(Role, User.Identity.Name);

        TextBox comment = (TextBox)PC_GV_Comments.Rows[e.RowIndex].FindControl("PC_TB_Comment");

        TextBox videoURL = (TextBox)PC_GV_Comments.Rows[e.RowIndex].FindControl("PC_TB_VideoComment");
        string  URl      = "NA";

        if (videoURL.Text != "")
        {
            URl = videoURL.Text;
        }
        Label courseID = (Label)PC_GV_Comments.Rows[e.RowIndex].FindControl("Label5");

        int rowsUpdated = CourseConnectAccess.updateComments(UserID, comment.Text, URl, commentID.Text);

        PC_GV_Comments.EditIndex = -1;

        LoadDataToGridView();
    }
    public void getProfiledetails()
    {
        TextBox userID = (TextBox)(this.LoginView1.FindControl("userID"));

        if (Roles.IsUserInRole(User.Identity.Name, utiliFuntions.professorRole))
        {
            userID.Text = CourseConnectAccess.getUserID("PF", User.Identity.Name);
        }
        else if (Roles.IsUserInRole(User.Identity.Name, utiliFuntions.studentRole))
        {
            userID.Text = CourseConnectAccess.getUserID("ST", User.Identity.Name);
        }

        TextBox userName = (TextBox)(this.LoginView1.FindControl("userName"));

        userName.Text = User.Identity.Name;

        TextBox contact = (TextBox)(this.LoginView1.FindControl("contact"));

        contact.Text = Profile.contact;

        TextBox email = (TextBox)(this.LoginView1.FindControl("email"));

        email.Text = Profile.email;

        TextBox address = (TextBox)(this.LoginView1.FindControl("address"));

        address.Text = Profile.address;
    }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            MasterPage         masterPage = (MasterPage)this.Master;
            HtmlGenericControl homeLi     = masterPage.Home;
            homeLi.Attributes["class"] = "home";
            HtmlGenericControl aboutLi = masterPage.About;
            aboutLi.Attributes["class"] = "about";
            HtmlGenericControl userprofileLi = masterPage.UserProfile;
            userprofileLi.Attributes["class"] = "projects";
            HtmlGenericControl commentsLi = masterPage.Comments;
            commentsLi.Attributes["class"] = "blog";
            HtmlGenericControl contactLi = masterPage.Contact;
            contactLi.Attributes["class"] = "selected contact";
            HtmlGenericControl backRef = masterPage.Background;
            backRef.Attributes["class"] = "contact-page";
        }

        string role   = utiliFuntions.checkIFStudentorProfessor(User.Identity.Name);
        string userID = CourseConnectAccess.getUserID(role, User.Identity.Name);

        C_TB_UserID.Text = userID;
        C_TB_Name.Text   = User.Identity.Name;
    }
Esempio n. 4
0
    //use this event after sucessfull login to get the profile details
    //get the userID from the userName
    //Check profile type
    protected void Login1_LoggedIn(object sender, EventArgs e)
    {
        //getIdbased on userName
        string userName = Login1.UserName;
        string userID   = "NA";

        string[] userRole = Roles.GetRolesForUser(userName);
        if (Roles.IsUserInRole(userName, utiliFuntions.professorRole))
        {
            userID = CourseConnectAccess.getUserID("PF", userName);
            utiliFuntions.isProfessor = "YES";
            //Profile.isProfessor = "YES";
        }
        else if (Roles.IsUserInRole(userName, utiliFuntions.studentRole))
        {
            userID = CourseConnectAccess.getUserID("ST", userName);
            //Profile.isProfessor = "NO";
            utiliFuntions.isProfessor = "NO";
        }
        else
        {
            //Roles.AddUserToRole(userName, utiliFuntions.studentRole);
            utiliFuntions.isProfessor = "NO";
            //logged in user was not either professor / student cannot have StudentID / ProfessorID
        }

        if (userID != "NA")
        {
            utiliFuntions.userID   = userID;
            utiliFuntions.userName = userName;
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Roles.IsUserInRole(User.Identity.Name, utiliFuntions.professorRole))
     {
         string userId = CourseConnectAccess.getUserID("PF", User.Identity.Name);
         PA_LB_ProfName.Text = userId;
     }
 }
    // This method is to load the data in to the gridview.
    public void LoadDataToGridView()
    {
        string    Role         = utiliFuntions.checkIFStudentorProfessor(User.Identity.Name);
        string    UserID       = CourseConnectAccess.getUserID(Role, User.Identity.Name);
        string    testUserID   = Profile.userID;
        DataTable commnetsData = CourseConnectAccess.getCommentsByID(UserID);

        PC_GV_Comments.DataSource = commnetsData;
        PC_GV_Comments.DataBind();
    }
    //Method to handel the button click for submitting the comment
    protected void PC_B_Submit_Click(object sender, EventArgs e)
    {
        if (PC_DL_Courses.SelectedValue != "")
        {
            if (Roles.IsUserInRole(User.Identity.Name, utiliFuntions.studentRole) || Roles.IsUserInRole(User.Identity.Name, utiliFuntions.professorRole))
            {
                string commentID      = utiliFuntions.getNextuniqueID("CM");
                int    recordsUpdated = 0;
                string commnetURL     = "NA";

                // pass the value in the URL only if given any.
                if (PC_LB_VidURL.Text.Length > 0)
                {
                    commnetURL = PC_LB_VidURL.Text;
                }
                string Role   = utiliFuntions.checkIFStudentorProfessor(User.Identity.Name);
                string isProf = (Role == "PF") ? "YES": "NO";
                string UserID = CourseConnectAccess.getUserID(Role, User.Identity.Name);
                // method to update the comment in the database
                recordsUpdated = CourseConnectAccess.insterCommnet(commentID,
                                                                   PC_LB_Comment.Text,
                                                                   commnetURL,
                                                                   PC_DL_Courses.SelectedValue,
                                                                   UserID,
                                                                   isProf);

                string messageText = "Commnet Posted for: " + PC_DL_Courses.SelectedValue + "  as user: "******"/Default.aspx");
            }
            else
            {
                MsgBox("Only logged in Professors / Students can post comments", this.Page, this);
            }
        }
        else
        {
            MsgBox("Please select course to post comment", this.Page, this);
        }
    }
    protected void UpdateDetails_Click(object sender, EventArgs e)
    {
        TextBox userID = (TextBox)(this.LoginView1.FindControl("userID"));

        if (Roles.IsUserInRole(User.Identity.Name, utiliFuntions.professorRole))
        {
            Profile.userID      = CourseConnectAccess.getUserID("PF", User.Identity.Name);
            Profile.isProfessor = "YES";
        }
        else if (Roles.IsUserInRole(User.Identity.Name, utiliFuntions.studentRole))
        {
            Profile.userID      = CourseConnectAccess.getUserID("PF", User.Identity.Name);
            Profile.isProfessor = "NO";
        }

        TextBox userName = (TextBox)(this.LoginView1.FindControl("userName"));

        Profile.userName = userName.Text;

        TextBox contact = (TextBox)(this.LoginView1.FindControl("contact"));

        Profile.contact = contact.Text;

        TextBox email = (TextBox)(this.LoginView1.FindControl("email"));

        Profile.email = email.Text;

        TextBox address = (TextBox)(this.LoginView1.FindControl("address"));

        Profile.address = address.Text;

        Profile.Save();

        if (User.Identity.IsAuthenticated)
        {
            getProfiledetails();
        }
    }