예제 #1
0
        /// <summary>
        /// Create a new submission
        /// </summary>
        public Components.Submission Create(int asstid, int principalID, IExternalSource files)
        {
            //TODO: Verify parameters
            Components.Submission sub = new Components.Submission();
            sub.AsstID = asstid;
            sub.PrincipalID = principalID;
            sub.Status = Submission.UNGRADED;

            //Check for locked for evaluation
            if (!new Assignments(m_ident).IsSubmissionAvailable(asstid))
                throw new DataAccessException("Submission is locked. No more submissions are being accepted. Please contact course staff to proceed");

            //Create submission
            m_dp.CreateSubmission(sub);

            //Update to commit files
            sub = GetInfo(sub.ID);
            try {
                Update(sub, files);
            } catch (DataAccessException er) {
                UnsafeDelete(sub.ID);
                throw er;
            }

            //Queue autosubmit tests
            QueueSubmitTests(sub);

            //Log submission
            Assignment asst = new Assignments(m_ident).GetInfo(asstid);
            Log("User submitted " + asst.Description + " successfully", sub.ID);

            return sub;
        }
예제 #2
0
        /// <summary>
        /// Create a auto result.
        /// </summary>
        public bool CreateAuto(int evalID, string grader, int subID, string result)
        {
            //Check permission
            Submissions subac = new Submissions(m_ident);
            Components.Submission sub = subac.GetInfo(subID);
            Assignment asst = new Assignments(m_ident).GetInfo(sub.AsstID);
            Authorize(asst.CourseID, "createauto", asst.ID, null);

            AutoResult res = new AutoResult();
            res.EvalID = evalID; res.Grader = grader;
            res.SubmissionID = subID; res.XmlResult = result;

            //Clear out all results for this evaluation
            Submission.SubmissionList subs =
                new Principals(m_ident).GetSubmissions(sub.PrincipalID, sub.AsstID);

            //Delete all old results
            foreach (Submission s in subs) {
                Result.ResultList ress = subac.GetResults(s.ID);
                foreach (Result r in ress) {
                    if (r.Type == Result.AUTO_TYPE) {
                        AutoResult ar = r as AutoResult;
                        if (ar.EvalID == evalID)
                            Delete(ar.ID);
                    }
                }
            }

            return m_dp.CreateAutoResult(res);
        }
예제 #3
0
        /// <summary>
        /// Create a canned response for a rubric
        /// </summary>
        public bool AddCannedResponse(int rubricID, string comment, double points, int type)
        {
            //check permission
            Rubric rub = GetInfo(rubricID);
            Assignment asst = new Assignments(m_ident).GetInfo(rub.AsstID);
            Authorize(asst.CourseID, "createrubric", asst.ID, null);

            return m_dp.CreateCannedResponse(rubricID, comment, points, type);
        }
예제 #4
0
파일: rubrics.cs 프로젝트: lokygb/FrontDesk
        /// <summary>
        /// Create a canned response for a rubric
        /// </summary>
        public bool AddCannedResponse(int rubricID, string comment, double points, int type)
        {
            //check permission
            Rubric     rub  = GetInfo(rubricID);
            Assignment asst = new Assignments(m_ident).GetInfo(rub.AsstID);

            Authorize(asst.CourseID, "createrubric", asst.ID, null);

            return(m_dp.CreateCannedResponse(rubricID, comment, points, type));
        }
예제 #5
0
        private void BindComps()
        {
            //Bind list
            Evaluation.EvaluationList comps = new Assignments(Globals.CurrentIdentity).GetCompetitions(GetAsstID());
            ddlCompete.Items.Clear();
            foreach (Evaluation comp in comps)
                ddlCompete.Items.Add(new ListItem(comp.Name, comp.ID.ToString()));

            divMain.Visible = !(lblNone.Visible = (ddlCompete.Items.Count == 0));
        }
예제 #6
0
파일: rubrics.cs 프로젝트: lokygb/FrontDesk
        /// <summary>
        /// Update a canned response
        /// </summary>
        public bool UpdateCannedResponse(CannedResponse can)
        {
            //check permission
            Rubric     rub  = GetInfo(can.RubricID);
            Assignment asst = new Assignments(m_ident).GetInfo(rub.AsstID);

            Authorize(asst.CourseID, "updaterubric", asst.ID, null);

            return(m_dp.UpdateCannedResponse(can));
        }
예제 #7
0
        private void BindData()
        {
            int asstID = Convert.ToInt32(HttpContext.Current.Request.Params["AsstID"]);
            Evaluation.EvaluationList evals =
                new Assignments(Globals.CurrentIdentity).GetAutoEvals(asstID);

            lstTests.DataSource = evals;
            lstTests.DataTextField = Evaluation.NAME_FIELD;
            lstTests.DataValueField = Evaluation.ID_FIELD;
            lstTests.DataBind();
        }
예제 #8
0
        /// <summary>
        /// Update a subjective result
        /// </summary>
        public bool UpdateSubj(SubjResult res)
        {
            //Check permission
            Components.Submission sub =
                new Submissions(m_ident).GetInfo(res.SubmissionID);
            Assignment asst = new Assignments(m_ident).GetInfo(sub.AsstID);

            Authorize(asst.CourseID, "updatesubj", asst.ID, null);

            return(m_dp.UpdateSubjResult(res));
        }
