Exemplo n.º 1
0
        private ControlInfo BuildStages(TblCurriculums curriculum, TreeNode node, DateTime?date)
        {
            IList <TblStages> stages = StudentRecordFinder.GetStagesForCurriculum(curriculum);

            ControlInfo controlInfo = new ControlInfo();

            foreach (TblStages stage in stages)
            {
                var child = new IdendtityNode(stage);

                if (StudentPermissionsHelper.IsDateAllowed(date, _userId, stage.ID, NodeType.Stage, GetOperationType))
                {
                    controlInfo = BuildThemes(stage, child);

                    if (controlInfo.IsControlStartsNow)
                    {
                        controlInfo.AddCurriculumnToInfo(curriculum);
                        return(controlInfo);
                    }
                    if (child.ChildNodes.Count != 0)
                    {
                        node.ChildNodes.Add(child);
                    }
                }
            }

            return(controlInfo);
        }
Exemplo n.º 2
0
        private ControlInfo BuildTree(DateTime?date)
        {
            CurriculumnTreeView.Nodes.Clear();

            var userCurriculums = StudentRecordFinder.GetCurriculumnsForUser(_userId);

            var controlInfo = new ControlInfo();

            foreach (TblCurriculums curriculum in userCurriculums)
            {
                var node = new IdendtityNode(curriculum);

                if (StudentPermissionsHelper.IsDateAllowed(date, _userId, node.ID, node.Type, GetOperationType))
                {
                    controlInfo = BuildStages(curriculum, node, date);

                    if (controlInfo != null && controlInfo.IsControlStartsNow)
                    {
                        return(controlInfo);
                    }

                    if (node.ChildNodes.Count != 0)
                    {
                        CurriculumnTreeView.Nodes.Add(node);
                    }
                }
            }

            CurriculumnTreeView.ExpandAll();

            return(controlInfo);
        }
Exemplo n.º 3
0
        public static bool IsViewingAllowed(int stageId)
        {
            if (ServerModel.User.Current != null)
            {
                int userId = ServerModel.User.Current.ID;

                return(StudentPermissionsHelper.IsDateAllowed(DateTime.Now, userId, stageId, NodeType.Stage, OperationType.View));
            }
            return(false);
        }
Exemplo n.º 4
0
        public static bool IsSubmitEnabled(int stageId, int pageId)
        {
            if (ServerModel.User.Current != null)
            {
                int userId = ServerModel.User.Current.ID;

                return /*UserSubmitCountChecker.IsUserCanSubmitOnPage(userId, pageId)
                        * &&*/(StudentPermissionsHelper.IsDateAllowed(DateTime.Now, userId, stageId, NodeType.Stage, OperationType.Pass));
            }
            return(false);
        }
Exemplo n.º 5
0
        private void SetButtonVisibility()
        {
            var selectedNode = (IdendtityNode)CurriculumnTreeView.SelectedNode;

            if (selectedNode != null)
            {
                if (selectedNode.Type == NodeType.Curriculum || selectedNode.Type == NodeType.Stage)
                {
                    OpenTestButton.Enabled = false;
                }
                else
                {
                    OpenTestButton.Enabled = StudentPermissionsHelper.IsDateAllowed(DateTime.Now, _userId, ((IdendtityNode)selectedNode.Parent).ID, NodeType.Stage, OperationType.View);
                }
            }
        }