예제 #1
0
        private void BindData()
        {
            Sections sectda = new Sections(Globals.CurrentIdentity);
            Section sect = sectda.GetInfo(GetSectionID());

            User.UserList secs = sectda.GetMembers(sect.ID);
            lstSectionUsers.Items.Clear();
            foreach (User user in secs)
                lstSectionUsers.Items.Add(
                    new ListItem(user.FullName + " (" + user.UserName + ")", user.UserName));

            User.UserList mems =
                new Courses(Globals.CurrentIdentity).GetMembers(sect.CourseID, null);
            lstAllUsers.Items.Clear();
            foreach (User user in mems)
                lstAllUsers.Items.Add(
                    new ListItem(user.FullName + " (" + user.UserName + ")", user.UserName));

            lnkSecExpl.Attributes.Add("onClick",
                @"window.open('sectionexpl.aspx?CourseID=" + sect.CourseID +
                @"', '"+sect.CourseID+@"', 'width=430, height=530')");
        }
예제 #2
0
 private string HarvestSelectedUsers()
 {
     string userstr="";
     Label lblType, lblID;
     Sections sectda = new Sections(Globals.CurrentIdentity);
     Users userda = new Users(Globals.CurrentIdentity);
     foreach (DataGridItem row in dgUsers.Items) {
         if ((row.FindControl("chkSelect") as CheckBox).Checked) {
             lblType = (Label) row.FindControl("lblType");
             lblID = (Label) row.FindControl("lblID");
             string sid = lblID.Text;
             if (lblType.Text == "S") {
                 int id = Convert.ToInt32(sid);
                 User.UserList users = sectda.GetMembers(id);
                 foreach (User user in users)
                     userstr += user.UserName + "|";
             }
             else
                 userstr += sid + "|";
         }
     }
     return userstr;
 }
예제 #3
0
        private int GetSectionProgress(Section sec)
        {
            Users userda = new Users(Globals.CurrentIdentity);
            User.UserList users = new Sections(Globals.CurrentIdentity).GetMembers(sec.ID);
            int done=0, count=0;
            foreach (User user in users) {
                Components.Submission sub = userda.GetLatestAsstSubmission(user.UserName, GetAsstID());
                if (sub != null) {
                    count++;
                    if (sub.Status == Components.Submission.GRADED)
                        done++;
                }
            }

            return Math.Min(100, Math.Max(0, (int)(((double)done)/((double)count)*100.0)));
        }
예제 #4
0
        private void cmdAdd_Click(object sender, System.EventArgs e)
        {
            int sectionID = GetSectionID();
            bool switchu = chkSwitch.Checked;
            ArrayList users = GetSelectedUsers(lstAllUsers);

            lblMemError.Visible = false;
            Sections sectionda = new Sections(Globals.CurrentIdentity);
            try {
                foreach (string user in users)
                    sectionda.AddUser(sectionID, user, switchu);
            } catch (DataAccessException er) {
                lblMemError.Text = er.Message;
                lblMemError.Visible = true;
            }

            BindData();
            if (Refresh != null)
                Refresh(this, new RefreshEventArgs());
        }
예제 #5
0
        private string[] HarvestSelectedUsers(System.Web.UI.WebControls.DataGrid sgrid)
        {
            string userstr="", prinstr="";
            Label lblType, lblID;
            Sections sectda = new Sections(Globals.CurrentIdentity);
            Users userda = new Users(Globals.CurrentIdentity);
            foreach (DataGridItem row in sgrid.Items) {
                if ((row.FindControl("chkSelect") as CheckBox).Checked) {
                    lblType = (Label) row.FindControl("lblType");
                    lblID = (Label) row.FindControl("lblID");
                    string sid = lblID.Text;
                    if (lblType.Text == "S") {
                        int id = Convert.ToInt32(sid);
                        User.UserList users = sectda.GetMembers(id);
                        foreach (User user in users) {
                            userstr += user.UserName + "|";
                            prinstr += user.PrincipalID.ToString() + " ";
                        }
                    }
                    else {
                        userstr += sid + "|";
                        User user = userda.GetInfo(sid, null);
                        prinstr += user.PrincipalID.ToString() + " ";
                    }
                }
            }

            string[] retarr = new string[2];
            retarr[0] = userstr; retarr[1] = prinstr;
            return retarr;
        }
