Exemple #1
0
        // getDirtyNotes, 把note的图片, 附件信息都发送给客户端
        // 客户端保存到本地, 再获取图片, 附件

        // 得到所有图片, 附件信息
        // 查images表, attachs表
        // [待测]

        public static NoteFile[] getFiles(long noteId)
        {
            var noteImages  = NoteImageService.getImagesByNoteId(noteId);
            var noteAttachs = AttachService.getAttachsByNoteId(noteId);


            Dictionary <long, NoteFile[]> noteFilesMap = new Dictionary <long, NoteFile[]>(100);

            throw new Exception();
        }
Exemple #2
0
        // getDirtyNotes, 把note的图片, 附件信息都发送给客户端
        // 客户端保存到本地, 再获取图片, 附件

        /// <summary>
        /// 得到所有图片, 附件信息
        /// 查images表, attachs表
        /// [待测]
        /// </summary>
        /// <param name="noteIds"></param>
        /// <returns></returns>
        public static Dictionary <long, List <APINoteFile> > getFiles(long[] noteIds)
        {
            var noteImages  = NoteImageService.getImagesByNoteIds(noteIds);
            var noteAttachs = AttachService.getAttachsByNoteIds(noteIds);
            Dictionary <long, List <APINoteFile> > noteFilesMap = new Dictionary <long, List <APINoteFile> >(100);

            //if (noteImages != null && noteImages.Length > 0)
            //{
            //    foreach (var item in noteImages)
            //    {
            //        NoteFile noteFile=new NoteFile()
            //        {
            //            FileId=item.FileId,
            //            Type=item.Type
            //        };
            //        if (noteFilesMap.ContainsKey(item.note))
            //        {
            //            noteFilesMap[item.NoteId].Add(noteFile);
            //        }
            //        else
            //        {
            //            noteFilesMap.Add(item.NoteId,new List<NoteFile>());
            //            noteFilesMap[item.NoteId].Add(noteFile);

            //        }

            //    }
            //}
            if (noteAttachs != null && noteAttachs.Length > 0)
            {
                foreach (var item in noteAttachs)
                {
                    APINoteFile noteFile = new APINoteFile()
                    {
                        FileId   = item.AttachId.ToString("x"),
                        Type     = item.Type,
                        Title    = item.Title,
                        IsAttach = true
                    };
                    if (noteFilesMap.ContainsKey(item.NoteId))
                    {
                        noteFilesMap[item.NoteId].Add(noteFile);
                    }
                    else
                    {
                        noteFilesMap.Add(item.NoteId, new List <APINoteFile>());
                        noteFilesMap[item.NoteId].Add(noteFile);
                    }
                }
            }
            return(noteFilesMap);
        }
Exemple #3
0
        //todo 删除废纸篓
        public static bool DeleteTrashApi(long noteId, long userId, int usn, out string msg, out int afterUsn)
        {
            Note note = NoteService.GetNote(noteId, userId);

            if (note == null)
            {
                msg      = "notExists";
                afterUsn = 0;
                //todo: 存疑
                return(false);
            }

            if (note.Usn != usn)
            {
                msg      = "conflict";
                afterUsn = 0;
                return(false);
            }
            // 设置删除位
            //afterUsn = UserService.IncrUsn(userId);
            // delete note's attachs
            var result = NoteService.SetDeleteStatus(noteId, userId, out afterUsn);

            if (!result)
            {
                msg      = "设置删除位错误";
                afterUsn = 0;
                return(false);
            }
            AttachService.DeleteAllAttachs(noteId, userId);

            // 删除content history
            NoteContentService.DeleteByIdAndUserId(noteId, userId, true);
            NotebookService.ReCountNotebookNumberNotes(note.NotebookId);
            msg = "";
            return(true);
        }