Exemplo n.º 1
0
        public override void Loaded()
        {
            base.Loaded();

            string message = "";

            if (CourseId != -1)
            {
                course        = ServerModel.DB.Load <TblCourses>(CourseId);
                Caption.Value = pageCaption.
                                Replace("{0}", courseStr).
                                Replace("{1}", course.Name);
                Description.Value = pageDescription.
                                    Replace("{0}", courseStr).
                                    Replace("{1}", course.Name);

                foreach (TblPermissions permission in TeacherHelper.CurrentUserPermissionsForCourse(course))
                {
                    FxCourseOperations operation = ServerModel.DB.Load <FxCourseOperations>(permission.CourseOperationRef.Value);
                    if (permission.ParentPermitionRef.HasValue)
                    {
                        TblPermissions parentPermission = ServerModel.DB.Load <TblPermissions>(permission.ParentPermitionRef.Value);
                        TblUsers       parent           = ServerModel.DB.Load <TblUsers>(parentPermission.OwnerUserRef.Value);
                        message += grantedObject.
                                   Replace("{0}", parent.DisplayName).
                                   Replace("{1}", operation.Name).
                                   Replace("{2}", courseStr) + breakLine;
                    }
                    else
                    {
                        message += ownObject.Replace("{0}", courseStr).Replace("{1}", operation.Name) + breakLine;
                    }
                }
            }

            if (CurriculumId != -1)
            {
                curriculum    = ServerModel.DB.Load <TblCurriculums>(CurriculumId);
                Caption.Value = pageCaption.
                                Replace("{0}", curriculumStr).
                                Replace("{1}", curriculum.Name);
                Description.Value = pageDescription.
                                    Replace("{0}", curriculumStr).
                                    Replace("{1}", curriculum.Name);

                foreach (TblPermissions permission in TeacherHelper.CurrentUserPermissionsForCurriculum(curriculum))
                {
                    FxCurriculumOperations operation = ServerModel.DB.Load <FxCurriculumOperations>(permission.CurriculumOperationRef.Value);
                    if (permission.ParentPermitionRef.HasValue)
                    {
                        TblPermissions parentPermission = ServerModel.DB.Load <TblPermissions>(permission.ParentPermitionRef.Value);
                        TblUsers       parent           = ServerModel.DB.Load <TblUsers>(parentPermission.OwnerUserRef.Value);
                        message += grantedObject.
                                   Replace("{0}", parent.DisplayName).
                                   Replace("{1}", operation.Name).
                                   Replace("{2}", curriculumStr) + breakLine;
                    }
                    else
                    {
                        message += ownObject.Replace("{0}", curriculumStr).Replace("{1}", operation.Name) + breakLine;
                    }
                }
            }

            Message.Value = message;
            Title.Value   = Caption.Value;

            fillTeachersTable();
        }
Exemplo n.º 2
0
 public void TestFxObjectToImutable()
 {
     var co = new FxCourseOperations();
     co.Name = "test";
 }
Exemplo n.º 3
0
        public static TblPermissions GetPermissionForCourse(TblPermissions parentPermission, TblUsers user, TblCourses course, FxCourseOperations operation)
        {
            IList<TblPermissions> permissions = ServerModel.DB.Query<TblPermissions>(
                           new AndCondition(
                              new CompareCondition<int>(
                                 DataObject.Schema.OwnerUserRef,
                                 new ValueCondition<int>(user.ID), COMPARE_KIND.EQUAL),
                              new CompareCondition<int>(
                                 DataObject.Schema.CourseOperationRef,
                                 new ValueCondition<int>(operation.ID), COMPARE_KIND.EQUAL),
                              new CompareCondition<int>(
                                 DataObject.Schema.CourseRef,
                                 new ValueCondition<int>(course.ID), COMPARE_KIND.EQUAL),
                              new CompareCondition<int>(
                                 DataObject.Schema.ParentPermitionRef,
                                 new ValueCondition<int>(parentPermission.ID), COMPARE_KIND.EQUAL)));

            if (permissions.Count == 0)
            {
                return null;
            }

            return permissions[0];
        }
Exemplo n.º 4
0
 public static IList<TblCourses> CurrentUserCourses(FxCourseOperations operation)
 {
     IList<int> iDs = PermissionsManager.GetObjectsForUser(SECURED_OBJECT_TYPE.COURSE, ServerModel.User.Current.ID, operation.ID, null);
     return ServerModel.DB.Load<TblCourses>(iDs);
 }
Exemplo n.º 5
0
        public static TblPermissions GetPermissionForCourse(TblPermissions parentPermission, TblUsers user, TblCourses course, FxCourseOperations operation)
        {
            IList <TblPermissions> permissions = ServerModel.DB.Query <TblPermissions>(
                new AndCondtion(
                    new CompareCondition <int>(
                        DataObject.Schema.OwnerUserRef,
                        new ValueCondition <int>(user.ID), COMPARE_KIND.EQUAL),
                    new CompareCondition <int>(
                        DataObject.Schema.CourseOperationRef,
                        new ValueCondition <int>(operation.ID), COMPARE_KIND.EQUAL),
                    new CompareCondition <int>(
                        DataObject.Schema.CourseRef,
                        new ValueCondition <int>(course.ID), COMPARE_KIND.EQUAL),
                    new CompareCondition <int>(
                        DataObject.Schema.ParentPermitionRef,
                        new ValueCondition <int>(parentPermission.ID), COMPARE_KIND.EQUAL)));

            if (permissions.Count == 0)
            {
                return(null);
            }

            return(permissions[0]);
        }
Exemplo n.º 6
0
        public static IList <TblCourses> CurrentUserCourses(FxCourseOperations operation)
        {
            IList <int> iDs = PermissionsManager.GetObjectsForUser(SECURED_OBJECT_TYPE.COURSE, ServerModel.User.Current.ID, operation.ID, null);

            return(ServerModel.DB.Load <TblCourses>(iDs));
        }
Exemplo n.º 7
0
        public void TestFxObjectToImutable()
        {
            var co = new FxCourseOperations();

            co.Name = "test";
        }