BlMenuInfo.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using ProjectBase.Data.BaseDAL;
  2. using SIMDP.DAL.IDALSQL;
  3. using SIMDP.Model;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace SIMDP.BLL
  10. {
  11. /// <summary>
  12. /// 菜单管理
  13. /// </summary>
  14. public class BlMenuInfo : BaseBLL<MoMenuInfo>
  15. {
  16. private IDalMenuInfo dalMenuInfo;
  17. /// <summary>
  18. /// 构造函数
  19. /// </summary>
  20. public BlMenuInfo() : base()
  21. {
  22. base.Init(this.GetType().FullName, System.Reflection.Assembly.GetExecutingAssembly().GetName().Name);
  23. dalMenuInfo = baseDal as IDalMenuInfo;
  24. dalMenuInfo.OnOperationLog += new OperationLogEventHandler(BlLogOperation.OnOperationLog);
  25. }
  26. public string CreateFunctionId(string winfromType, string menuParentId )
  27. {
  28. string createId = null;
  29. string condition = " 1 = 1";
  30. condition += string.IsNullOrEmpty(menuParentId) ? " and menu_parent_id is null" : string.Format(" and menu_parent_id = '{0}'", menuParentId);
  31. condition += string.IsNullOrEmpty(winfromType) ? "" : string.Format(" and menu_winform_type = '{0}'", winfromType);
  32. int count = dalMenuInfo.GetRecordCount(condition);
  33. if (winfromType.Equals("1"))
  34. {
  35. MoMenuInfo mo = dalMenuInfo.FindSingle(condition);
  36. createId = string.Format("{0}{1}", (count + 1).ToString().PadLeft(2, '0'), mo.ID.Substring(2, 4));
  37. }
  38. else if (winfromType.Equals("2"))
  39. {
  40. createId = string.Format("{0}{1}{2}", menuParentId.Substring(0, 2), (count + 1).ToString().PadLeft(2, '0'), menuParentId.Substring(4, 2));
  41. }
  42. else
  43. {
  44. createId = string.Format("{0}{1}", menuParentId.Substring(0, 4), (count + 1).ToString().PadLeft(2, '0'));
  45. }
  46. return createId;
  47. }
  48. }
  49. }