Ejemplo n.º 1
0
        public FolderInfoModel GetQuickFolderInfo(int folderId)
        {
            var folderInfo = new FolderInfoModel();

            try
            {
                using (var db = new OggleBoobleMySqlContext())
                {
                    var dbFolder = db.CategoryFolders.Where(f => f.Id == folderId).FirstOrDefault();
                    if (dbFolder == null)
                    {
                        folderInfo.Success = "folder not found";
                        return(folderInfo);
                    }
                    folderInfo.FolderType = dbFolder.FolderType;
                    folderInfo.FolderName = dbFolder.FolderName;
                    folderInfo.Parent     = dbFolder.Parent;
                    var dbFolderDetails = db.FolderDetails.Where(d => d.FolderId == folderId).FirstOrDefault();
                    if (dbFolderDetails != null)
                    {
                        folderInfo.FolderComments = dbFolderDetails.FolderComments;
                    }
                    folderInfo.Success = "ok";
                    folderInfo.Success = "ok";
                }
            }
            catch (Exception ex) { folderInfo.Success = Helpers.ErrorDetails(ex); }
            return(folderInfo);
        }
Ejemplo n.º 2
0
        public IActionResult GetFolderInfo(Guid?id)
        {
            FolderInfoModel model     = null;
            CajFolder       retFolder = null;

            if (id.HasValue)
            {
                retFolder = _db.CajFolder.FirstOrDefault(x => x.Id == id.Value);
            }
            else
            {
                retFolder = _db.CajFolder.FirstOrDefault(x => x.ParentId == null);
            }

            if (retFolder != null)
            {
                model = new FolderInfoModel()
                {
                    Id   = retFolder.Id,
                    Name = retFolder.Name
                }
            }
            ;
            return(Ok(model));
        }
Ejemplo n.º 3
0
        public FolderInfoModel GetFolderInfo(string FolderID, string UserID = "")
        {
            FolderInfoModel folder = null;

            var _folder = servisDal.getMany(a => a.ID == FolderID)
                          .Include(a => a.Group)
                          .ThenInclude(b => b.Users)
                          .Include(a => a.Notes)
                          .FirstOrDefault();

            if (_folder != null)
            {
                folder             = new FolderInfoModel();
                folder.ID          = _folder.ID;
                folder.Name        = _folder.Name;
                folder.Explanation = _folder.Explanation;
                folder.CreateDate  = _folder.CreateDate;
                folder.Visible     = _folder.Visible;
                folder.NoteCount   = _folder.Notes.Count;
                folder.Group       = _folder.Group;

                var user = _folder.Group.Users.FirstOrDefault(a => a.UserID == UserID);
                folder.Status = user != null ? user.Status : !string.IsNullOrEmpty(UserID) ? Status.User : Status.Visitor;
            }

            return(folder);
        }
Ejemplo n.º 4
0
        private async Task UpdateInfo(string currentRequestFolder, IEnumerable <string> files)
        {
            var infoFileName = Path.Combine(currentRequestFolder, _infoFileName);

            if (infoFileName.Exists())
            {
                return;
            }

            var folderInfo = new FolderInfoModel {
                Files = files.Select(file => new FileInfoModel {
                    Name = file
                })
            };

            await infoFileName.WriteJson(folderInfo);
        }
Ejemplo n.º 5
0
        public static async Task <StorageFolder> GetParentFolder(FolderInfoModel folderItem)
        {
            StorageFolder outerFolder;

            if ((bool)(folderItem?.FolderList.Any()))
            {
                outerFolder = await folderItem?.FolderList.First().GetParentAsync();
            }
            else
            {
                var currentFolder = await StorageFolder.GetFolderFromPathAsync(folderItem?.FolderPath);

                outerFolder = currentFolder;
            }

            return(outerFolder);
        }