public async Task SetDownloadTypeByUserId(long?userId, DownloadTypeEnum downloadType)
        {
            var entity = await this.QueryAsNoTracking.Where(o => o.UserId == userId.Value)
                         .FirstOrDefaultAsync();

            entity.DownloadType = downloadType.ToString();
            await this.Update(entity);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="JournalStatusResponseJournals" /> class.
 /// </summary>
 /// <param name="companyId">事業所ID (required).</param>
 /// <param name="downloadType">ダウンロード形式 (required).</param>
 /// <param name="downloadUrl">ダウンロードURL.</param>
 /// <param name="endDate">取得終了日 (yyyy-mm-dd) (required).</param>
 /// <param name="id">受け付けID (required).</param>
 /// <param name="startDate">取得開始日 (yyyy-mm-dd) (required).</param>
 /// <param name="status">事業所ID (required).</param>
 /// <param name="visibleTags">visibleTags.</param>
 public JournalStatusResponseJournals(int companyId = default(int), DownloadTypeEnum downloadType = default(DownloadTypeEnum), string downloadUrl = default(string), string endDate = default(string), int id = default(int), string startDate = default(string), StatusEnum status = default(StatusEnum), List <VisibleTagsEnum> visibleTags = default(List <VisibleTagsEnum>))
 {
     this.CompanyId    = companyId;
     this.DownloadType = downloadType;
     // to ensure "endDate" is required (not null)
     this.EndDate = endDate ?? throw new ArgumentNullException("endDate is a required property for JournalStatusResponseJournals and cannot be null");
     this.Id      = id;
     // to ensure "startDate" is required (not null)
     this.StartDate   = startDate ?? throw new ArgumentNullException("startDate is a required property for JournalStatusResponseJournals and cannot be null");
     this.Status      = status;
     this.DownloadUrl = downloadUrl;
     this.VisibleTags = visibleTags;
 }
Пример #3
0
 public UrlInfo(DownloadTypeEnum priority, string url, string referer = null,
                AfterEffectsDelegate afterEffects = null, ResolveUrlDelegate resolveUrlFunc = null, ulong fileSize = 0)
 {
     DownloadType = priority;
     Url          = url;
     if (referer != null)
     {
         Referer = referer;
     }
     if (afterEffects != null)
     {
         AfterEffectsFunc = afterEffects;
     }
     ResolveUrlFunc = resolveUrlFunc;
     FileSize       = fileSize;
 }
 /// <summary>
 /// 生成文件流
 /// </summary>
 /// <param name="response">HttpResponseBase</param>
 /// <param name="filePath">文件路径</param>
 /// <param name="fileName">文件名称,为空,则根据 GUID 生成</param>
 /// <param name="encoding">编码格式</param>
 /// <param name="downloadType">下载模式</param>
 /// <returns></returns>
 public static bool Download(HttpResponseBase response, string filePath, string fileName, Encoding encoding, DownloadTypeEnum downloadType = DownloadTypeEnum.TransmitFile)
 {
     if (downloadType == DownloadTypeEnum.TransmitFile)
     {
         return(TransmitFileDownload(response, filePath, fileName, encoding));
     }
     else if (downloadType == DownloadTypeEnum.WriteFile)
     {
         return(WriteFileDownload(response, filePath, fileName, encoding));
     }
     else if (downloadType == DownloadTypeEnum.BinaryWrite)
     {
         return(BinaryWriteDownload(response, filePath, fileName, encoding));
     }
     else
     {
         return(WriteFilePortionDownload(response, filePath, fileName, encoding));
     }
 }
 /// <summary>
 /// 生成文件流
 /// </summary>
 /// <param name="response">HttpResponseBase</param>
 /// <param name="filePath">文件路径</param>
 /// <param name="fileName">文件名称,为空,则根据 GUID 生成</param>
 /// <param name="downloadType">下载模式</param>
 /// <returns></returns>
 public static bool Download(HttpResponseBase response, string filePath, string fileName, DownloadTypeEnum downloadType = DownloadTypeEnum.TransmitFile)
 {
     return(Download(response, filePath, fileName, Encoding.UTF8, downloadType));
 }