You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.6 KiB

2 years ago
  1. using EasyBL.WebApi.Message;
  2. using Entity.Sugar;
  3. using SqlSugar;
  4. using SqlSugar.Base;
  5. using System;
  6. namespace EasyBL.WEBAPP.SYS
  7. {
  8. public class MailSet_QryService : ServiceBase
  9. {
  10. #region 郵件管理(分頁查詢)
  11. /// <summary>
  12. /// 郵件管理(分頁查詢)
  13. /// </summary>
  14. /// <param name="i_crm"></param>
  15. /// <returns></returns>
  16. public ResponseMessage QueryPage(RequestMessage i_crm)
  17. {
  18. ResponseMessage rm = null;
  19. string sMsg = null;
  20. var db = SugarBase.GetIntance();
  21. try
  22. {
  23. do
  24. {
  25. var pml = new PageModel
  26. {
  27. PageIndex = _fetchInt(i_crm, @"pageIndex"),
  28. PageSize = _fetchInt(i_crm, @"pageSize")
  29. };
  30. var iPageCount = 0;
  31. var sSortField = _fetchString(i_crm, @"sortField");
  32. var sSortOrder = _fetchString(i_crm, @"sortOrder");
  33. var sEmailID = _fetchString(i_crm, @"EmailID");
  34. var sEmailName = _fetchString(i_crm, @"EmailName");
  35. var sEmailSubject = _fetchString(i_crm, @"EmailSubject");
  36. var bExcel = _fetchBool(i_crm, @"Excel");
  37. pml.DataList = db.Queryable<OTB_SYS_Email>()
  38. .Where(x => x.OrgID == i_crm.ORIGID && x.EmailID.Contains(sEmailID) && x.EmailName.Contains(sEmailName) && x.EmailSubject.Contains(sEmailSubject))
  39. .OrderBy(sSortField, sSortOrder)
  40. .ToPageList(pml.PageIndex, bExcel ? 100000 : pml.PageSize, ref iPageCount);
  41. pml.Total = iPageCount;
  42. rm = new SuccessResponseMessage(null, i_crm);
  43. if (bExcel)
  44. {
  45. }
  46. else
  47. {
  48. rm.DATA.Add(BLWording.REL, pml);
  49. }
  50. } while (false);
  51. }
  52. catch (Exception ex)
  53. {
  54. sMsg = Util.GetLastExceptionMsg(ex);
  55. LogAndSendEmail(sMsg + "Params:" + JsonToString(i_crm), ex, i_crm.ORIGID, i_crm.USERID, nameof(MailSet_QryService), "", "QueryPage(郵件管理(分頁查詢))", "", "", "");
  56. }
  57. finally
  58. {
  59. if (null != sMsg)
  60. {
  61. rm = new ErrorResponseMessage(sMsg, i_crm);
  62. }
  63. }
  64. return rm;
  65. }
  66. #endregion 郵件管理(分頁查詢)
  67. }
  68. }