人民医院API

CommandInfo.cs 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data.SqlClient;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace RMYY_CallCenter_Api.DB
  8. {
  9. public enum EffentNextType
  10. {
  11. /// <summary>
  12. /// 对其他语句无任何影响
  13. /// </summary>
  14. None,
  15. /// <summary>
  16. /// 当前语句必须为"select count(1) from .."格式,如果存在则继续执行,不存在回滚事务
  17. /// </summary>
  18. WhenHaveContine,
  19. /// <summary>
  20. /// 当前语句必须为"select count(1) from .."格式,如果不存在则继续执行,存在回滚事务
  21. /// </summary>
  22. WhenNoHaveContine,
  23. /// <summary>
  24. /// 当前语句影响到的行数必须大于0,否则回滚事务
  25. /// </summary>
  26. ExcuteEffectRows,
  27. /// <summary>
  28. /// 引发事件-当前语句必须为"select count(1) from .."格式,如果不存在则继续执行,存在回滚事务
  29. /// </summary>
  30. SolicitationEvent
  31. }
  32. public class CommandInfo
  33. {
  34. public object ShareObject = null;
  35. public object OriginalData = null;
  36. event EventHandler _solicitationEvent;
  37. public event EventHandler SolicitationEvent
  38. {
  39. add
  40. {
  41. _solicitationEvent += value;
  42. }
  43. remove
  44. {
  45. _solicitationEvent -= value;
  46. }
  47. }
  48. public void OnSolicitationEvent()
  49. {
  50. if (_solicitationEvent != null)
  51. {
  52. _solicitationEvent(this, new EventArgs());
  53. }
  54. }
  55. public string CommandText;
  56. public System.Data.Common.DbParameter[] Parameters;
  57. public EffentNextType EffentNextType = EffentNextType.None;
  58. public CommandInfo()
  59. {
  60. }
  61. public CommandInfo(string sqlText, SqlParameter[] para)
  62. {
  63. this.CommandText = sqlText;
  64. this.Parameters = para;
  65. }
  66. public CommandInfo(string sqlText, SqlParameter[] para, EffentNextType type)
  67. {
  68. this.CommandText = sqlText;
  69. this.Parameters = para;
  70. this.EffentNextType = type;
  71. }
  72. }
  73. }