Пример #1
0
        public void OnCheckPermissions(EntityJs.Client.Events.CheckPermissionsEventArgs e)
        {
            BuildingEntities db   = (BuildingEntities)e.Context;
            User             user = db.CurrentUser;

            e.Cancel = e.Action == EntityJs.Client.Events.ActionsEnum.Delete && user.RoleID != (int)RolesEnum.Admin;
        }
Пример #2
0
        public void OnDeleting(EntityJs.Client.Events.EntityEventArgs e)
        {
            BuildingEntities db = (BuildingEntities)e.Context;
            var files           = this.Files.ToList();

            foreach (ProjectFile file in files)
            {
                var args = new EntityJs.Client.Events.CheckPermissionsEventArgs(db, "ProjectFiles", "ProjectFile", file, EntityJs.Client.Events.ActionsEnum.Delete);
                file.OnDeleting(args);
                db.ProjectFiles.DeleteObject(file);
                file.OnDeleted(args);
            }
        }