예제 #1
0
    //update the comments table with the comment added
    protected void Update_Click(object sender, EventArgs e)
    {
        // create a method to get a new unique comment number
        string commentID      = utiliFuntions.getNextuniqueID("CM");
        int    recordsUpdated = 0;
        string commnetURL     = "NA";


        if (CommentURL.Text.Length > 2)
        {
            commnetURL = CommentURL.Text;
        }

        // method to update the comment in the database
        recordsUpdated = CourseConnectAccess.insterCommnet(commentID,
                                                           Commnet.Text,
                                                           commnetURL,
                                                           CourseID.Text,
                                                           utiliFuntions.userID,
                                                           utiliFuntions.isProfessor);

        //Display the pop us message to the user
        string messageText = "Commnet Posted for: " + CourseID.Text + "  as user: "******"/StudentComments.aspx");
    }
    //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);
        }
    }