예제 #1
0
        internal filelist GetClassSharedFiles(User user, Class userclass)
        {
            filelist myList = new filelist();
            List<Class> userclasses = GetClasses(user);


            string pathextension = userclass.SharedPath;
            var dir = new System.IO.DirectoryInfo(Path.Combine(HttpRuntime.AppDomainAppPath, "/UploadedFiles/", pathextension));
            List<System.IO.FileInfo> filenames = dir.GetFiles("*.*").ToList();

            var results = from f in filenames
                          select new filelistviewmodel()
                          {
                              filename = f.Name,
                              filecreation = f.CreationTimeUtc,
                              filepath = f.FullName,

                          };
            foreach (var item in results)
            {
                myList.SharedFilelist.Add(item);
            }
            return myList;
        }
예제 #2
0
        internal filelist GetAllFilesCurrentUserClass(int classId, string userId)
        {

            User currentUser = GetUser(userId);
            Class userclass = currentUser.Classes.Single(x => x.Id == classId);
            filelist mylist = new filelist();
            mylist.SharedFilelist.AddRange(GetClassSharedFiles(currentUser, userclass).SharedFilelist);
            if (RoleValues.Adminuser == true)
            {
                mylist.TaskFileList.AddRange(GetClassTaskFiless(currentUser, userclass).TaskFileList);
                mylist.AdminUser = true;
            }

            mylist.currentclass = userclass;
            return mylist;
        }