예제 #9
0
        /// <summary>
        /// Create a new rubric entry
        /// </summary>
        public bool CreateItem(int parent, string name, string desc, double points, int evalID)
        {
            //check permission
            Rubric rub = GetInfo(parent);
            Assignment asst = new Assignments(m_ident).GetInfo(rub.AsstID);
            Authorize(asst.CourseID, "createrubric", asst.ID, null);

            //log
            Log("Created rubric entry: " + name, asst.ID);
            return m_dp.CreateRubricEntry(name, desc, parent, points, evalID);
        }
예제 #10
0
        protected string GetAsstPoints(User user, int asstID)
        {
            Components.Submission latsub =
                new Principals(Globals.CurrentIdentity).GetLatestGradedSubmission(user.PrincipalID, asstID);
            double total = new Assignments(Globals.CurrentIdentity).GetRubric(asstID).Points;

            if (latsub != null) {
                double userp = new Users(Globals.CurrentIdentity).GetAsstPoints(user.UserName, asstID);
                return String.Format("{0} / {1} ({2}%)", userp, total, Math.Round((userp/total)*100.0, 2));
            } else
                return String.Format("?? / {0}", total);
        }
예제 #11
0
        /// <summary>
        /// Delete a result
        /// </summary>
        public bool Delete(int resID)
        {
            //Check permission
            Result res = GetInfo(resID);

            Components.Submission sub  = new Submissions(m_ident).GetInfo(res.SubmissionID);
            Assignment            asst = new Assignments(m_ident).GetInfo(sub.AsstID);

            Authorize(asst.CourseID, "deletesubj", asst.ID, null);

            return(m_dp.DeleteResult(resID));
        }
예제 #12
0
파일: rubrics.cs 프로젝트: lokygb/FrontDesk
        /// <summary>
        /// Create a new rubric entry
        /// </summary>
        public bool CreateItem(int parent, string name, string desc, double points, int evalID)
        {
            //check permission
            Rubric     rub  = GetInfo(parent);
            Assignment asst = new Assignments(m_ident).GetInfo(rub.AsstID);

            Authorize(asst.CourseID, "createrubric", asst.ID, null);

            //log
            Log("Created rubric entry: " + name, asst.ID);
            return(m_dp.CreateRubricEntry(name, desc, parent, points, evalID));
        }
예제 #13
0
        /// <summary>
        /// Create a test for a job
        /// </summary>
        public bool CreateTest(int jobID, int subID, int evalID, bool onsubmit)
        {
            Components.Submission sub = new Submissions(m_ident).GetInfo(subID);
            Assignment asst = new Assignments(m_ident).GetInfo(sub.AsstID);
            Evaluation eval = new Evaluations(m_ident).GetInfo(evalID);
            //		Authorize(asst.CourseID, "createjob", asst.ID, null);

            //Log that the student is being auto run
            new Activities(m_ident).Create(m_ident.Name, Activity.SUBMISSION, subID,
                "Started auto-evaluation: " + eval.Name);

            return m_dp.CreateAutoJobTest(jobID, evalID, subID, onsubmit);
        }
예제 #14
0
        /// <summary>
        /// Create a new job in the queue
        /// </summary>
        public AutoJob Create(string name, int asstID)
        {
            Assignment asst = new Assignments(m_ident).GetInfo(asstID);
            //	Authorize(asst.CourseID, "createjob", asstID, null);

            AutoJob job = new AutoJob();
            job.JobName = name;
            job.JobCreator = m_ident.Name;
            job.AsstID = asstID;
            m_dp.CreateAutoJob(job);

            return job;
        }
예제 #15
0
        /// <summary>
        /// Create a new job in the queue
        /// </summary>
        public AutoJob Create(string name, int asstID)
        {
            Assignment asst = new Assignments(m_ident).GetInfo(asstID);
            //	Authorize(asst.CourseID, "createjob", asstID, null);

            AutoJob job = new AutoJob();

            job.JobName    = name;
            job.JobCreator = m_ident.Name;
            job.AsstID     = asstID;
            m_dp.CreateAutoJob(job);

            return(job);
        }
예제 #16
0
        /// <summary>
        /// Create a test for a job
        /// </summary>
        public bool CreateTest(int jobID, int subID, int evalID, bool onsubmit)
        {
            Components.Submission sub  = new Submissions(m_ident).GetInfo(subID);
            Assignment            asst = new Assignments(m_ident).GetInfo(sub.AsstID);
            Evaluation            eval = new Evaluations(m_ident).GetInfo(evalID);

            //		Authorize(asst.CourseID, "createjob", asst.ID, null);

            //Log that the student is being auto run
            new Activities(m_ident).Create(m_ident.Name, Activity.SUBMISSION, subID,
                                           "Started auto-evaluation: " + eval.Name);

            return(m_dp.CreateAutoJobTest(jobID, evalID, subID, onsubmit));
        }
예제 #17
0
        /// <summary>
        /// Delete a submission
        /// </summary>
        public bool Delete(int subID)
        {
            Submission sub = GetInfo(subID);
            Assignment asst = new Assignments(m_ident).GetInfo(sub.AsstID);
            int locid = sub.LocationID;

            //Check permission
            Authorize(asst.CourseID, Permission.ASSIGNMENT, "delsub", asst.ID, null);

            //Kill
            DoDelete(subID, locid);

            return true;
        }
