Exemple #1
0
 public static IList <TblPermissions> AllPermissionsForTheme(TblThemes theme)
 {
     return(ServerModel.DB.Query <TblPermissions>(
                new CompareCondition <int>(
                    DataObject.Schema.ThemeRef,
                    new ValueCondition <int>(theme.ID), COMPARE_KIND.EQUAL)));
 }
Exemple #2
0
 private void deleteTheme(TblThemes theme, TblStages parentStage)
 {
     //remove permissions
     ServerModel.DB.UnLink(theme, parentStage);
     //ServerModel.DB.Delete<TblPermissions>(TeacherHelper.AllPermissionsForTheme(theme));
     //ServerModel.DB.Delete<TblThemes>(theme.ID);
 }
Exemple #3
0
 public ControlInfo(TblStages stage, TblThemes theme, IList <DatePeriod> datePeriods)
 {
     _stage              = stage;
     _theme              = theme;
     _datePeriods        = datePeriods;
     _isControlStartsNow = true;
 }
Exemple #4
0
 public ControlInfo(TblStages stage, TblThemes theme, IList<DatePeriod> datePeriods)
 {
     _stage = stage;
     _theme = theme;
     _datePeriods = datePeriods;
     _isControlStartsNow = true;
 }
        private void AddThemeToTable(TblThemes theme, int i)
        {
            var row = new TableRow {ID = theme.ID.ToString()};
            var number = new TableCell {Text = i.ToString(), HorizontalAlign = HorizontalAlign.Center};
            var name = new TableCell {Text = theme.Name, HorizontalAlign = HorizontalAlign.Center};
            var type = new TableCell {Text = theme.IsControl.ToString(), HorizontalAlign = HorizontalAlign.Center};

            var pageOrder = new TableCell {HorizontalAlign = HorizontalAlign.Center};
            pageOrder.Controls.Add(GetPageOrderDropDownList(theme.PageOrderRef));

            var pageCountToShow = new TableCell {HorizontalAlign = HorizontalAlign.Center};
            pageCountToShow.Controls.Add(GetPageCountToShowDropDownList(theme));

            var maxCountToSubmit = new TableCell {HorizontalAlign = HorizontalAlign.Center};
            maxCountToSubmit.Controls.Add(GetMaxCountToSubmitDropDownList(theme.MaxCountToSubmit));

            var themePages = new TableCell();
            themePages.Controls.Add(new HyperLink
            {
                Text = "Pages",
                NavigateUrl = ServerModel.Forms.BuildRedirectUrl(new ThemePagesController
                                                                     {
                    BackUrl = string.Empty,
                    ThemeId = theme.ID
                })
            });

            row.Cells.AddRange(new[] { number, name, type, pageOrder, pageCountToShow, maxCountToSubmit, themePages });
            CourseBehaviorTable.Rows.Add(row);

        }
