Example #1
0
        protected string GetGroupMembers(Group group)
        {
            User.UserList users = new Groups(Globals.CurrentIdentity).GetMembership(group.PrincipalID);
            string ulist=String.Empty;

            foreach (User user in users)
                ulist += user.UserName + " ";

            return ulist;
        }
Example #2
0
 public bool SendByPrincipal(int principalID, string subj, string body)
 {
     Principal prin = new Principals(m_ident).GetInfo(principalID);
     if (prin.Type == Principal.USER) {
         User user = new Users(m_ident).GetInfo(prin.Name, null);
         return SendByEmail(user.Email, subj, body);
     } else {
         User.UserList users =
             new Groups(m_ident).GetMembership(principalID);
         foreach (User user in users)
             SendByEmail(user.Email, subj, body);
     }
     return true;
 }
Example #3
0
        /// <summary>
        /// Delete the assignment
        /// </summary>
        public bool Delete(int asstID)
        {
            FileSystem fs = new FileSystem(m_ident);
            Submissions subda = new Submissions(m_ident);
            Evaluations evalda = new Evaluations(m_ident);
            Results resultda = new Results(m_ident);
            Groups groupda = new Groups(m_ident);
            AutoJobs jobda = new AutoJobs(m_ident);

            Assignment asst = GetInfo(asstID);

            //Check permission
            Authorize(asst.CourseID, "delete", asstID, null);

            //Take auto jobs
            IProviderTransaction tran = m_dp.BeginTransaction();
            AutoJob.AutoJobList jobs = GetAutoJobs(asstID, tran);
            foreach (AutoJob job in jobs)
                jobda.Finish(job.ID, tran);
            m_dp.CommitTransaction(tran);

            //Take submissions and results
            Components.Submission.SubmissionList allsubs = GetSubmissions(asstID);
            foreach (Components.Submission sub in allsubs)
                subda.Delete(sub.ID);

            //Take rubric
            Rubric rub = GetRubric(asstID);
            new Rubrics(m_ident).Delete(rub.ID);

            //Take evaluations
            Evaluation.EvaluationList allevals = GetEvals(asstID);
            foreach (Evaluation eval in allevals)
                evalda.Delete(eval.ID);

            //Take groups
            Group.GroupList groups = GetGroups(asstID);
            foreach (Group group in groups)
                groupda.Delete(group.PrincipalID, asstID);

            //Take assignment
            m_dp.DeleteAssignment(asstID);

            //Take content
            CFile content = fs.GetFile(asst.ContentID);
            fs.DeleteFile(content);

            //Log
            Log("Deleted assignment: " + asst.Description, asst.ID);

            return true;
        }