DbTransaction.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Data;
  6. using CoreFS.CA06;
  7. namespace Core.StlMes.Client.Sale.DbHelp
  8. {
  9. public class DbTransaction:DbBase
  10. {
  11. private CoreFS.CA06.OpeBase _ob = null;
  12. private Core.StlMes.Client.Sale.DbHelp.DbExecute dbExecute = null;
  13. private const string ServerName = "core.stlmes.server.sale.dbhelp.DbManager";
  14. private const string BeginTransactionMethod = "beginTransaction";
  15. private const string CommitMethod = "commit";
  16. private const string RollbackMethod = "rollBack";
  17. private string uuid = "";
  18. public string Uuid
  19. {
  20. get
  21. {
  22. return this.uuid;
  23. }
  24. set
  25. {
  26. this.uuid = value;
  27. }
  28. }
  29. public string _errMsg = "";
  30. public string ErrMsg
  31. {
  32. get
  33. {
  34. return this._errMsg;
  35. }
  36. set
  37. {
  38. this._errMsg = value;
  39. }
  40. }
  41. public DbTransaction(CoreFS.CA06.OpeBase ob)
  42. {
  43. this._ob = ob;
  44. dbExecute = new DbExecute(ob);
  45. }
  46. public void BeginTransaction()
  47. {
  48. CoreClientParam pa = dbExecute.GetUuid();
  49. if (pa == null)
  50. {
  51. this.ErrMsg = " 无法获取连接!!!! ";
  52. return;
  53. }
  54. this.uuid = pa.ReturnObject.ToString();
  55. this.ErrMsg = (this.uuid.Length == 0) ? " 无法获取连接!!!! " : "";
  56. }
  57. public void Commit()
  58. {
  59. if (this.ErrMsg.Length > 0)
  60. {
  61. RollBack();
  62. return;
  63. }
  64. dbExecute.Commit(this.Uuid);
  65. }
  66. public void RollBack()
  67. {
  68. dbExecute.RollBack(this.Uuid);
  69. }
  70. }
  71. }