Exemple #6
0
        public void AddThemeButton_Click()
        {
            if (CourseTree.CheckedNodes.Count == 0)
            {
                Message.Value = noThemesSelected;
                return;
            }

            IdendtityNode stageNode = CurriculumTree.SelectedNode as IdendtityNode;

            Message.Value = alreadyHaveTheme.Replace("{0}", stageNode.Text);
            bool alreadyHaveSomeTheme = false;

            for (int i = 0; i < CourseTree.CheckedNodes.Count; i++)
            {
                IdendtityNode orgNode = CourseTree.CheckedNodes[i] as IdendtityNode;

                if (TeacherHelper.StageContainsTheme(stageNode.ID, orgNode.ID))
                {
                    Message.Value       += orgNode.Text + ", ";
                    alreadyHaveSomeTheme = true;
                }
                else
                {
                    TblOrganizations org = ServerModel.DB.Load <TblOrganizations>(orgNode.ID);

                    TblThemes t = new TblThemes
                    {
                        Name            = org.Title,
                        CourseRef       = org.CourseRef,
                        OrganizationRef = org.ID,
                        StageRef        = stageNode.ID
                    };

                    ServerModel.DB.Insert(t);

                    /*ServerModel.DB.Link(
                     *  ServerModel.DB.Load<TblStages>(stageNode.ID),
                     *  ServerModel.DB.Load<TblThemes>(t.ID));*/
                    stageNode.ChildNodes.Add(new IdendtityNode(ServerModel.DB.Load <TblThemes>(t.ID)));
                }

                CourseTree.CheckedNodes[i].Checked = false;
                i--;
            }

            if (alreadyHaveSomeTheme)
            {
                Message.Value = Message.Value.Remove(Message.Value.Length - 2) + ".";
            }
            else
            {
                Message.Value = string.Empty;
            }
        }
        public static ControlInfo IsTimeForControl(int userId, TblStages stage, TblThemes theme)
        {
            IList<TblPermissions> permissions = GetPermissions(userId, stage.ID, NodeType.Stage, OperationType.Pass);

            if (theme.IsControl)
                if (!IsAllDatesAreNull(permissions))// If dates are nulls --> control is notvisible
                    if (IsDateAllowed(DateTime.Now, permissions))
                        return new ControlInfo(stage, theme, DatePeriod.ExtractPeriodsFromPermissions(permissions));

            return new ControlInfo();
        }
Exemple #8
0
        private static int Store(int courseRef, string name, bool isControl)
        {
            var t = new TblThemes
            {
                CourseRef = courseRef,
                Name      = name,
                IsControl = isControl
            };

            ServerModel.DB.Insert(t);

            return(t.ID);
        }
Exemple #9
0
        private static int Store(int courseRef, string name, bool isControl)
        {
            var t = new TblThemes
            {
                CourseRef = courseRef,
                Name = name,
                IsControl = isControl
            };

            ServerModel.DB.Insert(t);

            return t.ID;
        }
Exemple #10
0
        public static bool StageContainsTheme(int stageID, int themeID)
        {
            TblStages stage = ServerModel.DB.Load <TblStages>(stageID);
            TblThemes theme = ServerModel.DB.Load <TblThemes>(themeID);

            foreach (TblThemes childThemes in ThemesOfStage(stage))
            {
                if (childThemes.ID == theme.ID)
                {
                    return(true);
                }
            }
            return(false);
        }
Exemple #11
0
        public override void Loaded()
        {
            base.Loaded();

            Caption.Value     = pageCaption;
            Description.Value = pageDescription;

            curriculum = ServerModel.DB.Load <TblCurriculums>(CurriculumID);

            if (ThemeID != -1)
            {
                theme             = ServerModel.DB.Load <TblThemes>(ThemeID);
                stage             = ServerModel.DB.Load <TblStages>(StageID);
                Description.Value = Description.Value.
                                    Replace("{1}", themeStr).
                                    Replace("{2}", theme.Name).
                                    Replace("{3}", usedInCurriculum.Replace("{0}", curriculum.Name));
                Caption.Value = Caption.Value.
                                Replace("{0}", themeStr).
                                Replace("{1}", theme.Name);
            }
            else
            {
                if (StageID != -1)
                {
                    stage             = ServerModel.DB.Load <TblStages>(StageID);
                    Description.Value = Description.Value.
                                        Replace("{1}", stageStr).
                                        Replace("{2}", stage.Name).
                                        Replace("{3}", usedInCurriculum.Replace("{0}", curriculum.Name));
                    Caption.Value = Caption.Value.
                                    Replace("{0}", stageStr).
                                    Replace("{1}", stage.Name);
                }
                else
                {
                    Description.Value = Description.Value.
                                        Replace("{1}", curriculumStr).
                                        Replace("{2}", curriculum.Name).
                                        Replace("{3}", string.Empty);
                    Caption.Value = Caption.Value.
                                    Replace("{0}", curriculumStr).
                                    Replace("{1}", curriculum.Name);
                }
            }

            Title.Value = Caption.Value;
        }
