Пример #1
0
 public HttpResponseMessage ExportRevaluation(string userKeyId, string revalutionNo)
 {
     try
     {
         var user        = UserService.GetUserByKeyId(userKeyId);
         var revaluation = RevaluationService.GetByRevaluationNo(revalutionNo, user.Id);
         var bytes       = RevaluationService.ExportRevaluation(revaluation.TId, user.Id);
         HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
         response.Content = new StreamContent(new MemoryStream(bytes));
         response.Content.Headers.ContentType        = new MediaTypeHeaderValue("application/octet-stream");
         response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
         {
             FileName = string.Format("复估单{0}_{1:yyyyMMddHHmmss}.xls", revalutionNo, DateTime.Now)
         };
         return(response);
     }
     catch (Exception ex)
     {
         return(new HttpResponseMessage(HttpStatusCode.NoContent));
     }
 }
Пример #2
0
        /// <summary>
        /// 导出复估
        /// </summary>
        /// <param name="id"></param>
        /// <param name="revaluationNo"></param>
        /// <returns></returns>
        public ActionResult ExportRevaluation(long id, string revaluationNo)
        {
            var excel = RevaluationService.ExportRevaluation(id, UserHelper.GetCurrentUser().Id);

            return(File(excel, "application/octet-stream", string.Format("导出{0}复估单_{1:yyyyMMddHHmmss}.xls", revaluationNo, DateTime.Now)));
        }