예제 #18
0
        /// <summary>
        /// Delete a submission
        /// </summary>
        public bool Delete(int subID)
        {
            Submission sub   = GetInfo(subID);
            Assignment asst  = new Assignments(m_ident).GetInfo(sub.AsstID);
            int        locid = sub.LocationID;

            //Check permission
            Authorize(asst.CourseID, Permission.ASSIGNMENT, "delsub", asst.ID, null);

            //Kill
            DoDelete(subID, locid);

            return(true);
        }
예제 #19
0
파일: courses.cs 프로젝트: lokygb/FrontDesk
        /// <summary>
        /// Get total points available for course
        /// </summary>
        public double GetTotalPoints(int courseID)
        {
            Assignment.AssignmentList assts = GetAssignments(courseID);
            double points = 0.0;

            Assignments asstda = new Assignments(m_ident);

            foreach (Assignment asst in assts)
            {
                points += asstda.GetRubric(asst.ID).Points;
            }

            return(points);
        }
예제 #20
0
        /// <summary>
        /// Get the results of a competitive evaluation
        /// </summary>
        public Result.ResultList GetCompetitionResults(int evalID, out Hashtable subhash)
        {
            subhash = new Hashtable();
            Evaluation eval  = GetInfo(evalID);
            int        rubID = GetRubric(evalID).ID;

            //Get all results for the evaluation
            Result.ResultList ress = new Rubrics(m_ident).GetResults(rubID);

            //Get all subs for the assignment
            Components.Submission.SubmissionList subs = new Assignments(m_ident).GetSubmissions(eval.AsstID);

            //Load unique subs into hash table
            Principals prinda = new Principals(m_ident);

            foreach (Components.Submission sub in subs)
            {
                if (!subhash.Contains(sub.PrincipalID) &&
                    prinda.GetLatestSubmission(sub.PrincipalID, eval.AsstID).ID == sub.ID)
                {
                    subhash[sub.PrincipalID] = sub;
                }
            }
            Components.Submission[] usubs = new Components.Submission[subhash.Count];
            subhash.Values.CopyTo(usubs, 0);
            subhash.Clear();
            foreach (Components.Submission sub in usubs)
            {
                subhash[sub.ID] = sub;
            }

            //Run through results and delete any repetitive ones
            Result.ResultList fress = new Result.ResultList();
            foreach (Result res in ress)
            {
                if (((AutoResult)res).Success != AutoResult.CRITICALLYFLAWED &&
                    ((AutoResult)res).Success != AutoResult.DEPFAIL &&
                    subhash.Contains(res.SubmissionID))
                {
                    fress.Add(res);
                }
            }

            //Sort by competitive score
            fress.Sort(new CompResultComparer());

            return(fress);
        }
예제 #21
0
        public string Backup(string username, int courseID, int asstID, IExternalSink extsink)
        {
            string zfile, wzfile, backdesc=username+": ";
            //Create our external sink file
            if (extsink == null) {
                extsink = ArchiveToolFactory.GetInstance().CreateArchiveTool(".zip") as IExternalSink;
                zfile = username+DateTime.Now.Hour+DateTime.Now.Minute+DateTime.Now.Second+".zip";
                wzfile = Globals.BackupDirectoryName + "/" + zfile;
                zfile = Path.Combine(Globals.BackupDirectory, zfile);
                extsink.CreateSink(zfile);
            }
            else {
                wzfile = zfile = ""; // In the middle of a backup
            }
            //Backup Results

            //Back up submissions
            FileSystem fs = new FileSystem(m_ident);
            Components.Submission.SubmissionList subs;
            if (asstID < 0) {
                if (zfile != "")
                    backdesc += (new Courses(m_ident).GetInfo(courseID)).Name;
                subs = GetCourseSubmissions(username, courseID);
            }
            else {
                if (zfile != "")
                    backdesc += new Assignments(m_ident).GetInfo(asstID).Description;
                subs = GetAsstSubmissions(username, asstID);
            }

            foreach (Components.Submission sub in subs)
                fs.ExportData(username, sub.LocationID, extsink, true);

            //If we are doing this not in a batch
            if (zfile != "") extsink.CloseSink();

            //Log backup in database
            if (zfile != "") new Backups(Globals.CurrentIdentity).Create(
                                 backdesc, wzfile, courseID);

            return zfile;
        }
예제 #22
0
파일: users.cs 프로젝트: lokygb/FrontDesk
        /// <summary>
        /// Get the heading row for an export
        /// </summary>
        public ExportRow GetAsstExportHeading(int asstID)
        {
            Rubrics   rubda = new Rubrics(m_ident);
            ExportRow row   = new ExportRow();

            //Get all rubric entries for the assignment
            Assignment asst = new Assignments(m_ident).GetInfo(asstID);
            Rubric     rub  = new Assignments(m_ident).GetRubric(asstID);

            Rubric.RubricList rublist = rubda.Flatten(rub);

            //Total
            row.Fields.Add(asst.Description + " Total");
            foreach (Rubric rubent in rublist)
            {
                row.Fields.Add(rubent.Name);
            }

            return(row);
        }
