BaseControl.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Runtime.InteropServices;
  6. namespace Bowin.Web.Controls.Mvc
  7. {
  8. public abstract class BaseControl
  9. {
  10. public BaseControl()
  11. {
  12. Attributes = new Dictionary<string, string>();
  13. CurrentHttpContext = HttpContext.Current;
  14. //if (!Check())
  15. //{
  16. // throw new Exception("软件需要注册,您并未完成注册,请联系厂商完成注册程序。");
  17. //}
  18. }
  19. //[DllImport("RegisterMFC.dll")]
  20. //public static extern bool Check();
  21. public HttpContext CurrentHttpContext { get; set; }
  22. protected IDictionary<string, string> Attributes { get; set; }
  23. public string ID { get; set; }
  24. public string Name { get; set; }
  25. public string Title { get; set; }
  26. public string CssClass { get; set; }
  27. /// <summary>
  28. /// 是否显示
  29. /// </summary>
  30. public bool? IsShow { get; set; }
  31. /// <summary>
  32. /// 是否启用
  33. /// </summary>
  34. public bool? IsEnabled { get; set; }
  35. public abstract string Render();
  36. private static readonly object lock_NewIDIndex = new object();
  37. private static int currIDIndex = 0;
  38. public static int NewIDIndex()
  39. {
  40. lock (lock_NewIDIndex)
  41. {
  42. return currIDIndex++;
  43. }
  44. }
  45. }
  46. }