Exemple #12
0
        private void AddThemeToTable(TblThemes theme, int i)
        {
            var row = new TableRow {
                ID = theme.ID.ToString()
            };
            var number = new TableCell {
                Text = i.ToString(), HorizontalAlign = HorizontalAlign.Center
            };
            var name = new TableCell {
                Text = theme.Name, HorizontalAlign = HorizontalAlign.Center
            };
            var type = new TableCell {
                Text = theme.IsControl.ToString(), HorizontalAlign = HorizontalAlign.Center
            };

            var pageOrder = new TableCell {
                HorizontalAlign = HorizontalAlign.Center
            };

            pageOrder.Controls.Add(GetPageOrderDropDownList(theme.PageOrderRef));

            var pageCountToShow = new TableCell {
                HorizontalAlign = HorizontalAlign.Center
            };

            pageCountToShow.Controls.Add(GetPageCountToShowDropDownList(theme));

            var maxCountToSubmit = new TableCell {
                HorizontalAlign = HorizontalAlign.Center
            };

            maxCountToSubmit.Controls.Add(GetMaxCountToSubmitDropDownList(theme.MaxCountToSubmit));

            var themePages = new TableCell();

            themePages.Controls.Add(new HyperLink
            {
                Text        = "Pages",
                NavigateUrl = ServerModel.Forms.BuildRedirectUrl(new ThemePagesController
                {
                    BackUrl = string.Empty,
                    ThemeId = theme.ID
                })
            });

            row.Cells.AddRange(new[] { number, name, type, pageOrder, pageCountToShow, maxCountToSubmit, themePages });
            CourseBehaviorTable.Rows.Add(row);
        }
        public override void Loaded()
        {
            base.Loaded();

            Caption.Value = pageCaption;
            Description.Value = pageDescription;

            curriculum = ServerModel.DB.Load<TblCurriculums>(CurriculumID);

            if (ThemeID != -1)
            {
                theme = ServerModel.DB.Load<TblThemes>(ThemeID);
                stage = ServerModel.DB.Load<TblStages>(StageID);
                Description.Value = Description.Value.
                    Replace("{1}", themeStr).
                    Replace("{2}", theme.Name).
                    Replace("{3}", usedInCurriculum.Replace("{0}", curriculum.Name));
                Caption.Value = Caption.Value.
                    Replace("{0}", themeStr).
                    Replace("{1}", theme.Name);
            }
            else
            {
                if (StageID != -1)
                {
                    stage = ServerModel.DB.Load<TblStages>(StageID);
                    Description.Value = Description.Value.
                        Replace("{1}", stageStr).
                        Replace("{2}", stage.Name).
                        Replace("{3}", usedInCurriculum.Replace("{0}", curriculum.Name));
                    Caption.Value = Caption.Value.
                        Replace("{0}", stageStr).
                        Replace("{1}", stage.Name);
                }
                else
                {
                    Description.Value = Description.Value.
                        Replace("{1}", curriculumStr).
                        Replace("{2}", curriculum.Name).
                        Replace("{3}", string.Empty);
                    Caption.Value = Caption.Value.
                        Replace("{0}", curriculumStr).
                        Replace("{1}", curriculum.Name);
                }
            }

            Title.Value = Caption.Value;
        }
Exemple #14
0
        public static ControlInfo IsTimeForControl(int userId, TblStages stage, TblThemes theme)
        {
            IList <TblPermissions> permissions = GetPermissions(userId, stage.ID, NodeType.Stage, OperationType.Pass);

            if (theme.IsControl)
            {
                if (!IsAllDatesAreNull(permissions))// If dates are nulls --> control is notvisible
                {
                    if (IsDateAllowed(DateTime.Now, permissions))
                    {
                        return(new ControlInfo(stage, theme, DatePeriod.ExtractPeriodsFromPermissions(permissions)));
                    }
                }
            }

            return(new ControlInfo());
        }
