FundUserAndBalRelationDAL.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. using DbHelp = Core.StlMes.Client.Sale.DbHelp;
  8. namespace Core.StlMes.Client.Sale.SaleFundMgt.FundDAL.FundUserAndBalanceRelationDAL
  9. {
  10. /// <summary>
  11. /// 登陆用户和结算单位关系管理
  12. /// </summary>
  13. public class FundUserAndBalRelationDAL : BaseDAL.BaseDAL
  14. {
  15. public FundUserAndBalRelationDAL(OpeBase ob)
  16. : base(ob)
  17. {
  18. }
  19. private const string STR_QUERY = @" select userid,balancesubject,importor,importtime
  20. from sel_fund_userandbalrelation where 1 = 1 {0} ";
  21. private const string STR_DELETE = @"delete from sel_fund_userandbalrelation where userid = '{0}' ";
  22. private const string STR_INSERT = @"insert into sel_fund_userandbalrelation(userid,balancesubject,importor,importtime)
  23. values('{0}','{1}','{2}','{3}') ";
  24. public System.Data.DataSet GetSelFundUserAndBalRelation(string sqlCondition)
  25. {
  26. string sqlStr = string.Format(STR_QUERY,sqlCondition);
  27. return base.ExecuteReaderForSaleFund(sqlStr);
  28. }
  29. /// <summary>
  30. /// 带标题,返回数据集合
  31. /// </summary>
  32. /// <param name="sqlCondition"></param>
  33. /// <param name="isSetCaption"></param>
  34. /// <returns></returns>
  35. public System.Data.DataSet GetSelFundUserAndBalRelation(string sqlCondition,Boolean isSetCaption)
  36. {
  37. DataSet ds = GetSelFundUserAndBalRelation(sqlCondition);
  38. if (isSetCaption)
  39. {
  40. base.SetDataSetCaption(ref ds,base.GetColumnNameAndCaption());
  41. }
  42. return ds;
  43. }
  44. public List<Model.SEL_FUND_USERANDBALRELATION> GetSelFundUserAndBalRelationList(string sqlCondition)
  45. {
  46. return Model.SEL_FUND_USERANDBALRELATION.GetSelFundUserAndBalRealtion(GetSelFundUserAndBalRelation(sqlCondition));
  47. }
  48. /// <summary>
  49. /// 通过用户编码获取一个数据,唯一
  50. /// </summary>
  51. /// <param name="userId"></param>
  52. /// <returns></returns>
  53. public Model.SEL_FUND_USERANDBALRELATION GetSelFundUserAndBalRelationByUserId(string userId)
  54. {
  55. string sqlConditon = string.Format(" and userid = '{0}' ", userId);
  56. List<Model.SEL_FUND_USERANDBALRELATION> list = GetSelFundUserAndBalRelationList(sqlConditon);
  57. if (list == null || list.Count == 0)
  58. return null;
  59. return list[0];
  60. }
  61. public void Insert(Model.SEL_FUND_USERANDBALRELATION real,out string errMsg)
  62. {
  63. errMsg = "";
  64. if (real == null)
  65. {
  66. errMsg = "Error";
  67. return;
  68. }
  69. try
  70. {
  71. string sqlStr = string.Format(STR_INSERT,real.USERID,real.BALANCESUBJECT,real.IMPORTOR,real.IMPORTTIME);
  72. base.ExecuteNoReaderForSaleFund(sqlStr,out errMsg);
  73. }
  74. catch(Exception ex)
  75. {
  76. errMsg = ex.Message;
  77. }
  78. }
  79. public void Insert(Model.SEL_FUND_USERANDBALRELATION real, DbHelp.DbTransaction transaction)
  80. {
  81. // 基本判断
  82. if (real == null)
  83. {
  84. transaction.ErrMsg = "Error";
  85. return;
  86. }
  87. try
  88. {
  89. string sqlStr = string.Format(STR_INSERT, real.USERID, real.BALANCESUBJECT, real.IMPORTOR, real.IMPORTTIME);
  90. base.ExecuteNoReaderForSaleFund(sqlStr, transaction);
  91. }
  92. catch (Exception ex)
  93. {
  94. }
  95. }
  96. public void Delete(string userId,out string errMsg)
  97. {
  98. errMsg = "";
  99. if (userId.Length == 0)
  100. return;
  101. try
  102. {
  103. string sqlDelete = string.Format(STR_DELETE,userId);
  104. base.ExecuteNoReaderForSaleFund(sqlDelete,out errMsg);
  105. }
  106. catch
  107. {
  108. }
  109. }
  110. public void Delete(string userId, DbHelp.DbTransaction transaction)
  111. {
  112. if (userId.Length == 0)
  113. {
  114. transaction.ErrMsg = "Error";
  115. return;
  116. }
  117. try
  118. {
  119. string sqlDelete = string.Format(STR_DELETE, userId);
  120. base.ExecuteNoReaderForSaleFund(sqlDelete, transaction);
  121. }
  122. catch
  123. {
  124. }
  125. }
  126. }
  127. }