/// <summary> /// Start converting data. /// </summary> /// <remarks>See other documentation page about converting format and file path.</remarks> public async Task BuildAsync() { var mdFileType = new PostFileType(_fileSystem); var attachmentType = new AttachmentFileType(_fileSystem); await Task.WhenAll( new[] { new PartialConverter(mdFileType, _fileSystem).BuildAsync(), new PartialConverter(attachmentType, _fileSystem).BuildAsync() } ).ConfigureAwait(false); }
/// <summary> /// 获取指定用户未使用的附件的附件列表 /// </summary> /// <param name="userid">指定用户id</param> /// <param name="posttime">获取指定时间后的新附件,空为不限时间</param> /// <param name="attachmentType">附件的类型</param> /// <returns>AttachmentInfo列表</returns> public static List<AttachmentInfo> GetNoUsedAttachmentList(int userid, string posttime, AttachmentFileType attachmentType) { if (appDBCache) { if (attachmentType == AttachmentFileType.All) return IAttachmentService.GetNoUsedAttachmentJson(userid, posttime, 2); else if (attachmentType == AttachmentFileType.FileAttachment) return IAttachmentService.GetNoUsedAttachmentJson(userid, posttime, 0); else return IAttachmentService.GetNoUsedAttachmentJson(userid, posttime, 1); } IDataReader reader; if (attachmentType == AttachmentFileType.All) reader = DatabaseProvider.GetInstance().GetNoUsedAttachmentListByUid(userid, posttime, 2); else if (attachmentType == AttachmentFileType.FileAttachment) reader = DatabaseProvider.GetInstance().GetNoUsedAttachmentListByUid(userid, posttime, 0); else reader = DatabaseProvider.GetInstance().GetNoUsedAttachmentListByUid(userid, posttime, 1); List<AttachmentInfo> attachmentList = new List<AttachmentInfo>(); while (reader.Read()) { AttachmentInfo attach = LoadAttachmentInfo(reader); attachmentList.Add(attach); } reader.Close(); return attachmentList; }
public static EntityList <Attachment> FindAllByUid(Int32 userid, DateTime posttime, AttachmentFileType attachmentType = AttachmentFileType.All) { var exp = new WhereExpression(); if (userid > 0) { exp &= _.Uid == userid; } if (posttime > DateTime.MinValue) { exp &= _.PostDateTime > posttime; } if (attachmentType < AttachmentFileType.All) { exp &= _.IsImage == attachmentType; } return(FindAll(exp, null, null, 0, 100)); }
/// <summary> /// 获取指定用户未使用的附件的附件列表 /// </summary> /// <param name="userid">指定用户id</param> /// <param name="posttime">获取指定时间后的新附件,空为不限时间</param> /// <param name="attachmentType">附件的类型</param> /// <returns>AttachmentInfo列表</returns> public static List <AttachmentInfo> GetNoUsedAttachmentList(int userid, string posttime, AttachmentFileType attachmentType) { if (appDBCache) { if (attachmentType == AttachmentFileType.All) { return(IAttachmentService.GetNoUsedAttachmentJson(userid, posttime, 2)); } else if (attachmentType == AttachmentFileType.FileAttachment) { return(IAttachmentService.GetNoUsedAttachmentJson(userid, posttime, 0)); } else { return(IAttachmentService.GetNoUsedAttachmentJson(userid, posttime, 1)); } } IDataReader reader; if (attachmentType == AttachmentFileType.All) { reader = DatabaseProvider.GetInstance().GetNoUsedAttachmentListByUid(userid, posttime, 2); } else if (attachmentType == AttachmentFileType.FileAttachment) { reader = DatabaseProvider.GetInstance().GetNoUsedAttachmentListByUid(userid, posttime, 0); } else { reader = DatabaseProvider.GetInstance().GetNoUsedAttachmentListByUid(userid, posttime, 1); } List <AttachmentInfo> attachmentList = new List <AttachmentInfo>(); while (reader.Read()) { AttachmentInfo attach = LoadAttachmentInfo(reader); attachmentList.Add(attach); } reader.Close(); return(attachmentList); }