You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
7.1 KiB

  1. using System.Data;
  2. using Swift.DAL.SwiftDAL;
  3. namespace Swift.DAL.BL.Remit.CreditRiskManagement.TransactionLimit
  4. {
  5. public class ReceiveTranLimitDao : RemittanceDao
  6. {
  7. #region -- Previous Function --
  8. //public DbResult Update(string user, string rtlId, string agentId, string countryId, string userId,
  9. // string sendingCountry, string maxLimitAmt, string agMaxLimitAmt, string currency, string tranType,
  10. // string customerType)
  11. //{
  12. // string sql = "EXEC proc_receiveTranLimit";
  13. // sql += " @flag = " + (rtlId == "0" || rtlId == "" ? "'i'" : "'u'");
  14. // sql += ", @user = " + FilterString(user);
  15. // sql += ", @rtlId = " + FilterString(rtlId);
  16. // sql += ", @agentId = " + FilterString(agentId);
  17. // sql += ", @countryId = " + FilterString(countryId);
  18. // sql += ", @userId = " + FilterString(userId);
  19. // sql += ", @sendingCountry = " + FilterString(sendingCountry);
  20. // sql += ", @maxLimitAmt = " + FilterString(maxLimitAmt);
  21. // sql += ", @agMaxLimitAmt = " + FilterString(agMaxLimitAmt);
  22. // sql += ", @currency = " + FilterString(currency);
  23. // sql += ", @tranType = " + FilterString(tranType);
  24. // sql += ", @customerType = " + FilterString(customerType);
  25. // return ParseDbResult(ExecuteDataset(sql).Tables[0]);
  26. //}
  27. //public DbResult Delete(string user, string rtlId)
  28. //{
  29. // string sql = "EXEC proc_receiveTranLimit";
  30. // sql += " @flag = 'd'";
  31. // sql += ", @user = " + FilterString(user);
  32. // sql += ", @rtlId = " + FilterString(rtlId);
  33. // return ParseDbResult(ExecuteDataset(sql).Tables[0]);
  34. //}
  35. //public DataRow SelectById(string user, string rtlId)
  36. //{
  37. // string sql = "EXEC proc_receiveTranLimit";
  38. // sql += " @flag = 'a'";
  39. // sql += ", @user = " + FilterString(user);
  40. // sql += ", @rtlId = " + FilterString(rtlId);
  41. // DataSet ds = ExecuteDataset(sql);
  42. // if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
  43. // return null;
  44. // return ds.Tables[0].Rows[0];
  45. //}
  46. #endregion
  47. public DbResult Update(string user, string rtlId, string agentId, string countryId, string userId,
  48. string sendingCountry, string maxLimitAmt, string agMaxLimitAmt, string currency, string tranType,
  49. string customerType, string branchSelection, string benificiaryIdReq, string relationshipReq,
  50. string benificiaryContactReq, string acLengthFrom, string acLengthTo, string acNumberType)
  51. {
  52. string sql = "EXEC proc_receiveTranLimit";
  53. sql += " @flag = " + (rtlId == "0" || rtlId == "" ? "'i'" : "'u'");
  54. sql += ", @user = " + FilterString(user);
  55. sql += ", @rtlId = " + FilterString(rtlId);
  56. sql += ", @agentId = " + FilterString(agentId);
  57. sql += ", @countryId = " + FilterString(countryId);
  58. sql += ", @userId = " + FilterString(userId);
  59. sql += ", @sendingCountry = " + FilterString(sendingCountry);
  60. sql += ", @maxLimitAmt = " + FilterString(maxLimitAmt);
  61. sql += ", @agMaxLimitAmt = " + FilterString(agMaxLimitAmt);
  62. sql += ", @currency = " + FilterString(currency);
  63. sql += ", @tranType = " + FilterString(tranType);
  64. sql += ", @customerType = " + FilterString(customerType);
  65. sql += ", @branchSelection = " + FilterString(branchSelection);
  66. sql += ", @benificiaryIdReq = " + FilterString(benificiaryIdReq);
  67. sql += ", @relationshipReq = " + FilterString(relationshipReq);
  68. sql += ", @benificiaryContactReq = " + FilterString(benificiaryContactReq);
  69. sql += ", @acLengthFrom = " + FilterString(acLengthFrom);
  70. sql += ", @acLengthTo = " + FilterString(acLengthTo);
  71. sql += ", @acNumberType = " + FilterString(acNumberType);
  72. return ParseDbResult(ExecuteDataset(sql).Tables[0]);
  73. }
  74. public DbResult UpdateCountryWise(string user, string rtlId, string agentId, string countryId, string userId,
  75. string sendingCountry, string maxLimitAmt, string agMaxLimitAmt, string currency, string tranType,
  76. string customerType, string branchSelection, string benificiaryIdReq, string relationshipReq,
  77. string benificiaryContactReq)
  78. {
  79. string sql = "EXEC proc_receiveTranLimit";
  80. sql += " @flag = " + (rtlId == "0" || rtlId == "" ? "'i'" : "'u'");
  81. sql += ", @user = " + FilterString(user);
  82. sql += ", @rtlId = " + FilterString(rtlId);
  83. sql += ", @agentId = " + FilterString(agentId);
  84. sql += ", @countryId = " + FilterString(countryId);
  85. sql += ", @userId = " + FilterString(userId);
  86. sql += ", @sendingCountry = " + FilterString(sendingCountry);
  87. sql += ", @maxLimitAmt = " + FilterString(maxLimitAmt);
  88. sql += ", @agMaxLimitAmt = " + FilterString(agMaxLimitAmt);
  89. sql += ", @currency = " + FilterString(currency);
  90. sql += ", @tranType = " + FilterString(tranType);
  91. sql += ", @customerType = " + FilterString(customerType);
  92. sql += ", @branchSelection = " + FilterString(branchSelection);
  93. sql += ", @benificiaryIdReq = " + FilterString(benificiaryIdReq);
  94. sql += ", @relationshipReq = " + FilterString(relationshipReq);
  95. sql += ", @benificiaryContactReq = " + FilterString(benificiaryContactReq);
  96. return ParseDbResult(ExecuteDataset(sql).Tables[0]);
  97. }
  98. public DbResult Delete(string user, string rtlId)
  99. {
  100. string sql = "EXEC proc_receiveTranLimit";
  101. sql += " @flag = 'd'";
  102. sql += ", @user = " + FilterString(user);
  103. sql += ", @rtlId = " + FilterString(rtlId);
  104. return ParseDbResult(ExecuteDataset(sql).Tables[0]);
  105. }
  106. public DataRow SelectById(string user, string rtlId)
  107. {
  108. string sql = "EXEC proc_receiveTranLimit";
  109. sql += " @flag = 'a'";
  110. sql += ", @user = " + FilterString(user);
  111. sql += ", @rtlId = " + FilterString(rtlId);
  112. DataSet ds = ExecuteDataset(sql);
  113. if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
  114. return null;
  115. return ds.Tables[0].Rows[0];
  116. }
  117. public double GetCountryMaxLimit(string user, string agentId)
  118. {
  119. var sql = "EXEC proc_receiveTranLimit";
  120. sql += " @flag = 'cml'";
  121. sql += ", @user = " + FilterString(user);
  122. sql += ", @agentId = " + FilterString(agentId);
  123. var value = GetSingleResult(sql);
  124. double maxLimit;
  125. double.TryParse(value, out maxLimit);
  126. return maxLimit;
  127. }
  128. }
  129. }