Exemple #15
0
        private static DropDownList GetPageCountToShowDropDownList(TblThemes theme)
        {
            var list = new DropDownList {
                ID = PageCountToShowListId
            };

            var pagesIds = ServerModel.DB.LookupIds <TblPages>(theme, null);

            for (int i = 1; i <= pagesIds.Count; i++)
            {
                list.Items.Add(i.ToString());
            }

            list.Items.Add(All);

            list.SelectedValue = theme.PageCountToShow == null ? All : theme.PageCountToShow.ToString();

            return(list);
        }
        public void PageLoad(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["CurrentLearnerAttemptId"] == null)
            {
                throw new Exception(Translations.OpenTestController_PageLoad_Wrong_request__LearnerAttempt_ID_not_specified_);
            }

            learnerAttemptId = Convert.ToInt32(HttpContext.Current.Session["CurrentLearnerAttemptId"].ToString());

            attempt = ServerModel.DB.Load <TblLearnerAttempts>(learnerAttemptId);
            theme   = ServerModel.DB.Load <TblThemes>(attempt.ThemeRef);
            org     = ServerModel.DB.Load <TblOrganizations>(theme.OrganizationRef);
            if (isNew)
            {
                items = TeacherHelper.LeafItemsOfOrganization(org).ToList();
                items = MixList <TblItems>(items);
                isNew = false;
            }
            items = items.GetRange(0, items.Count > 20 ? 20 : items.Count);

            ShowCurrent();
        }
Exemple #17
0
    public void PageLoad(object sender, EventArgs e)
    {
        if (Controller.LearnerAttemptId == 0)
        {
            throw new Exception("Wrong request (LearnerAttempt ID not specified)");
        }

        TblLearnerAttempts         learnerAttempt  = ServerModel.DB.Load <TblLearnerAttempts>(Controller.LearnerAttemptId);
        IList <TblLearnerSessions> learnerSessions = ServerModel.DB.Load <TblLearnerSessions>(ServerModel.DB.LookupIds <TblLearnerSessions>(learnerAttempt, null));
        TblUsers user = ServerModel.DB.Load <TblUsers>(learnerAttempt.UserRef);

        TblThemes      theme      = ServerModel.DB.Load <TblThemes>(learnerAttempt.ThemeRef);
        TblStages      stage      = ServerModel.DB.Load <TblStages>(theme.StageRef);
        TblCurriculums curriculum = ServerModel.DB.Load <TblCurriculums>(stage.CurriculumRef);

        _themeResult.LearnerAttempt  = learnerAttempt;
        _themeResult.LearnerSessions = learnerSessions;
        _themeResult.User            = user;
        _themeResult.Theme           = theme;
        _themeResult.StageName       = stage.Name;
        _themeResult.CurriculumnName = curriculum.Name;

        _headerLabel.Text = string.Format("Statistic for Theme: {0}", theme.Name);
    }
Exemple #18
0
 public IdendtityNode(TblThemes theme)
     : this(theme.Name, theme.ID)
 {
     Type = NodeType.Theme;
 }
Exemple #19
0
 public static IList<TblPermissions> AllPermissionsForTheme(TblThemes theme)
 {
     return ServerModel.DB.Query<TblPermissions>(
                 new CompareCondition<int>(
                    DataObject.Schema.ThemeRef,
                    new ValueCondition<int>(theme.ID), COMPARE_KIND.EQUAL));
 }
Exemple #20
0
        public static bool IsUserCanSubmitOnPage(int userId, int pageId)
        {
            TblThemes theme = StudentRecordFinder.GetThemeForPage(pageId);

            return(CheckCountOfSubmits(theme.MaxCountToSubmit, userId, pageId));
        }
Exemple #21
0
        private void SetPages(TblThemes thema)
        {
            ThemaName.Value = thema.Name;

            _pages = PageShifter.GetPagesFromParameter(PagesIds);
        }
Exemple #22
0
 public IdendtityNode(TblThemes theme)
     : this(theme.Name, theme.ID)
 {
     Type = NodeType.Theme;
 }
Exemple #23
0
 public static IList <TblLearnerAttempts> AttemptsOfTheme(TblThemes theme)
 {
     return(ServerModel.DB.Query <TblLearnerAttempts>(new CompareCondition <int>(
                                                          DataObject.Schema.ThemeRef,
                                                          new ValueCondition <int>(theme.ID), COMPARE_KIND.EQUAL)));
 }
