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.

151 lines
6.3 KiB

9 months ago
9 months ago
9 months ago
9 months ago
  1. using System;
  2. using System.Web.UI;
  3. using Swift.web.Library;
  4. using Swift.DAL.BL.Remit.Transaction;
  5. using Swift.DAL.SwiftDAL;
  6. using Newtonsoft.Json;
  7. using System.Net;
  8. namespace Swift.web.Remit.Transaction.Modify
  9. {
  10. public partial class ModifyField : Page
  11. {
  12. readonly StaticDataDdl sd = new StaticDataDdl();
  13. RemittanceLibrary sl = new RemittanceLibrary();
  14. private readonly ModifyTransactionDao mtd = new ModifyTransactionDao();
  15. protected void Page_Load(object sender, EventArgs e)
  16. {
  17. sl.CheckSession();
  18. if (!IsPostBack)
  19. {
  20. DisplayLabel();
  21. lblOldValue.Text = getOldValue();
  22. if (getFieldName() == "rIdType" || getFieldName() == "sIdType")
  23. {
  24. rptShowOther.Visible = true;
  25. PopulateDll(getFieldName());
  26. ddlNewValue.Visible = true;
  27. txtNewValue.Visible = false;
  28. rptName.Visible = false;
  29. txtContactNo.Visible = false;
  30. }
  31. else if (getFieldName() == "sContactNo" || getFieldName() == "rContactNo")
  32. {
  33. rptShowOther.Visible = true;
  34. txtNewValue.Visible = false;
  35. txtContactNo.Visible = true;
  36. rptName.Visible = false;
  37. ddlNewValue.Visible = false;
  38. }
  39. else if (getFieldName() == "receiverName" || getFieldName() == "senderName")
  40. {
  41. rptName.Visible = true;
  42. rptShowOther.Visible = false;
  43. }
  44. else if (getFieldName() == "paymentMethod")
  45. {
  46. rptShowOther.Visible = true;
  47. PopulateDll(getFieldName());
  48. ddlNewValue.Visible = true;
  49. txtNewValue.Visible = false;
  50. rptName.Visible = false;
  51. txtContactNo.Visible = false;
  52. }
  53. else
  54. {
  55. rptShowOther.Visible = true;
  56. txtNewValue.Visible = true;
  57. ddlNewValue.Visible = false;
  58. rptName.Visible = false;
  59. txtContactNo.Visible = false;
  60. }
  61. }
  62. }
  63. private void DisplayLabel()
  64. {
  65. if (getFieldName() == "rIdType")
  66. lblFieldName.Text = "Receiver Id Type";
  67. else if (getFieldName() == "sIdType")
  68. lblFieldName.Text = "Sender Id Type";
  69. else if (getFieldName() == "receiverName")
  70. lblFieldName.Text = "Receiver Name";
  71. else if (getFieldName() == "senderName")
  72. lblFieldName.Text = "Sender Name";
  73. else if (getFieldName() == "sAddress")
  74. lblFieldName.Text = "Sender Address";
  75. else if (getFieldName() == "rAddress")
  76. lblFieldName.Text = "Receiver Address";
  77. else if (getFieldName() == "rContactNo")
  78. lblFieldName.Text = "Receiver Contact Number";
  79. else if (getFieldName() == "sContactNo")
  80. lblFieldName.Text = "Sender Contact Number";
  81. else if (getFieldName() == "rIdNo")
  82. lblFieldName.Text = "Receiver Id No";
  83. else if (getFieldName() == "sIdNo")
  84. lblFieldName.Text = "Sender Id No";
  85. else if (getFieldName() == "paymentMethod")
  86. lblFieldName.Text = "Mode of Payment";
  87. }
  88. private string GetLabel()
  89. {
  90. return GetStatic.ReadQueryString("label", "");
  91. }
  92. private string getFieldName()
  93. {
  94. return GetStatic.ReadQueryString("fieldName", "");
  95. }
  96. private string getOldValue()
  97. {
  98. return WebUtility.UrlDecode(GetStatic.ReadQueryString("oldValue", ""));
  99. }
  100. protected long GetTranId()
  101. {
  102. return GetStatic.ReadNumericDataFromQueryString("tranId");
  103. }
  104. private void PopulateDll(string fieldName)
  105. {
  106. var country = GetStatic.ReadQueryString("pCountry","");
  107. if (fieldName == "rIdType")
  108. sd.SetDDL(ref ddlNewValue, "EXEC proc_online_dropDownList @flag = 'idType', @user = '" + GetStatic.GetUser() + "'", "valueId", "detailTitle", "", "Select..");
  109. else if (fieldName == "sIdType")
  110. sd.SetDDL2(ref ddlNewValue, "EXEC proc_countryIdType @flag = 'il', @countryId='151', @spFlag = '5201'", "detailTitle", "", "Select");
  111. else if (fieldName == "paymentMethod")
  112. sd.SetDDL(ref ddlNewValue, "EXEC proc_online_sendPageLoadData @flag = 'payoutMethods' ,@country = " + country + "", "Key", "Value", "", "Select");
  113. }
  114. protected void btnUpdate_Click(object sender, EventArgs e)
  115. {
  116. OnUpdate();
  117. }
  118. private void OnUpdate()
  119. {
  120. DbResult dbResult = mtd.UpdateTransaction(GetStatic.GetUser()
  121. , GetTranId().ToString()
  122. , getFieldName()
  123. , getOldValue()
  124. , txtNewValue.Text
  125. , ddlNewValue.Text
  126. , txtFirstName.Text
  127. , txtMiddleName.Text
  128. , txtLastName1.Text
  129. , txtLastName2.Text
  130. , txtContactNo.Text
  131. , GetStatic.GetIsApiFlag()
  132. , GetStatic.GetSessionId()
  133. );
  134. ManageMessage(dbResult);
  135. }
  136. private void ManageMessage(DbResult dbResult)
  137. {
  138. var res = JsonConvert.SerializeObject(dbResult);
  139. //var mes = GetStatic.ParseResultJsPrint(dbResult);
  140. //mes = mes.Replace("<center>", "");
  141. //mes = mes.Replace("</center>", "");
  142. var scriptName = "CallBack";
  143. var functionName = "CallBack('" + res + "');";
  144. GetStatic.CallBackJs1(Page, scriptName, functionName);
  145. }
  146. }
  147. }