예제 #23
0
        private void BindData()
        {
            Courses courseda = new Courses(Globals.CurrentIdentity);
            Assignment asst = new Assignments(Globals.CurrentIdentity).GetInfo(GetAsstID());
            Course course = courseda.GetInfo(asst.CourseID);

            Section.SectionList sections = courseda.GetSections(course.ID);
            CourseMember.CourseMemberList mems = courseda.GetMembers(course.ID, null);

            ArrayList secmems = sections;
            secmems.AddRange(mems);

            dgUsers.DataSource = secmems;
            dgUsers.DataBind();

            cmdEvaluate.Enabled = asst.ResultRelease;
            lblEvaluate.Visible = !asst.ResultRelease;

            lnkSecExpl.Attributes.Add("onClick",
                @"window.open('sectionexpl.aspx?CourseID=" + course.ID +
                @"', '"+ course.ID+@"', 'width=430, height=530')");
        }
예제 #24
0
        /// <summary>
        /// Create a auto result.
        /// </summary>
        public bool CreateAuto(int evalID, string grader, int subID, string result)
        {
            //Check permission
            Submissions subac = new Submissions(m_ident);

            Components.Submission sub  = subac.GetInfo(subID);
            Assignment            asst = new Assignments(m_ident).GetInfo(sub.AsstID);

            Authorize(asst.CourseID, "createauto", asst.ID, null);

            AutoResult res = new AutoResult();

            res.EvalID       = evalID; res.Grader = grader;
            res.SubmissionID = subID; res.XmlResult = result;

            //Clear out all results for this evaluation
            Submission.SubmissionList subs =
                new Principals(m_ident).GetSubmissions(sub.PrincipalID, sub.AsstID);

            //Delete all old results
            foreach (Submission s in subs)
            {
                Result.ResultList ress = subac.GetResults(s.ID);
                foreach (Result r in ress)
                {
                    if (r.Type == Result.AUTO_TYPE)
                    {
                        AutoResult ar = r as AutoResult;
                        if (ar.EvalID == evalID)
                        {
                            Delete(ar.ID);
                        }
                    }
                }
            }

            return(m_dp.CreateAutoResult(res));
        }
예제 #25
0
        public void BindData(AutoEvaluation eval)
        {
            int asstID = eval.AsstID;

            Assignments assts = new Assignments(Globals.CurrentIdentity);
            Evaluations evals = new Evaluations(Globals.CurrentIdentity);

            Evaluation.EvaluationList allevals = assts.GetAutoEvals(asstID);
            Evaluation.EvaluationList deps = evals.GetDependencies(eval.ID);

            chkDeps.Items.Clear();
            foreach (Evaluation e in allevals) {
                if (e.ID == eval.ID) continue;
                ListItem eitem = new ListItem(e.Name, e.ID.ToString());
                foreach (Evaluation d in deps) {
                    if (d.ID == e.ID) {
                        eitem.Selected = true;
                        break;
                    }
                }
                chkDeps.Items.Add(eitem);
            }
        }
예제 #26
0
파일: rubrics.cs 프로젝트: lokygb/FrontDesk
        /// <summary>
        /// Delete a rubric entry
        /// </summary>
        public bool Delete(int rubID)
        {
            //check permission
            Rubric     rub  = GetInfo(rubID);
            Assignment asst = new Assignments(m_ident).GetInfo(rub.AsstID);

            Authorize(asst.CourseID, "deleterubric", asst.ID, null);

            //Delete children
            Rubric.RubricList chil = GetChildren(rubID);
            foreach (Rubric c in chil)
            {
                Delete(c.ID);
            }

            //Delete any underlying evaluation
            if (rub.EvalID >= 0)
            {
                new Evaluations(m_ident).Delete(rub.EvalID);
            }

            //Delete entry
            m_dp.DeleteRubricEntry(rubID);

            //Retally points and update root entry
            if (rub.ParentID >= 0)
            {
                Rubric root = new Assignments(m_ident).GetRubric(rub.AsstID);
                root.Points = RetallyPoints(root);
                m_dp.UpdateRubricEntry(root);
            }

            //Log
            Log("Deleted rubric entry: " + rub.Name, rub.AsstID);

            return(true);
        }
예제 #27
0
        public void Update(int editEval, int asstID)
        {
            Assignments assts = new Assignments(Globals.CurrentIdentity);
            Evaluations evals = new Evaluations(Globals.CurrentIdentity);

            Evaluation.EvaluationList allevals = assts.GetAutoEvals(asstID);
            foreach (ListItem item in Items) {
                int iid = Convert.ToInt32(item.Value);
                foreach (Evaluation eval in allevals) {
                    if (iid == eval.ID) {
                        bool dependence = evals.DependsOn(editEval, iid);
                        if (dependence && !item.Selected)
                            evals.DeleteDependency(editEval, iid);
                        else if (!dependence && item.Selected) {
                            if (!evals.CreateDependency(editEval, iid)) {
                                item.Selected = false;
                                throw new DataAccessException("Cannot create a circular dependency: " +
                                    eval.Name);
                            }
                        }
                    }
                }
            }
        }
예제 #28
0
        private void QueueSubmitTests(Components.Submission sub)
        {
            int    asstID = sub.AsstID;
            string strlog = "";

            Evaluation.EvaluationList tests = new Assignments(m_ident).GetSubmitAutoEvals(asstID);
            if (tests.Count == 0)
            {
                return;
            }

            //Queue up pretests
            AutoJobs jobda = new AutoJobs(m_ident);
            AutoJob  job   = jobda.Create(m_ident.Name + " submission", asstID);

            foreach (Evaluation eval in tests)
            {
                jobda.CreateTest(job.ID, sub.ID, eval.ID, true);
                strlog += eval.Name + " ";
            }

            //Log queueing
            Log("Pretests queued: " + strlog, sub.ID);
        }
