Esempio n. 1
0
        /// <summary>
        /// 设置输出文件
        /// </summary>
        /// <param name="filter"></param>
        /// <param name="dt"></param>
        /// <param name="responseEntity"></param>
        protected void SetExportFile(BaseExportFilter filter, DataTable dt
                                     , ResponseEntity responseEntity, string sheetName = "Sheet1")
        {
            ResponseFileResult responseResult = new ResponseFileResult();

            responseResult.Result
                = FileExportUtility.GenerateFileStream(dt, (EnumExportFileType)filter.ExportFileType, sheetName);

            dt = null;

            ServiceUtility.SetResponseStatus(responseEntity, EnumResponseState.Success);
            responseEntity.Results = responseResult;
        }
Esempio n. 2
0
        /// <summary>
        /// 设置输出文件
        /// </summary>
        /// <param name="filter"></param>
        /// <param name="list"></param>
        /// <param name="responseEntity"></param>
        protected void SetExportFile(BaseExportFilter filter, ICollection list
                                     , ResponseEntity responseEntity, string sheetName = "Sheet1")
        {
            string[] titles = filter.Titles.Split(WebServiceConst.Separater_Comma.ToArray()).ToArray();
            string[] fields = filter.Fields.Split(WebServiceConst.Separater_Comma.ToArray()).ToArray();

            ResponseFileResult responseResult = new ResponseFileResult();

            responseResult.Result = FileExportUtility.GenerateFileStream(titles, fields,
                                                                         list, (EnumExportFileType)filter.ExportFileType, sheetName);

            titles = null;
            fields = null;
            list   = null;

            ServiceUtility.SetResponseStatus(responseEntity, EnumResponseState.Success);
            responseEntity.Results = responseResult;
        }