예제 #6
0
        private void dgSections_ItemCommand(object sender, DataGridCommandEventArgs e)
        {
            string refreshString = "";
            string prinstr = "";
            int status = Components.Submission.UNGRADED;;
            User.UserList users=null;
            Label lblID = (Label) e.Item.FindControl("lblID");

            if (e.CommandName=="UnGraded")
                status = Components.Submission.UNGRADED;
            else if (e.CommandName == "Graded")
                status = Components.Submission.GRADED;

            users = new Sections(Globals.CurrentIdentity).GetStudentsBySubStatus(
                Convert.ToInt32(lblID.Text), GetAsstID(), status);

            if (users!=null){
                if (users.Count!=0){
                    foreach (User user in users){
                        refreshString += user.UserName + "|";
                        prinstr += user.PrincipalID.ToString() + " ";
                    }
                    mpViews.SelectedIndex = 2;
                    Refresh(this, new RefreshEventArgs(refreshString, false, false));
                    lblPrinStr.Text = prinstr;
                    BindAutoData();
                }
            }
        }
예제 #7
0
        private void BindSectionItem(Section sec, Label lblName, 
            LinkButton lnkGraded,
            LinkButton lnkUnGraded,
            Label lblStudents,
            Label lblSubmissions,
            System.Web.UI.WebControls.Image imgStatus,
            System.Web.UI.WebControls.Image imgType, CheckBox chkSelect)
        {
            imgType.ImageUrl = "../../attributes/group.gif";
            lblName.Text = sec.Name;
            chkSelect.Checked = false;

            Section.SectionProgress progress =
                new Sections(Globals.CurrentIdentity).GetGradingProgress(sec.ID, GetAsstID());

            int gradedperc =
                Math.Min(100, Math.Max(0, (int)(((double)progress.TotalGraded / ((double)(progress.TotalSubmissions)))*100.0)));
            lnkGraded.Text = progress.TotalGraded.ToString() + " (" + gradedperc + "%)";
            lnkUnGraded.Text = (progress.TotalSubmissions - progress.TotalGraded).ToString()
                + " (" + (100-gradedperc).ToString() + "%)";
            lblStudents.Text = progress.TotalStudents.ToString();
            lblSubmissions.Text = progress.TotalSubmissions.ToString();

            if (progress.TotalGraded == progress.TotalSubmissions)
                imgStatus.ImageUrl = "../../attributes/subgrade.gif";
            else
                imgStatus.Visible = false;
        }
예제 #8
0
        private void LoadUserGroupNode(TreeNode par, int courseID, string ubound, string lbound)
        {
            User.UserList users;
            int sectID;

            bool sectnode = IsSectionNode(par, out sectID);
            if (!sectnode)
                users = new Courses(Globals.CurrentIdentity).GetMembers(courseID, null);
            else
                users = new Sections(Globals.CurrentIdentity).GetMembers(sectID);

            par.Nodes.Clear();
            bool cnode = IsCourseNode(par);
            int asstID=0;
            if (!cnode) asstID = GetAsstParentID(par);
            new UserGrouper().Regroup(ubound, lbound, users);

            foreach (User user in users)
                AddUserNode(par.Nodes, user, asstID, !cnode);
        }
예제 #9
0
        private void LoadSectionNode(TreeNode par, int sectionID)
        {
            User.UserList users = new Sections(Globals.CurrentIdentity).GetMembers(sectionID);
            UserGrouper grouper = new UserGrouper();

            par.Nodes.Clear();
            AddReportNode(par.Nodes, sectionID);
            AddPermNode(par.Nodes, sectionID);
            ArrayList groups = new ArrayList();

            bool cnode = IsCourseNode(par);
            int asstID=0;
            if (!cnode) asstID = GetAsstParentID(par);
            if (grouper.Group(users, groups))
                foreach (UserGrouper.UserGroup group in groups)
                    AddUserGroupNode(par.Nodes, GetCourseID(), group);
            else
                foreach (User user in users)
                    AddUserNode(par.Nodes, user, asstID, !cnode);
        }