예제 #29
0
        /// <summary>
        /// Create a new submission
        /// </summary>
        public Components.Submission Create(int asstid, int principalID, IExternalSource files)
        {
            //TODO: Verify parameters
            Components.Submission sub = new Components.Submission();
            sub.AsstID      = asstid;
            sub.PrincipalID = principalID;
            sub.Status      = Submission.UNGRADED;

            //Check for locked for evaluation
            if (!new Assignments(m_ident).IsSubmissionAvailable(asstid))
            {
                throw new DataAccessException("Submission is locked. No more submissions are being accepted. Please contact course staff to proceed");
            }

            //Create submission
            m_dp.CreateSubmission(sub);

            //Update to commit files
            sub = GetInfo(sub.ID);
            try {
                Update(sub, files);
            } catch (DataAccessException er) {
                UnsafeDelete(sub.ID);
                throw er;
            }

            //Queue autosubmit tests
            QueueSubmitTests(sub);

            //Log submission
            Assignment asst = new Assignments(m_ident).GetInfo(asstid);

            Log("User submitted " + asst.Description + " successfully", sub.ID);

            return(sub);
        }
예제 #30
0
        /// <summary>
        /// Create a subjective result
        /// </summary>
        public bool CreateSubj(int subID, int rubricID, string comment, int fileid, int line, 
            double points, ArrayList lines, int type)
        {
            //Check permission
            Components.Submission sub =
                new Submissions(m_ident).GetInfo(subID);
            Assignment asst = new Assignments(m_ident).GetInfo(sub.AsstID);
            Authorize(asst.CourseID, "createsubj", asst.ID, null);

            SubjResult res = new SubjResult();
            res.SubjType = type; res.RubricID = rubricID;
            res.Comment = comment; res.FileID = fileid; res.Line = line;
            res.Grader = m_ident.Name; res.SubmissionID = subID;
            res.Points = points;

            //Create result
            m_dp.CreateSubjResult(res);

            //Attach lines
            foreach (int l in lines)
                m_dp.CreateSubjLineAffect(res.ID, l);

            return true;
        }
예제 #31
0
        /// <summary>
        /// Load submission directory with new files, updates time
        /// </summary>
        public bool Update(Submission sub, IExternalSource files)
        {
            FileSystem fs = new FileSystem(m_ident);
            bool       markcmp, unmarkcmp, defunct;

            //Get old sub
            Components.Submission oldsub = GetInfo(sub.ID);
            markcmp = (oldsub.Status == Components.Submission.UNGRADED &&
                       sub.Status == Components.Submission.GRADED);
            unmarkcmp = (oldsub.Status == Components.Submission.GRADED &&
                         sub.Status == Components.Submission.UNGRADED);
            defunct = (oldsub.Status != Components.Submission.DEFUNCT &&
                       sub.Status == Components.Submission.DEFUNCT);

            //Make sure toplevel zone directory exists
            CFile subdir = fs.GetFile(@"c:\subs");

            if (null == subdir)
            {
                subdir = fs.CreateDirectory(@"c:\subs", true, null, false);
            }

            //Build file perms
            CFilePermission.FilePermissionList perms = new CFilePermission.FilePermissionList();
            int courseID = new Assignments(m_ident).GetInfo(sub.AsstID).CourseID;

            CourseRole.CourseRoleList staff = new Courses(m_ident).GetTypedRoles(courseID, true, null);
            foreach (CourseRole role in staff)
            {
                perms.AddRange(CFilePermission.CreateFullAccess(role.PrincipalID));
            }
            perms.AddRange(CFilePermission.CreateOprFullAccess(sub.PrincipalID));

            //Create zone directory
            CFile  esubdir;
            string zpath = @"c:\subs\" + sub.ID;

            if (null == (esubdir = fs.GetFile(zpath)))
            {
                esubdir          = fs.CreateDirectory(zpath, false, perms, false);
                esubdir.SpecType = CFile.SpecialType.SUBMISSION;
                string name = new Principals(m_ident).GetInfo(sub.PrincipalID).Name;
                esubdir.Alias = String.Format("{0}: {1}",
                                              name, GetNextSubmission(sub.AsstID, sub.PrincipalID));
                fs.UpdateFileInfo(esubdir, false);
            }
            //Update sub entry
            sub.LocationID = esubdir.ID;
            m_dp.UpdateSubmission(sub);


            //Load files
            try {
                fs.ImportData(zpath, files, false, false);                 //Import the data
            } catch (Exception) {
                throw new DataAccessException("Invalid external file source. This means the system does " +
                                              "not understand how to extract files from the source. Please create a valid source");
            }

            //Verify submission structure
            VerifyFormat(sub.AsstID, zpath);

            //Log
            if (markcmp)
            {
                Log("User [" + m_ident.Name + "] marked submission " + esubdir.Alias + " completed", sub.ID);
            }
            else if (unmarkcmp)
            {
                Log("User [" + m_ident.Name + "] marked submission " + esubdir.Alias + " incomplete", sub.ID);
            }
            else if (defunct)
            {
                Log("User [" + m_ident.Name + "] marked submission " + esubdir.Alias + " defunct", sub.ID);
            }

            return(true);
        }
