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.

123 lines
5.3 KiB

  1. using Swift.DAL.BL.Remit.Transaction;
  2. using Swift.DAL.SwiftDAL;
  3. using Swift.web.Component.Grid;
  4. using Swift.web.Component.Grid.gridHelper;
  5. using Swift.web.Library;
  6. using System;
  7. using System.Collections.Generic;
  8. namespace Swift.web.Remit.Transaction.ApproveTxn
  9. {
  10. public partial class MappingInfo : System.Web.UI.Page
  11. {
  12. private const string GridName = "grid_Beneficiarylist";
  13. private ApproveTransactionDao at = new ApproveTransactionDao();
  14. private readonly SwiftGrid _grid = new SwiftGrid();
  15. private readonly RemittanceLibrary swiftLibrary = new RemittanceLibrary();
  16. protected void Page_Load(object sender, EventArgs e)
  17. {
  18. swiftLibrary.CheckSession();
  19. LoadGrid();
  20. GetAvailableBalance();
  21. }
  22. private void GetAvailableBalance()
  23. {
  24. string amount = at.GetAvailableBalance(GetStatic.GetUser(), getTranId());
  25. lblAvailableBalance.InnerText = "Available Balance: " + GetStatic.ShowDecimal(amount);
  26. }
  27. private void LoadGrid()
  28. {
  29. _grid.ColumnList = new List<GridColumn>
  30. {
  31. new GridColumn("SN", "SN", "", "T"),
  32. new GridColumn("fullName", "Customer Name", "", "T"),
  33. new GridColumn("particulars", "particulars", "", "T"),
  34. new GridColumn("depositAmount", "depositAmount", "", "M"),
  35. };
  36. _grid.GridType = 1;
  37. _grid.GridDataSource = SwiftGrid.GridDS.RemittanceDB;
  38. _grid.GridName = GridName;
  39. _grid.ShowPagingBar = false;
  40. _grid.AllowEdit = false;
  41. _grid.AlwaysShowFilterForm = false;
  42. _grid.ShowFilterForm = false;
  43. _grid.SortOrder = "ASC";
  44. _grid.RowIdField = "customerId";
  45. _grid.ThisPage = "MappingInfo.aspx";
  46. _grid.InputPerRow = 4;
  47. _grid.GridMinWidth = 700;
  48. _grid.GridWidth = 100;
  49. _grid.IsGridWidthInPercent = true;
  50. _grid.AllowCustomLink = true;
  51. var approveLink = "&nbsp;<input type = 'button' class='btn btn-primary m-t-25' onclick = \"Approve(@customerId,@tranId,'"+ getTranId()+ "');\" value = 'Approve' />";
  52. approveLink += "&nbsp;<input type = 'button' class='btn btn-primary m-t-25' onclick = \"Reject(@customerId,@tranId);\" value = 'Reject' />";
  53. //var editLink = swiftLibrary.HasRight(EditFunctionId) ? "<span class=\"action-icon\"> <btn type=\"button\" class=\"btn btn-xs btn-default\" data-toggle=\"tooltip\" data-placement=\"top\" title = \"Edit\"> <a href =\"Manage.aspx?receiverId=@receiverId&customerId=@customerId&hideSearchDiv=" + hideSearchDiv.Value + "\"><i class=\"fa fa-edit\" ></i></a></btn></span>" : "";
  54. //var printLink = "<span class=\"action-icon\"> <btn type=\"button\" class=\"btn btn-xs btn-default\" data-toggle=\"tooltip\" data-placement=\"top\" title = \"Print Details\"> <a href =\"ReceiverDetails.aspx?receiverId=@receiverId\"><i class=\"fa fa-print\" ></i></a></btn></span>";
  55. _grid.CustomLinkText = approveLink;
  56. _grid.CustomLinkVariables = "tranId,customerId";
  57. string sql = "EXEC [PROC_CUSTOMER_DEPOSITS] @flag = 'getMappedDeposits',@tranId=" + getTranId() + " ";
  58. _grid.SetComma();
  59. rpt_grid.InnerHtml = _grid.CreateGrid(sql);
  60. }
  61. private string getTranId()
  62. {
  63. var tranId = GetStatic.ReadQueryString("id", "");
  64. return tranId;
  65. }
  66. protected void btnApprove_Click(object sender, EventArgs e)
  67. {
  68. string tranId = hddTranId.Value;
  69. string customerId = hddCustomerId.Value;
  70. string remittrantempId = hddremitTranTempId.Value;
  71. DbResult _dbRes = new DbResult();
  72. if (!string.IsNullOrEmpty(tranId))
  73. {
  74. _dbRes = at.ApproveMappingData(GetStatic.GetUser(), tranId, customerId, "deposit-approve", remittrantempId);
  75. //GetStatic.AlertMessage(this, _dbRes.Msg);
  76. if (_dbRes.ErrorCode == "0")
  77. {
  78. GetStatic.AlertMessage(this, "Mapping Data approved successfully!!");
  79. LoadGrid();
  80. }
  81. else
  82. {
  83. GetStatic.AlertMessage(this, _dbRes.Msg);
  84. }
  85. }
  86. else
  87. {
  88. GetStatic.AlertMessage(this, "No transaction to approve!!");
  89. }
  90. }
  91. protected void btnReject_Click(object sender, EventArgs e)
  92. {
  93. string tranId = hddTranId.Value;
  94. string customerId = hddCustomerId.Value;
  95. DbResult _dbRes = new DbResult();
  96. if (!string.IsNullOrEmpty(tranId))
  97. {
  98. _dbRes = at.ApproveMappingData(GetStatic.GetUser(), tranId, customerId, "reject","");
  99. //GetStatic.AlertMessage(this, _dbRes.Msg);
  100. GetStatic.AlertMessage(this, _dbRes.Msg);
  101. if (_dbRes.ErrorCode == "0")
  102. {
  103. LoadGrid();
  104. }
  105. }
  106. else
  107. {
  108. GetStatic.AlertMessage(this, "No transaction to unmap!!");
  109. }
  110. }
  111. }
  112. }