Exemplo n.º 1
0
        private void CreateCurriculumnList()
        {
            CurriculumnDropDownList.Items.Clear();
            StageDropDownList.Items.Clear();
            ThemeDropDownList.Items.Clear();

            var selectedGroup = ServerModel.DB.Load <TblGroups>(int.Parse(GroupDropDownList.SelectedItem.Value));

            var curriculumns = TeacherHelper.GetCurriculumsForGroup(selectedGroup);

            foreach (var c in curriculumns)
            {
                CurriculumnDropDownList.Items.Add(new ListItem(c.Name, c.ID.ToString()));
            }
        }
Exemplo n.º 2
0
        private void GroupsDropDownList_SelectedIndexChanged(object sender, EventArgs e)
        {
            CurriculumsCheckBoxList.Items.Clear();
            TblGroups selectedGroup = ServerModel.DB.Load <TblGroups>(int.Parse(GroupsDropDownList.SelectedValue));

            foreach (TblCurriculums curr in TeacherHelper.GetCurriculumsForGroup(selectedGroup))
            {
                CurriculumsCheckBoxList.Items.Add(new ListItem(curr.Name, curr.ID.ToString()));
            }

            if (CurriculumsCheckBoxList.Items.Count == 0)
            {
                CurriculumsCheckBoxList.Enabled = false;
                ShowButtonEnabled.Value         = false;

                Message.Value = noCurriculums;
            }
            else
            {
                CurriculumsCheckBoxList.Enabled = true;
                ShowButtonEnabled.Value         = true;
            }
        }
Exemplo n.º 3
0
    private void buildAssignTable()
    {
        List <TblGroups>       groups      = ServerModel.DB.Query <TblGroups>(null);
        IList <TblCurriculums> curriculums = TeacherHelper.CurrentUserCurriculums(FxCurriculumOperations.Use);

        Table_Assignments.Rows.Clear();

        //create header row
        TableRow        headerRow       = new TableRow();
        TableHeaderCell emptyHeaderCell = new TableHeaderCell();

        emptyHeaderCell.Text = "";
        headerRow.Cells.Add(emptyHeaderCell);
        foreach (TblCurriculums curriculum in curriculums)
        {
            TableHeaderCell headerCell = new TableHeaderCell();
            headerCell.Text = curriculum.Name;
            headerRow.Cells.Add(headerCell);
        }
        Table_Assignments.Rows.Add(headerRow);

        //create row for each group
        foreach (TblGroups group in groups)
        {
            TableRow        groupRow        = new TableRow();
            TableHeaderCell groupHeaderCell = new TableHeaderCell();
            groupHeaderCell.Text = group.Name;
            groupRow.Cells.Add(groupHeaderCell);

            IList <TblCurriculums> assignedCurriculums = TeacherHelper.GetCurriculumsForGroup(group);

            foreach (TblCurriculums curriculum in curriculums)
            {
                bool isAssigned = false;
                foreach (TblCurriculums assignedCurriculum in assignedCurriculums)
                {
                    if (assignedCurriculum.ID == curriculum.ID)
                    {
                        isAssigned = true;
                        break;
                    }
                }
                TableCell groupCell = new TableCell();
                if (isAssigned)
                {
                    Button modifyButton = new Button();
                    modifyButton.ID          = group.ID.ToString() + modifyChar + curriculum.ID;
                    modifyButton.Text        = modify;
                    modifyButton.PostBackUrl = ServerModel.Forms.BuildRedirectUrl <CurriculumTimelineController>(
                        new CurriculumTimelineController()
                    {
                        BackUrl      = Request.RawUrl,
                        GroupID      = group.ID,
                        CurriculumID = curriculum.ID
                    });

                    Button unsignButton = new Button();
                    unsignButton.ID     = group.ID.ToString() + unsignChar + curriculum.ID;
                    unsignButton.Click += new EventHandler(unsignButton_Click);
                    unsignButton.Text   = unsign;

                    groupCell.Controls.Add(modifyButton);
                    groupCell.Controls.Add(unsignButton);
                }
                else
                {
                    Button assignButton = new Button();
                    assignButton.ID     = group.ID.ToString() + assignChar + curriculum.ID;
                    assignButton.Click += new EventHandler(assignButton_Click);
                    assignButton.Text   = assign;

                    groupCell.Controls.Add(assignButton);
                }

                groupRow.Cells.Add(groupCell);
            }
            if (assignedCurriculums.Count == 0 && group.ID != VisibleGroupID)
            {
                groupRow.Visible = false;
            }
            Table_Assignments.Rows.Add(groupRow);
        }
    }