예제 #32
0
        private void VerifyFormat(int asstID, string zpath)
        {
            FileSystem fs = new FileSystem(m_ident);

            DataSet zonedesc = new DataSet();
            string xmlString = new Assignments(m_ident).GetInfo(asstID).Format;
            if (xmlString == null || xmlString.Length == 0)
                return;
            MemoryStream memstream =
                new MemoryStream(System.Text.Encoding.ASCII.GetBytes(xmlString));
            zonedesc.ReadXml(memstream);
            DataTable inodes = zonedesc.Tables["File"];

            foreach (DataRow row in inodes.Rows){
                string name = (string)row["name"];
                if (name != ".")
                    if (null == fs.GetFile(Path.Combine(zpath, name.Substring(2))))
                        throw new DataAccessException("Error: Your archive was missing the file: "+ name + " that is required by this assignment. You must resubmit with the correct files.");
            }
        }
예제 #33
0
        public void SynchronizePoints()
        {
            Courses courseda = new Courses(m_ident);
            Assignments asstda = new Assignments(m_ident);
            int total=0;

            Course.CourseList courses = courseda.GetAll();
            foreach (Course course in courses) {
                Assignment.AssignmentList assts = courseda.GetAssignments(course.ID);
                foreach (Assignment asst in assts) {
                    Rubric arub = asstda.GetRubric(asst.ID);
                    Rubric.RubricList rubs = Flatten(arub);
                    Components.Submission.SubmissionList subs = asstda.GetSubmissions(asst.ID);
                    foreach (Rubric rub in rubs) {
                        foreach (Components.Submission sub in subs) {
                            m_dp.UpdateRubricSubPoints(rub.ID, sub.ID);
                            total++;
                        }
                    }
                }
            }

            System.Diagnostics.Trace.WriteLine(total);
        }
예제 #34
0
        /// <summary>
        /// Get the heading row for an export
        /// </summary>
        public ExportRow GetAsstExportHeading(int asstID)
        {
            Rubrics rubda = new Rubrics(m_ident);
            ExportRow row = new ExportRow();

            //Get all rubric entries for the assignment
            Assignment asst = new Assignments(m_ident).GetInfo(asstID);
            Rubric rub = new Assignments(m_ident).GetRubric(asstID);
            Rubric.RubricList rublist = rubda.Flatten(rub);

            //Total
            row.Fields.Add(asst.Description + " Total");
            foreach (Rubric rubent in rublist)
                row.Fields.Add(rubent.Name);

            return row;
        }
예제 #35
0
        private void dgReport_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            Label lblPoints;
            if (null != (lblPoints = (Label) e.Item.FindControl("lblPoints"))) {

                int asstID = Convert.ToInt32(dgReport.DataKeys[e.Item.ItemIndex]);
                User user = new Users(Globals.CurrentIdentity).GetInfo(GetUsername(), null);
                Components.Submission latsub =
                    new Principals(Globals.CurrentIdentity).GetLatestGradedSubmission(user.PrincipalID, asstID);
                double total = new Assignments(Globals.CurrentIdentity).GetRubric(asstID).Points;

                if (latsub != null) {
                    double userp = new Users(Globals.CurrentIdentity).GetAsstPoints(user.UserName, asstID);
                    lblPoints.Text =
                        String.Format("{0} / {1} ({2}%)", userp, total, Math.Round((userp/total)*100.0, 2));
                } else {
                    lblPoints.Text =
                        String.Format("?? / {0}", total);
                }
            }
        }
예제 #36
0
        private DataTable TabulateUsers(User.UserList users)
        {
            DataTable resulttab = new DataTable();
            int asstID = GetAsstID();
            Rubrics rubda = new Rubrics(Globals.CurrentIdentity);
            Principals prinda = new Principals(Globals.CurrentIdentity);
            Rubric asstrub = new Assignments(Globals.CurrentIdentity).GetRubric(asstID);

            //Add rubric columns to data grid
            Rubric.RubricList flatrub = rubda.Flatten(asstrub);
            resulttab.Columns.Add("UserName");
            resulttab.Columns.Add("Status");
            resulttab.Columns.Add("Total");
            foreach (Rubric rub in flatrub) {
                AddRubricColumn(rub.Name, rub.Name);
                resulttab.Columns.Add(rub.Name);
            }

            //Add user data to the datatable
            foreach (User user in users) {
                Components.Submission sub = prinda.GetLatestSubmission(user.PrincipalID, asstID);
                DataRow row = resulttab.NewRow();

                if (sub == null) continue;

                row["UserName"] = user.UserName;
                row["Status"] = sub.Status;
                row["Total"] = rubda.GetPoints(asstrub.ID, sub.ID).ToString() + "/" + asstrub.Points.ToString();
                foreach (Rubric rub in flatrub)
                    row[rub.Name] = GetRubricPoints(rub, sub.ID) + "/" + rub.Points.ToString();

                resulttab.Rows.Add(row);
            }

            return resulttab;
        }
