Esempio n. 1
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;
        }
    }
Esempio n. 2
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. 3
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");
    }
    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;
    }
 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;
     }
 }
    protected void PC_GV_Comments_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        Label commentID = (Label)PC_GV_Comments.Rows[e.RowIndex].FindControl("PC_LB_CommentID");

        int rowsUpdated = CourseConnectAccess.deleteCommnet(commentID.Text);

        LoadDataToGridView();
        MsgBox("Comment Deleted", this.Page, this);
    }
Esempio n. 8
0
    //This method is used to get the website details.
    private void UpdateThestatistics()
    {
        int count = Membership.GetAllUsers().Count;

        numberOfUsers.Text = count.ToString();
        int noOfCourses = CourseConnectAccess.getnoOfCourses();

        Count.Text = noOfCourses.ToString();
    }
    // 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();
    }
Esempio n. 10
0
    //to get all the departments.
    public DataTable getDepartments()
    {
        DataTable    departmentsRequired = null;
        DropDownList shoolSelected       = (DropDownList)DetailsView1.FindControl("Schools_DL");

        if (shoolSelected != null)
        {
            string schoolSelected = shoolSelected.SelectedValue;

            departmentsRequired = CourseConnectAccess.getDepartmentsFromShoolID(schoolSelected);
        }

        return(departmentsRequired);
    }
Esempio n. 11
0
    public string getName(string ID, string isProfessor)
    {
        string name = "NA";

        if (isProfessor == "YES")
        {
            name = CourseConnectAccess.getProfNamefromId(ID) + "(Professor)";
        }
        else
        {
            name = CourseConnectAccess.getStudentNamefromId(ID);
        }
        return(name);
    }
Esempio n. 12
0
    protected void C_B_Submit_Click(object sender, EventArgs e)
    {
        // user this method to inset the userposted comment in to the database.

        int rowsInserted = CourseConnectAccess.inserContact(C_TB_Name.Text, C_TB_UserID.Text, C_TB_Email.Text, C_TB_IssueURL.Text, C_TB_Description.Text);

        if (rowsInserted > 0)
        {
            C_LB_Sucess.Text = "Your issue has been reporte; will respond accordingly";

            clearScreen();
        }
        else
        {
            C_LB_Sucess.Text = "Error in posting";
        }
    }
    //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();
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     SS_LB_ActiveUsers.Text = Membership.GetNumberOfUsersOnline().ToString();
     SS_LB_Courses.Text     = CourseConnectAccess.getnoOfCourses().ToString();
 }
Esempio n. 16
0
    public DataTable getDegrees()
    {
        DataTable degrees = CourseConnectAccess.getDegreesFromSchoolID( );

        return(degrees);
    }
Esempio n. 17
0
    // To get all the schools data
    public DataTable getSchools()
    {
        DataTable schools = CourseConnectAccess.getSchools();

        return(schools);
    }