BlAuthoryRight.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using ProjectBase.Data.BaseDAL;
  2. using ProjectBase.Data.Logs;
  3. using SIMDP.DAL.IDALSQL;
  4. using SIMDP.Model;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace SIMDP.BLL
  11. {
  12. public class BlAuthoryRight : BaseBLL<MoAuthoryRight>
  13. {
  14. private IDalAuthoryRight dalAuthoryRight;
  15. /// <summary>
  16. /// 构造函数
  17. /// </summary>
  18. public BlAuthoryRight() : base()
  19. {
  20. base.Init(this.GetType().FullName, System.Reflection.Assembly.GetExecutingAssembly().GetName().Name);
  21. dalAuthoryRight = baseDal as IDalAuthoryRight;
  22. dalAuthoryRight.OnOperationLog += new OperationLogEventHandler(BlLogOperation.OnOperationLog);
  23. }
  24. /// <summary>
  25. /// 产生功能列表
  26. /// </summary>
  27. /// <returns></returns>
  28. public bool CreateAuthoryRight()
  29. {
  30. try
  31. {
  32. string condition = " 1 =1";
  33. if (dalAuthoryRight.IsExistRecord(condition))
  34. dalAuthoryRight.DeleteByCondition(condition);
  35. string sql = string.Format("INSERT INTO authory_right(right_id, parent_right_id, right_name)select menu_id, menu_parent_id, menu_name FROM menu");
  36. dalAuthoryRight.SqlExecute(sql);
  37. }
  38. catch (Exception ex)
  39. {
  40. LogHelper.log.Error("功能管理产生失败 原因是{0}", ex);
  41. return false;
  42. }
  43. return true;
  44. }
  45. }
  46. }