BlWhite.cs 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. using ProjectBase.Data.BaseDAL;
  2. using SIASUN.Autopilot.DAL.IDALSQL;
  3. using SIASUN.Autopilot.Model;
  4. using System.Collections.Generic;
  5. namespace SIASUN.Autopilot.BLL
  6. {
  7. public class BlWhite : BaseBLL<MoWhite>
  8. {
  9. private IDalWhite dalBlack;
  10. /// <summary>
  11. /// 构造函数
  12. /// </summary>
  13. public BlWhite() : base()
  14. {
  15. base.Init(this.GetType().FullName, System.Reflection.Assembly.GetExecutingAssembly().GetName().Name);
  16. dalBlack = baseDal as IDalWhite;
  17. dalBlack.OnOperationLog += new OperationLogEventHandler(BlLogOperation.OnOperationLog);
  18. }
  19. /// <summary>
  20. /// 黑白名单验证
  21. /// </summary>
  22. /// <param name="user">用户</param>
  23. /// <param name="ip">本机IP地址</param>
  24. /// <param name="message">反馈信息</param>
  25. /// <returns></returns>
  26. //public bool VerifyBlackWhite(string userAccount, string ip, out string message)
  27. //{
  28. // try
  29. // {
  30. // List<MoBlackWhite> list = Find(string.Format(" black_UserAccount = '{0}' AND black_forbid = 0", userAccount));
  31. // if (list == null || list.Count == 0)
  32. // {
  33. // message = "";
  34. // return true;
  35. // }
  36. // foreach (MoBlackWhite item in list)
  37. // {
  38. // if (item.Type == 0) //黑名单
  39. // {
  40. // if (item.IPStart.CompareTo(ip) <= 0 && item.IPEnd.CompareTo(ip) >= 0)
  41. // {
  42. // message = "您被黑名单禁止登录!";
  43. // MoLogLogIn moLogIn = new MoLogLogIn
  44. // {
  45. // Account = userAccount,
  46. // Name = SysEnvironment.CurrentLoginName,
  47. // GroupId = SysEnvironment.CurrentLoginGroupId,
  48. // Description = "用户登录操作被黑名单禁止登录!",
  49. // Ip = ip,
  50. // Mac = SysEnvironment.Mac,
  51. // Time = DateTime.Now
  52. // };
  53. // BLLFactory<BlLogLogIn>.Instance.Insert(moLogIn);
  54. // return false;
  55. // }
  56. // }
  57. // if (item.Type == 1) //白名单
  58. // {
  59. // if (item.IPStart.CompareTo(ip) > 0 || item.IPEnd.CompareTo(ip) < 0)
  60. // {
  61. // message = "您被白名单禁止登录!";
  62. // MoLogLogIn moLogIn = new MoLogLogIn
  63. // {
  64. // Account = userAccount,
  65. // Name = SysEnvironment.CurrentLoginName,
  66. // GroupId = SysEnvironment.CurrentLoginGroupId,
  67. // Description = "用户登录操作被白名单禁止登录!",
  68. // Ip = ip,
  69. // Mac = SysEnvironment.Mac,
  70. // Time = DateTime.Now
  71. // };
  72. // BLLFactory<BlLogLogIn>.Instance.Insert(moLogIn);
  73. // return false;
  74. // }
  75. // }
  76. // }
  77. // message = "";
  78. // return true;
  79. // }
  80. // catch (Exception ex)
  81. // {
  82. // LogHelper.log.Error(string.Format("黑白名单验证出现错误:{0}", ex));
  83. // message = ex.ToString();
  84. // return false;
  85. // }
  86. //}
  87. }
  88. }