예제 #37
0
        private bool tb_Save(object sender, EventArgs e)
        {
            //needs to navigate in order thru the current tree and write
            //the structure to and xml string which is then written to the database
            //the order of forming this final xml is important since it determines
            //the order in which nodes are created in the tree
            TreeNode rootNode = tvFormat.Nodes[0];
            string xmlString = GenerateXMLForStructure(rootNode);
            Assignment asst = new Assignments(Globals.CurrentIdentity).GetInfo((int)ViewState["asstid"]);
            asst.Format = "<Root>"+xmlString+"</Root>";
            new Assignments(Globals.CurrentIdentity).Update(asst);

            return true;
        }
예제 #38
0
        /// <summary>
        /// Delete a rubric entry
        /// </summary>
        public bool Delete(int rubID)
        {
            //check permission
            Rubric rub = GetInfo(rubID);
            Assignment asst = new Assignments(m_ident).GetInfo(rub.AsstID);
            Authorize(asst.CourseID, "deleterubric", asst.ID, null);

            //Delete children
            Rubric.RubricList chil = GetChildren(rubID);
            foreach (Rubric c in chil)
                Delete(c.ID);

            //Delete any underlying evaluation
            if (rub.EvalID >= 0)
                new Evaluations(m_ident).Delete(rub.EvalID);

            //Delete entry
            m_dp.DeleteRubricEntry(rubID);

            //Retally points and update root entry
            if (rub.ParentID >= 0) {
                Rubric root = new Assignments(m_ident).GetRubric(rub.AsstID);
                root.Points = RetallyPoints(root);
                m_dp.UpdateRubricEntry(root);
            }

            //Log
            Log("Deleted rubric entry: " + rub.Name, rub.AsstID);

            return true;
        }
예제 #39
0
        private void BindData()
        {
            Components.Submission sub =
                new Submissions(Globals.CurrentIdentity).GetInfo(GetSubID());

            //Set up top controls
            if (!IsStudent()) {
                lnkComplete.Visible = true;
                imgComplete.Visible = true;
                lblMarkInst.Visible = true;
                lnkDefunct.Visible = true;
                imgDefunct.Visible = true;
                if (sub.Status == Components.Submission.GRADED) {
                    lnkComplete.Text = "Mark as Incomplete";
                    imgComplete.ImageUrl = "../../attributes/sub.gif";
                } else {
                    lnkComplete.Text = "Mark as Completed";
                    imgComplete.ImageUrl = "../../attributes/subgrade.gif";
                }

                if (sub.Status == Components.Submission.DEFUNCT)
                    lnkDefunct.Text = "Mark as Non-Defunct";
                else
                    lnkDefunct.Text = "Mark as Defunct";

            } else {
                lnkComplete.Visible = false;
                imgComplete.Visible = false;
                lnkDefunct.Visible = false;
                imgDefunct.Visible = false;
                lblMarkInst.Visible = false;
            }

            //Set up sub time label
            string latestr;
            Assignment asst = new Assignments(Globals.CurrentIdentity).GetInfo(sub.AsstID);
            if (sub.Creation <= asst.DueDate)
                latestr = "<font color=\"#4768A3\"><b>ON TIME</b></font>";
            else
                latestr = "<font color=\"#ff0000\"><b>LATE</b></font>";
            lblSubTime.Text = String.Format("<b>Time:</b> {0} <b>Status:</b> {1}", sub.Creation.ToString(),
                latestr);

            //Set up rubric view
            Rubric arub = new Assignments(Globals.CurrentIdentity).GetRubric(sub.AsstID);
            ucRubric.ExpandSubj = false;
            ucRubric.InitRubric(arub, GetSubID(), "");

            //Set up view files link
            BindFileLink();

            if (!IsStudent())
                mpViews.SelectedIndex = 1;
            else
                mpViews.SelectedIndex = 4;
        }
예제 #40
0
        /// <summary>
        /// Get total points available for course
        /// </summary>
        public double GetTotalPoints(int courseID)
        {
            Assignment.AssignmentList assts = GetAssignments(courseID);
            double points=0.0;

            Assignments asstda = new Assignments(m_ident);
            foreach (Assignment asst in assts)
                points += asstda.GetRubric(asst.ID).Points;

            return points;
        }
예제 #41
0
        /// <summary>
        /// Get earned points for a submission
        /// </summary>
        public double GetPoints(int subID)
        {
            Rubric arub = new Assignments(m_ident).GetRubric(GetInfo(subID).AsstID);

            return new Rubrics(m_ident).GetPoints(arub.ID, subID);
        }
예제 #42
0
        public ExportRow GetAsstExport(Components.Submission sub, int asstID, out double totpoints)
        {
            Rubrics rubda = new Rubrics(m_ident);
            ExportRow row = new ExportRow();

            //Get all rubric entries for the assignment
            Rubric rub = new Assignments(m_ident).GetRubric(asstID);
            Rubric.RubricList rublist = rubda.Flatten(rub);

            //Tally
            //Cats
            double points=0;
            foreach (Rubric rubent in rublist) {
                if (sub == null)
                    row.Fields.Add("0");
                else {
                    double catpoints = rubda.GetPoints(rubent.ID, sub.ID);
                    points += catpoints;
                    row.Fields.Add(catpoints.ToString());
                }
            }

            //Total
            row.Fields.Insert(0, points.ToString());
            totpoints = points;

            return row;
        }
