BarCodeBase.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace Bowin.Common.BarCode
  6. {
  7. /// <summary>
  8. /// 条码类型基类
  9. /// </summary>
  10. public abstract class BarCodeBase
  11. {
  12. protected string rawData; //原始数据
  13. /// <summary>
  14. /// 获取编码原始数据
  15. /// </summary>
  16. public string RawData
  17. {
  18. get
  19. {
  20. return rawData;
  21. }
  22. }
  23. /// <summary>
  24. /// 获取条码值
  25. /// </summary>
  26. public string EncodeValue
  27. {
  28. get
  29. {
  30. try
  31. {
  32. return EncodeCode();
  33. }
  34. catch (Exception)
  35. {
  36. throw;
  37. }
  38. }
  39. }
  40. /// <summary>
  41. /// 进行条码编码
  42. /// </summary>
  43. /// <returns>返回条码值</returns>
  44. public abstract string EncodeCode();
  45. /// <summary>
  46. /// 初始化条码对照字典
  47. /// </summary>
  48. protected virtual void InitCode()
  49. {
  50. }
  51. }
  52. }