Exemple #24
0
        private void SetPages(TblThemes thema)
        {
            ThemaName.Value = thema.Name;

            _pages = PageShifter.GetPagesFromParameter(PagesIds);
        }
        public void AddThemeButton_Click()
        {
            if (CourseTree.CheckedNodes.Count == 0)
            {
                Message.Value = noThemesSelected;
                return;
            }

            IdendtityNode stageNode = CurriculumTree.SelectedNode as IdendtityNode;
            Message.Value = alreadyHaveTheme.Replace("{0}", stageNode.Text);
            bool alreadyHaveSomeTheme = false;

            for (int i = 0; i < CourseTree.CheckedNodes.Count; i++)
            {
                IdendtityNode orgNode = CourseTree.CheckedNodes[i] as IdendtityNode;

                if (TeacherHelper.StageContainsTheme(stageNode.ID, orgNode.ID))
                {
                    Message.Value += orgNode.Text + ", ";
                    alreadyHaveSomeTheme = true;
                }
                else
                {
                    TblOrganizations org = ServerModel.DB.Load<TblOrganizations>(orgNode.ID);

                    TblThemes t = new TblThemes
                    {
                        Name = org.Title,
                        CourseRef = org.CourseRef,
                        OrganizationRef = org.ID,
                        StageRef = stageNode.ID
                    };

                    ServerModel.DB.Insert(t);

                    /*ServerModel.DB.Link(
                        ServerModel.DB.Load<TblStages>(stageNode.ID),
                        ServerModel.DB.Load<TblThemes>(t.ID));*/
                    stageNode.ChildNodes.Add(new IdendtityNode(ServerModel.DB.Load<TblThemes>(t.ID)));
                }

                CourseTree.CheckedNodes[i].Checked = false;
                i--;
            }

            if (alreadyHaveSomeTheme)
            {
                Message.Value = Message.Value.Remove(Message.Value.Length - 2) + ".";
            }
            else
            {
                Message.Value = string.Empty;
            }
        }
        private static DropDownList GetPageCountToShowDropDownList(TblThemes theme)
        {
            var list = new DropDownList {ID = PageCountToShowListId};

            var pagesIds = ServerModel.DB.LookupIds<TblPages>(theme, null);

            for (int i = 1; i <= pagesIds.Count; i++)
                list.Items.Add(i.ToString());

            list.Items.Add(All);

            list.SelectedValue = theme.PageCountToShow == null ? All : theme.PageCountToShow.ToString();

            return list;
        }
        private void deleteTheme(TblThemes theme, TblStages parentStage)
        {
            //remove permissions
            //ServerModel.DB.UnLink(theme, parentStage);
            //ServerModel.DB.Delete<TblPermissions>(TeacherHelper.AllPermissionsForTheme(theme));
            ServerModel.DB.Delete<TblThemes>(theme.ID);

            // REMOVE DEPENDENSIES?
        }
Exemple #28
0
        public static IList <TblStages> StagesForTheme(TblThemes theme)
        {
            List <int> stagesIDs = ServerModel.DB.LookupMany2ManyIds <TblStages>(theme, null);

            return(ServerModel.DB.Load <TblStages>(stagesIDs));
        }
Exemple #29
0
 public static IList<TblStages> StagesForTheme(TblThemes theme)
 {
     List<int> stagesIDs = ServerModel.DB.LookupMany2ManyIds<TblStages>(theme, null);
     return ServerModel.DB.Load<TblStages>(stagesIDs);
 }
Exemple #30
0
 public static IList<TblLearnerAttempts> AttemptsOfTheme(TblThemes theme)
 {
     return ServerModel.DB.Query<TblLearnerAttempts>(new CompareCondition<int>(
                       DataObject.Schema.ThemeRef,
                       new ValueCondition<int>(theme.ID), COMPARE_KIND.EQUAL));
 }