ServiceResultEntityManager.cs 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*******************************************************************************
  2. * Copyright(c) 2014 dongke All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:ServiceResultEntityManager.cs
  5. * 2.功能描述:服务返回实体控制
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 庄天威 2014/12/4 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.ServiceModel;
  13. using System.Windows.Forms;
  14. using Dongke.IBOSS.PRD.Basics.BaseResources;
  15. using Dongke.IBOSS.PRD.Basics.Library;
  16. using Dongke.IBOSS.PRD.WCF.DataModels;
  17. using Dongke.IBOSS.PRD.WCF.Proxys.TATModuleService;
  18. namespace Dongke.IBOSS.PRD.Client.CommonModule
  19. {
  20. /// <summary>
  21. /// 服务返回实体控制
  22. /// </summary>
  23. public class ServiceResultEntityManager
  24. {
  25. /// <summary>
  26. /// 服务返回共通处理
  27. /// </summary>
  28. /// <param name="srEntity">服务返回实体</param>
  29. /// <param name="pageText">页面文本</param>
  30. public static void HandleServiceResultEntity(ServiceResultEntity srEntity, String pageText)
  31. {
  32. //如果有提示信息的话
  33. //根据返回值的不同状态设置不同的消息框图标
  34. if (srEntity.Message != null && srEntity.Message != "")
  35. {
  36. MessageBoxIcon boxIcon;
  37. switch (srEntity.Status)
  38. {
  39. case Constant.ServiceResultStatus.Success:
  40. boxIcon = MessageBoxIcon.Information;
  41. break;
  42. case Constant.ServiceResultStatus.ValidationFailed:
  43. boxIcon = MessageBoxIcon.Warning;
  44. break;
  45. case Constant.ServiceResultStatus.UserNotLogin:
  46. boxIcon = MessageBoxIcon.Warning;
  47. break;
  48. case Constant.ServiceResultStatus.UserOtherLogin:
  49. boxIcon = MessageBoxIcon.Warning;
  50. break;
  51. case Constant.ServiceResultStatus.AccountDateError:
  52. boxIcon = MessageBoxIcon.Warning;
  53. break;
  54. case Constant.ServiceResultStatus.NoFunRight:
  55. boxIcon = MessageBoxIcon.Warning;
  56. break;
  57. case Constant.ServiceResultStatus.NoModifyData:
  58. boxIcon = MessageBoxIcon.Warning;
  59. break;
  60. case Constant.ServiceResultStatus.DataChanged:
  61. boxIcon = MessageBoxIcon.Warning;
  62. break;
  63. case Constant.ServiceResultStatus.DataDuplicated:
  64. boxIcon = MessageBoxIcon.Warning;
  65. break;
  66. case Constant.ServiceResultStatus.NoLicensesRight:
  67. boxIcon = MessageBoxIcon.Warning;
  68. break;
  69. case Constant.ServiceResultStatus.SystemError:
  70. boxIcon = MessageBoxIcon.Error;
  71. break;
  72. default:
  73. boxIcon = MessageBoxIcon.Information;
  74. break;
  75. }
  76. MessageBox.Show(srEntity.Message, pageText,
  77. MessageBoxButtons.OK,
  78. boxIcon);
  79. }
  80. }
  81. }
  82. }