CheckDataHelper.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace SCC.Common
  6. {
  7. public static class CheckDataHelper
  8. {
  9. private IEmail email = null;
  10. static CheckDataHelper()
  11. {
  12. email = IOC.Resolve<IEmail>();
  13. }
  14. /// <summary>
  15. /// 纠错参数
  16. /// </summary>
  17. /// <param name="dbData"></param>
  18. /// <param name="newData"></param>
  19. private static void CheckData(Dictionary<string, string> dbData, Dictionary<string, string> newData)
  20. {
  21. try
  22. {
  23. foreach (var item in dbData)
  24. {
  25. var data = newData.SingleOrDefault(w => w.Key == item.Key);
  26. if (data.Key != null)
  27. {
  28. if (data.Value != item.Value)
  29. {
  30. email.AddEmail(Config.Area + Config.LotteryName, data.Key, DateTime.Now, "数据验证失败");
  31. }
  32. }
  33. }
  34. }
  35. catch (Exception ex)
  36. {
  37. //log.Error(this.GetType(), string.Format("【{0}】数据验证发生错误,错误信息【{1}】", Config.Area + Config.LotteryName, ex.Message));
  38. //报错处理
  39. }
  40. }
  41. }
  42. }