Beispiel #1
0
        public Response <GetMessageHistoryQueryRequest> GetMessageHistoryInfoReport(GetMessageHistoryQueryRequest request)
        {
            Response <GetMessageHistoryQueryRequest> response = new Response <GetMessageHistoryQueryRequest>()
            {
                Result = new GetMessageHistoryQueryRequest()
            };

            if (request == null)
            {
                ArgumentNullException ex = new ArgumentNullException("GetMessageHistoryInfo request");
                LogError(ex);
                response.ErrorCode = ErrorCode.Argument;
                response.Exception = ex;
                return(response);
            }

            try
            {
                TotalAccessor accessor = new TotalAccessor();

                response.Result.MessageHistoryTable = accessor.GetMessageHistoryInfoReport(request.SqlWhere);

                response.IsSuccess = true;
            }
            catch (Exception ex)
            {
                LogError(ex);
                response.IsSuccess = false;
                response.ErrorCode = ErrorCode.Technical;
                response.Exception = ex;
            }

            return(response);
        }
Beispiel #2
0
        public Response <GetMessageHistoryQueryRequest> GetMessageHistoryInfo(GetMessageHistoryQueryRequest request)
        {
            Response <GetMessageHistoryQueryRequest> response = new Response <GetMessageHistoryQueryRequest>()
            {
                Result = new GetMessageHistoryQueryRequest()
            };

            if (request == null)
            {
                ArgumentNullException ex = new ArgumentNullException("GetMessageHistoryInfo request");
                LogError(ex);
                response.ErrorCode = ErrorCode.Argument;
                response.Exception = ex;
                return(response);
            }

            try
            {
                TotalAccessor accessor = new TotalAccessor();
                int           Rowcount;
                response.Result.MessageHistoryTable = accessor.GetMessageHistoryInfo(request.SqlWhere, request.PageIndex, request.PageSize, out Rowcount);
                response.Result.PageIndex           = request.PageIndex;
                response.Result.PageCount           = Rowcount % request.PageSize == 0 ? Rowcount / request.PageSize : Rowcount / request.PageSize + 1;
                response.IsSuccess = true;
            }
            catch (Exception ex)
            {
                LogError(ex);
                response.IsSuccess = false;
                response.ErrorCode = ErrorCode.Technical;
                response.Exception = ex;
            }

            return(response);
        }
Beispiel #3
0
 public ActionResult MessageHistoryQuery(MessageHistoryQueryModel model, int?PageIndex)
 {
     if (model.IsExprot)
     {
         return(this.GetMessageHistoryInfoReport(model));
     }
     else
     {
         GetMessageHistoryQueryRequest request = new GetMessageHistoryQueryRequest()
         {
             SqlWhere = GetSqlWhere(model), PageSize = UtilConstants.PAGESIZE, PageIndex = PageIndex ?? 0
         };
         Response <GetMessageHistoryQueryRequest> Response = new TotalService().GetMessageHistoryInfo(request);
         model.MessageHistoryTable = Response.Result.MessageHistoryTable;
         model.PageIndex           = Response.Result.PageIndex;
         model.PageSize            = Response.Result.PageSize;
         model.PageCount           = Response.Result.PageCount;
     }
     return(View(model));
 }
Beispiel #4
0
        public ActionResult GetMessageHistoryInfoReport(MessageHistoryQueryModel view)
        {
            string SQL        = this.GetSqlWhere(view);
            string ReportName = "Total短信信息" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx";
            GetMessageHistoryQueryRequest request = new GetMessageHistoryQueryRequest()
            {
                SqlWhere = GetSqlWhere(view)
            };
            Response <GetMessageHistoryQueryRequest> Response = new TotalService().GetMessageHistoryInfoReport(request);

            DataTable   Exprottable  = Response.Result.MessageHistoryTable;
            ExcelHelper excelHelper  = new ExcelHelper();
            string      targetPath   = Path.Combine(Runbow.TWS.Common.Constants.UPLOAD_FOLDER_PATH, base.UserInfo.ProjectID.ToString(), "Temp");
            string      fileFullPath = Path.Combine(targetPath, ReportName);

            excelHelper.CreateExcelByDataTable(fileFullPath, Exprottable);
            excelHelper.Dispose();

            string     mimeType = "application/msexcel";
            FileStream fs       = MyFile.Open(fileFullPath, FileMode.Open);

            return(File(fs, mimeType, Url.Encode(ReportName)));
        }