Пример #1
0
        private void SetState(string Flag)
        {
            if (tabFlag == Flag)
            {
                return;
            }
            tabFlag = Flag;
            if (string.IsNullOrEmpty(Flag))
            {
                Flag = "组织结构";
            }
            switch (Flag)
            {
            case "组织结构":
                if (grouplist == null)
                {
                    grouplist = new Group.GroupList();
                }

                frame_window.Children.Clear();
                frame_window.Children.Add(grouplist);
                break;

            case "完成任务":
                Obj.taskData.GetTaskData();
                frame_window.Children.Clear();
                frame_window.Children.Add(taskedList);
                break;

            case "执行任务":
                Obj.taskData.GetTaskData();
                frame_window.Children.Clear();
                frame_window.Children.Add(taskingList);
                break;

            case "活动简介":
                if (activityInfo == null)
                {
                    activityInfo = new Areas.ActivityInfo();
                }
                activityInfo.IniData();
                frame_window.Children.Clear();
                frame_window.Children.Add(activityInfo);
                break;

            case "区域简介":
                if (areaInfo == null)
                {
                    areaInfo = new Areas.AreaInfo();
                }
                areaInfo.IniData(_placeInfo);
                frame_window.Children.Clear();
                frame_window.Children.Add(areaInfo);
                break;
            }
        }
Пример #2
0
        private void AddAllAsstGroups(TreeNode node)
        {
            string[] tokens = node.NodeData.Split(" ".ToCharArray());
            int      asstID = Convert.ToInt32(tokens[1]);

            Group.GroupList groups = (new Assignments(Globals.CurrentIdentity)).GetGroups(asstID);
            foreach (Group group in groups)
            {
                AddNode(node.Nodes, true, group.Name, "attributes/group.jpg", "Group " + group.PrincipalID);
            }
        }
Пример #3
0
        /// <summary>
        /// Get a PrincipalList with the user and all their groups
        /// </summary>
        public Principal.PrincipalList GetPrincipals(string username, int asstID)
        {
            Principal.PrincipalList plist = new Principal.PrincipalList();
            User user = new User();

            //Add the user principal
            m_dp.GetUserInfo(username, user, null);
            plist.Add(user);

            //Add the groups
            Group.GroupList glist = m_dp.GetUserGroups(username, asstID);
            plist.AddRange(glist);

            return(plist);
        }
Пример #4
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);
        }