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.

113 lines
4.5 KiB

  1. using Swift.DAL.BL.AgentPanel.Send;
  2. using Swift.DAL.SwiftDAL;
  3. using Swift.web.Library;
  4. using System;
  5. using System.Data;
  6. using System.Text;
  7. namespace Swift.web.AgentNew.SendTxn
  8. {
  9. public partial class FormLoader : System.Web.UI.Page
  10. {
  11. private string _bankId = GetStatic.ReadQueryString("bankId", "");
  12. private string _isBranchByName = GetStatic.ReadQueryString("isBranchByName", "");
  13. private string _branchSelected = GetStatic.ReadQueryString("branchSelected", "");
  14. private readonly SwiftLibrary sl = new SwiftLibrary();
  15. private SendTranIRHDao st = new SendTranIRHDao();
  16. protected void Page_Load(object sender, EventArgs e)
  17. {
  18. sl.CheckSession();
  19. ReturnValue();
  20. }
  21. private void ReturnValue()
  22. {
  23. switch (GetQueryType())
  24. {
  25. case "bb":
  26. PopulateBranchName();
  27. break;
  28. }
  29. }
  30. private string GetQueryType()
  31. {
  32. return GetStatic.ReadQueryString("type", "");
  33. }
  34. private void PopulateBranchName()
  35. {
  36. string bankId = GetStatic.ReadQueryString("bankId", "");
  37. string partnerId = GetStatic.ReadQueryString("partnerId", "");
  38. string pMode = GetStatic.ReadQueryString("pMode", "");
  39. string receivingCountryId = GetStatic.ReadQueryString("receivingCountryId", "");
  40. var dao = new RemittanceDao();
  41. var html = new StringBuilder();
  42. if (string.IsNullOrEmpty(_bankId) || _bankId == "undefined")
  43. {
  44. html.Append("<select id=\"branch\" class=\"form-control\" >");
  45. html.Append("<option value = \"\">Select</option>");
  46. }
  47. else
  48. {
  49. DataTable dt = null;
  50. string sql = "EXEC proc_dropDownLists @flag = 'pickBranchById', @agentId=" + dao.FilterString(_bankId);
  51. dt = dao.ExecuteDataset(sql).Tables[0];
  52. if (dt == null || dt.Rows.Count == 0)
  53. {
  54. if(receivingCountryId == "151")
  55. {
  56. html.Append("<select id=\"branch\" class=\"form-control\"><option value = \"0\">Any Branch</option></select>");
  57. }
  58. else
  59. {
  60. html.Append("<select id=\"branch\" class=\"form-control\"><option value = \"-1\">No Branches Found</option></select>");
  61. }
  62. Response.Write(html.ToString());
  63. return;
  64. }
  65. html.Append("<select id=\"branch\" class=\"form-control\" >");
  66. html.Append("<option value = \"\">Select</option>");
  67. if (string.IsNullOrEmpty(_isBranchByName))
  68. {
  69. foreach (DataRow dr in dt.Rows)
  70. {
  71. html.Append("<option value = \"" + dr["agentId"] + "\">" + dr["agentName"] + "</option>");
  72. }
  73. }
  74. else
  75. {
  76. foreach (DataRow dr in dt.Rows)
  77. {
  78. if (_isBranchByName.ToUpper() == "Y")
  79. {
  80. if (_branchSelected.ToUpper() == dr["agentName"].ToString().ToUpper())
  81. {
  82. html.Append("<option value = \"" + dr["agentId"] + "\" selected=\"selected\">" + dr["agentName"] + "</option>");
  83. }
  84. else
  85. {
  86. html.Append("<option value = \"" + dr["agentId"] + "\">" + dr["agentName"] + "</option>");
  87. }
  88. }
  89. else
  90. {
  91. if (_branchSelected == dr["agentId"].ToString())
  92. {
  93. html.Append("<option value = \"" + dr["agentId"] + "\" selected=\"selected\">" + dr["agentName"] + "</option>");
  94. }
  95. else
  96. {
  97. html.Append("<option value = \"" + dr["agentId"] + "\">" + dr["agentName"] + "</option>");
  98. }
  99. }
  100. }
  101. }
  102. html.Append("</select>");
  103. }
  104. Response.Write(html.ToString());
  105. }
  106. }
  107. }