예제 #43
0
        /// <summary>
        /// Load submission directory with new files, updates time
        /// </summary>
        public bool Update(Submission sub, IExternalSource files)
        {
            FileSystem fs = new FileSystem(m_ident);
            bool markcmp, unmarkcmp, defunct;

            //Get old sub
            Components.Submission oldsub = GetInfo(sub.ID);
            markcmp = (oldsub.Status == Components.Submission.UNGRADED &&
                      sub.Status == Components.Submission.GRADED);
            unmarkcmp = (oldsub.Status == Components.Submission.GRADED &&
                         sub.Status == Components.Submission.UNGRADED);
            defunct = (oldsub.Status != Components.Submission.DEFUNCT &&
                        sub.Status == Components.Submission.DEFUNCT);

            //Make sure toplevel zone directory exists
            CFile subdir = fs.GetFile(@"c:\subs");
            if (null == subdir)
                subdir = fs.CreateDirectory(@"c:\subs", true, null, false);

            //Build file perms
            CFilePermission.FilePermissionList perms = new CFilePermission.FilePermissionList();
            int courseID = new Assignments(m_ident).GetInfo(sub.AsstID).CourseID;
            CourseRole.CourseRoleList staff = new Courses(m_ident).GetTypedRoles(courseID, true, null);
            foreach (CourseRole role in staff)
                perms.AddRange(CFilePermission.CreateFullAccess(role.PrincipalID));
            perms.AddRange(CFilePermission.CreateOprFullAccess(sub.PrincipalID));

            //Create zone directory
            CFile esubdir;
            string zpath = @"c:\subs\" + sub.ID;
            if (null == (esubdir = fs.GetFile(zpath))) {
                esubdir = fs.CreateDirectory(zpath, false, perms, false);
                esubdir.SpecType = CFile.SpecialType.SUBMISSION;
                string name = new Principals(m_ident).GetInfo(sub.PrincipalID).Name;
                esubdir.Alias = String.Format("{0}: {1}",
                    name, GetNextSubmission(sub.AsstID, sub.PrincipalID));
                fs.UpdateFileInfo(esubdir, false);
            }
            //Update sub entry
            sub.LocationID = esubdir.ID;
            m_dp.UpdateSubmission(sub);

            //Load files
            try {
                fs.ImportData(zpath, files, false, false); //Import the data
            } catch (Exception) {
                throw new DataAccessException("Invalid external file source. This means the system does " +
                    "not understand how to extract files from the source. Please create a valid source");
            }

            //Verify submission structure
            VerifyFormat(sub.AsstID, zpath);

            //Log
            if (markcmp)
                Log("User [" + m_ident.Name + "] marked submission " + esubdir.Alias + " completed", sub.ID);
            else if (unmarkcmp)
                Log("User [" + m_ident.Name + "] marked submission " + esubdir.Alias + " incomplete", sub.ID);
            else if (defunct)
                Log("User [" + m_ident.Name + "] marked submission " + esubdir.Alias + " defunct", sub.ID);

            return true;
        }
예제 #44
0
        /// <summary>
        /// Get earned points for a submission
        /// </summary>
        public double GetPoints(int subID)
        {
            Rubric arub = new Assignments(m_ident).GetRubric(GetInfo(subID).AsstID);

            return(new Rubrics(m_ident).GetPoints(arub.ID, subID));
        }
예제 #45
0
        private void QueueSubmitTests(Components.Submission sub)
        {
            int asstID = sub.AsstID;
            string strlog="";
            Evaluation.EvaluationList tests = new Assignments(m_ident).GetSubmitAutoEvals(asstID);
            if (tests.Count == 0) return;

            //Queue up pretests
            AutoJobs jobda = new AutoJobs(m_ident);
            AutoJob job = jobda.Create(m_ident.Name + " submission", asstID);
            foreach (Evaluation eval in tests) {
                jobda.CreateTest(job.ID, sub.ID, eval.ID, true);
                strlog += eval.Name + " ";
            }

            //Log queueing
            Log("Pretests queued: " + strlog, sub.ID);
        }
예제 #46
0
        /// <summary>
        /// Update a canned response
        /// </summary>
        public bool UpdateCannedResponse(CannedResponse can)
        {
            //check permission
            Rubric rub = GetInfo(can.RubricID);
            Assignment asst = new Assignments(m_ident).GetInfo(rub.AsstID);
            Authorize(asst.CourseID, "updaterubric", asst.ID, null);

            return m_dp.UpdateCannedResponse(can);
        }
예제 #47
0
        /// <summary>
        /// Update a rubric entry
        /// </summary>
        public bool Update(Rubric rub)
        {
            //check permission
            Assignment asst = new Assignments(m_ident).GetInfo(rub.AsstID);
            Authorize(asst.CourseID, "updaterubric", asst.ID, null);

            //Rename zone on entry rename
            if (rub.EvalID >= 0) {
                FileSystem fs = new FileSystem(m_ident);
                int zoneID =
                    (new Evaluations(m_ident).GetInfo(rub.EvalID) as AutoEvaluation).ZoneID;
                CFile zdir = fs.GetFile(zoneID);
                zdir.Alias = rub.Name;
                fs.UpdateFileInfo(zdir, false);
            }

            //Update entry
            m_dp.UpdateRubricEntry(rub);

            //Retally points and update root entry
            Rubric root = new Assignments(m_ident).GetRubric(rub.AsstID);
            root.Points = RetallyPoints(root);
            m_dp.UpdateRubricEntry(root);

            //Log
            Log("Updated rubric entry: " + rub.Name, rub.AsstID);

            return true;
        }