Guest User

Untitled

a guest
Feb 21st, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. public class FileFoldersDisplayClass
  2. {
  3. public int folderID { get; set; }
  4.  
  5. public string folderName { get; set; }
  6.  
  7. public int? parentFolderID { get; set; }
  8.  
  9. public int? contractorID { get; set; }
  10.  
  11. public int? teamID { get; set; }
  12.  
  13. public int? contractID { get; set; }
  14.  
  15. public int? clientID { get; set; }
  16.  
  17. public bool bureau { get; set; }
  18.  
  19. public bool teamManager { get; set; }
  20.  
  21. public bool staff { get; set; }
  22.  
  23. public bool? secure { get; set; }
  24.  
  25. public List<FileFoldersDisplayClass> childFolders { get; set; }
  26. }
  27.  
  28. List<FileFoldersDisplayClass> ITeamsRepository.GetTopLevelFolders(int? teamID, int? clientID, int? contractorID, int staffID, bool secure)
  29. {
  30. CMS3Context _db = new CMS3Context();
  31. try
  32. {
  33. var childFolders = new List<FileFoldersDisplayClass>();
  34. var folders = from f in _db.FileFolders
  35. where (((f.teamID == teamID && f.teamID != null) || (f.contractorID == contractorID && f.contractID != null) || (f.clientID == clientID && f.clientID != null)) && (f.secure ?? false == secure)) && f.parentFolderID == null
  36. select new FileFoldersDisplayClass()
  37. {
  38. folderID = f.folderID,
  39. folderName = f.folderName,
  40. parentFolderID = f.parentFolderID,
  41. contractorID = f.contractorID,
  42. teamID = f.teamID,
  43. contractID = f.contractID,
  44. bureau = f.bureau,
  45. teamManager = f.teamManager,
  46. staff = f.staff,
  47. secure = f.secure,
  48. childFolders = (from cF in _db.FileFolders
  49. where cF.parentFolderID == f.folderID
  50. select new FileFoldersDisplayClass()
  51. {
  52. folderID = f.folderID,
  53. folderName = f.folderName,
  54. parentFolderID = f.parentFolderID,
  55. contractorID = f.contractorID,
  56. teamID = f.teamID,
  57. contractID = f.contractID,
  58. bureau = f.bureau,
  59. teamManager = f.teamManager,
  60. staff = f.staff,
  61. secure = f.secure,
  62. childFolders = childFolders
  63. }).ToList()
  64. };
  65.  
  66.  
  67.  
  68.  
  69.  
  70. return folders.ToList();
  71. }
  72. catch(Exception e)
  73. {
  74. var d = e;
  75. return new List<FileFoldersDisplayClass>();
  76. }
  77.  
  78. }
Add Comment
Please, Sign In to add comment