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.

101 lines
3.2 KiB

  1. using System;
  2. using Swift.DAL.BL.Remit.Transaction;
  3. using Swift.DAL.SwiftDAL;
  4. using Swift.web.Library;
  5. namespace Swift.web.Remit.Transaction.BlockTransaction
  6. {
  7. public partial class Manage : System.Web.UI.Page
  8. {
  9. private readonly StaticDataDdl _sdd = new StaticDataDdl();
  10. SwiftLibrary sl= new SwiftLibrary();
  11. private readonly LockUnlock obj = new LockUnlock();
  12. private const string viewFunctionId = "20121200";
  13. private const string approveFunctionId = "20121230";
  14. protected void Page_Load(object sender, EventArgs e)
  15. {
  16. sl.CheckAuthentication(viewFunctionId);
  17. ManageButtons();
  18. }
  19. private void ManageButtons()
  20. {
  21. var mode = GetStatic.ReadQueryString("controlNo", "");
  22. var controlNo = GetStatic.ReadQueryString("controlNo", "");
  23. if (controlNo != "")
  24. {
  25. btnBlock.Visible = false;
  26. btnUnBlock.Visible = sl.HasRight(approveFunctionId);
  27. divSearch.Visible = false;
  28. LoadData();
  29. } else
  30. {
  31. btnBlock.Visible = sl.HasRight(approveFunctionId);
  32. btnBlock.Enabled = sl.HasRight(approveFunctionId);
  33. btnUnBlock.Visible = false;
  34. divSearch.Visible = true;
  35. }
  36. }
  37. private void LoadData()
  38. {
  39. var ctrlNo = GetStatic.ReadQueryString("controlNo", "");
  40. ucTran.SearchData("", ctrlNo,"","N", "UNBLOCK", "ADM: UNBLOCK TXN");
  41. divTranDetails.Visible = true;
  42. divComments.Visible = true;
  43. }
  44. private void SearchData()
  45. {
  46. ucTran.SearchData("", controlNo.Text, "","N","BLOCK","ADM: BLOCK TXN");
  47. if(ucTran.TranStatus != "Payment")
  48. {
  49. divTranDetails.Visible = false;
  50. PrintMessage("No transaction found..");
  51. return;
  52. }
  53. divTranDetails.Visible = true;
  54. divComments.Visible = true;
  55. }
  56. private void PrintMessage(string msg)
  57. {
  58. GetStatic.CallBackJs1(Page, "Msg", "alert('"+msg+"');");
  59. }
  60. protected void btnBlock_Click(object sender, EventArgs e)
  61. {
  62. var dbResult = obj.BlockTransaction(GetStatic.GetUser(), controlNo.Text, comments.Text);
  63. ManageMessage(dbResult);
  64. }
  65. protected void btnUnBlock_Click(object sender, EventArgs e)
  66. {
  67. var cnNo = GetStatic.ReadQueryString("controlNo", "");
  68. if (cnNo == "")
  69. return;
  70. var dbResult = obj.UnBlockTransaction(GetStatic.GetUser(), cnNo, comments.Text);
  71. ManageMessage(dbResult);
  72. }
  73. protected void btnSearchDetail_Click(object sender, EventArgs e)
  74. {
  75. SearchData();
  76. }
  77. private void ManageMessage(DbResult dbResult)
  78. {
  79. GetStatic.SetMessage(dbResult);
  80. if (dbResult.ErrorCode != "0")
  81. {
  82. GetStatic.PrintMessage(Page);
  83. }
  84. else
  85. {
  86. Response.Redirect("List.aspx");
  87. }
  88. }
  89. }
  90. }