Exemplo n.º 1
0
        /// <summary>
        /// Create an assignment
        /// </summary>
        public int Create(int courseID, string creator, string desc, DateTime duedate)
        {
            //Check perm
            Authorize(courseID, Permission.COURSE, "createasst", courseID, null);

            Assignment asst = new Assignment();
            asst.CourseID = courseID;
            asst.Creator = creator;
            asst.Description = desc;
            asst.DueDate = duedate;
            asst.Format = Assignment.DEFAULT_FORMAT;

            //Create
            m_dp.CreateAssignment(asst);

            //Setup default permissions
            CreatePermissions(asst.ID, courseID, Permission.ASSIGNMENT);

            //Setup default file permissions
            Courses courseda = new Courses(m_ident);
            CFilePermission.FilePermissionList perms = new CFilePermission.FilePermissionList();
            CourseRole.CourseRoleList staff = courseda.GetTypedRoles(courseID, true, null);
            CourseRole.CourseRoleList stu = courseda.GetTypedRoles(courseID, false, null);
            foreach (CourseRole role in staff)
                perms.AddRange(CFilePermission.CreateFullAccess(role.PrincipalID));

            foreach (CourseRole role in stu)
                perms.Add(new CFilePermission(role.PrincipalID, FileAction.READ, true));

            //Create content area
            FileSystem fs = new FileSystem(m_ident);
            CFile cdir = fs.CreateDirectory(@"c:\acontent\" + asst.ID, false, perms, false);
            asst.ContentID = cdir.ID;
            Update(asst);

            //Log
            Log("Created assignment: " + desc, asst.ID);

            return asst.ID;
        }
Exemplo n.º 2
0
        private void cmdAsstUpdate_Click(object sender, EventArgs e)
        {
            Assignment asst = new Assignment();

            asst.ID = (int) ViewState["asstid"];
            asst = new Assignments(Globals.CurrentIdentity).GetInfo(asst.ID);
            asst.Description = txtAsstName.Text;
            asst.DueDate = Convert.ToDateTime(txtAsstDueDate.Text);
            asst.ContentID = Convert.ToInt32(lblContentID.Text);
            asst.StudentRelease = chkAvailable.Checked;
            asst.StudentSubmit = chkEvaluation.Checked;
            asst.CourseID = Convert.ToInt32(lblCourseID.Text);

            try {
                new Assignments(Globals.CurrentIdentity).Update(asst);
            } catch (DataAccessException er) {
                PageAsstError(er.Message);
            }

            Refresh(this, new RefreshEventArgs("", true, false));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Get assignment info
 /// Results in direct Provider layer call
 /// </summary>
 public Assignment GetInfo(int asstID)
 {
     Assignment asst = new Assignment();
     m_dp.GetAssignmentInfo(asstID, asst);
     return asst;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Update the assignment
        /// </summary>
        public bool Update(Assignment asst)
        {
            //Check various permissions
            Authorize(asst.CourseID, "update", asst.ID, null);
            Assignment oldasst = GetInfo(asst.ID);
            if (oldasst.StudentRelease != asst.StudentRelease)
                Authorize(asst.CourseID, "mrkavail", asst.ID, null);
            if (oldasst.StudentSubmit != asst.StudentSubmit)
                Authorize(asst.CourseID, "stusubmit", asst.ID, null);

            return m_dp.UpdateAssignment(asst);
        }
Exemplo n.º 5
0
 private TreeNode AddAsstNode(TreeNodeCollection par, Assignment asst)
 {
     return AddNode(par, asst.Description, "attributes/asst.gif", "attributes/asst.gif",
         "Asst " + asst.ID, true);
 }