示例#1
0
        private void fillOperationsTable()
        {
            Operations.Rows.Clear();

            foreach (FxCourseOperations operation in TeacherHelper.CourseOperations())
            {
                TableRow  operationRow  = new TableRow();
                TableCell operationCell = new TableCell();

                CheckBox operationCheckBox = new CheckBox();
                operationCheckBox.Text = operation.Name;
                operationCheckBox.ID   = operation.ID.ToString();

                TblPermissions permission = TeacherHelper.GetPermissionForCourse(course, operation);
                if (permission == null || !permission.CanBeDelagated)
                {
                    operationCheckBox.Enabled = false;
                }
                else
                {
                    operationCheckBox.Checked = TeacherHelper.AreParentAndChildByCourse(permission, teacher, course);
                }
                operationCell.Controls.Add(operationCheckBox);

                operationRow.Cells.Add(operationCell);
                Operations.Rows.Add(operationRow);
            }
        }
        private void fillTeachersTable()
        {
            AlreadySharedTeachers.Rows.Clear();
            CanBeSharedTeachers.Rows.Clear();
            TblUsers currentUser = ServerModel.DB.Load <TblUsers>(ServerModel.User.Current.ID);

            foreach (TblUsers teacher in TeacherHelper.GetTeachers())
            {
                if (teacher.ID != currentUser.ID)
                {
                    HyperLink sharedHyperlink = new HyperLink();
                    sharedHyperlink.Text        = teacher.DisplayName;
                    sharedHyperlink.NavigateUrl = ServerModel.Forms.BuildRedirectUrl <CourseShareController>
                                                      (new CourseShareController {
                        BackUrl = RawUrl, CourseId = CourseId, TeacherId = teacher.ID
                    });
                    TableCell sharedCell = new TableCell();
                    sharedCell.Controls.Add(sharedHyperlink);
                    TableRow sharedRow = new TableRow();
                    sharedRow.Cells.Add(sharedCell);
                    if (TeacherHelper.AreParentAndChildByCourse(currentUser, teacher, course))
                    {
                        AlreadySharedTeachers.Rows.Add(sharedRow);
                    }
                    else
                    {
                        CanBeSharedTeachers.Rows.Add(sharedRow);
                    }
                }
            }

            if (AlreadySharedTeachers.Rows.Count == 0)
            {
                HyperLink alreadySharedHyperlink = new HyperLink();
                alreadySharedHyperlink.Text = noTeachers;
                TableCell alreadySharedCell = new TableCell();
                alreadySharedCell.Controls.Add(alreadySharedHyperlink);
                TableRow alreadySharedRow = new TableRow();
                alreadySharedRow.Cells.Add(alreadySharedCell);
                AlreadySharedTeachers.Rows.Add(alreadySharedRow);
            }
            if (CanBeSharedTeachers.Rows.Count == 0)
            {
                HyperLink canBeSharedHyperlink = new HyperLink();
                canBeSharedHyperlink.Text = noTeachers;
                TableCell canBeSharedCell = new TableCell();
                canBeSharedCell.Controls.Add(canBeSharedHyperlink);
                TableRow canBeSharedRow = new TableRow();
                canBeSharedRow.Cells.Add(canBeSharedCell);
                CanBeSharedTeachers.Rows.Add(canBeSharedRow);
            }
        }
示例#3
0
        private void fillCourseOperationsTable()
        {
            Operations.Rows.Clear();

            foreach (FxCourseOperations operation in TeacherHelper.CourseOperations())
            {
                TableRow  operationRow  = new TableRow();
                TableCell operationCell = new TableCell();

                CheckBox operationCheckBox = new CheckBox();
                operationCheckBox.Text = operation.Name;

                operationCheckBox.AutoPostBack    = true;
                operationCheckBox.CheckedChanged += new EventHandler(operationCheckBox_CheckedChanged);

                CheckBox delegateCheckBox = new CheckBox();
                delegateCheckBox.Text = delegateStr;

                TblPermissions permission = TeacherHelper.CurrentUserPermissionForCourse(course, operation);
                if (permission == null || !permission.CanBeDelagated)
                {
                    operationCheckBox.Enabled = false;
                    delegateCheckBox.Enabled  = false;
                }
                else
                {
                    operationCheckBox.ID      = permission.ID.ToString();
                    operationCheckBox.Checked = TeacherHelper.AreParentAndChildByCourse(permission, teacher, course);
                    if (operationCheckBox.Checked)
                    {
                        delegateCheckBox.Checked = TeacherHelper.CanChildDelegateCourse(permission, teacher, course);
                    }
                    else
                    {
                        delegateCheckBox.Enabled = false;
                    }
                }

                TableCell leftCell = new TableCell();
                leftCell.HorizontalAlign = HorizontalAlign.Left;
                leftCell.Controls.Add(operationCheckBox);

                TableCell rightCell = new TableCell();
                rightCell.HorizontalAlign = HorizontalAlign.Right;
                rightCell.Controls.Add(delegateCheckBox);

                operationRow.Cells.Add(leftCell);
                operationRow.Cells.Add(rightCell);
                Operations.Rows.Add(operationRow);
            }
        }